@@ -41,7 +41,7 @@  | 
                                                    ||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | /**  | 
                                                        
| 44 | - * @param array $registrations  | 
                                                        |
| 44 | + * @param EE_Registration[] $registrations  | 
                                                        |
| 45 | 45 | * @return array  | 
                                                        
| 46 | 46 | * @throws EE_Error  | 
                                                        
| 47 | 47 | * @throws ReflectionException  | 
                                                        
@@ -12,76 +12,76 @@  | 
                                                    ||
| 12 | 12 | |
| 13 | 13 | class LegacyCopyAttendeeInfoForm extends EE_Form_Section_Proper  | 
                                                        
| 14 | 14 |  { | 
                                                        
| 15 | - /**  | 
                                                        |
| 16 | - * LegacyCopyAttendeeInfoForm constructor.  | 
                                                        |
| 17 | - *  | 
                                                        |
| 18 | - * @param EE_Registration[] $registrations  | 
                                                        |
| 19 | - * @param string $slug  | 
                                                        |
| 20 | - * @throws EE_Error  | 
                                                        |
| 21 | - * @throws ReflectionException  | 
                                                        |
| 22 | - */  | 
                                                        |
| 23 | - public function __construct(array $registrations, string $slug)  | 
                                                        |
| 24 | -    { | 
                                                        |
| 25 | - parent::__construct(  | 
                                                        |
| 26 | - [  | 
                                                        |
| 27 | - 'subsections' => $this->copyAttendeeInfoInputs($registrations),  | 
                                                        |
| 28 | - 'layout_strategy' => new EE_Template_Layout(  | 
                                                        |
| 29 | - [  | 
                                                        |
| 30 | - 'layout_template_file' => SPCO_REG_STEPS_PATH  | 
                                                        |
| 31 | - . $slug  | 
                                                        |
| 32 | - . '/copy_attendee_info.template.php',  | 
                                                        |
| 33 | - 'begin_template_file' => null,  | 
                                                        |
| 34 | - 'input_template_file' => null,  | 
                                                        |
| 35 | - 'subsection_template_file' => null,  | 
                                                        |
| 36 | - 'end_template_file' => null,  | 
                                                        |
| 37 | - ]  | 
                                                        |
| 38 | - ),  | 
                                                        |
| 39 | - ]);  | 
                                                        |
| 40 | - }  | 
                                                        |
| 15 | + /**  | 
                                                        |
| 16 | + * LegacyCopyAttendeeInfoForm constructor.  | 
                                                        |
| 17 | + *  | 
                                                        |
| 18 | + * @param EE_Registration[] $registrations  | 
                                                        |
| 19 | + * @param string $slug  | 
                                                        |
| 20 | + * @throws EE_Error  | 
                                                        |
| 21 | + * @throws ReflectionException  | 
                                                        |
| 22 | + */  | 
                                                        |
| 23 | + public function __construct(array $registrations, string $slug)  | 
                                                        |
| 24 | +	{ | 
                                                        |
| 25 | + parent::__construct(  | 
                                                        |
| 26 | + [  | 
                                                        |
| 27 | + 'subsections' => $this->copyAttendeeInfoInputs($registrations),  | 
                                                        |
| 28 | + 'layout_strategy' => new EE_Template_Layout(  | 
                                                        |
| 29 | + [  | 
                                                        |
| 30 | + 'layout_template_file' => SPCO_REG_STEPS_PATH  | 
                                                        |
| 31 | + . $slug  | 
                                                        |
| 32 | + . '/copy_attendee_info.template.php',  | 
                                                        |
| 33 | + 'begin_template_file' => null,  | 
                                                        |
| 34 | + 'input_template_file' => null,  | 
                                                        |
| 35 | + 'subsection_template_file' => null,  | 
                                                        |
| 36 | + 'end_template_file' => null,  | 
                                                        |
| 37 | + ]  | 
                                                        |
| 38 | + ),  | 
                                                        |
| 39 | + ]);  | 
                                                        |
| 40 | + }  | 
                                                        |
| 41 | 41 | |
| 42 | 42 | |
| 43 | - /**  | 
                                                        |
| 44 | - * @param array $registrations  | 
                                                        |
| 45 | - * @return array  | 
                                                        |
| 46 | - * @throws EE_Error  | 
                                                        |
| 47 | - * @throws ReflectionException  | 
                                                        |
| 48 | - */  | 
                                                        |
| 49 | - private function copyAttendeeInfoInputs(array $registrations): array  | 
                                                        |
| 50 | -    { | 
                                                        |
| 51 | - $copy_attendee_info_inputs = [];  | 
                                                        |
| 52 | - $prev_ticket = null;  | 
                                                        |
| 53 | -        foreach ($registrations as $registration) { | 
                                                        |
| 54 | - // for all attendees other than the primary attendee  | 
                                                        |
| 55 | -            if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { | 
                                                        |
| 56 | - // if this is a new ticket OR if this is the very first additional attendee after the primary attendee  | 
                                                        |
| 57 | -                if ($registration->ticket()->ID() !== $prev_ticket) { | 
                                                        |
| 58 | - $item_name = $registration->ticket()->name();  | 
                                                        |
| 59 | - $item_name .= $registration->ticket()->description() !== ''  | 
                                                        |
| 60 | - ? ' - ' . $registration->ticket()->description()  | 
                                                        |
| 61 | - : '';  | 
                                                        |
| 62 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ]  | 
                                                        |
| 63 | - = new EE_Form_Section_HTML(  | 
                                                        |
| 64 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'  | 
                                                        |
| 65 | - );  | 
                                                        |
| 66 | - $prev_ticket = $registration->ticket()->ID();  | 
                                                        |
| 67 | - }  | 
                                                        |
| 43 | + /**  | 
                                                        |
| 44 | + * @param array $registrations  | 
                                                        |
| 45 | + * @return array  | 
                                                        |
| 46 | + * @throws EE_Error  | 
                                                        |
| 47 | + * @throws ReflectionException  | 
                                                        |
| 48 | + */  | 
                                                        |
| 49 | + private function copyAttendeeInfoInputs(array $registrations): array  | 
                                                        |
| 50 | +	{ | 
                                                        |
| 51 | + $copy_attendee_info_inputs = [];  | 
                                                        |
| 52 | + $prev_ticket = null;  | 
                                                        |
| 53 | +		foreach ($registrations as $registration) { | 
                                                        |
| 54 | + // for all attendees other than the primary attendee  | 
                                                        |
| 55 | +			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { | 
                                                        |
| 56 | + // if this is a new ticket OR if this is the very first additional attendee after the primary attendee  | 
                                                        |
| 57 | +				if ($registration->ticket()->ID() !== $prev_ticket) { | 
                                                        |
| 58 | + $item_name = $registration->ticket()->name();  | 
                                                        |
| 59 | + $item_name .= $registration->ticket()->description() !== ''  | 
                                                        |
| 60 | + ? ' - ' . $registration->ticket()->description()  | 
                                                        |
| 61 | + : '';  | 
                                                        |
| 62 | + $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ]  | 
                                                        |
| 63 | + = new EE_Form_Section_HTML(  | 
                                                        |
| 64 | + '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'  | 
                                                        |
| 65 | + );  | 
                                                        |
| 66 | + $prev_ticket = $registration->ticket()->ID();  | 
                                                        |
| 67 | + }  | 
                                                        |
| 68 | 68 | |
| 69 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ]  | 
                                                        |
| 70 | - = new EE_Checkbox_Multi_Input(  | 
                                                        |
| 71 | - [  | 
                                                        |
| 72 | - $registration->ID() => sprintf(  | 
                                                        |
| 73 | -                            esc_html_x('Attendee #%s', 'Attendee #123', 'event_espresso'), | 
                                                        |
| 74 | - $registration->count()  | 
                                                        |
| 75 | - ),  | 
                                                        |
| 76 | - ],  | 
                                                        |
| 77 | - [  | 
                                                        |
| 78 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),  | 
                                                        |
| 79 | - 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate',  | 
                                                        |
| 80 | - 'display_html_label_text' => false,  | 
                                                        |
| 81 | - ]  | 
                                                        |
| 82 | - );  | 
                                                        |
| 83 | - }  | 
                                                        |
| 84 | - }  | 
                                                        |
| 85 | - return $copy_attendee_info_inputs;  | 
                                                        |
| 86 | - }  | 
                                                        |
| 69 | + $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ]  | 
                                                        |
| 70 | + = new EE_Checkbox_Multi_Input(  | 
                                                        |
| 71 | + [  | 
                                                        |
| 72 | + $registration->ID() => sprintf(  | 
                                                        |
| 73 | +							esc_html_x('Attendee #%s', 'Attendee #123', 'event_espresso'), | 
                                                        |
| 74 | + $registration->count()  | 
                                                        |
| 75 | + ),  | 
                                                        |
| 76 | + ],  | 
                                                        |
| 77 | + [  | 
                                                        |
| 78 | + 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),  | 
                                                        |
| 79 | + 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate',  | 
                                                        |
| 80 | + 'display_html_label_text' => false,  | 
                                                        |
| 81 | + ]  | 
                                                        |
| 82 | + );  | 
                                                        |
| 83 | + }  | 
                                                        |
| 84 | + }  | 
                                                        |
| 85 | + return $copy_attendee_info_inputs;  | 
                                                        |
| 86 | + }  | 
                                                        |
| 87 | 87 | }  | 
                                                        
| 88 | 88 | \ No newline at end of file  | 
                                                        
@@ -55,18 +55,18 @@ discard block  | 
                                                    ||
| 55 | 55 |              if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { | 
                                                        
| 56 | 56 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee  | 
                                                        
| 57 | 57 |                  if ($registration->ticket()->ID() !== $prev_ticket) { | 
                                                        
| 58 | - $item_name = $registration->ticket()->name();  | 
                                                        |
| 59 | - $item_name .= $registration->ticket()->description() !== ''  | 
                                                        |
| 60 | - ? ' - ' . $registration->ticket()->description()  | 
                                                        |
| 58 | + $item_name = $registration->ticket()->name();  | 
                                                        |
| 59 | + $item_name .= $registration->ticket()->description() !== ''  | 
                                                        |
| 60 | + ? ' - '.$registration->ticket()->description()  | 
                                                        |
| 61 | 61 | : '';  | 
                                                        
| 62 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ]  | 
                                                        |
| 62 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']']  | 
                                                        |
| 63 | 63 | = new EE_Form_Section_HTML(  | 
                                                        
| 64 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'  | 
                                                        |
| 64 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'  | 
                                                        |
| 65 | 65 | );  | 
                                                        
| 66 | 66 | $prev_ticket = $registration->ticket()->ID();  | 
                                                        
| 67 | 67 | }  | 
                                                        
| 68 | 68 | |
| 69 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ]  | 
                                                        |
| 69 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']']  | 
                                                        |
| 70 | 70 | = new EE_Checkbox_Multi_Input(  | 
                                                        
| 71 | 71 | [  | 
                                                        
| 72 | 72 | $registration->ID() => sprintf(  | 
                                                        
@@ -75,7 +75,7 @@ discard block  | 
                                                    ||
| 75 | 75 | ),  | 
                                                        
| 76 | 76 | ],  | 
                                                        
| 77 | 77 | [  | 
                                                        
| 78 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),  | 
                                                        |
| 78 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(),  | 
                                                        |
| 79 | 79 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate',  | 
                                                        
| 80 | 80 | 'display_html_label_text' => false,  | 
                                                        
| 81 | 81 | ]  | 
                                                        
@@ -22,1070 +22,1070 @@  | 
                                                    ||
| 22 | 22 | class EE_Dependency_Map  | 
                                                        
| 23 | 23 |  { | 
                                                        
| 24 | 24 | |
| 25 | - /**  | 
                                                        |
| 26 | - * This means that the requested class dependency is not present in the dependency map  | 
                                                        |
| 27 | - */  | 
                                                        |
| 28 | - const not_registered = 0;  | 
                                                        |
| 29 | -  | 
                                                        |
| 30 | - /**  | 
                                                        |
| 31 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.  | 
                                                        |
| 32 | - */  | 
                                                        |
| 33 | - const load_new_object = 1;  | 
                                                        |
| 34 | -  | 
                                                        |
| 35 | - /**  | 
                                                        |
| 36 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class.  | 
                                                        |
| 37 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache.  | 
                                                        |
| 38 | - */  | 
                                                        |
| 39 | - const load_from_cache = 2;  | 
                                                        |
| 40 | -  | 
                                                        |
| 41 | - /**  | 
                                                        |
| 42 | - * When registering a dependency,  | 
                                                        |
| 43 | - * this indicates to keep any existing dependencies that already exist,  | 
                                                        |
| 44 | - * and simply discard any new dependencies declared in the incoming data  | 
                                                        |
| 45 | - */  | 
                                                        |
| 46 | - const KEEP_EXISTING_DEPENDENCIES = 0;  | 
                                                        |
| 47 | -  | 
                                                        |
| 48 | - /**  | 
                                                        |
| 49 | - * When registering a dependency,  | 
                                                        |
| 50 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data  | 
                                                        |
| 51 | - */  | 
                                                        |
| 52 | - const OVERWRITE_DEPENDENCIES = 1;  | 
                                                        |
| 53 | -  | 
                                                        |
| 54 | - /**  | 
                                                        |
| 55 | - * @type EE_Dependency_Map $_instance  | 
                                                        |
| 56 | - */  | 
                                                        |
| 57 | - protected static $_instance;  | 
                                                        |
| 58 | -  | 
                                                        |
| 59 | - /**  | 
                                                        |
| 60 | - * @var ClassInterfaceCache $class_cache  | 
                                                        |
| 61 | - */  | 
                                                        |
| 62 | - private $class_cache;  | 
                                                        |
| 63 | -  | 
                                                        |
| 64 | - /**  | 
                                                        |
| 65 | - * @type RequestInterface $request  | 
                                                        |
| 66 | - */  | 
                                                        |
| 67 | - protected $request;  | 
                                                        |
| 68 | -  | 
                                                        |
| 69 | - /**  | 
                                                        |
| 70 | - * @type LegacyRequestInterface $legacy_request  | 
                                                        |
| 71 | - */  | 
                                                        |
| 72 | - protected $legacy_request;  | 
                                                        |
| 73 | -  | 
                                                        |
| 74 | - /**  | 
                                                        |
| 75 | - * @type ResponseInterface $response  | 
                                                        |
| 76 | - */  | 
                                                        |
| 77 | - protected $response;  | 
                                                        |
| 78 | -  | 
                                                        |
| 79 | - /**  | 
                                                        |
| 80 | - * @type LoaderInterface $loader  | 
                                                        |
| 81 | - */  | 
                                                        |
| 82 | - protected $loader;  | 
                                                        |
| 83 | -  | 
                                                        |
| 84 | - /**  | 
                                                        |
| 85 | - * @type array $_dependency_map  | 
                                                        |
| 86 | - */  | 
                                                        |
| 87 | - protected $_dependency_map = [];  | 
                                                        |
| 88 | -  | 
                                                        |
| 89 | - /**  | 
                                                        |
| 90 | - * @type array $_class_loaders  | 
                                                        |
| 91 | - */  | 
                                                        |
| 92 | - protected $_class_loaders = [];  | 
                                                        |
| 93 | -  | 
                                                        |
| 94 | -  | 
                                                        |
| 95 | - /**  | 
                                                        |
| 96 | - * EE_Dependency_Map constructor.  | 
                                                        |
| 97 | - *  | 
                                                        |
| 98 | - * @param ClassInterfaceCache $class_cache  | 
                                                        |
| 99 | - */  | 
                                                        |
| 100 | - protected function __construct(ClassInterfaceCache $class_cache)  | 
                                                        |
| 101 | -    { | 
                                                        |
| 102 | - $this->class_cache = $class_cache;  | 
                                                        |
| 103 | -        do_action('EE_Dependency_Map____construct', $this); | 
                                                        |
| 104 | - }  | 
                                                        |
| 105 | -  | 
                                                        |
| 106 | -  | 
                                                        |
| 107 | - /**  | 
                                                        |
| 108 | - * @return void  | 
                                                        |
| 109 | - * @throws InvalidAliasException  | 
                                                        |
| 110 | - */  | 
                                                        |
| 111 | - public function initialize()  | 
                                                        |
| 112 | -    { | 
                                                        |
| 113 | - $this->_register_core_dependencies();  | 
                                                        |
| 114 | - $this->_register_core_class_loaders();  | 
                                                        |
| 115 | - $this->_register_core_aliases();  | 
                                                        |
| 116 | - }  | 
                                                        |
| 117 | -  | 
                                                        |
| 118 | -  | 
                                                        |
| 119 | - /**  | 
                                                        |
| 120 | - * @singleton method used to instantiate class object  | 
                                                        |
| 121 | - * @param ClassInterfaceCache|null $class_cache  | 
                                                        |
| 122 | - * @return EE_Dependency_Map  | 
                                                        |
| 123 | - */  | 
                                                        |
| 124 | - public static function instance(ClassInterfaceCache $class_cache = null)  | 
                                                        |
| 125 | -    { | 
                                                        |
| 126 | - // check if class object is instantiated, and instantiated properly  | 
                                                        |
| 127 | - if (  | 
                                                        |
| 128 | - ! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map  | 
                                                        |
| 129 | - && $class_cache instanceof ClassInterfaceCache  | 
                                                        |
| 130 | -        ) { | 
                                                        |
| 131 | - EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache);  | 
                                                        |
| 132 | - }  | 
                                                        |
| 133 | - return EE_Dependency_Map::$_instance;  | 
                                                        |
| 134 | - }  | 
                                                        |
| 135 | -  | 
                                                        |
| 136 | -  | 
                                                        |
| 137 | - /**  | 
                                                        |
| 138 | - * @param RequestInterface $request  | 
                                                        |
| 139 | - */  | 
                                                        |
| 140 | - public function setRequest(RequestInterface $request)  | 
                                                        |
| 141 | -    { | 
                                                        |
| 142 | - $this->request = $request;  | 
                                                        |
| 143 | - }  | 
                                                        |
| 144 | -  | 
                                                        |
| 145 | -  | 
                                                        |
| 146 | - /**  | 
                                                        |
| 147 | - * @param LegacyRequestInterface $legacy_request  | 
                                                        |
| 148 | - */  | 
                                                        |
| 149 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request)  | 
                                                        |
| 150 | -    { | 
                                                        |
| 151 | - $this->legacy_request = $legacy_request;  | 
                                                        |
| 152 | - }  | 
                                                        |
| 153 | -  | 
                                                        |
| 154 | -  | 
                                                        |
| 155 | - /**  | 
                                                        |
| 156 | - * @param ResponseInterface $response  | 
                                                        |
| 157 | - */  | 
                                                        |
| 158 | - public function setResponse(ResponseInterface $response)  | 
                                                        |
| 159 | -    { | 
                                                        |
| 160 | - $this->response = $response;  | 
                                                        |
| 161 | - }  | 
                                                        |
| 162 | -  | 
                                                        |
| 163 | -  | 
                                                        |
| 164 | - /**  | 
                                                        |
| 165 | - * @param LoaderInterface $loader  | 
                                                        |
| 166 | - */  | 
                                                        |
| 167 | - public function setLoader(LoaderInterface $loader)  | 
                                                        |
| 168 | -    { | 
                                                        |
| 169 | - $this->loader = $loader;  | 
                                                        |
| 170 | - }  | 
                                                        |
| 171 | -  | 
                                                        |
| 172 | -  | 
                                                        |
| 173 | - /**  | 
                                                        |
| 174 | - * @param string $class  | 
                                                        |
| 175 | - * @param array $dependencies  | 
                                                        |
| 176 | - * @param int $overwrite  | 
                                                        |
| 177 | - * @return bool  | 
                                                        |
| 178 | - */  | 
                                                        |
| 179 | - public static function register_dependencies(  | 
                                                        |
| 180 | - $class,  | 
                                                        |
| 181 | - array $dependencies,  | 
                                                        |
| 182 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 183 | -    ) { | 
                                                        |
| 184 | - return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite);  | 
                                                        |
| 185 | - }  | 
                                                        |
| 186 | -  | 
                                                        |
| 187 | -  | 
                                                        |
| 188 | - /**  | 
                                                        |
| 189 | - * Assigns an array of class names and corresponding load sources (new or cached)  | 
                                                        |
| 190 | - * to the class specified by the first parameter.  | 
                                                        |
| 191 | - * IMPORTANT !!!  | 
                                                        |
| 192 | - * The order of elements in the incoming $dependencies array MUST match  | 
                                                        |
| 193 | - * the order of the constructor parameters for the class in question.  | 
                                                        |
| 194 | - * This is especially important when overriding any existing dependencies that are registered.  | 
                                                        |
| 195 | - * the third parameter controls whether any duplicate dependencies are overwritten or not.  | 
                                                        |
| 196 | - *  | 
                                                        |
| 197 | - * @param string $class  | 
                                                        |
| 198 | - * @param array $dependencies  | 
                                                        |
| 199 | - * @param int $overwrite  | 
                                                        |
| 200 | - * @return bool  | 
                                                        |
| 201 | - */  | 
                                                        |
| 202 | - public function registerDependencies(  | 
                                                        |
| 203 | - $class,  | 
                                                        |
| 204 | - array $dependencies,  | 
                                                        |
| 205 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 206 | -    ) { | 
                                                        |
| 207 | - $class = trim($class, '\\');  | 
                                                        |
| 208 | - $registered = false;  | 
                                                        |
| 209 | -        if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) { | 
                                                        |
| 210 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = [];  | 
                                                        |
| 211 | - }  | 
                                                        |
| 212 | - // we need to make sure that any aliases used when registering a dependency  | 
                                                        |
| 213 | - // get resolved to the correct class name  | 
                                                        |
| 214 | -        foreach ($dependencies as $dependency => $load_source) { | 
                                                        |
| 215 | - $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency);  | 
                                                        |
| 216 | - if (  | 
                                                        |
| 217 | - $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES  | 
                                                        |
| 218 | - || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ])  | 
                                                        |
| 219 | -            ) { | 
                                                        |
| 220 | - unset($dependencies[ $dependency ]);  | 
                                                        |
| 221 | - $dependencies[ $alias ] = $load_source;  | 
                                                        |
| 222 | - $registered = true;  | 
                                                        |
| 223 | - }  | 
                                                        |
| 224 | - }  | 
                                                        |
| 225 | - // now add our two lists of dependencies together.  | 
                                                        |
| 226 | - // using Union (+=) favours the arrays in precedence from left to right,  | 
                                                        |
| 227 | - // so $dependencies is NOT overwritten because it is listed first  | 
                                                        |
| 228 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C  | 
                                                        |
| 229 | - // Union is way faster than array_merge() but should be used with caution...  | 
                                                        |
| 230 | - // especially with numerically indexed arrays  | 
                                                        |
| 231 | - $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ];  | 
                                                        |
| 232 | - // now we need to ensure that the resulting dependencies  | 
                                                        |
| 233 | - // array only has the entries that are required for the class  | 
                                                        |
| 234 | - // so first count how many dependencies were originally registered for the class  | 
                                                        |
| 235 | - $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]);  | 
                                                        |
| 236 | - // if that count is non-zero (meaning dependencies were already registered)  | 
                                                        |
| 237 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count  | 
                                                        |
| 238 | - // then truncate the final array to match that count  | 
                                                        |
| 239 | - ? array_slice($dependencies, 0, $dependency_count)  | 
                                                        |
| 240 | - // otherwise just take the incoming array because nothing previously existed  | 
                                                        |
| 241 | - : $dependencies;  | 
                                                        |
| 242 | - return $registered;  | 
                                                        |
| 243 | - }  | 
                                                        |
| 244 | -  | 
                                                        |
| 245 | -  | 
                                                        |
| 246 | - /**  | 
                                                        |
| 247 | - * @param string $class_name  | 
                                                        |
| 248 | - * @param string $loader  | 
                                                        |
| 249 | - * @return bool  | 
                                                        |
| 250 | - * @throws DomainException  | 
                                                        |
| 251 | - */  | 
                                                        |
| 252 | - public static function register_class_loader($class_name, $loader = 'load_core')  | 
                                                        |
| 253 | -    { | 
                                                        |
| 254 | - return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader);  | 
                                                        |
| 255 | - }  | 
                                                        |
| 256 | -  | 
                                                        |
| 257 | -  | 
                                                        |
| 258 | - /**  | 
                                                        |
| 259 | - * @param string $class_name  | 
                                                        |
| 260 | - * @param string $loader  | 
                                                        |
| 261 | - * @return bool  | 
                                                        |
| 262 | - * @throws DomainException  | 
                                                        |
| 263 | - */  | 
                                                        |
| 264 | - public function registerClassLoader($class_name, $loader = 'load_core')  | 
                                                        |
| 265 | -    { | 
                                                        |
| 266 | -        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { | 
                                                        |
| 267 | - throw new DomainException(  | 
                                                        |
| 268 | -                esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') | 
                                                        |
| 269 | - );  | 
                                                        |
| 270 | - }  | 
                                                        |
| 271 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry  | 
                                                        |
| 272 | - if (  | 
                                                        |
| 273 | - ! is_callable($loader)  | 
                                                        |
| 274 | - && (  | 
                                                        |
| 275 | - strpos($loader, 'load_') !== 0  | 
                                                        |
| 276 | -                || ! method_exists('EE_Registry', $loader) | 
                                                        |
| 277 | - )  | 
                                                        |
| 278 | -        ) { | 
                                                        |
| 279 | - throw new DomainException(  | 
                                                        |
| 280 | - sprintf(  | 
                                                        |
| 281 | - esc_html__(  | 
                                                        |
| 282 | - '"%1$s" is not a valid loader method on EE_Registry.',  | 
                                                        |
| 283 | - 'event_espresso'  | 
                                                        |
| 284 | - ),  | 
                                                        |
| 285 | - $loader  | 
                                                        |
| 286 | - )  | 
                                                        |
| 287 | - );  | 
                                                        |
| 288 | - }  | 
                                                        |
| 289 | - $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name);  | 
                                                        |
| 290 | -        if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { | 
                                                        |
| 291 | - EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader;  | 
                                                        |
| 292 | - return true;  | 
                                                        |
| 293 | - }  | 
                                                        |
| 294 | - return false;  | 
                                                        |
| 295 | - }  | 
                                                        |
| 296 | -  | 
                                                        |
| 297 | -  | 
                                                        |
| 298 | - /**  | 
                                                        |
| 299 | - * @return array  | 
                                                        |
| 300 | - */  | 
                                                        |
| 301 | - public function dependency_map()  | 
                                                        |
| 302 | -    { | 
                                                        |
| 303 | - return $this->_dependency_map;  | 
                                                        |
| 304 | - }  | 
                                                        |
| 305 | -  | 
                                                        |
| 306 | -  | 
                                                        |
| 307 | - /**  | 
                                                        |
| 308 | - * returns TRUE if dependency map contains a listing for the provided class name  | 
                                                        |
| 309 | - *  | 
                                                        |
| 310 | - * @param string $class_name  | 
                                                        |
| 311 | - * @return boolean  | 
                                                        |
| 312 | - */  | 
                                                        |
| 313 | - public function has($class_name = '')  | 
                                                        |
| 314 | -    { | 
                                                        |
| 315 | - // all legacy models have the same dependencies  | 
                                                        |
| 316 | -        if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 317 | - $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 318 | - }  | 
                                                        |
| 319 | - return isset($this->_dependency_map[ $class_name ]);  | 
                                                        |
| 320 | - }  | 
                                                        |
| 321 | -  | 
                                                        |
| 322 | -  | 
                                                        |
| 323 | - /**  | 
                                                        |
| 324 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency  | 
                                                        |
| 325 | - *  | 
                                                        |
| 326 | - * @param string $class_name  | 
                                                        |
| 327 | - * @param string $dependency  | 
                                                        |
| 328 | - * @return bool  | 
                                                        |
| 329 | - */  | 
                                                        |
| 330 | - public function has_dependency_for_class($class_name = '', $dependency = '')  | 
                                                        |
| 331 | -    { | 
                                                        |
| 332 | - // all legacy models have the same dependencies  | 
                                                        |
| 333 | -        if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 334 | - $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 335 | - }  | 
                                                        |
| 336 | - $dependency = $this->getFqnForAlias($dependency, $class_name);  | 
                                                        |
| 337 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]);  | 
                                                        |
| 338 | - }  | 
                                                        |
| 339 | -  | 
                                                        |
| 340 | -  | 
                                                        |
| 341 | - /**  | 
                                                        |
| 342 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned  | 
                                                        |
| 343 | - *  | 
                                                        |
| 344 | - * @param string $class_name  | 
                                                        |
| 345 | - * @param string $dependency  | 
                                                        |
| 346 | - * @return int  | 
                                                        |
| 347 | - */  | 
                                                        |
| 348 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')  | 
                                                        |
| 349 | -    { | 
                                                        |
| 350 | - // all legacy models have the same dependencies  | 
                                                        |
| 351 | -        if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 352 | - $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 353 | - }  | 
                                                        |
| 354 | - $dependency = $this->getFqnForAlias($dependency);  | 
                                                        |
| 355 | - return $this->has_dependency_for_class($class_name, $dependency)  | 
                                                        |
| 356 | - ? $this->_dependency_map[ $class_name ][ $dependency ]  | 
                                                        |
| 357 | - : EE_Dependency_Map::not_registered;  | 
                                                        |
| 358 | - }  | 
                                                        |
| 359 | -  | 
                                                        |
| 360 | -  | 
                                                        |
| 361 | - /**  | 
                                                        |
| 362 | - * @param string $class_name  | 
                                                        |
| 363 | - * @return string | Closure  | 
                                                        |
| 364 | - */  | 
                                                        |
| 365 | - public function class_loader($class_name)  | 
                                                        |
| 366 | -    { | 
                                                        |
| 367 | - // all legacy models use load_model()  | 
                                                        |
| 368 | -        if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 369 | - return 'load_model';  | 
                                                        |
| 370 | - }  | 
                                                        |
| 371 | - // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc  | 
                                                        |
| 372 | - // perform strpos() first to avoid loading regex every time we load a class  | 
                                                        |
| 373 | - if (  | 
                                                        |
| 374 | - strpos($class_name, 'EE_CPT_') === 0  | 
                                                        |
| 375 | -            && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) | 
                                                        |
| 376 | -        ) { | 
                                                        |
| 377 | - return 'load_core';  | 
                                                        |
| 378 | - }  | 
                                                        |
| 379 | - $class_name = $this->getFqnForAlias($class_name);  | 
                                                        |
| 380 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';  | 
                                                        |
| 381 | - }  | 
                                                        |
| 382 | -  | 
                                                        |
| 383 | -  | 
                                                        |
| 384 | - /**  | 
                                                        |
| 385 | - * @return array  | 
                                                        |
| 386 | - */  | 
                                                        |
| 387 | - public function class_loaders()  | 
                                                        |
| 388 | -    { | 
                                                        |
| 389 | - return $this->_class_loaders;  | 
                                                        |
| 390 | - }  | 
                                                        |
| 391 | -  | 
                                                        |
| 392 | -  | 
                                                        |
| 393 | - /**  | 
                                                        |
| 394 | - * adds an alias for a classname  | 
                                                        |
| 395 | - *  | 
                                                        |
| 396 | - * @param string $fqcn the class name that should be used (concrete class to replace interface)  | 
                                                        |
| 397 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface)  | 
                                                        |
| 398 | - * @param string $for_class the class that has the dependency (is type hinting for the interface)  | 
                                                        |
| 399 | - * @throws InvalidAliasException  | 
                                                        |
| 400 | - */  | 
                                                        |
| 401 | - public function add_alias($fqcn, $alias, $for_class = '')  | 
                                                        |
| 402 | -    { | 
                                                        |
| 403 | - $this->class_cache->addAlias($fqcn, $alias, $for_class);  | 
                                                        |
| 404 | - }  | 
                                                        |
| 405 | -  | 
                                                        |
| 406 | -  | 
                                                        |
| 407 | - /**  | 
                                                        |
| 408 | - * Returns TRUE if the provided fully qualified name IS an alias  | 
                                                        |
| 409 | - * WHY?  | 
                                                        |
| 410 | - * Because if a class is type hinting for a concretion,  | 
                                                        |
| 411 | - * then why would we need to find another class to supply it?  | 
                                                        |
| 412 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,  | 
                                                        |
| 413 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.  | 
                                                        |
| 414 | - * Don't go looking for some substitute.  | 
                                                        |
| 415 | - * Whereas if a class is type hinting for an interface...  | 
                                                        |
| 416 | - * then we need to find an actual class to use.  | 
                                                        |
| 417 | - * So the interface IS the alias for some other FQN,  | 
                                                        |
| 418 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`  | 
                                                        |
| 419 | - * represents some other class.  | 
                                                        |
| 420 | - *  | 
                                                        |
| 421 | - * @param string $fqn  | 
                                                        |
| 422 | - * @param string $for_class  | 
                                                        |
| 423 | - * @return bool  | 
                                                        |
| 424 | - */  | 
                                                        |
| 425 | - public function isAlias($fqn = '', $for_class = '')  | 
                                                        |
| 426 | -    { | 
                                                        |
| 427 | - return $this->class_cache->isAlias($fqn, $for_class);  | 
                                                        |
| 428 | - }  | 
                                                        |
| 429 | -  | 
                                                        |
| 430 | -  | 
                                                        |
| 431 | - /**  | 
                                                        |
| 432 | - * Returns a FQN for provided alias if one exists, otherwise returns the original $alias  | 
                                                        |
| 433 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN  | 
                                                        |
| 434 | - * for example:  | 
                                                        |
| 435 | - * if the following two entries were added to the _aliases array:  | 
                                                        |
| 436 | - * array(  | 
                                                        |
| 437 | - * 'interface_alias' => 'some\namespace\interface'  | 
                                                        |
| 438 | - * 'some\namespace\interface' => 'some\namespace\classname'  | 
                                                        |
| 439 | - * )  | 
                                                        |
| 440 | - * then one could use EE_Registry::instance()->create( 'interface_alias' )  | 
                                                        |
| 441 | - * to load an instance of 'some\namespace\classname'  | 
                                                        |
| 442 | - *  | 
                                                        |
| 443 | - * @param string $alias  | 
                                                        |
| 444 | - * @param string $for_class  | 
                                                        |
| 445 | - * @return string  | 
                                                        |
| 446 | - */  | 
                                                        |
| 447 | - public function getFqnForAlias($alias = '', $for_class = '')  | 
                                                        |
| 448 | -    { | 
                                                        |
| 449 | - return (string) $this->class_cache->getFqnForAlias($alias, $for_class);  | 
                                                        |
| 450 | - }  | 
                                                        |
| 451 | -  | 
                                                        |
| 452 | -  | 
                                                        |
| 453 | - /**  | 
                                                        |
| 454 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,  | 
                                                        |
| 455 | - * if one exists, or whether a new object should be generated every time the requested class is loaded.  | 
                                                        |
| 456 | - * This is done by using the following class constants:  | 
                                                        |
| 457 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object  | 
                                                        |
| 458 | - * EE_Dependency_Map::load_new_object - generates a new object every time  | 
                                                        |
| 459 | - */  | 
                                                        |
| 460 | - protected function _register_core_dependencies()  | 
                                                        |
| 461 | -    { | 
                                                        |
| 462 | - $this->_dependency_map = [  | 
                                                        |
| 463 | - 'EE_Request_Handler' => [  | 
                                                        |
| 464 | - 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 465 | - ],  | 
                                                        |
| 466 | - 'EE_System' => [  | 
                                                        |
| 467 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 468 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 469 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 470 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 471 | - 'EventEspresso\core\services\routing\Router' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 472 | - ],  | 
                                                        |
| 473 | - 'EE_Admin' => [  | 
                                                        |
| 474 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 475 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 476 | - ],  | 
                                                        |
| 477 | - 'EE_Cart' => [  | 
                                                        |
| 478 | - 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 479 | - ],  | 
                                                        |
| 480 | - 'EE_Messenger_Collection_Loader' => [  | 
                                                        |
| 481 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 482 | - ],  | 
                                                        |
| 483 | - 'EE_Message_Type_Collection_Loader' => [  | 
                                                        |
| 484 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 485 | - ],  | 
                                                        |
| 486 | - 'EE_Message_Resource_Manager' => [  | 
                                                        |
| 487 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 488 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 489 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 490 | - ],  | 
                                                        |
| 491 | - 'EE_Message_Factory' => [  | 
                                                        |
| 492 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 493 | - ],  | 
                                                        |
| 494 | - 'EE_messages' => [  | 
                                                        |
| 495 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 496 | - ],  | 
                                                        |
| 497 | - 'EE_Messages_Generator' => [  | 
                                                        |
| 498 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 499 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 500 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 501 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 502 | - ],  | 
                                                        |
| 503 | - 'EE_Messages_Processor' => [  | 
                                                        |
| 504 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 505 | - ],  | 
                                                        |
| 506 | - 'EE_Messages_Queue' => [  | 
                                                        |
| 507 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 508 | - ],  | 
                                                        |
| 509 | - 'EE_Messages_Template_Defaults' => [  | 
                                                        |
| 510 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 511 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 512 | - ],  | 
                                                        |
| 513 | - 'EE_Message_To_Generate_From_Request' => [  | 
                                                        |
| 514 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 515 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 516 | - ],  | 
                                                        |
| 517 | - 'EventEspresso\core\services\commands\CommandBus' => [  | 
                                                        |
| 518 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 519 | - ],  | 
                                                        |
| 520 | - 'EventEspresso\services\commands\CommandHandler' => [  | 
                                                        |
| 521 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 522 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 523 | - ],  | 
                                                        |
| 524 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => [  | 
                                                        |
| 525 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 526 | - ],  | 
                                                        |
| 527 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => [  | 
                                                        |
| 528 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 529 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 530 | - ],  | 
                                                        |
| 531 | - 'EventEspresso\core\services\commands\CommandFactory' => [  | 
                                                        |
| 532 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 533 | - ],  | 
                                                        |
| 534 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => [  | 
                                                        |
| 535 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 536 | - ],  | 
                                                        |
| 537 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [  | 
                                                        |
| 538 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 539 | - ],  | 
                                                        |
| 540 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [  | 
                                                        |
| 541 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 542 | - ],  | 
                                                        |
| 543 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => [  | 
                                                        |
| 544 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 545 | - ],  | 
                                                        |
| 546 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [  | 
                                                        |
| 547 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 548 | - ],  | 
                                                        |
| 549 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [  | 
                                                        |
| 550 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 551 | - ],  | 
                                                        |
| 552 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [  | 
                                                        |
| 553 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 554 | - ],  | 
                                                        |
| 555 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [  | 
                                                        |
| 556 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 557 | - ],  | 
                                                        |
| 558 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => [  | 
                                                        |
| 559 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 560 | - ],  | 
                                                        |
| 561 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => [  | 
                                                        |
| 562 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 563 | - ],  | 
                                                        |
| 564 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [  | 
                                                        |
| 565 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 566 | - ],  | 
                                                        |
| 567 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => [  | 
                                                        |
| 568 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 569 | - ],  | 
                                                        |
| 570 | - 'EventEspresso\core\services\database\TableManager' => [  | 
                                                        |
| 571 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 572 | - ],  | 
                                                        |
| 573 | - 'EE_Data_Migration_Class_Base' => [  | 
                                                        |
| 574 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 575 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 576 | - ],  | 
                                                        |
| 577 | - 'EE_DMS_Core_4_1_0' => [  | 
                                                        |
| 578 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 579 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 580 | - ],  | 
                                                        |
| 581 | - 'EE_DMS_Core_4_2_0' => [  | 
                                                        |
| 582 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 583 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 584 | - ],  | 
                                                        |
| 585 | - 'EE_DMS_Core_4_3_0' => [  | 
                                                        |
| 586 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 587 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 588 | - ],  | 
                                                        |
| 589 | - 'EE_DMS_Core_4_4_0' => [  | 
                                                        |
| 590 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 591 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 592 | - ],  | 
                                                        |
| 593 | - 'EE_DMS_Core_4_5_0' => [  | 
                                                        |
| 594 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 595 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 596 | - ],  | 
                                                        |
| 597 | - 'EE_DMS_Core_4_6_0' => [  | 
                                                        |
| 598 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 599 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 600 | - ],  | 
                                                        |
| 601 | - 'EE_DMS_Core_4_7_0' => [  | 
                                                        |
| 602 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 603 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 604 | - ],  | 
                                                        |
| 605 | - 'EE_DMS_Core_4_8_0' => [  | 
                                                        |
| 606 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 607 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 608 | - ],  | 
                                                        |
| 609 | - 'EE_DMS_Core_4_9_0' => [  | 
                                                        |
| 610 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 611 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 612 | - ],  | 
                                                        |
| 613 | - 'EE_DMS_Core_4_10_0' => [  | 
                                                        |
| 614 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 615 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 616 | - 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 617 | - ],  | 
                                                        |
| 618 | - 'EE_DMS_Core_4_11_0' => [  | 
                                                        |
| 619 | - 'EE_DMS_Core_4_10_0' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 620 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 621 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 622 | - ],  | 
                                                        |
| 623 | - 'EE_DMS_Core_4_12_0' => [  | 
                                                        |
| 624 | - 'EE_DMS_Core_4_11_0' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 625 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 626 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 627 | - ],  | 
                                                        |
| 628 | - 'EventEspresso\core\services\assets\Registry' => [  | 
                                                        |
| 629 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 630 | - 'EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 631 | - ],  | 
                                                        |
| 632 | - 'EventEspresso\core\services\cache\BasicCacheManager' => [  | 
                                                        |
| 633 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 634 | - ],  | 
                                                        |
| 635 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [  | 
                                                        |
| 636 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 637 | - ],  | 
                                                        |
| 638 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [  | 
                                                        |
| 639 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 640 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 641 | - ],  | 
                                                        |
| 642 | - 'EventEspresso\core\domain\values\EmailAddress' => [  | 
                                                        |
| 643 | - null,  | 
                                                        |
| 644 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 645 | - ],  | 
                                                        |
| 646 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => [  | 
                                                        |
| 647 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 648 | - ],  | 
                                                        |
| 649 | - 'LEGACY_MODELS' => [  | 
                                                        |
| 650 | - null,  | 
                                                        |
| 651 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 652 | - ],  | 
                                                        |
| 653 | - 'EE_Module_Request_Router' => [  | 
                                                        |
| 654 | - 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 655 | - ],  | 
                                                        |
| 656 | - 'EE_Registration_Processor' => [  | 
                                                        |
| 657 | - 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 658 | - ],  | 
                                                        |
| 659 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [  | 
                                                        |
| 660 | - null,  | 
                                                        |
| 661 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 662 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 663 | - ],  | 
                                                        |
| 664 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [  | 
                                                        |
| 665 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 666 | - 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 667 | - ],  | 
                                                        |
| 668 | - 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [  | 
                                                        |
| 669 | - 'EventEspresso\core\domain\entities\users\CurrentUser' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 670 | - ],  | 
                                                        |
| 671 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [  | 
                                                        |
| 672 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 673 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 674 | - 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 675 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 676 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 677 | - ],  | 
                                                        |
| 678 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [  | 
                                                        |
| 679 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 680 | - ],  | 
                                                        |
| 681 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [  | 
                                                        |
| 682 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 683 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 684 | - ],  | 
                                                        |
| 685 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [  | 
                                                        |
| 686 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 687 | - ],  | 
                                                        |
| 688 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [  | 
                                                        |
| 689 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 690 | - ],  | 
                                                        |
| 691 | - 'EE_CPT_Strategy' => [  | 
                                                        |
| 692 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 693 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 694 | - ],  | 
                                                        |
| 695 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => [  | 
                                                        |
| 696 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 697 | - ],  | 
                                                        |
| 698 | - 'EventEspresso\core\CPTs\CptQueryModifier' => [  | 
                                                        |
| 699 | - null,  | 
                                                        |
| 700 | - null,  | 
                                                        |
| 701 | - null,  | 
                                                        |
| 702 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 703 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 704 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 705 | - ],  | 
                                                        |
| 706 | - 'EventEspresso\core\services\dependencies\DependencyResolver' => [  | 
                                                        |
| 707 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 708 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 709 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 710 | - ],  | 
                                                        |
| 711 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => [  | 
                                                        |
| 712 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 713 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 714 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 715 | - ],  | 
                                                        |
| 716 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => [  | 
                                                        |
| 717 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 718 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 719 | - ],  | 
                                                        |
| 720 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => [  | 
                                                        |
| 721 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 722 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 723 | - ],  | 
                                                        |
| 724 | - 'EE_URL_Validation_Strategy' => [  | 
                                                        |
| 725 | - null,  | 
                                                        |
| 726 | - null,  | 
                                                        |
| 727 | - 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 728 | - ],  | 
                                                        |
| 729 | - 'EventEspresso\core\services\request\files\FilesDataHandler' => [  | 
                                                        |
| 730 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 731 | - ],  | 
                                                        |
| 732 | - 'EventEspressoBatchRequest\BatchRequestProcessor' => [  | 
                                                        |
| 733 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 734 | - ],  | 
                                                        |
| 735 | - 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [  | 
                                                        |
| 736 | - 'WP_REST_Server' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 737 | - 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 738 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 739 | - null,  | 
                                                        |
| 740 | - ],  | 
                                                        |
| 741 | - 'EventEspresso\core\services\routing\RouteHandler' => [  | 
                                                        |
| 742 | - 'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 743 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 744 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 745 | - 'EventEspresso\core\services\routing\RouteCollection' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 746 | - ],  | 
                                                        |
| 747 | - 'EventEspresso\core\services\json\JsonDataNodeHandler' => [  | 
                                                        |
| 748 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 749 | - ],  | 
                                                        |
| 750 | - 'EventEspresso\core\services\routing\Router' => [  | 
                                                        |
| 751 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 752 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 753 | - 'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 754 | - ],  | 
                                                        |
| 755 | - 'EventEspresso\core\services\assets\AssetManifest' => [  | 
                                                        |
| 756 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 757 | - ],  | 
                                                        |
| 758 | - 'EventEspresso\core\services\assets\AssetManifestFactory' => [  | 
                                                        |
| 759 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 760 | - ],  | 
                                                        |
| 761 | - 'EventEspresso\core\services\assets\BaristaFactory' => [  | 
                                                        |
| 762 | - 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 763 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 764 | - ],  | 
                                                        |
| 765 | - 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => [  | 
                                                        |
| 766 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 767 | - ],  | 
                                                        |
| 768 | - 'EventEspresso\core\services\addon\AddonManager' => [  | 
                                                        |
| 769 | - 'EventEspresso\core\services\addon\AddonCollection' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 770 | - 'EventEspresso\core\Psr4Autoloader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 771 | - 'EventEspresso\core\services\addon\api\v1\RegisterAddon' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 772 | - 'EventEspresso\core\services\addon\api\IncompatibleAddonHandler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 773 | - 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 774 | - ],  | 
                                                        |
| 775 | - 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => [  | 
                                                        |
| 776 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 777 | - ],  | 
                                                        |
| 778 | - 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [  | 
                                                        |
| 779 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 780 | - ],  | 
                                                        |
| 781 | - 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [  | 
                                                        |
| 782 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 783 | - ],  | 
                                                        |
| 784 | - 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [  | 
                                                        |
| 785 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 786 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 787 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 788 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 789 | - ],  | 
                                                        |
| 790 | - 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [  | 
                                                        |
| 791 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 792 | - ],  | 
                                                        |
| 793 | - 'EventEspresso\core\domain\entities\users\CurrentUser' => [  | 
                                                        |
| 794 | - 'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 795 | - ],  | 
                                                        |
| 796 | - 'EventEspresso\core\services\form\meta\InputTypes' => [  | 
                                                        |
| 797 | - 'EventEspresso\core\services\form\meta\inputs\Button' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 798 | - 'EventEspresso\core\services\form\meta\inputs\DateTime' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 799 | - 'EventEspresso\core\services\form\meta\inputs\Input' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 800 | - 'EventEspresso\core\services\form\meta\inputs\Number' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 801 | - 'EventEspresso\core\services\form\meta\inputs\Phone' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 802 | - 'EventEspresso\core\services\form\meta\inputs\Select' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 803 | - 'EventEspresso\core\services\form\meta\inputs\Text' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 804 | - ],  | 
                                                        |
| 805 | - 'EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm' => [  | 
                                                        |
| 806 | - null,  | 
                                                        |
| 807 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 808 | - ],  | 
                                                        |
| 809 | - 'EventEspresso\core\domain\services\registration\form\CountryOptions' => [  | 
                                                        |
| 810 | - null,  | 
                                                        |
| 811 | - 'EEM_Answer' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 812 | - 'EEM_Country' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 813 | - ],  | 
                                                        |
| 814 | - 'EventEspresso\core\domain\services\registration\form\StateOptions' => [  | 
                                                        |
| 815 | - null,  | 
                                                        |
| 816 | - 'EEM_State' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 817 | - ],  | 
                                                        |
| 818 | - ];  | 
                                                        |
| 819 | - }  | 
                                                        |
| 820 | -  | 
                                                        |
| 821 | -  | 
                                                        |
| 822 | - /**  | 
                                                        |
| 823 | - * Registers how core classes are loaded.  | 
                                                        |
| 824 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:  | 
                                                        |
| 825 | - * 'EE_Request_Handler' => 'load_core'  | 
                                                        |
| 826 | - * 'EE_Messages_Queue' => 'load_lib'  | 
                                                        |
| 827 | - * 'EEH_Debug_Tools' => 'load_helper'  | 
                                                        |
| 828 | - * or, if greater control is required, by providing a custom closure. For example:  | 
                                                        |
| 829 | -     *        'Some_Class' => function () { | 
                                                        |
| 830 | - * return new Some_Class();  | 
                                                        |
| 831 | - * },  | 
                                                        |
| 832 | - * This is required for instantiating dependencies  | 
                                                        |
| 833 | - * where an interface has been type hinted in a class constructor. For example:  | 
                                                        |
| 834 | -     *        'Required_Interface' => function () { | 
                                                        |
| 835 | - * return new A_Class_That_Implements_Required_Interface();  | 
                                                        |
| 836 | - * },  | 
                                                        |
| 837 | - */  | 
                                                        |
| 838 | - protected function _register_core_class_loaders()  | 
                                                        |
| 839 | -    { | 
                                                        |
| 840 | - $this->_class_loaders = [  | 
                                                        |
| 841 | - // load_core  | 
                                                        |
| 842 | -            'EE_Dependency_Map'                            => function () { | 
                                                        |
| 843 | - return $this;  | 
                                                        |
| 844 | - },  | 
                                                        |
| 845 | - 'EE_Capabilities' => 'load_core',  | 
                                                        |
| 846 | - 'EE_Encryption' => 'load_core',  | 
                                                        |
| 847 | - 'EE_Front_Controller' => 'load_core',  | 
                                                        |
| 848 | - 'EE_Module_Request_Router' => 'load_core',  | 
                                                        |
| 849 | - 'EE_Registry' => 'load_core',  | 
                                                        |
| 850 | -            'EE_Request'                                   => function () { | 
                                                        |
| 851 | - return $this->legacy_request;  | 
                                                        |
| 852 | - },  | 
                                                        |
| 853 | -            'EventEspresso\core\services\request\Request'  => function () { | 
                                                        |
| 854 | - return $this->request;  | 
                                                        |
| 855 | - },  | 
                                                        |
| 856 | -            'EventEspresso\core\services\request\Response' => function () { | 
                                                        |
| 857 | - return $this->response;  | 
                                                        |
| 858 | - },  | 
                                                        |
| 859 | - 'EE_Base' => 'load_core',  | 
                                                        |
| 860 | - 'EE_Request_Handler' => 'load_core',  | 
                                                        |
| 861 | - 'EE_Session' => 'load_core',  | 
                                                        |
| 862 | - 'EE_Cron_Tasks' => 'load_core',  | 
                                                        |
| 863 | - 'EE_System' => 'load_core',  | 
                                                        |
| 864 | - 'EE_Maintenance_Mode' => 'load_core',  | 
                                                        |
| 865 | - 'EE_Register_CPTs' => 'load_core',  | 
                                                        |
| 866 | - 'EE_Admin' => 'load_core',  | 
                                                        |
| 867 | - 'EE_CPT_Strategy' => 'load_core',  | 
                                                        |
| 868 | - // load_class  | 
                                                        |
| 869 | - 'EE_Registration_Processor' => 'load_class',  | 
                                                        |
| 870 | - // load_lib  | 
                                                        |
| 871 | - 'EE_Message_Resource_Manager' => 'load_lib',  | 
                                                        |
| 872 | - 'EE_Message_Type_Collection' => 'load_lib',  | 
                                                        |
| 873 | - 'EE_Message_Type_Collection_Loader' => 'load_lib',  | 
                                                        |
| 874 | - 'EE_Messenger_Collection' => 'load_lib',  | 
                                                        |
| 875 | - 'EE_Messenger_Collection_Loader' => 'load_lib',  | 
                                                        |
| 876 | - 'EE_Messages_Processor' => 'load_lib',  | 
                                                        |
| 877 | - 'EE_Message_Repository' => 'load_lib',  | 
                                                        |
| 878 | - 'EE_Messages_Queue' => 'load_lib',  | 
                                                        |
| 879 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib',  | 
                                                        |
| 880 | - 'EE_Message_Template_Group_Collection' => 'load_lib',  | 
                                                        |
| 881 | - 'EE_Payment_Method_Manager' => 'load_lib',  | 
                                                        |
| 882 | - 'EE_DMS_Core_4_1_0' => 'load_dms',  | 
                                                        |
| 883 | - 'EE_DMS_Core_4_2_0' => 'load_dms',  | 
                                                        |
| 884 | - 'EE_DMS_Core_4_3_0' => 'load_dms',  | 
                                                        |
| 885 | - 'EE_DMS_Core_4_5_0' => 'load_dms',  | 
                                                        |
| 886 | - 'EE_DMS_Core_4_6_0' => 'load_dms',  | 
                                                        |
| 887 | - 'EE_DMS_Core_4_7_0' => 'load_dms',  | 
                                                        |
| 888 | - 'EE_DMS_Core_4_8_0' => 'load_dms',  | 
                                                        |
| 889 | - 'EE_DMS_Core_4_9_0' => 'load_dms',  | 
                                                        |
| 890 | - 'EE_DMS_Core_4_10_0' => 'load_dms',  | 
                                                        |
| 891 | - 'EE_DMS_Core_4_11_0' => 'load_dms',  | 
                                                        |
| 892 | - 'EE_DMS_Core_4_12_0' => 'load_dms',  | 
                                                        |
| 893 | -            'EE_Messages_Generator'                        => static function () { | 
                                                        |
| 894 | - return EE_Registry::instance()->load_lib(  | 
                                                        |
| 895 | - 'Messages_Generator',  | 
                                                        |
| 896 | - [],  | 
                                                        |
| 897 | - false,  | 
                                                        |
| 898 | - false  | 
                                                        |
| 899 | - );  | 
                                                        |
| 900 | - },  | 
                                                        |
| 901 | -            'EE_Messages_Template_Defaults'                => static function ($arguments = []) { | 
                                                        |
| 902 | - return EE_Registry::instance()->load_lib(  | 
                                                        |
| 903 | - 'Messages_Template_Defaults',  | 
                                                        |
| 904 | - $arguments,  | 
                                                        |
| 905 | - false,  | 
                                                        |
| 906 | - false  | 
                                                        |
| 907 | - );  | 
                                                        |
| 908 | - },  | 
                                                        |
| 909 | - // load_helper  | 
                                                        |
| 910 | -            'EEH_Parse_Shortcodes'                         => static function () { | 
                                                        |
| 911 | -                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { | 
                                                        |
| 912 | - return new EEH_Parse_Shortcodes();  | 
                                                        |
| 913 | - }  | 
                                                        |
| 914 | - return null;  | 
                                                        |
| 915 | - },  | 
                                                        |
| 916 | -            'EE_Template_Config'                           => static function () { | 
                                                        |
| 917 | - return EE_Config::instance()->template_settings;  | 
                                                        |
| 918 | - },  | 
                                                        |
| 919 | -            'EE_Currency_Config'                           => static function () { | 
                                                        |
| 920 | - return EE_Config::instance()->currency;  | 
                                                        |
| 921 | - },  | 
                                                        |
| 922 | -            'EE_Registration_Config'                       => static function () { | 
                                                        |
| 923 | - return EE_Config::instance()->registration;  | 
                                                        |
| 924 | - },  | 
                                                        |
| 925 | -            'EE_Core_Config'                               => static function () { | 
                                                        |
| 926 | - return EE_Config::instance()->core;  | 
                                                        |
| 927 | - },  | 
                                                        |
| 928 | -            'EventEspresso\core\services\loaders\Loader'   => static function () { | 
                                                        |
| 929 | - return LoaderFactory::getLoader();  | 
                                                        |
| 930 | - },  | 
                                                        |
| 931 | -            'EE_Network_Config'                            => static function () { | 
                                                        |
| 932 | - return EE_Network_Config::instance();  | 
                                                        |
| 933 | - },  | 
                                                        |
| 934 | -            'EE_Config'                                    => static function () { | 
                                                        |
| 935 | - return EE_Config::instance();  | 
                                                        |
| 936 | - },  | 
                                                        |
| 937 | -            'EventEspresso\core\domain\Domain'             => static function () { | 
                                                        |
| 938 | - return DomainFactory::getEventEspressoCoreDomain();  | 
                                                        |
| 939 | - },  | 
                                                        |
| 940 | -            'EE_Admin_Config'                              => static function () { | 
                                                        |
| 941 | - return EE_Config::instance()->admin;  | 
                                                        |
| 942 | - },  | 
                                                        |
| 943 | -            'EE_Organization_Config'                       => static function () { | 
                                                        |
| 944 | - return EE_Config::instance()->organization;  | 
                                                        |
| 945 | - },  | 
                                                        |
| 946 | -            'EE_Network_Core_Config'                       => static function () { | 
                                                        |
| 947 | - return EE_Network_Config::instance()->core;  | 
                                                        |
| 948 | - },  | 
                                                        |
| 949 | -            'EE_Environment_Config'                        => static function () { | 
                                                        |
| 950 | - return EE_Config::instance()->environment;  | 
                                                        |
| 951 | - },  | 
                                                        |
| 952 | -            'EED_Core_Rest_Api'                            => static function () { | 
                                                        |
| 953 | - return EED_Core_Rest_Api::instance();  | 
                                                        |
| 954 | - },  | 
                                                        |
| 955 | -            'WP_REST_Server'                               => static function () { | 
                                                        |
| 956 | - return rest_get_server();  | 
                                                        |
| 957 | - },  | 
                                                        |
| 958 | -            'EventEspresso\core\Psr4Autoloader'            => static function () { | 
                                                        |
| 959 | - return EE_Psr4AutoloaderInit::psr4_loader();  | 
                                                        |
| 960 | - },  | 
                                                        |
| 961 | - ];  | 
                                                        |
| 962 | - }  | 
                                                        |
| 963 | -  | 
                                                        |
| 964 | -  | 
                                                        |
| 965 | - /**  | 
                                                        |
| 966 | - * can be used for supplying alternate names for classes,  | 
                                                        |
| 967 | - * or for connecting interface names to instantiable classes  | 
                                                        |
| 968 | - *  | 
                                                        |
| 969 | - * @throws InvalidAliasException  | 
                                                        |
| 970 | - */  | 
                                                        |
| 971 | - protected function _register_core_aliases()  | 
                                                        |
| 972 | -    { | 
                                                        |
| 973 | - $aliases = [  | 
                                                        |
| 974 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface',  | 
                                                        |
| 975 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus',  | 
                                                        |
| 976 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',  | 
                                                        |
| 977 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager',  | 
                                                        |
| 978 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker',  | 
                                                        |
| 979 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook',  | 
                                                        |
| 980 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 981 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',  | 
                                                        |
| 982 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 983 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',  | 
                                                        |
| 984 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',  | 
                                                        |
| 985 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',  | 
                                                        |
| 986 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',  | 
                                                        |
| 987 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',  | 
                                                        |
| 988 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',  | 
                                                        |
| 989 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',  | 
                                                        |
| 990 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',  | 
                                                        |
| 991 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',  | 
                                                        |
| 992 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager',  | 
                                                        |
| 993 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis',  | 
                                                        |
| 994 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 995 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',  | 
                                                        |
| 996 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 997 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage',  | 
                                                        |
| 998 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface',  | 
                                                        |
| 999 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader',  | 
                                                        |
| 1000 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface',  | 
                                                        |
| 1001 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory',  | 
                                                        |
| 1002 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',  | 
                                                        |
| 1003 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',  | 
                                                        |
| 1004 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface',  | 
                                                        |
| 1005 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',  | 
                                                        |
| 1006 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface',  | 
                                                        |
| 1007 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer',  | 
                                                        |
| 1008 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request',  | 
                                                        |
| 1009 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response',  | 
                                                        |
| 1010 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain',  | 
                                                        |
| 1011 | - 'Registration_Processor' => 'EE_Registration_Processor',  | 
                                                        |
| 1012 | - 'EventEspresso\core\services\assets\AssetManifestInterface' => 'EventEspresso\core\services\assets\AssetManifest',  | 
                                                        |
| 1013 | - ];  | 
                                                        |
| 1014 | -        foreach ($aliases as $alias => $fqn) { | 
                                                        |
| 1015 | -            if (is_array($fqn)) { | 
                                                        |
| 1016 | -                foreach ($fqn as $class => $for_class) { | 
                                                        |
| 1017 | - $this->class_cache->addAlias($class, $alias, $for_class);  | 
                                                        |
| 1018 | - }  | 
                                                        |
| 1019 | - continue;  | 
                                                        |
| 1020 | - }  | 
                                                        |
| 1021 | - $this->class_cache->addAlias($fqn, $alias);  | 
                                                        |
| 1022 | - }  | 
                                                        |
| 1023 | -        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { | 
                                                        |
| 1024 | - $this->class_cache->addAlias(  | 
                                                        |
| 1025 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',  | 
                                                        |
| 1026 | - 'EventEspresso\core\services\notices\NoticeConverterInterface'  | 
                                                        |
| 1027 | - );  | 
                                                        |
| 1028 | - }  | 
                                                        |
| 1029 | - }  | 
                                                        |
| 1030 | -  | 
                                                        |
| 1031 | -  | 
                                                        |
| 1032 | - /**  | 
                                                        |
| 1033 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the  | 
                                                        |
| 1034 | - * request Primarily used by unit tests.  | 
                                                        |
| 1035 | - */  | 
                                                        |
| 1036 | - public function reset()  | 
                                                        |
| 1037 | -    { | 
                                                        |
| 1038 | - $this->_register_core_class_loaders();  | 
                                                        |
| 1039 | - $this->_register_core_dependencies();  | 
                                                        |
| 1040 | - }  | 
                                                        |
| 1041 | -  | 
                                                        |
| 1042 | -  | 
                                                        |
| 1043 | - /**  | 
                                                        |
| 1044 | - * PLZ NOTE: a better name for this method would be is_alias()  | 
                                                        |
| 1045 | - * because it returns TRUE if the provided fully qualified name IS an alias  | 
                                                        |
| 1046 | - * WHY?  | 
                                                        |
| 1047 | - * Because if a class is type hinting for a concretion,  | 
                                                        |
| 1048 | - * then why would we need to find another class to supply it?  | 
                                                        |
| 1049 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,  | 
                                                        |
| 1050 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.  | 
                                                        |
| 1051 | - * Don't go looking for some substitute.  | 
                                                        |
| 1052 | - * Whereas if a class is type hinting for an interface...  | 
                                                        |
| 1053 | - * then we need to find an actual class to use.  | 
                                                        |
| 1054 | - * So the interface IS the alias for some other FQN,  | 
                                                        |
| 1055 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`  | 
                                                        |
| 1056 | - * represents some other class.  | 
                                                        |
| 1057 | - *  | 
                                                        |
| 1058 | - * @param string $fqn  | 
                                                        |
| 1059 | - * @param string $for_class  | 
                                                        |
| 1060 | - * @return bool  | 
                                                        |
| 1061 | - * @deprecated 4.9.62.p  | 
                                                        |
| 1062 | - */  | 
                                                        |
| 1063 | - public function has_alias($fqn = '', $for_class = '')  | 
                                                        |
| 1064 | -    { | 
                                                        |
| 1065 | - return $this->isAlias($fqn, $for_class);  | 
                                                        |
| 1066 | - }  | 
                                                        |
| 1067 | -  | 
                                                        |
| 1068 | -  | 
                                                        |
| 1069 | - /**  | 
                                                        |
| 1070 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias()  | 
                                                        |
| 1071 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias  | 
                                                        |
| 1072 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN  | 
                                                        |
| 1073 | - * for example:  | 
                                                        |
| 1074 | - * if the following two entries were added to the _aliases array:  | 
                                                        |
| 1075 | - * array(  | 
                                                        |
| 1076 | - * 'interface_alias' => 'some\namespace\interface'  | 
                                                        |
| 1077 | - * 'some\namespace\interface' => 'some\namespace\classname'  | 
                                                        |
| 1078 | - * )  | 
                                                        |
| 1079 | - * then one could use EE_Registry::instance()->create( 'interface_alias' )  | 
                                                        |
| 1080 | - * to load an instance of 'some\namespace\classname'  | 
                                                        |
| 1081 | - *  | 
                                                        |
| 1082 | - * @param string $alias  | 
                                                        |
| 1083 | - * @param string $for_class  | 
                                                        |
| 1084 | - * @return string  | 
                                                        |
| 1085 | - * @deprecated 4.9.62.p  | 
                                                        |
| 1086 | - */  | 
                                                        |
| 1087 | - public function get_alias($alias = '', $for_class = '')  | 
                                                        |
| 1088 | -    { | 
                                                        |
| 1089 | - return $this->getFqnForAlias($alias, $for_class);  | 
                                                        |
| 1090 | - }  | 
                                                        |
| 25 | + /**  | 
                                                        |
| 26 | + * This means that the requested class dependency is not present in the dependency map  | 
                                                        |
| 27 | + */  | 
                                                        |
| 28 | + const not_registered = 0;  | 
                                                        |
| 29 | +  | 
                                                        |
| 30 | + /**  | 
                                                        |
| 31 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.  | 
                                                        |
| 32 | + */  | 
                                                        |
| 33 | + const load_new_object = 1;  | 
                                                        |
| 34 | +  | 
                                                        |
| 35 | + /**  | 
                                                        |
| 36 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class.  | 
                                                        |
| 37 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache.  | 
                                                        |
| 38 | + */  | 
                                                        |
| 39 | + const load_from_cache = 2;  | 
                                                        |
| 40 | +  | 
                                                        |
| 41 | + /**  | 
                                                        |
| 42 | + * When registering a dependency,  | 
                                                        |
| 43 | + * this indicates to keep any existing dependencies that already exist,  | 
                                                        |
| 44 | + * and simply discard any new dependencies declared in the incoming data  | 
                                                        |
| 45 | + */  | 
                                                        |
| 46 | + const KEEP_EXISTING_DEPENDENCIES = 0;  | 
                                                        |
| 47 | +  | 
                                                        |
| 48 | + /**  | 
                                                        |
| 49 | + * When registering a dependency,  | 
                                                        |
| 50 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data  | 
                                                        |
| 51 | + */  | 
                                                        |
| 52 | + const OVERWRITE_DEPENDENCIES = 1;  | 
                                                        |
| 53 | +  | 
                                                        |
| 54 | + /**  | 
                                                        |
| 55 | + * @type EE_Dependency_Map $_instance  | 
                                                        |
| 56 | + */  | 
                                                        |
| 57 | + protected static $_instance;  | 
                                                        |
| 58 | +  | 
                                                        |
| 59 | + /**  | 
                                                        |
| 60 | + * @var ClassInterfaceCache $class_cache  | 
                                                        |
| 61 | + */  | 
                                                        |
| 62 | + private $class_cache;  | 
                                                        |
| 63 | +  | 
                                                        |
| 64 | + /**  | 
                                                        |
| 65 | + * @type RequestInterface $request  | 
                                                        |
| 66 | + */  | 
                                                        |
| 67 | + protected $request;  | 
                                                        |
| 68 | +  | 
                                                        |
| 69 | + /**  | 
                                                        |
| 70 | + * @type LegacyRequestInterface $legacy_request  | 
                                                        |
| 71 | + */  | 
                                                        |
| 72 | + protected $legacy_request;  | 
                                                        |
| 73 | +  | 
                                                        |
| 74 | + /**  | 
                                                        |
| 75 | + * @type ResponseInterface $response  | 
                                                        |
| 76 | + */  | 
                                                        |
| 77 | + protected $response;  | 
                                                        |
| 78 | +  | 
                                                        |
| 79 | + /**  | 
                                                        |
| 80 | + * @type LoaderInterface $loader  | 
                                                        |
| 81 | + */  | 
                                                        |
| 82 | + protected $loader;  | 
                                                        |
| 83 | +  | 
                                                        |
| 84 | + /**  | 
                                                        |
| 85 | + * @type array $_dependency_map  | 
                                                        |
| 86 | + */  | 
                                                        |
| 87 | + protected $_dependency_map = [];  | 
                                                        |
| 88 | +  | 
                                                        |
| 89 | + /**  | 
                                                        |
| 90 | + * @type array $_class_loaders  | 
                                                        |
| 91 | + */  | 
                                                        |
| 92 | + protected $_class_loaders = [];  | 
                                                        |
| 93 | +  | 
                                                        |
| 94 | +  | 
                                                        |
| 95 | + /**  | 
                                                        |
| 96 | + * EE_Dependency_Map constructor.  | 
                                                        |
| 97 | + *  | 
                                                        |
| 98 | + * @param ClassInterfaceCache $class_cache  | 
                                                        |
| 99 | + */  | 
                                                        |
| 100 | + protected function __construct(ClassInterfaceCache $class_cache)  | 
                                                        |
| 101 | +	{ | 
                                                        |
| 102 | + $this->class_cache = $class_cache;  | 
                                                        |
| 103 | +		do_action('EE_Dependency_Map____construct', $this); | 
                                                        |
| 104 | + }  | 
                                                        |
| 105 | +  | 
                                                        |
| 106 | +  | 
                                                        |
| 107 | + /**  | 
                                                        |
| 108 | + * @return void  | 
                                                        |
| 109 | + * @throws InvalidAliasException  | 
                                                        |
| 110 | + */  | 
                                                        |
| 111 | + public function initialize()  | 
                                                        |
| 112 | +	{ | 
                                                        |
| 113 | + $this->_register_core_dependencies();  | 
                                                        |
| 114 | + $this->_register_core_class_loaders();  | 
                                                        |
| 115 | + $this->_register_core_aliases();  | 
                                                        |
| 116 | + }  | 
                                                        |
| 117 | +  | 
                                                        |
| 118 | +  | 
                                                        |
| 119 | + /**  | 
                                                        |
| 120 | + * @singleton method used to instantiate class object  | 
                                                        |
| 121 | + * @param ClassInterfaceCache|null $class_cache  | 
                                                        |
| 122 | + * @return EE_Dependency_Map  | 
                                                        |
| 123 | + */  | 
                                                        |
| 124 | + public static function instance(ClassInterfaceCache $class_cache = null)  | 
                                                        |
| 125 | +	{ | 
                                                        |
| 126 | + // check if class object is instantiated, and instantiated properly  | 
                                                        |
| 127 | + if (  | 
                                                        |
| 128 | + ! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map  | 
                                                        |
| 129 | + && $class_cache instanceof ClassInterfaceCache  | 
                                                        |
| 130 | +		) { | 
                                                        |
| 131 | + EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache);  | 
                                                        |
| 132 | + }  | 
                                                        |
| 133 | + return EE_Dependency_Map::$_instance;  | 
                                                        |
| 134 | + }  | 
                                                        |
| 135 | +  | 
                                                        |
| 136 | +  | 
                                                        |
| 137 | + /**  | 
                                                        |
| 138 | + * @param RequestInterface $request  | 
                                                        |
| 139 | + */  | 
                                                        |
| 140 | + public function setRequest(RequestInterface $request)  | 
                                                        |
| 141 | +	{ | 
                                                        |
| 142 | + $this->request = $request;  | 
                                                        |
| 143 | + }  | 
                                                        |
| 144 | +  | 
                                                        |
| 145 | +  | 
                                                        |
| 146 | + /**  | 
                                                        |
| 147 | + * @param LegacyRequestInterface $legacy_request  | 
                                                        |
| 148 | + */  | 
                                                        |
| 149 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request)  | 
                                                        |
| 150 | +	{ | 
                                                        |
| 151 | + $this->legacy_request = $legacy_request;  | 
                                                        |
| 152 | + }  | 
                                                        |
| 153 | +  | 
                                                        |
| 154 | +  | 
                                                        |
| 155 | + /**  | 
                                                        |
| 156 | + * @param ResponseInterface $response  | 
                                                        |
| 157 | + */  | 
                                                        |
| 158 | + public function setResponse(ResponseInterface $response)  | 
                                                        |
| 159 | +	{ | 
                                                        |
| 160 | + $this->response = $response;  | 
                                                        |
| 161 | + }  | 
                                                        |
| 162 | +  | 
                                                        |
| 163 | +  | 
                                                        |
| 164 | + /**  | 
                                                        |
| 165 | + * @param LoaderInterface $loader  | 
                                                        |
| 166 | + */  | 
                                                        |
| 167 | + public function setLoader(LoaderInterface $loader)  | 
                                                        |
| 168 | +	{ | 
                                                        |
| 169 | + $this->loader = $loader;  | 
                                                        |
| 170 | + }  | 
                                                        |
| 171 | +  | 
                                                        |
| 172 | +  | 
                                                        |
| 173 | + /**  | 
                                                        |
| 174 | + * @param string $class  | 
                                                        |
| 175 | + * @param array $dependencies  | 
                                                        |
| 176 | + * @param int $overwrite  | 
                                                        |
| 177 | + * @return bool  | 
                                                        |
| 178 | + */  | 
                                                        |
| 179 | + public static function register_dependencies(  | 
                                                        |
| 180 | + $class,  | 
                                                        |
| 181 | + array $dependencies,  | 
                                                        |
| 182 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 183 | +	) { | 
                                                        |
| 184 | + return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite);  | 
                                                        |
| 185 | + }  | 
                                                        |
| 186 | +  | 
                                                        |
| 187 | +  | 
                                                        |
| 188 | + /**  | 
                                                        |
| 189 | + * Assigns an array of class names and corresponding load sources (new or cached)  | 
                                                        |
| 190 | + * to the class specified by the first parameter.  | 
                                                        |
| 191 | + * IMPORTANT !!!  | 
                                                        |
| 192 | + * The order of elements in the incoming $dependencies array MUST match  | 
                                                        |
| 193 | + * the order of the constructor parameters for the class in question.  | 
                                                        |
| 194 | + * This is especially important when overriding any existing dependencies that are registered.  | 
                                                        |
| 195 | + * the third parameter controls whether any duplicate dependencies are overwritten or not.  | 
                                                        |
| 196 | + *  | 
                                                        |
| 197 | + * @param string $class  | 
                                                        |
| 198 | + * @param array $dependencies  | 
                                                        |
| 199 | + * @param int $overwrite  | 
                                                        |
| 200 | + * @return bool  | 
                                                        |
| 201 | + */  | 
                                                        |
| 202 | + public function registerDependencies(  | 
                                                        |
| 203 | + $class,  | 
                                                        |
| 204 | + array $dependencies,  | 
                                                        |
| 205 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES  | 
                                                        |
| 206 | +	) { | 
                                                        |
| 207 | + $class = trim($class, '\\');  | 
                                                        |
| 208 | + $registered = false;  | 
                                                        |
| 209 | +		if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) { | 
                                                        |
| 210 | + EE_Dependency_Map::$_instance->_dependency_map[ $class ] = [];  | 
                                                        |
| 211 | + }  | 
                                                        |
| 212 | + // we need to make sure that any aliases used when registering a dependency  | 
                                                        |
| 213 | + // get resolved to the correct class name  | 
                                                        |
| 214 | +		foreach ($dependencies as $dependency => $load_source) { | 
                                                        |
| 215 | + $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency);  | 
                                                        |
| 216 | + if (  | 
                                                        |
| 217 | + $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES  | 
                                                        |
| 218 | + || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ])  | 
                                                        |
| 219 | +			) { | 
                                                        |
| 220 | + unset($dependencies[ $dependency ]);  | 
                                                        |
| 221 | + $dependencies[ $alias ] = $load_source;  | 
                                                        |
| 222 | + $registered = true;  | 
                                                        |
| 223 | + }  | 
                                                        |
| 224 | + }  | 
                                                        |
| 225 | + // now add our two lists of dependencies together.  | 
                                                        |
| 226 | + // using Union (+=) favours the arrays in precedence from left to right,  | 
                                                        |
| 227 | + // so $dependencies is NOT overwritten because it is listed first  | 
                                                        |
| 228 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C  | 
                                                        |
| 229 | + // Union is way faster than array_merge() but should be used with caution...  | 
                                                        |
| 230 | + // especially with numerically indexed arrays  | 
                                                        |
| 231 | + $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ];  | 
                                                        |
| 232 | + // now we need to ensure that the resulting dependencies  | 
                                                        |
| 233 | + // array only has the entries that are required for the class  | 
                                                        |
| 234 | + // so first count how many dependencies were originally registered for the class  | 
                                                        |
| 235 | + $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]);  | 
                                                        |
| 236 | + // if that count is non-zero (meaning dependencies were already registered)  | 
                                                        |
| 237 | + EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count  | 
                                                        |
| 238 | + // then truncate the final array to match that count  | 
                                                        |
| 239 | + ? array_slice($dependencies, 0, $dependency_count)  | 
                                                        |
| 240 | + // otherwise just take the incoming array because nothing previously existed  | 
                                                        |
| 241 | + : $dependencies;  | 
                                                        |
| 242 | + return $registered;  | 
                                                        |
| 243 | + }  | 
                                                        |
| 244 | +  | 
                                                        |
| 245 | +  | 
                                                        |
| 246 | + /**  | 
                                                        |
| 247 | + * @param string $class_name  | 
                                                        |
| 248 | + * @param string $loader  | 
                                                        |
| 249 | + * @return bool  | 
                                                        |
| 250 | + * @throws DomainException  | 
                                                        |
| 251 | + */  | 
                                                        |
| 252 | + public static function register_class_loader($class_name, $loader = 'load_core')  | 
                                                        |
| 253 | +	{ | 
                                                        |
| 254 | + return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader);  | 
                                                        |
| 255 | + }  | 
                                                        |
| 256 | +  | 
                                                        |
| 257 | +  | 
                                                        |
| 258 | + /**  | 
                                                        |
| 259 | + * @param string $class_name  | 
                                                        |
| 260 | + * @param string $loader  | 
                                                        |
| 261 | + * @return bool  | 
                                                        |
| 262 | + * @throws DomainException  | 
                                                        |
| 263 | + */  | 
                                                        |
| 264 | + public function registerClassLoader($class_name, $loader = 'load_core')  | 
                                                        |
| 265 | +	{ | 
                                                        |
| 266 | +		if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { | 
                                                        |
| 267 | + throw new DomainException(  | 
                                                        |
| 268 | +				esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') | 
                                                        |
| 269 | + );  | 
                                                        |
| 270 | + }  | 
                                                        |
| 271 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry  | 
                                                        |
| 272 | + if (  | 
                                                        |
| 273 | + ! is_callable($loader)  | 
                                                        |
| 274 | + && (  | 
                                                        |
| 275 | + strpos($loader, 'load_') !== 0  | 
                                                        |
| 276 | +				|| ! method_exists('EE_Registry', $loader) | 
                                                        |
| 277 | + )  | 
                                                        |
| 278 | +		) { | 
                                                        |
| 279 | + throw new DomainException(  | 
                                                        |
| 280 | + sprintf(  | 
                                                        |
| 281 | + esc_html__(  | 
                                                        |
| 282 | + '"%1$s" is not a valid loader method on EE_Registry.',  | 
                                                        |
| 283 | + 'event_espresso'  | 
                                                        |
| 284 | + ),  | 
                                                        |
| 285 | + $loader  | 
                                                        |
| 286 | + )  | 
                                                        |
| 287 | + );  | 
                                                        |
| 288 | + }  | 
                                                        |
| 289 | + $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name);  | 
                                                        |
| 290 | +		if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { | 
                                                        |
| 291 | + EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader;  | 
                                                        |
| 292 | + return true;  | 
                                                        |
| 293 | + }  | 
                                                        |
| 294 | + return false;  | 
                                                        |
| 295 | + }  | 
                                                        |
| 296 | +  | 
                                                        |
| 297 | +  | 
                                                        |
| 298 | + /**  | 
                                                        |
| 299 | + * @return array  | 
                                                        |
| 300 | + */  | 
                                                        |
| 301 | + public function dependency_map()  | 
                                                        |
| 302 | +	{ | 
                                                        |
| 303 | + return $this->_dependency_map;  | 
                                                        |
| 304 | + }  | 
                                                        |
| 305 | +  | 
                                                        |
| 306 | +  | 
                                                        |
| 307 | + /**  | 
                                                        |
| 308 | + * returns TRUE if dependency map contains a listing for the provided class name  | 
                                                        |
| 309 | + *  | 
                                                        |
| 310 | + * @param string $class_name  | 
                                                        |
| 311 | + * @return boolean  | 
                                                        |
| 312 | + */  | 
                                                        |
| 313 | + public function has($class_name = '')  | 
                                                        |
| 314 | +	{ | 
                                                        |
| 315 | + // all legacy models have the same dependencies  | 
                                                        |
| 316 | +		if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 317 | + $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 318 | + }  | 
                                                        |
| 319 | + return isset($this->_dependency_map[ $class_name ]);  | 
                                                        |
| 320 | + }  | 
                                                        |
| 321 | +  | 
                                                        |
| 322 | +  | 
                                                        |
| 323 | + /**  | 
                                                        |
| 324 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency  | 
                                                        |
| 325 | + *  | 
                                                        |
| 326 | + * @param string $class_name  | 
                                                        |
| 327 | + * @param string $dependency  | 
                                                        |
| 328 | + * @return bool  | 
                                                        |
| 329 | + */  | 
                                                        |
| 330 | + public function has_dependency_for_class($class_name = '', $dependency = '')  | 
                                                        |
| 331 | +	{ | 
                                                        |
| 332 | + // all legacy models have the same dependencies  | 
                                                        |
| 333 | +		if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 334 | + $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 335 | + }  | 
                                                        |
| 336 | + $dependency = $this->getFqnForAlias($dependency, $class_name);  | 
                                                        |
| 337 | + return isset($this->_dependency_map[ $class_name ][ $dependency ]);  | 
                                                        |
| 338 | + }  | 
                                                        |
| 339 | +  | 
                                                        |
| 340 | +  | 
                                                        |
| 341 | + /**  | 
                                                        |
| 342 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned  | 
                                                        |
| 343 | + *  | 
                                                        |
| 344 | + * @param string $class_name  | 
                                                        |
| 345 | + * @param string $dependency  | 
                                                        |
| 346 | + * @return int  | 
                                                        |
| 347 | + */  | 
                                                        |
| 348 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')  | 
                                                        |
| 349 | +	{ | 
                                                        |
| 350 | + // all legacy models have the same dependencies  | 
                                                        |
| 351 | +		if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 352 | + $class_name = 'LEGACY_MODELS';  | 
                                                        |
| 353 | + }  | 
                                                        |
| 354 | + $dependency = $this->getFqnForAlias($dependency);  | 
                                                        |
| 355 | + return $this->has_dependency_for_class($class_name, $dependency)  | 
                                                        |
| 356 | + ? $this->_dependency_map[ $class_name ][ $dependency ]  | 
                                                        |
| 357 | + : EE_Dependency_Map::not_registered;  | 
                                                        |
| 358 | + }  | 
                                                        |
| 359 | +  | 
                                                        |
| 360 | +  | 
                                                        |
| 361 | + /**  | 
                                                        |
| 362 | + * @param string $class_name  | 
                                                        |
| 363 | + * @return string | Closure  | 
                                                        |
| 364 | + */  | 
                                                        |
| 365 | + public function class_loader($class_name)  | 
                                                        |
| 366 | +	{ | 
                                                        |
| 367 | + // all legacy models use load_model()  | 
                                                        |
| 368 | +		if (strpos($class_name, 'EEM_') === 0) { | 
                                                        |
| 369 | + return 'load_model';  | 
                                                        |
| 370 | + }  | 
                                                        |
| 371 | + // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc  | 
                                                        |
| 372 | + // perform strpos() first to avoid loading regex every time we load a class  | 
                                                        |
| 373 | + if (  | 
                                                        |
| 374 | + strpos($class_name, 'EE_CPT_') === 0  | 
                                                        |
| 375 | +			&& preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) | 
                                                        |
| 376 | +		) { | 
                                                        |
| 377 | + return 'load_core';  | 
                                                        |
| 378 | + }  | 
                                                        |
| 379 | + $class_name = $this->getFqnForAlias($class_name);  | 
                                                        |
| 380 | + return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';  | 
                                                        |
| 381 | + }  | 
                                                        |
| 382 | +  | 
                                                        |
| 383 | +  | 
                                                        |
| 384 | + /**  | 
                                                        |
| 385 | + * @return array  | 
                                                        |
| 386 | + */  | 
                                                        |
| 387 | + public function class_loaders()  | 
                                                        |
| 388 | +	{ | 
                                                        |
| 389 | + return $this->_class_loaders;  | 
                                                        |
| 390 | + }  | 
                                                        |
| 391 | +  | 
                                                        |
| 392 | +  | 
                                                        |
| 393 | + /**  | 
                                                        |
| 394 | + * adds an alias for a classname  | 
                                                        |
| 395 | + *  | 
                                                        |
| 396 | + * @param string $fqcn the class name that should be used (concrete class to replace interface)  | 
                                                        |
| 397 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface)  | 
                                                        |
| 398 | + * @param string $for_class the class that has the dependency (is type hinting for the interface)  | 
                                                        |
| 399 | + * @throws InvalidAliasException  | 
                                                        |
| 400 | + */  | 
                                                        |
| 401 | + public function add_alias($fqcn, $alias, $for_class = '')  | 
                                                        |
| 402 | +	{ | 
                                                        |
| 403 | + $this->class_cache->addAlias($fqcn, $alias, $for_class);  | 
                                                        |
| 404 | + }  | 
                                                        |
| 405 | +  | 
                                                        |
| 406 | +  | 
                                                        |
| 407 | + /**  | 
                                                        |
| 408 | + * Returns TRUE if the provided fully qualified name IS an alias  | 
                                                        |
| 409 | + * WHY?  | 
                                                        |
| 410 | + * Because if a class is type hinting for a concretion,  | 
                                                        |
| 411 | + * then why would we need to find another class to supply it?  | 
                                                        |
| 412 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,  | 
                                                        |
| 413 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.  | 
                                                        |
| 414 | + * Don't go looking for some substitute.  | 
                                                        |
| 415 | + * Whereas if a class is type hinting for an interface...  | 
                                                        |
| 416 | + * then we need to find an actual class to use.  | 
                                                        |
| 417 | + * So the interface IS the alias for some other FQN,  | 
                                                        |
| 418 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`  | 
                                                        |
| 419 | + * represents some other class.  | 
                                                        |
| 420 | + *  | 
                                                        |
| 421 | + * @param string $fqn  | 
                                                        |
| 422 | + * @param string $for_class  | 
                                                        |
| 423 | + * @return bool  | 
                                                        |
| 424 | + */  | 
                                                        |
| 425 | + public function isAlias($fqn = '', $for_class = '')  | 
                                                        |
| 426 | +	{ | 
                                                        |
| 427 | + return $this->class_cache->isAlias($fqn, $for_class);  | 
                                                        |
| 428 | + }  | 
                                                        |
| 429 | +  | 
                                                        |
| 430 | +  | 
                                                        |
| 431 | + /**  | 
                                                        |
| 432 | + * Returns a FQN for provided alias if one exists, otherwise returns the original $alias  | 
                                                        |
| 433 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN  | 
                                                        |
| 434 | + * for example:  | 
                                                        |
| 435 | + * if the following two entries were added to the _aliases array:  | 
                                                        |
| 436 | + * array(  | 
                                                        |
| 437 | + * 'interface_alias' => 'some\namespace\interface'  | 
                                                        |
| 438 | + * 'some\namespace\interface' => 'some\namespace\classname'  | 
                                                        |
| 439 | + * )  | 
                                                        |
| 440 | + * then one could use EE_Registry::instance()->create( 'interface_alias' )  | 
                                                        |
| 441 | + * to load an instance of 'some\namespace\classname'  | 
                                                        |
| 442 | + *  | 
                                                        |
| 443 | + * @param string $alias  | 
                                                        |
| 444 | + * @param string $for_class  | 
                                                        |
| 445 | + * @return string  | 
                                                        |
| 446 | + */  | 
                                                        |
| 447 | + public function getFqnForAlias($alias = '', $for_class = '')  | 
                                                        |
| 448 | +	{ | 
                                                        |
| 449 | + return (string) $this->class_cache->getFqnForAlias($alias, $for_class);  | 
                                                        |
| 450 | + }  | 
                                                        |
| 451 | +  | 
                                                        |
| 452 | +  | 
                                                        |
| 453 | + /**  | 
                                                        |
| 454 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,  | 
                                                        |
| 455 | + * if one exists, or whether a new object should be generated every time the requested class is loaded.  | 
                                                        |
| 456 | + * This is done by using the following class constants:  | 
                                                        |
| 457 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object  | 
                                                        |
| 458 | + * EE_Dependency_Map::load_new_object - generates a new object every time  | 
                                                        |
| 459 | + */  | 
                                                        |
| 460 | + protected function _register_core_dependencies()  | 
                                                        |
| 461 | +	{ | 
                                                        |
| 462 | + $this->_dependency_map = [  | 
                                                        |
| 463 | + 'EE_Request_Handler' => [  | 
                                                        |
| 464 | + 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 465 | + ],  | 
                                                        |
| 466 | + 'EE_System' => [  | 
                                                        |
| 467 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 468 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 469 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 470 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 471 | + 'EventEspresso\core\services\routing\Router' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 472 | + ],  | 
                                                        |
| 473 | + 'EE_Admin' => [  | 
                                                        |
| 474 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 475 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 476 | + ],  | 
                                                        |
| 477 | + 'EE_Cart' => [  | 
                                                        |
| 478 | + 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 479 | + ],  | 
                                                        |
| 480 | + 'EE_Messenger_Collection_Loader' => [  | 
                                                        |
| 481 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 482 | + ],  | 
                                                        |
| 483 | + 'EE_Message_Type_Collection_Loader' => [  | 
                                                        |
| 484 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 485 | + ],  | 
                                                        |
| 486 | + 'EE_Message_Resource_Manager' => [  | 
                                                        |
| 487 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 488 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 489 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 490 | + ],  | 
                                                        |
| 491 | + 'EE_Message_Factory' => [  | 
                                                        |
| 492 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 493 | + ],  | 
                                                        |
| 494 | + 'EE_messages' => [  | 
                                                        |
| 495 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 496 | + ],  | 
                                                        |
| 497 | + 'EE_Messages_Generator' => [  | 
                                                        |
| 498 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 499 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 500 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 501 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 502 | + ],  | 
                                                        |
| 503 | + 'EE_Messages_Processor' => [  | 
                                                        |
| 504 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 505 | + ],  | 
                                                        |
| 506 | + 'EE_Messages_Queue' => [  | 
                                                        |
| 507 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 508 | + ],  | 
                                                        |
| 509 | + 'EE_Messages_Template_Defaults' => [  | 
                                                        |
| 510 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 511 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 512 | + ],  | 
                                                        |
| 513 | + 'EE_Message_To_Generate_From_Request' => [  | 
                                                        |
| 514 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 515 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 516 | + ],  | 
                                                        |
| 517 | + 'EventEspresso\core\services\commands\CommandBus' => [  | 
                                                        |
| 518 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 519 | + ],  | 
                                                        |
| 520 | + 'EventEspresso\services\commands\CommandHandler' => [  | 
                                                        |
| 521 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 522 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 523 | + ],  | 
                                                        |
| 524 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => [  | 
                                                        |
| 525 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 526 | + ],  | 
                                                        |
| 527 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => [  | 
                                                        |
| 528 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 529 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 530 | + ],  | 
                                                        |
| 531 | + 'EventEspresso\core\services\commands\CommandFactory' => [  | 
                                                        |
| 532 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 533 | + ],  | 
                                                        |
| 534 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => [  | 
                                                        |
| 535 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 536 | + ],  | 
                                                        |
| 537 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [  | 
                                                        |
| 538 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 539 | + ],  | 
                                                        |
| 540 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [  | 
                                                        |
| 541 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 542 | + ],  | 
                                                        |
| 543 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => [  | 
                                                        |
| 544 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 545 | + ],  | 
                                                        |
| 546 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [  | 
                                                        |
| 547 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 548 | + ],  | 
                                                        |
| 549 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [  | 
                                                        |
| 550 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 551 | + ],  | 
                                                        |
| 552 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [  | 
                                                        |
| 553 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 554 | + ],  | 
                                                        |
| 555 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [  | 
                                                        |
| 556 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 557 | + ],  | 
                                                        |
| 558 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => [  | 
                                                        |
| 559 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 560 | + ],  | 
                                                        |
| 561 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => [  | 
                                                        |
| 562 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 563 | + ],  | 
                                                        |
| 564 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [  | 
                                                        |
| 565 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 566 | + ],  | 
                                                        |
| 567 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => [  | 
                                                        |
| 568 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 569 | + ],  | 
                                                        |
| 570 | + 'EventEspresso\core\services\database\TableManager' => [  | 
                                                        |
| 571 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 572 | + ],  | 
                                                        |
| 573 | + 'EE_Data_Migration_Class_Base' => [  | 
                                                        |
| 574 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 575 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 576 | + ],  | 
                                                        |
| 577 | + 'EE_DMS_Core_4_1_0' => [  | 
                                                        |
| 578 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 579 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 580 | + ],  | 
                                                        |
| 581 | + 'EE_DMS_Core_4_2_0' => [  | 
                                                        |
| 582 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 583 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 584 | + ],  | 
                                                        |
| 585 | + 'EE_DMS_Core_4_3_0' => [  | 
                                                        |
| 586 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 587 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 588 | + ],  | 
                                                        |
| 589 | + 'EE_DMS_Core_4_4_0' => [  | 
                                                        |
| 590 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 591 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 592 | + ],  | 
                                                        |
| 593 | + 'EE_DMS_Core_4_5_0' => [  | 
                                                        |
| 594 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 595 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 596 | + ],  | 
                                                        |
| 597 | + 'EE_DMS_Core_4_6_0' => [  | 
                                                        |
| 598 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 599 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 600 | + ],  | 
                                                        |
| 601 | + 'EE_DMS_Core_4_7_0' => [  | 
                                                        |
| 602 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 603 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 604 | + ],  | 
                                                        |
| 605 | + 'EE_DMS_Core_4_8_0' => [  | 
                                                        |
| 606 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 607 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 608 | + ],  | 
                                                        |
| 609 | + 'EE_DMS_Core_4_9_0' => [  | 
                                                        |
| 610 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 611 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 612 | + ],  | 
                                                        |
| 613 | + 'EE_DMS_Core_4_10_0' => [  | 
                                                        |
| 614 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 615 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 616 | + 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 617 | + ],  | 
                                                        |
| 618 | + 'EE_DMS_Core_4_11_0' => [  | 
                                                        |
| 619 | + 'EE_DMS_Core_4_10_0' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 620 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 621 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 622 | + ],  | 
                                                        |
| 623 | + 'EE_DMS_Core_4_12_0' => [  | 
                                                        |
| 624 | + 'EE_DMS_Core_4_11_0' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 625 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 626 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 627 | + ],  | 
                                                        |
| 628 | + 'EventEspresso\core\services\assets\Registry' => [  | 
                                                        |
| 629 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,  | 
                                                        |
| 630 | + 'EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 631 | + ],  | 
                                                        |
| 632 | + 'EventEspresso\core\services\cache\BasicCacheManager' => [  | 
                                                        |
| 633 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 634 | + ],  | 
                                                        |
| 635 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [  | 
                                                        |
| 636 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 637 | + ],  | 
                                                        |
| 638 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [  | 
                                                        |
| 639 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 640 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 641 | + ],  | 
                                                        |
| 642 | + 'EventEspresso\core\domain\values\EmailAddress' => [  | 
                                                        |
| 643 | + null,  | 
                                                        |
| 644 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 645 | + ],  | 
                                                        |
| 646 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => [  | 
                                                        |
| 647 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 648 | + ],  | 
                                                        |
| 649 | + 'LEGACY_MODELS' => [  | 
                                                        |
| 650 | + null,  | 
                                                        |
| 651 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 652 | + ],  | 
                                                        |
| 653 | + 'EE_Module_Request_Router' => [  | 
                                                        |
| 654 | + 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 655 | + ],  | 
                                                        |
| 656 | + 'EE_Registration_Processor' => [  | 
                                                        |
| 657 | + 'EE_Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 658 | + ],  | 
                                                        |
| 659 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [  | 
                                                        |
| 660 | + null,  | 
                                                        |
| 661 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 662 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 663 | + ],  | 
                                                        |
| 664 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [  | 
                                                        |
| 665 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 666 | + 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 667 | + ],  | 
                                                        |
| 668 | + 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [  | 
                                                        |
| 669 | + 'EventEspresso\core\domain\entities\users\CurrentUser' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 670 | + ],  | 
                                                        |
| 671 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [  | 
                                                        |
| 672 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 673 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 674 | + 'EE_Session' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 675 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 676 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 677 | + ],  | 
                                                        |
| 678 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [  | 
                                                        |
| 679 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 680 | + ],  | 
                                                        |
| 681 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [  | 
                                                        |
| 682 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 683 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 684 | + ],  | 
                                                        |
| 685 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [  | 
                                                        |
| 686 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 687 | + ],  | 
                                                        |
| 688 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [  | 
                                                        |
| 689 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 690 | + ],  | 
                                                        |
| 691 | + 'EE_CPT_Strategy' => [  | 
                                                        |
| 692 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 693 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 694 | + ],  | 
                                                        |
| 695 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => [  | 
                                                        |
| 696 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 697 | + ],  | 
                                                        |
| 698 | + 'EventEspresso\core\CPTs\CptQueryModifier' => [  | 
                                                        |
| 699 | + null,  | 
                                                        |
| 700 | + null,  | 
                                                        |
| 701 | + null,  | 
                                                        |
| 702 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 703 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 704 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 705 | + ],  | 
                                                        |
| 706 | + 'EventEspresso\core\services\dependencies\DependencyResolver' => [  | 
                                                        |
| 707 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 708 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 709 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 710 | + ],  | 
                                                        |
| 711 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => [  | 
                                                        |
| 712 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 713 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 714 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 715 | + ],  | 
                                                        |
| 716 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => [  | 
                                                        |
| 717 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 718 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 719 | + ],  | 
                                                        |
| 720 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => [  | 
                                                        |
| 721 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 722 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 723 | + ],  | 
                                                        |
| 724 | + 'EE_URL_Validation_Strategy' => [  | 
                                                        |
| 725 | + null,  | 
                                                        |
| 726 | + null,  | 
                                                        |
| 727 | + 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 728 | + ],  | 
                                                        |
| 729 | + 'EventEspresso\core\services\request\files\FilesDataHandler' => [  | 
                                                        |
| 730 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 731 | + ],  | 
                                                        |
| 732 | + 'EventEspressoBatchRequest\BatchRequestProcessor' => [  | 
                                                        |
| 733 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 734 | + ],  | 
                                                        |
| 735 | + 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [  | 
                                                        |
| 736 | + 'WP_REST_Server' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 737 | + 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 738 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 739 | + null,  | 
                                                        |
| 740 | + ],  | 
                                                        |
| 741 | + 'EventEspresso\core\services\routing\RouteHandler' => [  | 
                                                        |
| 742 | + 'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 743 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 744 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 745 | + 'EventEspresso\core\services\routing\RouteCollection' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 746 | + ],  | 
                                                        |
| 747 | + 'EventEspresso\core\services\json\JsonDataNodeHandler' => [  | 
                                                        |
| 748 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 749 | + ],  | 
                                                        |
| 750 | + 'EventEspresso\core\services\routing\Router' => [  | 
                                                        |
| 751 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 752 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 753 | + 'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 754 | + ],  | 
                                                        |
| 755 | + 'EventEspresso\core\services\assets\AssetManifest' => [  | 
                                                        |
| 756 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 757 | + ],  | 
                                                        |
| 758 | + 'EventEspresso\core\services\assets\AssetManifestFactory' => [  | 
                                                        |
| 759 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 760 | + ],  | 
                                                        |
| 761 | + 'EventEspresso\core\services\assets\BaristaFactory' => [  | 
                                                        |
| 762 | + 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 763 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 764 | + ],  | 
                                                        |
| 765 | + 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => [  | 
                                                        |
| 766 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 767 | + ],  | 
                                                        |
| 768 | + 'EventEspresso\core\services\addon\AddonManager' => [  | 
                                                        |
| 769 | + 'EventEspresso\core\services\addon\AddonCollection' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 770 | + 'EventEspresso\core\Psr4Autoloader' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 771 | + 'EventEspresso\core\services\addon\api\v1\RegisterAddon' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 772 | + 'EventEspresso\core\services\addon\api\IncompatibleAddonHandler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 773 | + 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 774 | + ],  | 
                                                        |
| 775 | + 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => [  | 
                                                        |
| 776 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 777 | + ],  | 
                                                        |
| 778 | + 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [  | 
                                                        |
| 779 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 780 | + ],  | 
                                                        |
| 781 | + 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [  | 
                                                        |
| 782 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 783 | + ],  | 
                                                        |
| 784 | + 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [  | 
                                                        |
| 785 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 786 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 787 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 788 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache  | 
                                                        |
| 789 | + ],  | 
                                                        |
| 790 | + 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [  | 
                                                        |
| 791 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 792 | + ],  | 
                                                        |
| 793 | + 'EventEspresso\core\domain\entities\users\CurrentUser' => [  | 
                                                        |
| 794 | + 'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 795 | + ],  | 
                                                        |
| 796 | + 'EventEspresso\core\services\form\meta\InputTypes' => [  | 
                                                        |
| 797 | + 'EventEspresso\core\services\form\meta\inputs\Button' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 798 | + 'EventEspresso\core\services\form\meta\inputs\DateTime' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 799 | + 'EventEspresso\core\services\form\meta\inputs\Input' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 800 | + 'EventEspresso\core\services\form\meta\inputs\Number' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 801 | + 'EventEspresso\core\services\form\meta\inputs\Phone' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 802 | + 'EventEspresso\core\services\form\meta\inputs\Select' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 803 | + 'EventEspresso\core\services\form\meta\inputs\Text' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 804 | + ],  | 
                                                        |
| 805 | + 'EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm' => [  | 
                                                        |
| 806 | + null,  | 
                                                        |
| 807 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 808 | + ],  | 
                                                        |
| 809 | + 'EventEspresso\core\domain\services\registration\form\CountryOptions' => [  | 
                                                        |
| 810 | + null,  | 
                                                        |
| 811 | + 'EEM_Answer' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 812 | + 'EEM_Country' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 813 | + ],  | 
                                                        |
| 814 | + 'EventEspresso\core\domain\services\registration\form\StateOptions' => [  | 
                                                        |
| 815 | + null,  | 
                                                        |
| 816 | + 'EEM_State' => EE_Dependency_Map::load_from_cache,  | 
                                                        |
| 817 | + ],  | 
                                                        |
| 818 | + ];  | 
                                                        |
| 819 | + }  | 
                                                        |
| 820 | +  | 
                                                        |
| 821 | +  | 
                                                        |
| 822 | + /**  | 
                                                        |
| 823 | + * Registers how core classes are loaded.  | 
                                                        |
| 824 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:  | 
                                                        |
| 825 | + * 'EE_Request_Handler' => 'load_core'  | 
                                                        |
| 826 | + * 'EE_Messages_Queue' => 'load_lib'  | 
                                                        |
| 827 | + * 'EEH_Debug_Tools' => 'load_helper'  | 
                                                        |
| 828 | + * or, if greater control is required, by providing a custom closure. For example:  | 
                                                        |
| 829 | +	 *        'Some_Class' => function () { | 
                                                        |
| 830 | + * return new Some_Class();  | 
                                                        |
| 831 | + * },  | 
                                                        |
| 832 | + * This is required for instantiating dependencies  | 
                                                        |
| 833 | + * where an interface has been type hinted in a class constructor. For example:  | 
                                                        |
| 834 | +	 *        'Required_Interface' => function () { | 
                                                        |
| 835 | + * return new A_Class_That_Implements_Required_Interface();  | 
                                                        |
| 836 | + * },  | 
                                                        |
| 837 | + */  | 
                                                        |
| 838 | + protected function _register_core_class_loaders()  | 
                                                        |
| 839 | +	{ | 
                                                        |
| 840 | + $this->_class_loaders = [  | 
                                                        |
| 841 | + // load_core  | 
                                                        |
| 842 | +			'EE_Dependency_Map'                            => function () { | 
                                                        |
| 843 | + return $this;  | 
                                                        |
| 844 | + },  | 
                                                        |
| 845 | + 'EE_Capabilities' => 'load_core',  | 
                                                        |
| 846 | + 'EE_Encryption' => 'load_core',  | 
                                                        |
| 847 | + 'EE_Front_Controller' => 'load_core',  | 
                                                        |
| 848 | + 'EE_Module_Request_Router' => 'load_core',  | 
                                                        |
| 849 | + 'EE_Registry' => 'load_core',  | 
                                                        |
| 850 | +			'EE_Request'                                   => function () { | 
                                                        |
| 851 | + return $this->legacy_request;  | 
                                                        |
| 852 | + },  | 
                                                        |
| 853 | +			'EventEspresso\core\services\request\Request'  => function () { | 
                                                        |
| 854 | + return $this->request;  | 
                                                        |
| 855 | + },  | 
                                                        |
| 856 | +			'EventEspresso\core\services\request\Response' => function () { | 
                                                        |
| 857 | + return $this->response;  | 
                                                        |
| 858 | + },  | 
                                                        |
| 859 | + 'EE_Base' => 'load_core',  | 
                                                        |
| 860 | + 'EE_Request_Handler' => 'load_core',  | 
                                                        |
| 861 | + 'EE_Session' => 'load_core',  | 
                                                        |
| 862 | + 'EE_Cron_Tasks' => 'load_core',  | 
                                                        |
| 863 | + 'EE_System' => 'load_core',  | 
                                                        |
| 864 | + 'EE_Maintenance_Mode' => 'load_core',  | 
                                                        |
| 865 | + 'EE_Register_CPTs' => 'load_core',  | 
                                                        |
| 866 | + 'EE_Admin' => 'load_core',  | 
                                                        |
| 867 | + 'EE_CPT_Strategy' => 'load_core',  | 
                                                        |
| 868 | + // load_class  | 
                                                        |
| 869 | + 'EE_Registration_Processor' => 'load_class',  | 
                                                        |
| 870 | + // load_lib  | 
                                                        |
| 871 | + 'EE_Message_Resource_Manager' => 'load_lib',  | 
                                                        |
| 872 | + 'EE_Message_Type_Collection' => 'load_lib',  | 
                                                        |
| 873 | + 'EE_Message_Type_Collection_Loader' => 'load_lib',  | 
                                                        |
| 874 | + 'EE_Messenger_Collection' => 'load_lib',  | 
                                                        |
| 875 | + 'EE_Messenger_Collection_Loader' => 'load_lib',  | 
                                                        |
| 876 | + 'EE_Messages_Processor' => 'load_lib',  | 
                                                        |
| 877 | + 'EE_Message_Repository' => 'load_lib',  | 
                                                        |
| 878 | + 'EE_Messages_Queue' => 'load_lib',  | 
                                                        |
| 879 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib',  | 
                                                        |
| 880 | + 'EE_Message_Template_Group_Collection' => 'load_lib',  | 
                                                        |
| 881 | + 'EE_Payment_Method_Manager' => 'load_lib',  | 
                                                        |
| 882 | + 'EE_DMS_Core_4_1_0' => 'load_dms',  | 
                                                        |
| 883 | + 'EE_DMS_Core_4_2_0' => 'load_dms',  | 
                                                        |
| 884 | + 'EE_DMS_Core_4_3_0' => 'load_dms',  | 
                                                        |
| 885 | + 'EE_DMS_Core_4_5_0' => 'load_dms',  | 
                                                        |
| 886 | + 'EE_DMS_Core_4_6_0' => 'load_dms',  | 
                                                        |
| 887 | + 'EE_DMS_Core_4_7_0' => 'load_dms',  | 
                                                        |
| 888 | + 'EE_DMS_Core_4_8_0' => 'load_dms',  | 
                                                        |
| 889 | + 'EE_DMS_Core_4_9_0' => 'load_dms',  | 
                                                        |
| 890 | + 'EE_DMS_Core_4_10_0' => 'load_dms',  | 
                                                        |
| 891 | + 'EE_DMS_Core_4_11_0' => 'load_dms',  | 
                                                        |
| 892 | + 'EE_DMS_Core_4_12_0' => 'load_dms',  | 
                                                        |
| 893 | +			'EE_Messages_Generator'                        => static function () { | 
                                                        |
| 894 | + return EE_Registry::instance()->load_lib(  | 
                                                        |
| 895 | + 'Messages_Generator',  | 
                                                        |
| 896 | + [],  | 
                                                        |
| 897 | + false,  | 
                                                        |
| 898 | + false  | 
                                                        |
| 899 | + );  | 
                                                        |
| 900 | + },  | 
                                                        |
| 901 | +			'EE_Messages_Template_Defaults'                => static function ($arguments = []) { | 
                                                        |
| 902 | + return EE_Registry::instance()->load_lib(  | 
                                                        |
| 903 | + 'Messages_Template_Defaults',  | 
                                                        |
| 904 | + $arguments,  | 
                                                        |
| 905 | + false,  | 
                                                        |
| 906 | + false  | 
                                                        |
| 907 | + );  | 
                                                        |
| 908 | + },  | 
                                                        |
| 909 | + // load_helper  | 
                                                        |
| 910 | +			'EEH_Parse_Shortcodes'                         => static function () { | 
                                                        |
| 911 | +				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { | 
                                                        |
| 912 | + return new EEH_Parse_Shortcodes();  | 
                                                        |
| 913 | + }  | 
                                                        |
| 914 | + return null;  | 
                                                        |
| 915 | + },  | 
                                                        |
| 916 | +			'EE_Template_Config'                           => static function () { | 
                                                        |
| 917 | + return EE_Config::instance()->template_settings;  | 
                                                        |
| 918 | + },  | 
                                                        |
| 919 | +			'EE_Currency_Config'                           => static function () { | 
                                                        |
| 920 | + return EE_Config::instance()->currency;  | 
                                                        |
| 921 | + },  | 
                                                        |
| 922 | +			'EE_Registration_Config'                       => static function () { | 
                                                        |
| 923 | + return EE_Config::instance()->registration;  | 
                                                        |
| 924 | + },  | 
                                                        |
| 925 | +			'EE_Core_Config'                               => static function () { | 
                                                        |
| 926 | + return EE_Config::instance()->core;  | 
                                                        |
| 927 | + },  | 
                                                        |
| 928 | +			'EventEspresso\core\services\loaders\Loader'   => static function () { | 
                                                        |
| 929 | + return LoaderFactory::getLoader();  | 
                                                        |
| 930 | + },  | 
                                                        |
| 931 | +			'EE_Network_Config'                            => static function () { | 
                                                        |
| 932 | + return EE_Network_Config::instance();  | 
                                                        |
| 933 | + },  | 
                                                        |
| 934 | +			'EE_Config'                                    => static function () { | 
                                                        |
| 935 | + return EE_Config::instance();  | 
                                                        |
| 936 | + },  | 
                                                        |
| 937 | +			'EventEspresso\core\domain\Domain'             => static function () { | 
                                                        |
| 938 | + return DomainFactory::getEventEspressoCoreDomain();  | 
                                                        |
| 939 | + },  | 
                                                        |
| 940 | +			'EE_Admin_Config'                              => static function () { | 
                                                        |
| 941 | + return EE_Config::instance()->admin;  | 
                                                        |
| 942 | + },  | 
                                                        |
| 943 | +			'EE_Organization_Config'                       => static function () { | 
                                                        |
| 944 | + return EE_Config::instance()->organization;  | 
                                                        |
| 945 | + },  | 
                                                        |
| 946 | +			'EE_Network_Core_Config'                       => static function () { | 
                                                        |
| 947 | + return EE_Network_Config::instance()->core;  | 
                                                        |
| 948 | + },  | 
                                                        |
| 949 | +			'EE_Environment_Config'                        => static function () { | 
                                                        |
| 950 | + return EE_Config::instance()->environment;  | 
                                                        |
| 951 | + },  | 
                                                        |
| 952 | +			'EED_Core_Rest_Api'                            => static function () { | 
                                                        |
| 953 | + return EED_Core_Rest_Api::instance();  | 
                                                        |
| 954 | + },  | 
                                                        |
| 955 | +			'WP_REST_Server'                               => static function () { | 
                                                        |
| 956 | + return rest_get_server();  | 
                                                        |
| 957 | + },  | 
                                                        |
| 958 | +			'EventEspresso\core\Psr4Autoloader'            => static function () { | 
                                                        |
| 959 | + return EE_Psr4AutoloaderInit::psr4_loader();  | 
                                                        |
| 960 | + },  | 
                                                        |
| 961 | + ];  | 
                                                        |
| 962 | + }  | 
                                                        |
| 963 | +  | 
                                                        |
| 964 | +  | 
                                                        |
| 965 | + /**  | 
                                                        |
| 966 | + * can be used for supplying alternate names for classes,  | 
                                                        |
| 967 | + * or for connecting interface names to instantiable classes  | 
                                                        |
| 968 | + *  | 
                                                        |
| 969 | + * @throws InvalidAliasException  | 
                                                        |
| 970 | + */  | 
                                                        |
| 971 | + protected function _register_core_aliases()  | 
                                                        |
| 972 | +	{ | 
                                                        |
| 973 | + $aliases = [  | 
                                                        |
| 974 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface',  | 
                                                        |
| 975 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus',  | 
                                                        |
| 976 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',  | 
                                                        |
| 977 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager',  | 
                                                        |
| 978 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker',  | 
                                                        |
| 979 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook',  | 
                                                        |
| 980 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 981 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',  | 
                                                        |
| 982 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',  | 
                                                        |
| 983 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',  | 
                                                        |
| 984 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',  | 
                                                        |
| 985 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',  | 
                                                        |
| 986 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',  | 
                                                        |
| 987 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',  | 
                                                        |
| 988 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',  | 
                                                        |
| 989 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',  | 
                                                        |
| 990 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',  | 
                                                        |
| 991 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',  | 
                                                        |
| 992 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager',  | 
                                                        |
| 993 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis',  | 
                                                        |
| 994 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 995 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',  | 
                                                        |
| 996 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode',  | 
                                                        |
| 997 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage',  | 
                                                        |
| 998 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface',  | 
                                                        |
| 999 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader',  | 
                                                        |
| 1000 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface',  | 
                                                        |
| 1001 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory',  | 
                                                        |
| 1002 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',  | 
                                                        |
| 1003 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',  | 
                                                        |
| 1004 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface',  | 
                                                        |
| 1005 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',  | 
                                                        |
| 1006 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface',  | 
                                                        |
| 1007 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer',  | 
                                                        |
| 1008 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request',  | 
                                                        |
| 1009 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response',  | 
                                                        |
| 1010 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain',  | 
                                                        |
| 1011 | + 'Registration_Processor' => 'EE_Registration_Processor',  | 
                                                        |
| 1012 | + 'EventEspresso\core\services\assets\AssetManifestInterface' => 'EventEspresso\core\services\assets\AssetManifest',  | 
                                                        |
| 1013 | + ];  | 
                                                        |
| 1014 | +		foreach ($aliases as $alias => $fqn) { | 
                                                        |
| 1015 | +			if (is_array($fqn)) { | 
                                                        |
| 1016 | +				foreach ($fqn as $class => $for_class) { | 
                                                        |
| 1017 | + $this->class_cache->addAlias($class, $alias, $for_class);  | 
                                                        |
| 1018 | + }  | 
                                                        |
| 1019 | + continue;  | 
                                                        |
| 1020 | + }  | 
                                                        |
| 1021 | + $this->class_cache->addAlias($fqn, $alias);  | 
                                                        |
| 1022 | + }  | 
                                                        |
| 1023 | +		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { | 
                                                        |
| 1024 | + $this->class_cache->addAlias(  | 
                                                        |
| 1025 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',  | 
                                                        |
| 1026 | + 'EventEspresso\core\services\notices\NoticeConverterInterface'  | 
                                                        |
| 1027 | + );  | 
                                                        |
| 1028 | + }  | 
                                                        |
| 1029 | + }  | 
                                                        |
| 1030 | +  | 
                                                        |
| 1031 | +  | 
                                                        |
| 1032 | + /**  | 
                                                        |
| 1033 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the  | 
                                                        |
| 1034 | + * request Primarily used by unit tests.  | 
                                                        |
| 1035 | + */  | 
                                                        |
| 1036 | + public function reset()  | 
                                                        |
| 1037 | +	{ | 
                                                        |
| 1038 | + $this->_register_core_class_loaders();  | 
                                                        |
| 1039 | + $this->_register_core_dependencies();  | 
                                                        |
| 1040 | + }  | 
                                                        |
| 1041 | +  | 
                                                        |
| 1042 | +  | 
                                                        |
| 1043 | + /**  | 
                                                        |
| 1044 | + * PLZ NOTE: a better name for this method would be is_alias()  | 
                                                        |
| 1045 | + * because it returns TRUE if the provided fully qualified name IS an alias  | 
                                                        |
| 1046 | + * WHY?  | 
                                                        |
| 1047 | + * Because if a class is type hinting for a concretion,  | 
                                                        |
| 1048 | + * then why would we need to find another class to supply it?  | 
                                                        |
| 1049 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,  | 
                                                        |
| 1050 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.  | 
                                                        |
| 1051 | + * Don't go looking for some substitute.  | 
                                                        |
| 1052 | + * Whereas if a class is type hinting for an interface...  | 
                                                        |
| 1053 | + * then we need to find an actual class to use.  | 
                                                        |
| 1054 | + * So the interface IS the alias for some other FQN,  | 
                                                        |
| 1055 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`  | 
                                                        |
| 1056 | + * represents some other class.  | 
                                                        |
| 1057 | + *  | 
                                                        |
| 1058 | + * @param string $fqn  | 
                                                        |
| 1059 | + * @param string $for_class  | 
                                                        |
| 1060 | + * @return bool  | 
                                                        |
| 1061 | + * @deprecated 4.9.62.p  | 
                                                        |
| 1062 | + */  | 
                                                        |
| 1063 | + public function has_alias($fqn = '', $for_class = '')  | 
                                                        |
| 1064 | +	{ | 
                                                        |
| 1065 | + return $this->isAlias($fqn, $for_class);  | 
                                                        |
| 1066 | + }  | 
                                                        |
| 1067 | +  | 
                                                        |
| 1068 | +  | 
                                                        |
| 1069 | + /**  | 
                                                        |
| 1070 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias()  | 
                                                        |
| 1071 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias  | 
                                                        |
| 1072 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN  | 
                                                        |
| 1073 | + * for example:  | 
                                                        |
| 1074 | + * if the following two entries were added to the _aliases array:  | 
                                                        |
| 1075 | + * array(  | 
                                                        |
| 1076 | + * 'interface_alias' => 'some\namespace\interface'  | 
                                                        |
| 1077 | + * 'some\namespace\interface' => 'some\namespace\classname'  | 
                                                        |
| 1078 | + * )  | 
                                                        |
| 1079 | + * then one could use EE_Registry::instance()->create( 'interface_alias' )  | 
                                                        |
| 1080 | + * to load an instance of 'some\namespace\classname'  | 
                                                        |
| 1081 | + *  | 
                                                        |
| 1082 | + * @param string $alias  | 
                                                        |
| 1083 | + * @param string $for_class  | 
                                                        |
| 1084 | + * @return string  | 
                                                        |
| 1085 | + * @deprecated 4.9.62.p  | 
                                                        |
| 1086 | + */  | 
                                                        |
| 1087 | + public function get_alias($alias = '', $for_class = '')  | 
                                                        |
| 1088 | +	{ | 
                                                        |
| 1089 | + return $this->getFqnForAlias($alias, $for_class);  | 
                                                        |
| 1090 | + }  | 
                                                        |
| 1091 | 1091 | }  | 
                                                        
@@ -12,97 +12,97 @@  | 
                                                    ||
| 12 | 12 | |
| 13 | 13 | class StateOptions  | 
                                                        
| 14 | 14 |  { | 
                                                        
| 15 | - /**  | 
                                                        |
| 16 | - * the action being performed on the current step  | 
                                                        |
| 17 | - *  | 
                                                        |
| 18 | - * @var string  | 
                                                        |
| 19 | - */  | 
                                                        |
| 20 | - public $action = '';  | 
                                                        |
| 15 | + /**  | 
                                                        |
| 16 | + * the action being performed on the current step  | 
                                                        |
| 17 | + *  | 
                                                        |
| 18 | + * @var string  | 
                                                        |
| 19 | + */  | 
                                                        |
| 20 | + public $action = '';  | 
                                                        |
| 21 | 21 | |
| 22 | - /**  | 
                                                        |
| 23 | - * @var EEM_State  | 
                                                        |
| 24 | - */  | 
                                                        |
| 25 | - public $state_model;  | 
                                                        |
| 22 | + /**  | 
                                                        |
| 23 | + * @var EEM_State  | 
                                                        |
| 24 | + */  | 
                                                        |
| 25 | + public $state_model;  | 
                                                        |
| 26 | 26 | |
| 27 | - /**  | 
                                                        |
| 28 | - * @var [][]  | 
                                                        |
| 29 | - */  | 
                                                        |
| 30 | - private $state_options = [];  | 
                                                        |
| 27 | + /**  | 
                                                        |
| 28 | + * @var [][]  | 
                                                        |
| 29 | + */  | 
                                                        |
| 30 | + private $state_options = [];  | 
                                                        |
| 31 | 31 | |
| 32 | 32 | |
| 33 | - /**  | 
                                                        |
| 34 | - * CountryOptions constructor.  | 
                                                        |
| 35 | - *  | 
                                                        |
| 36 | - * @param string $action  | 
                                                        |
| 37 | - * @param EEM_State $state_model  | 
                                                        |
| 38 | - */  | 
                                                        |
| 39 | - public function __construct(string $action, EEM_State $state_model)  | 
                                                        |
| 40 | -    { | 
                                                        |
| 41 | - $this->action = $action;  | 
                                                        |
| 42 | - $this->state_model = $state_model;  | 
                                                        |
| 43 | - add_filter(  | 
                                                        |
| 44 | - 'FHEE__EE_Question__generate_form_input__state_options',  | 
                                                        |
| 45 | - [$this, 'forLegacyFormInput'],  | 
                                                        |
| 46 | - 10,  | 
                                                        |
| 47 | - 4  | 
                                                        |
| 48 | - );  | 
                                                        |
| 49 | - }  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * CountryOptions constructor.  | 
                                                        |
| 35 | + *  | 
                                                        |
| 36 | + * @param string $action  | 
                                                        |
| 37 | + * @param EEM_State $state_model  | 
                                                        |
| 38 | + */  | 
                                                        |
| 39 | + public function __construct(string $action, EEM_State $state_model)  | 
                                                        |
| 40 | +	{ | 
                                                        |
| 41 | + $this->action = $action;  | 
                                                        |
| 42 | + $this->state_model = $state_model;  | 
                                                        |
| 43 | + add_filter(  | 
                                                        |
| 44 | + 'FHEE__EE_Question__generate_form_input__state_options',  | 
                                                        |
| 45 | + [$this, 'forLegacyFormInput'],  | 
                                                        |
| 46 | + 10,  | 
                                                        |
| 47 | + 4  | 
                                                        |
| 48 | + );  | 
                                                        |
| 49 | + }  | 
                                                        |
| 50 | 50 | |
| 51 | 51 | |
| 52 | - /**  | 
                                                        |
| 53 | - * Gets the list of states for the form input  | 
                                                        |
| 54 | - *  | 
                                                        |
| 55 | - * @param array|null $states_list deprecated prop from an old hook  | 
                                                        |
| 56 | - * @param EE_Question|null $question  | 
                                                        |
| 57 | - * @param EE_Registration|null $registration  | 
                                                        |
| 58 | - * @param EE_Answer|null $answer  | 
                                                        |
| 59 | - * @return array 2d keys are state IDs, values are their names  | 
                                                        |
| 60 | - * @throws EE_Error  | 
                                                        |
| 61 | - * @throws ReflectionException  | 
                                                        |
| 62 | - */  | 
                                                        |
| 63 | - public function forLegacyFormInput(  | 
                                                        |
| 64 | - array $states_list = null,  | 
                                                        |
| 65 | - EE_Question $question = null,  | 
                                                        |
| 66 | - EE_Registration $registration = null,  | 
                                                        |
| 67 | - EE_Answer $answer = null  | 
                                                        |
| 68 | -    ): array { | 
                                                        |
| 69 | -        if (! isset($this->state_options[ $this->action ])) { | 
                                                        |
| 70 | - $this->generateLegacyStateOptions($question, $registration, $answer);  | 
                                                        |
| 71 | - }  | 
                                                        |
| 72 | - return $this->state_options[ $this->action ];  | 
                                                        |
| 73 | - }  | 
                                                        |
| 52 | + /**  | 
                                                        |
| 53 | + * Gets the list of states for the form input  | 
                                                        |
| 54 | + *  | 
                                                        |
| 55 | + * @param array|null $states_list deprecated prop from an old hook  | 
                                                        |
| 56 | + * @param EE_Question|null $question  | 
                                                        |
| 57 | + * @param EE_Registration|null $registration  | 
                                                        |
| 58 | + * @param EE_Answer|null $answer  | 
                                                        |
| 59 | + * @return array 2d keys are state IDs, values are their names  | 
                                                        |
| 60 | + * @throws EE_Error  | 
                                                        |
| 61 | + * @throws ReflectionException  | 
                                                        |
| 62 | + */  | 
                                                        |
| 63 | + public function forLegacyFormInput(  | 
                                                        |
| 64 | + array $states_list = null,  | 
                                                        |
| 65 | + EE_Question $question = null,  | 
                                                        |
| 66 | + EE_Registration $registration = null,  | 
                                                        |
| 67 | + EE_Answer $answer = null  | 
                                                        |
| 68 | +	): array { | 
                                                        |
| 69 | +		if (! isset($this->state_options[ $this->action ])) { | 
                                                        |
| 70 | + $this->generateLegacyStateOptions($question, $registration, $answer);  | 
                                                        |
| 71 | + }  | 
                                                        |
| 72 | + return $this->state_options[ $this->action ];  | 
                                                        |
| 73 | + }  | 
                                                        |
| 74 | 74 | |
| 75 | 75 | |
| 76 | - /**  | 
                                                        |
| 77 | - * @param EE_Question|null $question  | 
                                                        |
| 78 | - * @param EE_Registration|null $registration  | 
                                                        |
| 79 | - * @param EE_Answer|null $answer  | 
                                                        |
| 80 | - * @throws EE_Error  | 
                                                        |
| 81 | - * @throws ReflectionException  | 
                                                        |
| 82 | - */  | 
                                                        |
| 83 | - private function generateLegacyStateOptions(  | 
                                                        |
| 84 | - EE_Question $question = null,  | 
                                                        |
| 85 | - EE_Registration $registration = null,  | 
                                                        |
| 86 | - EE_Answer $answer = null  | 
                                                        |
| 87 | -    ) { | 
                                                        |
| 88 | - $state_options = ['' => ['' => '']];  | 
                                                        |
| 89 | - $states = $this->action === 'process_reg_step'  | 
                                                        |
| 90 | - ? $this->state_model->get_all_states()  | 
                                                        |
| 91 | - : $this->state_model->get_all_active_states();  | 
                                                        |
| 92 | -        if (! empty($states)) { | 
                                                        |
| 93 | -            foreach ($states as $state) { | 
                                                        |
| 94 | -                if ($state instanceof EE_State) { | 
                                                        |
| 95 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();  | 
                                                        |
| 96 | - }  | 
                                                        |
| 97 | - }  | 
                                                        |
| 98 | - }  | 
                                                        |
| 99 | - $this->state_options[ $this->action ] = apply_filters(  | 
                                                        |
| 100 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options',  | 
                                                        |
| 101 | - $state_options,  | 
                                                        |
| 102 | - $this,  | 
                                                        |
| 103 | - $registration,  | 
                                                        |
| 104 | - $question,  | 
                                                        |
| 105 | - $answer  | 
                                                        |
| 106 | - );  | 
                                                        |
| 107 | - }  | 
                                                        |
| 76 | + /**  | 
                                                        |
| 77 | + * @param EE_Question|null $question  | 
                                                        |
| 78 | + * @param EE_Registration|null $registration  | 
                                                        |
| 79 | + * @param EE_Answer|null $answer  | 
                                                        |
| 80 | + * @throws EE_Error  | 
                                                        |
| 81 | + * @throws ReflectionException  | 
                                                        |
| 82 | + */  | 
                                                        |
| 83 | + private function generateLegacyStateOptions(  | 
                                                        |
| 84 | + EE_Question $question = null,  | 
                                                        |
| 85 | + EE_Registration $registration = null,  | 
                                                        |
| 86 | + EE_Answer $answer = null  | 
                                                        |
| 87 | +	) { | 
                                                        |
| 88 | + $state_options = ['' => ['' => '']];  | 
                                                        |
| 89 | + $states = $this->action === 'process_reg_step'  | 
                                                        |
| 90 | + ? $this->state_model->get_all_states()  | 
                                                        |
| 91 | + : $this->state_model->get_all_active_states();  | 
                                                        |
| 92 | +		if (! empty($states)) { | 
                                                        |
| 93 | +			foreach ($states as $state) { | 
                                                        |
| 94 | +				if ($state instanceof EE_State) { | 
                                                        |
| 95 | + $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();  | 
                                                        |
| 96 | + }  | 
                                                        |
| 97 | + }  | 
                                                        |
| 98 | + }  | 
                                                        |
| 99 | + $this->state_options[ $this->action ] = apply_filters(  | 
                                                        |
| 100 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options',  | 
                                                        |
| 101 | + $state_options,  | 
                                                        |
| 102 | + $this,  | 
                                                        |
| 103 | + $registration,  | 
                                                        |
| 104 | + $question,  | 
                                                        |
| 105 | + $answer  | 
                                                        |
| 106 | + );  | 
                                                        |
| 107 | + }  | 
                                                        |
| 108 | 108 | }  | 
                                                        
@@ -66,10 +66,10 @@ discard block  | 
                                                    ||
| 66 | 66 | EE_Registration $registration = null,  | 
                                                        
| 67 | 67 | EE_Answer $answer = null  | 
                                                        
| 68 | 68 |      ): array { | 
                                                        
| 69 | -        if (! isset($this->state_options[ $this->action ])) { | 
                                                        |
| 69 | +        if ( ! isset($this->state_options[$this->action])) { | 
                                                        |
| 70 | 70 | $this->generateLegacyStateOptions($question, $registration, $answer);  | 
                                                        
| 71 | 71 | }  | 
                                                        
| 72 | - return $this->state_options[ $this->action ];  | 
                                                        |
| 72 | + return $this->state_options[$this->action];  | 
                                                        |
| 73 | 73 | }  | 
                                                        
| 74 | 74 | |
| 75 | 75 | |
@@ -89,14 +89,14 @@ discard block  | 
                                                    ||
| 89 | 89 | $states = $this->action === 'process_reg_step'  | 
                                                        
| 90 | 90 | ? $this->state_model->get_all_states()  | 
                                                        
| 91 | 91 | : $this->state_model->get_all_active_states();  | 
                                                        
| 92 | -        if (! empty($states)) { | 
                                                        |
| 92 | +        if ( ! empty($states)) { | 
                                                        |
| 93 | 93 |              foreach ($states as $state) { | 
                                                        
| 94 | 94 |                  if ($state instanceof EE_State) { | 
                                                        
| 95 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();  | 
                                                        |
| 95 | + $state_options[$state->country()->name()][$state->ID()] = $state->name();  | 
                                                        |
| 96 | 96 | }  | 
                                                        
| 97 | 97 | }  | 
                                                        
| 98 | 98 | }  | 
                                                        
| 99 | - $this->state_options[ $this->action ] = apply_filters(  | 
                                                        |
| 99 | + $this->state_options[$this->action] = apply_filters(  | 
                                                        |
| 100 | 100 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options',  | 
                                                        
| 101 | 101 | $state_options,  | 
                                                        
| 102 | 102 | $this,  | 
                                                        
@@ -13,109 +13,109 @@  | 
                                                    ||
| 13 | 13 | |
| 14 | 14 | class CountryOptions  | 
                                                        
| 15 | 15 |  { | 
                                                        
| 16 | - /**  | 
                                                        |
| 17 | - * the action being performed on the current step  | 
                                                        |
| 18 | - *  | 
                                                        |
| 19 | - * @var string  | 
                                                        |
| 20 | - */  | 
                                                        |
| 21 | - public $action = '';  | 
                                                        |
| 16 | + /**  | 
                                                        |
| 17 | + * the action being performed on the current step  | 
                                                        |
| 18 | + *  | 
                                                        |
| 19 | + * @var string  | 
                                                        |
| 20 | + */  | 
                                                        |
| 21 | + public $action = '';  | 
                                                        |
| 22 | 22 | |
| 23 | - /**  | 
                                                        |
| 24 | - * @var EEM_Answer  | 
                                                        |
| 25 | - */  | 
                                                        |
| 26 | - public $answer_model;  | 
                                                        |
| 23 | + /**  | 
                                                        |
| 24 | + * @var EEM_Answer  | 
                                                        |
| 25 | + */  | 
                                                        |
| 26 | + public $answer_model;  | 
                                                        |
| 27 | 27 | |
| 28 | - /**  | 
                                                        |
| 29 | - * @var EEM_Country  | 
                                                        |
| 30 | - */  | 
                                                        |
| 31 | - public $country_model;  | 
                                                        |
| 28 | + /**  | 
                                                        |
| 29 | + * @var EEM_Country  | 
                                                        |
| 30 | + */  | 
                                                        |
| 31 | + public $country_model;  | 
                                                        |
| 32 | 32 | |
| 33 | - /**  | 
                                                        |
| 34 | - * @var [][]  | 
                                                        |
| 35 | - */  | 
                                                        |
| 36 | - private $country_options = [];  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * @var [][]  | 
                                                        |
| 35 | + */  | 
                                                        |
| 36 | + private $country_options = [];  | 
                                                        |
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /**  | 
                                                        |
| 40 | - * CountryOptions constructor.  | 
                                                        |
| 41 | - *  | 
                                                        |
| 42 | - * @param string $action  | 
                                                        |
| 43 | - * @param EEM_Answer $answer_model  | 
                                                        |
| 44 | - * @param EEM_Country $country_model  | 
                                                        |
| 45 | - */  | 
                                                        |
| 46 | - public function __construct(string $action, EEM_Answer $answer_model, EEM_Country $country_model)  | 
                                                        |
| 47 | -    { | 
                                                        |
| 48 | - $this->action = $action;  | 
                                                        |
| 49 | - $this->answer_model = $answer_model;  | 
                                                        |
| 50 | - $this->country_model = $country_model;  | 
                                                        |
| 51 | - add_filter(  | 
                                                        |
| 52 | - 'FHEE__EE_Question__generate_form_input__country_options',  | 
                                                        |
| 53 | - [$this, 'forLegacyFormInput'],  | 
                                                        |
| 54 | - 10,  | 
                                                        |
| 55 | - 4  | 
                                                        |
| 56 | - );  | 
                                                        |
| 57 | - }  | 
                                                        |
| 39 | + /**  | 
                                                        |
| 40 | + * CountryOptions constructor.  | 
                                                        |
| 41 | + *  | 
                                                        |
| 42 | + * @param string $action  | 
                                                        |
| 43 | + * @param EEM_Answer $answer_model  | 
                                                        |
| 44 | + * @param EEM_Country $country_model  | 
                                                        |
| 45 | + */  | 
                                                        |
| 46 | + public function __construct(string $action, EEM_Answer $answer_model, EEM_Country $country_model)  | 
                                                        |
| 47 | +	{ | 
                                                        |
| 48 | + $this->action = $action;  | 
                                                        |
| 49 | + $this->answer_model = $answer_model;  | 
                                                        |
| 50 | + $this->country_model = $country_model;  | 
                                                        |
| 51 | + add_filter(  | 
                                                        |
| 52 | + 'FHEE__EE_Question__generate_form_input__country_options',  | 
                                                        |
| 53 | + [$this, 'forLegacyFormInput'],  | 
                                                        |
| 54 | + 10,  | 
                                                        |
| 55 | + 4  | 
                                                        |
| 56 | + );  | 
                                                        |
| 57 | + }  | 
                                                        |
| 58 | 58 | |
| 59 | 59 | |
| 60 | - /**  | 
                                                        |
| 61 | - * Gets the list of countries for the form input  | 
                                                        |
| 62 | - *  | 
                                                        |
| 63 | - * @param array|null $countries_list deprecated prop from an old hook  | 
                                                        |
| 64 | - * @param EE_Question|null $question  | 
                                                        |
| 65 | - * @param EE_Registration|null $registration  | 
                                                        |
| 66 | - * @param EE_Answer|null $answer deprecated prop from an old hook  | 
                                                        |
| 67 | - * @return array 2d keys are country IDs, values are their names  | 
                                                        |
| 68 | - * @throws EE_Error  | 
                                                        |
| 69 | - * @throws ReflectionException  | 
                                                        |
| 70 | - */  | 
                                                        |
| 71 | - public function forLegacyFormInput(  | 
                                                        |
| 72 | - array $countries_list = null,  | 
                                                        |
| 73 | - EE_Question $question = null,  | 
                                                        |
| 74 | - EE_Registration $registration = null,  | 
                                                        |
| 75 | - EE_Answer $answer = null  | 
                                                        |
| 76 | -    ): array { | 
                                                        |
| 77 | -        if (! isset($this->country_options[ $this->action ])) { | 
                                                        |
| 78 | - $this->generateLegacyCountryOptions($question, $registration);  | 
                                                        |
| 79 | - }  | 
                                                        |
| 80 | - return $this->country_options[ $this->action ];  | 
                                                        |
| 81 | - }  | 
                                                        |
| 60 | + /**  | 
                                                        |
| 61 | + * Gets the list of countries for the form input  | 
                                                        |
| 62 | + *  | 
                                                        |
| 63 | + * @param array|null $countries_list deprecated prop from an old hook  | 
                                                        |
| 64 | + * @param EE_Question|null $question  | 
                                                        |
| 65 | + * @param EE_Registration|null $registration  | 
                                                        |
| 66 | + * @param EE_Answer|null $answer deprecated prop from an old hook  | 
                                                        |
| 67 | + * @return array 2d keys are country IDs, values are their names  | 
                                                        |
| 68 | + * @throws EE_Error  | 
                                                        |
| 69 | + * @throws ReflectionException  | 
                                                        |
| 70 | + */  | 
                                                        |
| 71 | + public function forLegacyFormInput(  | 
                                                        |
| 72 | + array $countries_list = null,  | 
                                                        |
| 73 | + EE_Question $question = null,  | 
                                                        |
| 74 | + EE_Registration $registration = null,  | 
                                                        |
| 75 | + EE_Answer $answer = null  | 
                                                        |
| 76 | +	): array { | 
                                                        |
| 77 | +		if (! isset($this->country_options[ $this->action ])) { | 
                                                        |
| 78 | + $this->generateLegacyCountryOptions($question, $registration);  | 
                                                        |
| 79 | + }  | 
                                                        |
| 80 | + return $this->country_options[ $this->action ];  | 
                                                        |
| 81 | + }  | 
                                                        |
| 82 | 82 | |
| 83 | 83 | |
| 84 | - /**  | 
                                                        |
| 85 | - * @param EE_Question|null $question  | 
                                                        |
| 86 | - * @param EE_Registration|null $registration  | 
                                                        |
| 87 | - * @throws EE_Error  | 
                                                        |
| 88 | - * @throws ReflectionException  | 
                                                        |
| 89 | - */  | 
                                                        |
| 90 | - private function generateLegacyCountryOptions(EE_Question $question = null, EE_Registration $registration = null)  | 
                                                        |
| 91 | -    { | 
                                                        |
| 92 | - // get possibly cached list of countries  | 
                                                        |
| 93 | - $countries = $this->action === 'process_reg_step'  | 
                                                        |
| 94 | - ? $this->country_model->get_all_countries()  | 
                                                        |
| 95 | - : $this->country_model->get_all_active_countries();  | 
                                                        |
| 96 | - // start with an empty option  | 
                                                        |
| 97 | - $country_options = ['' => ''];  | 
                                                        |
| 98 | -        if (! empty($countries)) { | 
                                                        |
| 99 | -            foreach ($countries as $country) { | 
                                                        |
| 100 | -                if ($country instanceof EE_Country) { | 
                                                        |
| 101 | - $country_options[ $country->ID() ] = $country->name();  | 
                                                        |
| 102 | - }  | 
                                                        |
| 103 | - }  | 
                                                        |
| 104 | - }  | 
                                                        |
| 105 | -        if ($question instanceof EE_Question && $registration instanceof EE_Registration) { | 
                                                        |
| 106 | - $answer = $this->answer_model->get_one(  | 
                                                        |
| 107 | - [['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]  | 
                                                        |
| 108 | - );  | 
                                                        |
| 109 | -        } else { | 
                                                        |
| 110 | - $answer = EE_Answer::new_instance();  | 
                                                        |
| 111 | - }  | 
                                                        |
| 112 | - $this->country_options[ $this->action ] = apply_filters(  | 
                                                        |
| 113 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options',  | 
                                                        |
| 114 | - $country_options,  | 
                                                        |
| 115 | - $this,  | 
                                                        |
| 116 | - $registration,  | 
                                                        |
| 117 | - $question,  | 
                                                        |
| 118 | - $answer  | 
                                                        |
| 119 | - );  | 
                                                        |
| 120 | - }  | 
                                                        |
| 84 | + /**  | 
                                                        |
| 85 | + * @param EE_Question|null $question  | 
                                                        |
| 86 | + * @param EE_Registration|null $registration  | 
                                                        |
| 87 | + * @throws EE_Error  | 
                                                        |
| 88 | + * @throws ReflectionException  | 
                                                        |
| 89 | + */  | 
                                                        |
| 90 | + private function generateLegacyCountryOptions(EE_Question $question = null, EE_Registration $registration = null)  | 
                                                        |
| 91 | +	{ | 
                                                        |
| 92 | + // get possibly cached list of countries  | 
                                                        |
| 93 | + $countries = $this->action === 'process_reg_step'  | 
                                                        |
| 94 | + ? $this->country_model->get_all_countries()  | 
                                                        |
| 95 | + : $this->country_model->get_all_active_countries();  | 
                                                        |
| 96 | + // start with an empty option  | 
                                                        |
| 97 | + $country_options = ['' => ''];  | 
                                                        |
| 98 | +		if (! empty($countries)) { | 
                                                        |
| 99 | +			foreach ($countries as $country) { | 
                                                        |
| 100 | +				if ($country instanceof EE_Country) { | 
                                                        |
| 101 | + $country_options[ $country->ID() ] = $country->name();  | 
                                                        |
| 102 | + }  | 
                                                        |
| 103 | + }  | 
                                                        |
| 104 | + }  | 
                                                        |
| 105 | +		if ($question instanceof EE_Question && $registration instanceof EE_Registration) { | 
                                                        |
| 106 | + $answer = $this->answer_model->get_one(  | 
                                                        |
| 107 | + [['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]  | 
                                                        |
| 108 | + );  | 
                                                        |
| 109 | +		} else { | 
                                                        |
| 110 | + $answer = EE_Answer::new_instance();  | 
                                                        |
| 111 | + }  | 
                                                        |
| 112 | + $this->country_options[ $this->action ] = apply_filters(  | 
                                                        |
| 113 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options',  | 
                                                        |
| 114 | + $country_options,  | 
                                                        |
| 115 | + $this,  | 
                                                        |
| 116 | + $registration,  | 
                                                        |
| 117 | + $question,  | 
                                                        |
| 118 | + $answer  | 
                                                        |
| 119 | + );  | 
                                                        |
| 120 | + }  | 
                                                        |
| 121 | 121 | }  | 
                                                        
@@ -74,10 +74,10 @@ discard block  | 
                                                    ||
| 74 | 74 | EE_Registration $registration = null,  | 
                                                        
| 75 | 75 | EE_Answer $answer = null  | 
                                                        
| 76 | 76 |      ): array { | 
                                                        
| 77 | -        if (! isset($this->country_options[ $this->action ])) { | 
                                                        |
| 77 | +        if ( ! isset($this->country_options[$this->action])) { | 
                                                        |
| 78 | 78 | $this->generateLegacyCountryOptions($question, $registration);  | 
                                                        
| 79 | 79 | }  | 
                                                        
| 80 | - return $this->country_options[ $this->action ];  | 
                                                        |
| 80 | + return $this->country_options[$this->action];  | 
                                                        |
| 81 | 81 | }  | 
                                                        
| 82 | 82 | |
| 83 | 83 | |
@@ -95,10 +95,10 @@ discard block  | 
                                                    ||
| 95 | 95 | : $this->country_model->get_all_active_countries();  | 
                                                        
| 96 | 96 | // start with an empty option  | 
                                                        
| 97 | 97 | $country_options = ['' => ''];  | 
                                                        
| 98 | -        if (! empty($countries)) { | 
                                                        |
| 98 | +        if ( ! empty($countries)) { | 
                                                        |
| 99 | 99 |              foreach ($countries as $country) { | 
                                                        
| 100 | 100 |                  if ($country instanceof EE_Country) { | 
                                                        
| 101 | - $country_options[ $country->ID() ] = $country->name();  | 
                                                        |
| 101 | + $country_options[$country->ID()] = $country->name();  | 
                                                        |
| 102 | 102 | }  | 
                                                        
| 103 | 103 | }  | 
                                                        
| 104 | 104 | }  | 
                                                        
@@ -109,7 +109,7 @@ discard block  | 
                                                    ||
| 109 | 109 |          } else { | 
                                                        
| 110 | 110 | $answer = EE_Answer::new_instance();  | 
                                                        
| 111 | 111 | }  | 
                                                        
| 112 | - $this->country_options[ $this->action ] = apply_filters(  | 
                                                        |
| 112 | + $this->country_options[$this->action] = apply_filters(  | 
                                                        |
| 113 | 113 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options',  | 
                                                        
| 114 | 114 | $country_options,  | 
                                                        
| 115 | 115 | $this,  | 
                                                        
@@ -45,613 +45,613 @@  | 
                                                    ||
| 45 | 45 |  { | 
                                                        
| 46 | 46 | |
| 47 | 47 | |
| 48 | - /**  | 
                                                        |
| 49 | - * @var bool  | 
                                                        |
| 50 | - */  | 
                                                        |
| 51 | - private $print_copy_info;  | 
                                                        |
| 52 | -  | 
                                                        |
| 53 | - /**  | 
                                                        |
| 54 | - * @var EE_Registration_Config  | 
                                                        |
| 55 | - */  | 
                                                        |
| 56 | - public $reg_config;  | 
                                                        |
| 57 | -  | 
                                                        |
| 58 | - /**  | 
                                                        |
| 59 | - * @var int  | 
                                                        |
| 60 | - */  | 
                                                        |
| 61 | - protected $reg_form_count = 0;  | 
                                                        |
| 62 | -  | 
                                                        |
| 63 | -  | 
                                                        |
| 64 | - /**  | 
                                                        |
| 65 | - * @var EE_SPCO_Reg_Step_Attendee_Information  | 
                                                        |
| 66 | - */  | 
                                                        |
| 67 | - public $reg_step;  | 
                                                        |
| 68 | -  | 
                                                        |
| 69 | - /**  | 
                                                        |
| 70 | - * @var array  | 
                                                        |
| 71 | - */  | 
                                                        |
| 72 | - private $required_questions = [];  | 
                                                        |
| 73 | -  | 
                                                        |
| 74 | - /**  | 
                                                        |
| 75 | - * @var array  | 
                                                        |
| 76 | - */  | 
                                                        |
| 77 | - private $template_args = [];  | 
                                                        |
| 78 | -  | 
                                                        |
| 79 | -  | 
                                                        |
| 80 | - /**  | 
                                                        |
| 81 | - * LegacyRegistrationForm constructor.  | 
                                                        |
| 82 | - *  | 
                                                        |
| 83 | - * @param EE_SPCO_Reg_Step_Attendee_Information $reg_step  | 
                                                        |
| 84 | - * @param EE_Registration_Config $reg_config  | 
                                                        |
| 85 | - * @throws ReflectionException  | 
                                                        |
| 86 | - * @throws EE_Error  | 
                                                        |
| 87 | - */  | 
                                                        |
| 88 | - public function __construct(EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration_Config $reg_config)  | 
                                                        |
| 89 | -    { | 
                                                        |
| 90 | - $this->reg_step = $reg_step;  | 
                                                        |
| 91 | - $this->reg_config = $reg_config;  | 
                                                        |
| 92 | - $this->print_copy_info = $reg_config->copyAttendeeInfo();  | 
                                                        |
| 93 | - LoaderFactory::getLoader()->getShared(CountryOptions::class, [$this->reg_step->checkout->action]);  | 
                                                        |
| 94 | - LoaderFactory::getLoader()->getShared(StateOptions::class, [$this->reg_step->checkout->action]);  | 
                                                        |
| 95 | - parent::__construct(  | 
                                                        |
| 96 | - [  | 
                                                        |
| 97 | - 'name' => $this->reg_step->reg_form_name(),  | 
                                                        |
| 98 | - 'html_id' => $this->reg_step->reg_form_name(),  | 
                                                        |
| 99 | - 'subsections' => $this->generateSubsections(),  | 
                                                        |
| 100 | - 'layout_strategy' => new EE_Template_Layout(  | 
                                                        |
| 101 | - [  | 
                                                        |
| 102 | - 'layout_template_file' => $this->reg_step->template(), // layout_template  | 
                                                        |
| 103 | - 'template_args' => $this->template_args,  | 
                                                        |
| 104 | - ]  | 
                                                        |
| 105 | - ),  | 
                                                        |
| 106 | - ]  | 
                                                        |
| 107 | - );  | 
                                                        |
| 108 | - }  | 
                                                        |
| 109 | -  | 
                                                        |
| 110 | -  | 
                                                        |
| 111 | - /**  | 
                                                        |
| 112 | - * @return bool  | 
                                                        |
| 113 | - */  | 
                                                        |
| 114 | - public function printCopyInfo(): bool  | 
                                                        |
| 115 | -    { | 
                                                        |
| 116 | - return $this->print_copy_info;  | 
                                                        |
| 117 | - }  | 
                                                        |
| 118 | -  | 
                                                        |
| 119 | -  | 
                                                        |
| 120 | - /**  | 
                                                        |
| 121 | - * @return int  | 
                                                        |
| 122 | - */  | 
                                                        |
| 123 | - public function regFormCount(): int  | 
                                                        |
| 124 | -    { | 
                                                        |
| 125 | - return $this->reg_form_count;  | 
                                                        |
| 126 | - }  | 
                                                        |
| 127 | -  | 
                                                        |
| 128 | -  | 
                                                        |
| 129 | - /**  | 
                                                        |
| 130 | - * @return array  | 
                                                        |
| 131 | - */  | 
                                                        |
| 132 | - public function requiredQuestions(): array  | 
                                                        |
| 133 | -    { | 
                                                        |
| 134 | - return $this->required_questions;  | 
                                                        |
| 135 | - }  | 
                                                        |
| 136 | -  | 
                                                        |
| 137 | -  | 
                                                        |
| 138 | - /**  | 
                                                        |
| 139 | - * @return EE_Form_Section_Proper[]  | 
                                                        |
| 140 | - * @throws DomainException  | 
                                                        |
| 141 | - * @throws EE_Error  | 
                                                        |
| 142 | - * @throws InvalidArgumentException  | 
                                                        |
| 143 | - * @throws ReflectionException  | 
                                                        |
| 144 | - * @throws EntityNotFoundException  | 
                                                        |
| 145 | - * @throws InvalidDataTypeException  | 
                                                        |
| 146 | - * @throws InvalidInterfaceException  | 
                                                        |
| 147 | - */  | 
                                                        |
| 148 | - public function generateSubsections(): array  | 
                                                        |
| 149 | -    { | 
                                                        |
| 150 | - // Init reg forms count.  | 
                                                        |
| 151 | - $this->reg_form_count = 0;  | 
                                                        |
| 152 | -  | 
                                                        |
| 153 | - $primary_registrant = null;  | 
                                                        |
| 154 | - // autoload Line_Item_Display classes  | 
                                                        |
| 155 | - EEH_Autoloader::register_line_item_display_autoloaders();  | 
                                                        |
| 156 | - $Line_Item_Display = new EE_Line_Item_Display();  | 
                                                        |
| 157 | - // calculate taxes  | 
                                                        |
| 158 | - $Line_Item_Display->display_line_item(  | 
                                                        |
| 159 | - $this->reg_step->checkout->cart->get_grand_total(),  | 
                                                        |
| 160 | - ['set_tax_rate' => true]  | 
                                                        |
| 161 | - );  | 
                                                        |
| 162 | - $extra_inputs_section = $this->reg_step->reg_step_hidden_inputs();  | 
                                                        |
| 163 | - $this->addPrivacyConsentCheckbox($extra_inputs_section);  | 
                                                        |
| 164 | - $subsections = [  | 
                                                        |
| 165 | - 'default_hidden_inputs' => $extra_inputs_section,  | 
                                                        |
| 166 | - ];  | 
                                                        |
| 167 | -  | 
                                                        |
| 168 | - $this->template_args = [  | 
                                                        |
| 169 | - 'revisit' => $this->reg_step->checkout->revisit,  | 
                                                        |
| 170 | - 'registrations' => [],  | 
                                                        |
| 171 | - 'ticket_count' => [],  | 
                                                        |
| 172 | - ];  | 
                                                        |
| 173 | - // grab the saved registrations from the transaction  | 
                                                        |
| 174 | - $registrations  | 
                                                        |
| 175 | - = $this->reg_step->checkout->transaction->registrations($this->reg_step->checkout->reg_cache_where_params);  | 
                                                        |
| 176 | -        if ($registrations) { | 
                                                        |
| 177 | -            foreach ($registrations as $registration) { | 
                                                        |
| 178 | - // can this registration be processed during this visit ?  | 
                                                        |
| 179 | - if (  | 
                                                        |
| 180 | - $registration instanceof EE_Registration  | 
                                                        |
| 181 | - && $this->reg_step->checkout->visit_allows_processing_of_this_registration($registration)  | 
                                                        |
| 182 | -                ) { | 
                                                        |
| 183 | - $reg_url_link = $registration->reg_url_link();  | 
                                                        |
| 184 | - $subsections[ $reg_url_link ]  | 
                                                        |
| 185 | - = $this->getRegForm($registration);  | 
                                                        |
| 186 | - $this->template_args['registrations'][ $reg_url_link ] = $registration;  | 
                                                        |
| 187 | - $this->template_args['ticket_count'][ $registration->ticket()->ID() ] = isset(  | 
                                                        |
| 188 | - $this->template_args['ticket_count'][ $registration->ticket()->ID() ]  | 
                                                        |
| 189 | - )  | 
                                                        |
| 190 | - ? $this->template_args['ticket_count'][ $registration->ticket()->ID() ] + 1  | 
                                                        |
| 191 | - : 1;  | 
                                                        |
| 192 | - $ticket_line_item  | 
                                                        |
| 193 | - = EEH_Line_Item::get_line_items_by_object_type_and_IDs(  | 
                                                        |
| 194 | - $this->reg_step->checkout->cart->get_grand_total(),  | 
                                                        |
| 195 | - 'Ticket',  | 
                                                        |
| 196 | - [$registration->ticket()->ID()]  | 
                                                        |
| 197 | - );  | 
                                                        |
| 198 | - $ticket_line_item = is_array($ticket_line_item)  | 
                                                        |
| 199 | - ? reset($ticket_line_item)  | 
                                                        |
| 200 | - : $ticket_line_item;  | 
                                                        |
| 201 | - $this->template_args['ticket_line_item'][ $registration->ticket()->ID() ]  | 
                                                        |
| 202 | - = $Line_Item_Display->display_line_item($ticket_line_item);  | 
                                                        |
| 203 | -                    if ($registration->is_primary_registrant()) { | 
                                                        |
| 204 | - $primary_registrant = $reg_url_link;  | 
                                                        |
| 205 | - }  | 
                                                        |
| 206 | - }  | 
                                                        |
| 207 | - }  | 
                                                        |
| 208 | -  | 
                                                        |
| 209 | -            if ($primary_registrant && count($registrations) > 1) { | 
                                                        |
| 210 | - $copy_options['spco_copy_attendee_chk'] = $this->print_copy_info  | 
                                                        |
| 211 | - ? new LegacyCopyAttendeeInfoForm($registrations, $this->reg_step->slug())  | 
                                                        |
| 212 | - : new LegacyAutoCopyAttendeeInfoForm($this->reg_step->slug());  | 
                                                        |
| 213 | - // generate hidden input  | 
                                                        |
| 214 | - if (  | 
                                                        |
| 215 | - isset($subsections[ $primary_registrant ])  | 
                                                        |
| 216 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper  | 
                                                        |
| 217 | -                ) { | 
                                                        |
| 218 | - $subsections[ $primary_registrant ]->add_subsections(  | 
                                                        |
| 219 | - $copy_options,  | 
                                                        |
| 220 | - 'primary_registrant',  | 
                                                        |
| 221 | - false  | 
                                                        |
| 222 | - );  | 
                                                        |
| 223 | - }  | 
                                                        |
| 224 | - }  | 
                                                        |
| 225 | - }  | 
                                                        |
| 226 | -  | 
                                                        |
| 227 | - // Set the registration form template (default: one form per ticket details table).  | 
                                                        |
| 228 | - // We decide the template to used based on the number of forms.  | 
                                                        |
| 229 | - $template = $this->reg_form_count > 1  | 
                                                        |
| 230 | - ? SPCO_REG_STEPS_PATH . $this->reg_step->slug() . '/attendee_info_main.template.php'  | 
                                                        |
| 231 | - : SPCO_REG_STEPS_PATH . $this->reg_step->slug() . '/attendee_info_single.template.php';  | 
                                                        |
| 232 | - $this->reg_step->setTemplate($template);  | 
                                                        |
| 233 | -  | 
                                                        |
| 234 | - return $subsections;  | 
                                                        |
| 235 | - }  | 
                                                        |
| 236 | -  | 
                                                        |
| 237 | -  | 
                                                        |
| 238 | - /**  | 
                                                        |
| 239 | - * @param EE_Form_Section_Proper $extra_inputs_section  | 
                                                        |
| 240 | - * @throws EE_Error  | 
                                                        |
| 241 | - */  | 
                                                        |
| 242 | - private function addPrivacyConsentCheckbox(EE_Form_Section_Proper $extra_inputs_section)  | 
                                                        |
| 243 | -    { | 
                                                        |
| 244 | - // if this isn't a revisit, and they have the privacy consent box enabled, add it  | 
                                                        |
| 245 | -        if (! $this->reg_step->checkout->revisit && $this->reg_config->isConsentCheckboxEnabled()) { | 
                                                        |
| 246 | - $extra_inputs_section->add_subsections(  | 
                                                        |
| 247 | - [  | 
                                                        |
| 248 | - 'consent_box' => new EE_Form_Section_Proper(  | 
                                                        |
| 249 | - [  | 
                                                        |
| 250 | - 'layout_strategy' =>  | 
                                                        |
| 251 | - new EE_Template_Layout(  | 
                                                        |
| 252 | - [  | 
                                                        |
| 253 | - 'input_template_file' => SPCO_REG_STEPS_PATH  | 
                                                        |
| 254 | - . $this->reg_step->slug()  | 
                                                        |
| 255 | - . '/privacy_consent.template.php',  | 
                                                        |
| 256 | - ]  | 
                                                        |
| 257 | - ),  | 
                                                        |
| 258 | - 'subsections' => [  | 
                                                        |
| 259 | - 'consent' => new EE_Checkbox_Multi_Input(  | 
                                                        |
| 260 | - [  | 
                                                        |
| 261 | - 'consent' => $this->reg_config->getConsentCheckboxLabelText(),  | 
                                                        |
| 262 | - ],  | 
                                                        |
| 263 | - [  | 
                                                        |
| 264 | - 'required' => true,  | 
                                                        |
| 265 | - 'required_validation_error_message' => esc_html__(  | 
                                                        |
| 266 | - 'You must consent to these terms in order to register.',  | 
                                                        |
| 267 | - 'event_espresso'  | 
                                                        |
| 268 | - ),  | 
                                                        |
| 269 | - 'html_label_text' => '',  | 
                                                        |
| 270 | - ]  | 
                                                        |
| 271 | - ),  | 
                                                        |
| 272 | - ],  | 
                                                        |
| 273 | - ]  | 
                                                        |
| 274 | - ),  | 
                                                        |
| 275 | - ],  | 
                                                        |
| 276 | - null,  | 
                                                        |
| 277 | - false  | 
                                                        |
| 278 | - );  | 
                                                        |
| 279 | - }  | 
                                                        |
| 280 | - }  | 
                                                        |
| 281 | -  | 
                                                        |
| 282 | -  | 
                                                        |
| 283 | - /**  | 
                                                        |
| 284 | - * @param EE_Registration $registration  | 
                                                        |
| 285 | - * @return EE_Form_Section_Base  | 
                                                        |
| 286 | - * @throws EE_Error  | 
                                                        |
| 287 | - * @throws InvalidArgumentException  | 
                                                        |
| 288 | - * @throws EntityNotFoundException  | 
                                                        |
| 289 | - * @throws InvalidDataTypeException  | 
                                                        |
| 290 | - * @throws InvalidInterfaceException  | 
                                                        |
| 291 | - * @throws ReflectionException  | 
                                                        |
| 292 | - */  | 
                                                        |
| 293 | - public function getRegForm(EE_Registration $registration)  | 
                                                        |
| 294 | -    { | 
                                                        |
| 295 | - static $attendee_nmbr = 1;  | 
                                                        |
| 296 | - $form_args = [];  | 
                                                        |
| 297 | - // verify that registration has valid event  | 
                                                        |
| 298 | -        if ($registration->event() instanceof EE_Event) { | 
                                                        |
| 299 | - $field_name = 'Event_Question_Group.'  | 
                                                        |
| 300 | - . EEM_Event_Question_Group::instance()->fieldNameForContext(  | 
                                                        |
| 301 | - $registration->is_primary_registrant()  | 
                                                        |
| 302 | - );  | 
                                                        |
| 303 | - $question_groups = $registration->event()->question_groups(  | 
                                                        |
| 304 | - apply_filters(  | 
                                                        |
| 305 | - // @codingStandardsIgnoreStart  | 
                                                        |
| 306 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__question_groups_query_parameters',  | 
                                                        |
| 307 | - // @codingStandardsIgnoreEnd  | 
                                                        |
| 308 | - [  | 
                                                        |
| 309 | - [  | 
                                                        |
| 310 | - 'Event.EVT_ID' => $registration->event()->ID(),  | 
                                                        |
| 311 | - $field_name => true,  | 
                                                        |
| 312 | - ],  | 
                                                        |
| 313 | - 'order_by' => ['QSG_order' => 'ASC'],  | 
                                                        |
| 314 | - ],  | 
                                                        |
| 315 | - $registration,  | 
                                                        |
| 316 | - $this  | 
                                                        |
| 317 | - )  | 
                                                        |
| 318 | - );  | 
                                                        |
| 319 | -            if ($question_groups) { | 
                                                        |
| 320 | - // array of params to pass to parent constructor  | 
                                                        |
| 321 | - $form_args = [  | 
                                                        |
| 322 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(),  | 
                                                        |
| 323 | - 'html_class' => 'ee-reg-form-attendee-dv',  | 
                                                        |
| 324 | - 'html_style' => $this->reg_step->checkout->admin_request  | 
                                                        |
| 325 | - ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'  | 
                                                        |
| 326 | - : '',  | 
                                                        |
| 327 | - 'subsections' => [],  | 
                                                        |
| 328 | - 'layout_strategy' => new EE_Fieldset_Section_Layout(  | 
                                                        |
| 329 | - [  | 
                                                        |
| 330 | - 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text',  | 
                                                        |
| 331 | - 'legend_text' => sprintf(  | 
                                                        |
| 332 | - esc_html_x(  | 
                                                        |
| 333 | - 'Attendee %d',  | 
                                                        |
| 334 | - 'Attendee 123',  | 
                                                        |
| 335 | - 'event_espresso'  | 
                                                        |
| 336 | - ),  | 
                                                        |
| 337 | - $attendee_nmbr  | 
                                                        |
| 338 | - ),  | 
                                                        |
| 339 | - ]  | 
                                                        |
| 340 | - ),  | 
                                                        |
| 341 | - ];  | 
                                                        |
| 342 | -                foreach ($question_groups as $question_group) { | 
                                                        |
| 343 | -                    if ($question_group instanceof EE_Question_Group) { | 
                                                        |
| 344 | - $form_args['subsections'][ $question_group->identifier() ] = $this->questionGroupRegForm(  | 
                                                        |
| 345 | - $registration,  | 
                                                        |
| 346 | - $question_group  | 
                                                        |
| 347 | - );  | 
                                                        |
| 348 | - }  | 
                                                        |
| 349 | - }  | 
                                                        |
| 350 | - // add hidden input  | 
                                                        |
| 351 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->additionalAttendeeRegInfoInput(  | 
                                                        |
| 352 | - $registration  | 
                                                        |
| 353 | - );  | 
                                                        |
| 354 | -  | 
                                                        |
| 355 | - /**  | 
                                                        |
| 356 | - * @var $reg_config EE_Registration_Config  | 
                                                        |
| 357 | - */  | 
                                                        |
| 358 | -                $reg_config = LoaderFactory::getLoader()->getShared('EE_Registration_Config'); | 
                                                        |
| 359 | -  | 
                                                        |
| 360 | - // If we have question groups for additional attendees, then display the copy options  | 
                                                        |
| 361 | - $this->print_copy_info = apply_filters(  | 
                                                        |
| 362 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form___printCopyInfo',  | 
                                                        |
| 363 | - $attendee_nmbr > 1 && $reg_config->copyAttendeeInfo(),  | 
                                                        |
| 364 | - $attendee_nmbr  | 
                                                        |
| 365 | - );  | 
                                                        |
| 366 | -  | 
                                                        |
| 367 | -                if ($registration->is_primary_registrant()) { | 
                                                        |
| 368 | - // generate hidden input  | 
                                                        |
| 369 | - $form_args['subsections']['primary_registrant'] = $this->additionalPrimaryRegistrantInputs(  | 
                                                        |
| 370 | - $registration  | 
                                                        |
| 371 | - );  | 
                                                        |
| 372 | - }  | 
                                                        |
| 373 | - }  | 
                                                        |
| 374 | - }  | 
                                                        |
| 375 | - $attendee_nmbr++;  | 
                                                        |
| 376 | -  | 
                                                        |
| 377 | - // Increment the reg forms number if form is valid.  | 
                                                        |
| 378 | -        if (! empty($form_args)) { | 
                                                        |
| 379 | - $this->reg_form_count++;  | 
                                                        |
| 380 | - }  | 
                                                        |
| 381 | -  | 
                                                        |
| 382 | - return ! empty($form_args)  | 
                                                        |
| 383 | - ? new EE_Form_Section_Proper($form_args)  | 
                                                        |
| 384 | - : new EE_Form_Section_HTML();  | 
                                                        |
| 385 | - }  | 
                                                        |
| 386 | -  | 
                                                        |
| 387 | -  | 
                                                        |
| 388 | - /**  | 
                                                        |
| 389 | - * @param EE_Registration $registration  | 
                                                        |
| 390 | - * @return EE_Form_Input_Base  | 
                                                        |
| 391 | - * @throws EE_Error  | 
                                                        |
| 392 | - */  | 
                                                        |
| 393 | - private function additionalAttendeeRegInfoInput(EE_Registration $registration)  | 
                                                        |
| 394 | -    { | 
                                                        |
| 395 | - // generate hidden input  | 
                                                        |
| 396 | - return new EE_Hidden_Input(  | 
                                                        |
| 397 | - [  | 
                                                        |
| 398 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),  | 
                                                        |
| 399 | - 'default' => true,  | 
                                                        |
| 400 | - ]  | 
                                                        |
| 401 | - );  | 
                                                        |
| 402 | - }  | 
                                                        |
| 403 | -  | 
                                                        |
| 404 | -  | 
                                                        |
| 405 | - /**  | 
                                                        |
| 406 | - * @param EE_Registration $registration  | 
                                                        |
| 407 | - * @param EE_Question_Group $question_group  | 
                                                        |
| 408 | - * @return EE_Form_Section_Proper  | 
                                                        |
| 409 | - * @throws EE_Error  | 
                                                        |
| 410 | - * @throws InvalidArgumentException  | 
                                                        |
| 411 | - * @throws InvalidDataTypeException  | 
                                                        |
| 412 | - * @throws InvalidInterfaceException  | 
                                                        |
| 413 | - * @throws ReflectionException  | 
                                                        |
| 414 | - */  | 
                                                        |
| 415 | - private function questionGroupRegForm(EE_Registration $registration,  | 
                                                        |
| 416 | - EE_Question_Group $question_group): EE_Form_Section_Proper  | 
                                                        |
| 417 | -    { | 
                                                        |
| 418 | - // array of params to pass to parent constructor  | 
                                                        |
| 419 | - $form_args = [  | 
                                                        |
| 420 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-' . $registration->ID(),  | 
                                                        |
| 421 | - 'html_class' => $this->reg_step->checkout->admin_request  | 
                                                        |
| 422 | - ? 'form-table ee-reg-form-qstn-grp-dv'  | 
                                                        |
| 423 | - : 'ee-reg-form-qstn-grp-dv',  | 
                                                        |
| 424 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-'  | 
                                                        |
| 425 | - . $registration->ID() . '-lbl',  | 
                                                        |
| 426 | - 'subsections' => [  | 
                                                        |
| 427 | - 'reg_form_qstn_grp_hdr' => $this->questionGroupHeader($question_group),  | 
                                                        |
| 428 | - ],  | 
                                                        |
| 429 | - 'layout_strategy' => $this->reg_step->checkout->admin_request  | 
                                                        |
| 430 | - ? new EE_Admin_Two_Column_Layout()  | 
                                                        |
| 431 | - : new EE_Div_Per_Section_Layout(),  | 
                                                        |
| 432 | - ];  | 
                                                        |
| 433 | - // where params  | 
                                                        |
| 434 | - $query_params = ['QST_deleted' => 0];  | 
                                                        |
| 435 | - // don't load admin only questions on the frontend  | 
                                                        |
| 436 | -        if (! $this->reg_step->checkout->admin_request) { | 
                                                        |
| 437 | - $query_params['QST_admin_only'] = ['!=', true];  | 
                                                        |
| 438 | - }  | 
                                                        |
| 439 | - $questions = $question_group->get_many_related(  | 
                                                        |
| 440 | - 'Question',  | 
                                                        |
| 441 | - apply_filters(  | 
                                                        |
| 442 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__related_questions_query_params',  | 
                                                        |
| 443 | - [  | 
                                                        |
| 444 | - $query_params,  | 
                                                        |
| 445 | - 'order_by' => [  | 
                                                        |
| 446 | - 'Question_Group_Question.QGQ_order' => 'ASC',  | 
                                                        |
| 447 | - ],  | 
                                                        |
| 448 | - ],  | 
                                                        |
| 449 | - $question_group,  | 
                                                        |
| 450 | - $registration,  | 
                                                        |
| 451 | - $this  | 
                                                        |
| 452 | - )  | 
                                                        |
| 453 | - );  | 
                                                        |
| 454 | - // filter for additional content before questions  | 
                                                        |
| 455 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(  | 
                                                        |
| 456 | - apply_filters(  | 
                                                        |
| 457 | - 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions',  | 
                                                        |
| 458 | - '',  | 
                                                        |
| 459 | - $registration,  | 
                                                        |
| 460 | - $question_group,  | 
                                                        |
| 461 | - $this  | 
                                                        |
| 462 | - )  | 
                                                        |
| 463 | - );  | 
                                                        |
| 464 | - // loop thru questions  | 
                                                        |
| 465 | -        foreach ($questions as $question) { | 
                                                        |
| 466 | -            if ($question instanceof EE_Question) { | 
                                                        |
| 467 | - $identifier = $question->is_system_question()  | 
                                                        |
| 468 | - ? $question->system_ID()  | 
                                                        |
| 469 | - : $question->ID();  | 
                                                        |
| 470 | - $form_args['subsections'][ $identifier ] = $this->regFormQuestion($registration, $question);  | 
                                                        |
| 471 | - }  | 
                                                        |
| 472 | - }  | 
                                                        |
| 473 | - $form_args['subsections'] = apply_filters(  | 
                                                        |
| 474 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array',  | 
                                                        |
| 475 | - $form_args['subsections'],  | 
                                                        |
| 476 | - $registration,  | 
                                                        |
| 477 | - $question_group,  | 
                                                        |
| 478 | - $this  | 
                                                        |
| 479 | - );  | 
                                                        |
| 480 | - // filter for additional content after questions  | 
                                                        |
| 481 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(  | 
                                                        |
| 482 | - apply_filters(  | 
                                                        |
| 483 | - 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions',  | 
                                                        |
| 484 | - '',  | 
                                                        |
| 485 | - $registration,  | 
                                                        |
| 486 | - $question_group,  | 
                                                        |
| 487 | - $this  | 
                                                        |
| 488 | - )  | 
                                                        |
| 489 | - );  | 
                                                        |
| 490 | - // d($form_args);  | 
                                                        |
| 491 | - $question_group_reg_form = new EE_Form_Section_Proper($form_args);  | 
                                                        |
| 492 | - return apply_filters(  | 
                                                        |
| 493 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',  | 
                                                        |
| 494 | - $question_group_reg_form,  | 
                                                        |
| 495 | - $registration,  | 
                                                        |
| 496 | - $question_group,  | 
                                                        |
| 497 | - $this  | 
                                                        |
| 498 | - );  | 
                                                        |
| 499 | - }  | 
                                                        |
| 500 | -  | 
                                                        |
| 501 | -  | 
                                                        |
| 502 | - /**  | 
                                                        |
| 503 | - * @param EE_Question_Group $question_group  | 
                                                        |
| 504 | - * @return EE_Form_Section_HTML  | 
                                                        |
| 505 | - */  | 
                                                        |
| 506 | - private function questionGroupHeader(EE_Question_Group $question_group): EE_Form_Section_HTML  | 
                                                        |
| 507 | -    { | 
                                                        |
| 508 | - $html = '';  | 
                                                        |
| 509 | - // group_name  | 
                                                        |
| 510 | -        if ($question_group->show_group_name() && $question_group->name() !== '') { | 
                                                        |
| 511 | -            if ($this->reg_step->checkout->admin_request) { | 
                                                        |
| 512 | - $html .= EEH_HTML::br();  | 
                                                        |
| 513 | - $html .= EEH_HTML::h3(  | 
                                                        |
| 514 | - $question_group->name(),  | 
                                                        |
| 515 | - '',  | 
                                                        |
| 516 | - 'ee-reg-form-qstn-grp-title title',  | 
                                                        |
| 517 | - 'font-size: 1.3em; padding-left:0;'  | 
                                                        |
| 518 | - );  | 
                                                        |
| 519 | -            } else { | 
                                                        |
| 520 | - $html .= EEH_HTML::h4(  | 
                                                        |
| 521 | - $question_group->name(),  | 
                                                        |
| 522 | - '',  | 
                                                        |
| 523 | - 'ee-reg-form-qstn-grp-title section-title'  | 
                                                        |
| 524 | - );  | 
                                                        |
| 525 | - }  | 
                                                        |
| 526 | - }  | 
                                                        |
| 527 | - // group_desc  | 
                                                        |
| 528 | -        if ($question_group->show_group_desc() && $question_group->desc() !== '') { | 
                                                        |
| 529 | - $html .= EEH_HTML::p(  | 
                                                        |
| 530 | - $question_group->desc(),  | 
                                                        |
| 531 | - '',  | 
                                                        |
| 532 | - $this->reg_step->checkout->admin_request  | 
                                                        |
| 533 | - ? 'ee-reg-form-qstn-grp-desc-pg'  | 
                                                        |
| 534 | - : 'ee-reg-form-qstn-grp-desc-pg small-text lt-grey-text'  | 
                                                        |
| 535 | - );  | 
                                                        |
| 536 | - }  | 
                                                        |
| 537 | - return new EE_Form_Section_HTML($html);  | 
                                                        |
| 538 | - }  | 
                                                        |
| 539 | -  | 
                                                        |
| 540 | -  | 
                                                        |
| 541 | - /**  | 
                                                        |
| 542 | - * @param EE_Registration $registration  | 
                                                        |
| 543 | - * @return EE_Form_Input_Base  | 
                                                        |
| 544 | - * @throws EE_Error  | 
                                                        |
| 545 | - */  | 
                                                        |
| 546 | - private function additionalPrimaryRegistrantInputs(EE_Registration $registration)  | 
                                                        |
| 547 | -    { | 
                                                        |
| 548 | - // generate hidden input  | 
                                                        |
| 549 | - return new EE_Hidden_Input(  | 
                                                        |
| 550 | - [  | 
                                                        |
| 551 | - 'html_id' => 'primary_registrant',  | 
                                                        |
| 552 | - 'default' => $registration->reg_url_link(),  | 
                                                        |
| 553 | - ]  | 
                                                        |
| 554 | - );  | 
                                                        |
| 555 | - }  | 
                                                        |
| 556 | -  | 
                                                        |
| 557 | -  | 
                                                        |
| 558 | - /**  | 
                                                        |
| 559 | - * @param EE_Registration $registration  | 
                                                        |
| 560 | - * @param EE_Question $question  | 
                                                        |
| 561 | - * @return EE_Form_Input_Base  | 
                                                        |
| 562 | - * @throws EE_Error  | 
                                                        |
| 563 | - * @throws InvalidArgumentException  | 
                                                        |
| 564 | - * @throws InvalidDataTypeException  | 
                                                        |
| 565 | - * @throws InvalidInterfaceException  | 
                                                        |
| 566 | - * @throws ReflectionException  | 
                                                        |
| 567 | - */  | 
                                                        |
| 568 | - public function regFormQuestion(EE_Registration $registration, EE_Question $question): EE_Form_Input_Base  | 
                                                        |
| 569 | -    { | 
                                                        |
| 570 | -  | 
                                                        |
| 571 | - // if this question was for an attendee detail, then check for that answer  | 
                                                        |
| 572 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value(  | 
                                                        |
| 573 | - $registration,  | 
                                                        |
| 574 | - $question->system_ID()  | 
                                                        |
| 575 | - );  | 
                                                        |
| 576 | - $answer = $answer_value === null  | 
                                                        |
| 577 | - ? EEM_Answer::instance()->get_one(  | 
                                                        |
| 578 | - [['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]  | 
                                                        |
| 579 | - )  | 
                                                        |
| 580 | - : null;  | 
                                                        |
| 581 | - // if NOT returning to edit an existing registration  | 
                                                        |
| 582 | - // OR if this question is for an attendee property  | 
                                                        |
| 583 | - // OR we still don't have an EE_Answer object  | 
                                                        |
| 584 | -        if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) { | 
                                                        |
| 585 | - // create an EE_Answer object for storing everything in  | 
                                                        |
| 586 | - $answer = EE_Answer::new_instance(  | 
                                                        |
| 587 | - [  | 
                                                        |
| 588 | - 'QST_ID' => $question->ID(),  | 
                                                        |
| 589 | - 'REG_ID' => $registration->ID(),  | 
                                                        |
| 590 | - ]  | 
                                                        |
| 591 | - );  | 
                                                        |
| 592 | - }  | 
                                                        |
| 593 | - // verify instance  | 
                                                        |
| 594 | -        if ($answer instanceof EE_Answer) { | 
                                                        |
| 595 | -            if (! empty($answer_value)) { | 
                                                        |
| 596 | -                $answer->set('ANS_value', $answer_value); | 
                                                        |
| 597 | - }  | 
                                                        |
| 598 | -            $answer->cache('Question', $question); | 
                                                        |
| 599 | - // remember system ID had a bug where sometimes it could be null  | 
                                                        |
| 600 | - $answer_cache_id = $question->is_system_question()  | 
                                                        |
| 601 | - ? $question->system_ID() . '-' . $registration->reg_url_link()  | 
                                                        |
| 602 | - : $question->ID() . '-' . $registration->reg_url_link();  | 
                                                        |
| 603 | -            $registration->cache('Answer', $answer, $answer_cache_id); | 
                                                        |
| 604 | - }  | 
                                                        |
| 605 | - return $this->generateQuestionInput($registration, $question, $answer);  | 
                                                        |
| 606 | - }  | 
                                                        |
| 607 | -  | 
                                                        |
| 608 | -  | 
                                                        |
| 609 | - /**  | 
                                                        |
| 610 | - * @param EE_Registration $registration  | 
                                                        |
| 611 | - * @param EE_Question $question  | 
                                                        |
| 612 | - * @param $answer  | 
                                                        |
| 613 | - * @return EE_Form_Input_Base  | 
                                                        |
| 614 | - * @throws EE_Error  | 
                                                        |
| 615 | - * @throws InvalidArgumentException  | 
                                                        |
| 616 | - * @throws ReflectionException  | 
                                                        |
| 617 | - * @throws InvalidDataTypeException  | 
                                                        |
| 618 | - * @throws InvalidInterfaceException  | 
                                                        |
| 619 | - */  | 
                                                        |
| 620 | - private function generateQuestionInput(  | 
                                                        |
| 621 | - EE_Registration $registration,  | 
                                                        |
| 622 | - EE_Question $question,  | 
                                                        |
| 623 | - $answer  | 
                                                        |
| 624 | -    ): EE_Form_Input_Base { | 
                                                        |
| 625 | - $identifier = $question->is_system_question()  | 
                                                        |
| 626 | - ? $question->system_ID()  | 
                                                        |
| 627 | - : $question->ID();  | 
                                                        |
| 628 | - $this->required_questions[ $identifier ] = $question->required();  | 
                                                        |
| 629 | - $input_constructor_args = [  | 
                                                        |
| 630 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',  | 
                                                        |
| 631 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,  | 
                                                        |
| 632 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier,  | 
                                                        |
| 633 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,  | 
                                                        |
| 634 | - 'html_label_class' => 'ee-reg-qstn',  | 
                                                        |
| 635 | - ];  | 
                                                        |
| 636 | - $input_constructor_args['html_label_id'] .= '-lbl';  | 
                                                        |
| 637 | -        if ($answer instanceof EE_Answer && $answer->ID()) { | 
                                                        |
| 638 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']';  | 
                                                        |
| 639 | - $input_constructor_args['html_id'] .= '-' . $answer->ID();  | 
                                                        |
| 640 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID();  | 
                                                        |
| 641 | - }  | 
                                                        |
| 642 | - $form_input = $question->generate_form_input(  | 
                                                        |
| 643 | - $registration,  | 
                                                        |
| 644 | - $answer,  | 
                                                        |
| 645 | - $input_constructor_args  | 
                                                        |
| 646 | - );  | 
                                                        |
| 647 | - remove_filter(  | 
                                                        |
| 648 | - 'FHEE__EE_Question__generate_form_input__country_options',  | 
                                                        |
| 649 | - [$this, 'use_cached_countries_for_form_input']  | 
                                                        |
| 650 | - );  | 
                                                        |
| 651 | - remove_filter(  | 
                                                        |
| 652 | - 'FHEE__EE_Question__generate_form_input__state_options',  | 
                                                        |
| 653 | - [$this, 'use_cached_states_for_form_input']  | 
                                                        |
| 654 | - );  | 
                                                        |
| 655 | - return $form_input;  | 
                                                        |
| 656 | - }  | 
                                                        |
| 48 | + /**  | 
                                                        |
| 49 | + * @var bool  | 
                                                        |
| 50 | + */  | 
                                                        |
| 51 | + private $print_copy_info;  | 
                                                        |
| 52 | +  | 
                                                        |
| 53 | + /**  | 
                                                        |
| 54 | + * @var EE_Registration_Config  | 
                                                        |
| 55 | + */  | 
                                                        |
| 56 | + public $reg_config;  | 
                                                        |
| 57 | +  | 
                                                        |
| 58 | + /**  | 
                                                        |
| 59 | + * @var int  | 
                                                        |
| 60 | + */  | 
                                                        |
| 61 | + protected $reg_form_count = 0;  | 
                                                        |
| 62 | +  | 
                                                        |
| 63 | +  | 
                                                        |
| 64 | + /**  | 
                                                        |
| 65 | + * @var EE_SPCO_Reg_Step_Attendee_Information  | 
                                                        |
| 66 | + */  | 
                                                        |
| 67 | + public $reg_step;  | 
                                                        |
| 68 | +  | 
                                                        |
| 69 | + /**  | 
                                                        |
| 70 | + * @var array  | 
                                                        |
| 71 | + */  | 
                                                        |
| 72 | + private $required_questions = [];  | 
                                                        |
| 73 | +  | 
                                                        |
| 74 | + /**  | 
                                                        |
| 75 | + * @var array  | 
                                                        |
| 76 | + */  | 
                                                        |
| 77 | + private $template_args = [];  | 
                                                        |
| 78 | +  | 
                                                        |
| 79 | +  | 
                                                        |
| 80 | + /**  | 
                                                        |
| 81 | + * LegacyRegistrationForm constructor.  | 
                                                        |
| 82 | + *  | 
                                                        |
| 83 | + * @param EE_SPCO_Reg_Step_Attendee_Information $reg_step  | 
                                                        |
| 84 | + * @param EE_Registration_Config $reg_config  | 
                                                        |
| 85 | + * @throws ReflectionException  | 
                                                        |
| 86 | + * @throws EE_Error  | 
                                                        |
| 87 | + */  | 
                                                        |
| 88 | + public function __construct(EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration_Config $reg_config)  | 
                                                        |
| 89 | +	{ | 
                                                        |
| 90 | + $this->reg_step = $reg_step;  | 
                                                        |
| 91 | + $this->reg_config = $reg_config;  | 
                                                        |
| 92 | + $this->print_copy_info = $reg_config->copyAttendeeInfo();  | 
                                                        |
| 93 | + LoaderFactory::getLoader()->getShared(CountryOptions::class, [$this->reg_step->checkout->action]);  | 
                                                        |
| 94 | + LoaderFactory::getLoader()->getShared(StateOptions::class, [$this->reg_step->checkout->action]);  | 
                                                        |
| 95 | + parent::__construct(  | 
                                                        |
| 96 | + [  | 
                                                        |
| 97 | + 'name' => $this->reg_step->reg_form_name(),  | 
                                                        |
| 98 | + 'html_id' => $this->reg_step->reg_form_name(),  | 
                                                        |
| 99 | + 'subsections' => $this->generateSubsections(),  | 
                                                        |
| 100 | + 'layout_strategy' => new EE_Template_Layout(  | 
                                                        |
| 101 | + [  | 
                                                        |
| 102 | + 'layout_template_file' => $this->reg_step->template(), // layout_template  | 
                                                        |
| 103 | + 'template_args' => $this->template_args,  | 
                                                        |
| 104 | + ]  | 
                                                        |
| 105 | + ),  | 
                                                        |
| 106 | + ]  | 
                                                        |
| 107 | + );  | 
                                                        |
| 108 | + }  | 
                                                        |
| 109 | +  | 
                                                        |
| 110 | +  | 
                                                        |
| 111 | + /**  | 
                                                        |
| 112 | + * @return bool  | 
                                                        |
| 113 | + */  | 
                                                        |
| 114 | + public function printCopyInfo(): bool  | 
                                                        |
| 115 | +	{ | 
                                                        |
| 116 | + return $this->print_copy_info;  | 
                                                        |
| 117 | + }  | 
                                                        |
| 118 | +  | 
                                                        |
| 119 | +  | 
                                                        |
| 120 | + /**  | 
                                                        |
| 121 | + * @return int  | 
                                                        |
| 122 | + */  | 
                                                        |
| 123 | + public function regFormCount(): int  | 
                                                        |
| 124 | +	{ | 
                                                        |
| 125 | + return $this->reg_form_count;  | 
                                                        |
| 126 | + }  | 
                                                        |
| 127 | +  | 
                                                        |
| 128 | +  | 
                                                        |
| 129 | + /**  | 
                                                        |
| 130 | + * @return array  | 
                                                        |
| 131 | + */  | 
                                                        |
| 132 | + public function requiredQuestions(): array  | 
                                                        |
| 133 | +	{ | 
                                                        |
| 134 | + return $this->required_questions;  | 
                                                        |
| 135 | + }  | 
                                                        |
| 136 | +  | 
                                                        |
| 137 | +  | 
                                                        |
| 138 | + /**  | 
                                                        |
| 139 | + * @return EE_Form_Section_Proper[]  | 
                                                        |
| 140 | + * @throws DomainException  | 
                                                        |
| 141 | + * @throws EE_Error  | 
                                                        |
| 142 | + * @throws InvalidArgumentException  | 
                                                        |
| 143 | + * @throws ReflectionException  | 
                                                        |
| 144 | + * @throws EntityNotFoundException  | 
                                                        |
| 145 | + * @throws InvalidDataTypeException  | 
                                                        |
| 146 | + * @throws InvalidInterfaceException  | 
                                                        |
| 147 | + */  | 
                                                        |
| 148 | + public function generateSubsections(): array  | 
                                                        |
| 149 | +	{ | 
                                                        |
| 150 | + // Init reg forms count.  | 
                                                        |
| 151 | + $this->reg_form_count = 0;  | 
                                                        |
| 152 | +  | 
                                                        |
| 153 | + $primary_registrant = null;  | 
                                                        |
| 154 | + // autoload Line_Item_Display classes  | 
                                                        |
| 155 | + EEH_Autoloader::register_line_item_display_autoloaders();  | 
                                                        |
| 156 | + $Line_Item_Display = new EE_Line_Item_Display();  | 
                                                        |
| 157 | + // calculate taxes  | 
                                                        |
| 158 | + $Line_Item_Display->display_line_item(  | 
                                                        |
| 159 | + $this->reg_step->checkout->cart->get_grand_total(),  | 
                                                        |
| 160 | + ['set_tax_rate' => true]  | 
                                                        |
| 161 | + );  | 
                                                        |
| 162 | + $extra_inputs_section = $this->reg_step->reg_step_hidden_inputs();  | 
                                                        |
| 163 | + $this->addPrivacyConsentCheckbox($extra_inputs_section);  | 
                                                        |
| 164 | + $subsections = [  | 
                                                        |
| 165 | + 'default_hidden_inputs' => $extra_inputs_section,  | 
                                                        |
| 166 | + ];  | 
                                                        |
| 167 | +  | 
                                                        |
| 168 | + $this->template_args = [  | 
                                                        |
| 169 | + 'revisit' => $this->reg_step->checkout->revisit,  | 
                                                        |
| 170 | + 'registrations' => [],  | 
                                                        |
| 171 | + 'ticket_count' => [],  | 
                                                        |
| 172 | + ];  | 
                                                        |
| 173 | + // grab the saved registrations from the transaction  | 
                                                        |
| 174 | + $registrations  | 
                                                        |
| 175 | + = $this->reg_step->checkout->transaction->registrations($this->reg_step->checkout->reg_cache_where_params);  | 
                                                        |
| 176 | +		if ($registrations) { | 
                                                        |
| 177 | +			foreach ($registrations as $registration) { | 
                                                        |
| 178 | + // can this registration be processed during this visit ?  | 
                                                        |
| 179 | + if (  | 
                                                        |
| 180 | + $registration instanceof EE_Registration  | 
                                                        |
| 181 | + && $this->reg_step->checkout->visit_allows_processing_of_this_registration($registration)  | 
                                                        |
| 182 | +				) { | 
                                                        |
| 183 | + $reg_url_link = $registration->reg_url_link();  | 
                                                        |
| 184 | + $subsections[ $reg_url_link ]  | 
                                                        |
| 185 | + = $this->getRegForm($registration);  | 
                                                        |
| 186 | + $this->template_args['registrations'][ $reg_url_link ] = $registration;  | 
                                                        |
| 187 | + $this->template_args['ticket_count'][ $registration->ticket()->ID() ] = isset(  | 
                                                        |
| 188 | + $this->template_args['ticket_count'][ $registration->ticket()->ID() ]  | 
                                                        |
| 189 | + )  | 
                                                        |
| 190 | + ? $this->template_args['ticket_count'][ $registration->ticket()->ID() ] + 1  | 
                                                        |
| 191 | + : 1;  | 
                                                        |
| 192 | + $ticket_line_item  | 
                                                        |
| 193 | + = EEH_Line_Item::get_line_items_by_object_type_and_IDs(  | 
                                                        |
| 194 | + $this->reg_step->checkout->cart->get_grand_total(),  | 
                                                        |
| 195 | + 'Ticket',  | 
                                                        |
| 196 | + [$registration->ticket()->ID()]  | 
                                                        |
| 197 | + );  | 
                                                        |
| 198 | + $ticket_line_item = is_array($ticket_line_item)  | 
                                                        |
| 199 | + ? reset($ticket_line_item)  | 
                                                        |
| 200 | + : $ticket_line_item;  | 
                                                        |
| 201 | + $this->template_args['ticket_line_item'][ $registration->ticket()->ID() ]  | 
                                                        |
| 202 | + = $Line_Item_Display->display_line_item($ticket_line_item);  | 
                                                        |
| 203 | +					if ($registration->is_primary_registrant()) { | 
                                                        |
| 204 | + $primary_registrant = $reg_url_link;  | 
                                                        |
| 205 | + }  | 
                                                        |
| 206 | + }  | 
                                                        |
| 207 | + }  | 
                                                        |
| 208 | +  | 
                                                        |
| 209 | +			if ($primary_registrant && count($registrations) > 1) { | 
                                                        |
| 210 | + $copy_options['spco_copy_attendee_chk'] = $this->print_copy_info  | 
                                                        |
| 211 | + ? new LegacyCopyAttendeeInfoForm($registrations, $this->reg_step->slug())  | 
                                                        |
| 212 | + : new LegacyAutoCopyAttendeeInfoForm($this->reg_step->slug());  | 
                                                        |
| 213 | + // generate hidden input  | 
                                                        |
| 214 | + if (  | 
                                                        |
| 215 | + isset($subsections[ $primary_registrant ])  | 
                                                        |
| 216 | + && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper  | 
                                                        |
| 217 | +				) { | 
                                                        |
| 218 | + $subsections[ $primary_registrant ]->add_subsections(  | 
                                                        |
| 219 | + $copy_options,  | 
                                                        |
| 220 | + 'primary_registrant',  | 
                                                        |
| 221 | + false  | 
                                                        |
| 222 | + );  | 
                                                        |
| 223 | + }  | 
                                                        |
| 224 | + }  | 
                                                        |
| 225 | + }  | 
                                                        |
| 226 | +  | 
                                                        |
| 227 | + // Set the registration form template (default: one form per ticket details table).  | 
                                                        |
| 228 | + // We decide the template to used based on the number of forms.  | 
                                                        |
| 229 | + $template = $this->reg_form_count > 1  | 
                                                        |
| 230 | + ? SPCO_REG_STEPS_PATH . $this->reg_step->slug() . '/attendee_info_main.template.php'  | 
                                                        |
| 231 | + : SPCO_REG_STEPS_PATH . $this->reg_step->slug() . '/attendee_info_single.template.php';  | 
                                                        |
| 232 | + $this->reg_step->setTemplate($template);  | 
                                                        |
| 233 | +  | 
                                                        |
| 234 | + return $subsections;  | 
                                                        |
| 235 | + }  | 
                                                        |
| 236 | +  | 
                                                        |
| 237 | +  | 
                                                        |
| 238 | + /**  | 
                                                        |
| 239 | + * @param EE_Form_Section_Proper $extra_inputs_section  | 
                                                        |
| 240 | + * @throws EE_Error  | 
                                                        |
| 241 | + */  | 
                                                        |
| 242 | + private function addPrivacyConsentCheckbox(EE_Form_Section_Proper $extra_inputs_section)  | 
                                                        |
| 243 | +	{ | 
                                                        |
| 244 | + // if this isn't a revisit, and they have the privacy consent box enabled, add it  | 
                                                        |
| 245 | +		if (! $this->reg_step->checkout->revisit && $this->reg_config->isConsentCheckboxEnabled()) { | 
                                                        |
| 246 | + $extra_inputs_section->add_subsections(  | 
                                                        |
| 247 | + [  | 
                                                        |
| 248 | + 'consent_box' => new EE_Form_Section_Proper(  | 
                                                        |
| 249 | + [  | 
                                                        |
| 250 | + 'layout_strategy' =>  | 
                                                        |
| 251 | + new EE_Template_Layout(  | 
                                                        |
| 252 | + [  | 
                                                        |
| 253 | + 'input_template_file' => SPCO_REG_STEPS_PATH  | 
                                                        |
| 254 | + . $this->reg_step->slug()  | 
                                                        |
| 255 | + . '/privacy_consent.template.php',  | 
                                                        |
| 256 | + ]  | 
                                                        |
| 257 | + ),  | 
                                                        |
| 258 | + 'subsections' => [  | 
                                                        |
| 259 | + 'consent' => new EE_Checkbox_Multi_Input(  | 
                                                        |
| 260 | + [  | 
                                                        |
| 261 | + 'consent' => $this->reg_config->getConsentCheckboxLabelText(),  | 
                                                        |
| 262 | + ],  | 
                                                        |
| 263 | + [  | 
                                                        |
| 264 | + 'required' => true,  | 
                                                        |
| 265 | + 'required_validation_error_message' => esc_html__(  | 
                                                        |
| 266 | + 'You must consent to these terms in order to register.',  | 
                                                        |
| 267 | + 'event_espresso'  | 
                                                        |
| 268 | + ),  | 
                                                        |
| 269 | + 'html_label_text' => '',  | 
                                                        |
| 270 | + ]  | 
                                                        |
| 271 | + ),  | 
                                                        |
| 272 | + ],  | 
                                                        |
| 273 | + ]  | 
                                                        |
| 274 | + ),  | 
                                                        |
| 275 | + ],  | 
                                                        |
| 276 | + null,  | 
                                                        |
| 277 | + false  | 
                                                        |
| 278 | + );  | 
                                                        |
| 279 | + }  | 
                                                        |
| 280 | + }  | 
                                                        |
| 281 | +  | 
                                                        |
| 282 | +  | 
                                                        |
| 283 | + /**  | 
                                                        |
| 284 | + * @param EE_Registration $registration  | 
                                                        |
| 285 | + * @return EE_Form_Section_Base  | 
                                                        |
| 286 | + * @throws EE_Error  | 
                                                        |
| 287 | + * @throws InvalidArgumentException  | 
                                                        |
| 288 | + * @throws EntityNotFoundException  | 
                                                        |
| 289 | + * @throws InvalidDataTypeException  | 
                                                        |
| 290 | + * @throws InvalidInterfaceException  | 
                                                        |
| 291 | + * @throws ReflectionException  | 
                                                        |
| 292 | + */  | 
                                                        |
| 293 | + public function getRegForm(EE_Registration $registration)  | 
                                                        |
| 294 | +	{ | 
                                                        |
| 295 | + static $attendee_nmbr = 1;  | 
                                                        |
| 296 | + $form_args = [];  | 
                                                        |
| 297 | + // verify that registration has valid event  | 
                                                        |
| 298 | +		if ($registration->event() instanceof EE_Event) { | 
                                                        |
| 299 | + $field_name = 'Event_Question_Group.'  | 
                                                        |
| 300 | + . EEM_Event_Question_Group::instance()->fieldNameForContext(  | 
                                                        |
| 301 | + $registration->is_primary_registrant()  | 
                                                        |
| 302 | + );  | 
                                                        |
| 303 | + $question_groups = $registration->event()->question_groups(  | 
                                                        |
| 304 | + apply_filters(  | 
                                                        |
| 305 | + // @codingStandardsIgnoreStart  | 
                                                        |
| 306 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__question_groups_query_parameters',  | 
                                                        |
| 307 | + // @codingStandardsIgnoreEnd  | 
                                                        |
| 308 | + [  | 
                                                        |
| 309 | + [  | 
                                                        |
| 310 | + 'Event.EVT_ID' => $registration->event()->ID(),  | 
                                                        |
| 311 | + $field_name => true,  | 
                                                        |
| 312 | + ],  | 
                                                        |
| 313 | + 'order_by' => ['QSG_order' => 'ASC'],  | 
                                                        |
| 314 | + ],  | 
                                                        |
| 315 | + $registration,  | 
                                                        |
| 316 | + $this  | 
                                                        |
| 317 | + )  | 
                                                        |
| 318 | + );  | 
                                                        |
| 319 | +			if ($question_groups) { | 
                                                        |
| 320 | + // array of params to pass to parent constructor  | 
                                                        |
| 321 | + $form_args = [  | 
                                                        |
| 322 | + 'html_id' => 'ee-registration-' . $registration->reg_url_link(),  | 
                                                        |
| 323 | + 'html_class' => 'ee-reg-form-attendee-dv',  | 
                                                        |
| 324 | + 'html_style' => $this->reg_step->checkout->admin_request  | 
                                                        |
| 325 | + ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'  | 
                                                        |
| 326 | + : '',  | 
                                                        |
| 327 | + 'subsections' => [],  | 
                                                        |
| 328 | + 'layout_strategy' => new EE_Fieldset_Section_Layout(  | 
                                                        |
| 329 | + [  | 
                                                        |
| 330 | + 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text',  | 
                                                        |
| 331 | + 'legend_text' => sprintf(  | 
                                                        |
| 332 | + esc_html_x(  | 
                                                        |
| 333 | + 'Attendee %d',  | 
                                                        |
| 334 | + 'Attendee 123',  | 
                                                        |
| 335 | + 'event_espresso'  | 
                                                        |
| 336 | + ),  | 
                                                        |
| 337 | + $attendee_nmbr  | 
                                                        |
| 338 | + ),  | 
                                                        |
| 339 | + ]  | 
                                                        |
| 340 | + ),  | 
                                                        |
| 341 | + ];  | 
                                                        |
| 342 | +				foreach ($question_groups as $question_group) { | 
                                                        |
| 343 | +					if ($question_group instanceof EE_Question_Group) { | 
                                                        |
| 344 | + $form_args['subsections'][ $question_group->identifier() ] = $this->questionGroupRegForm(  | 
                                                        |
| 345 | + $registration,  | 
                                                        |
| 346 | + $question_group  | 
                                                        |
| 347 | + );  | 
                                                        |
| 348 | + }  | 
                                                        |
| 349 | + }  | 
                                                        |
| 350 | + // add hidden input  | 
                                                        |
| 351 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->additionalAttendeeRegInfoInput(  | 
                                                        |
| 352 | + $registration  | 
                                                        |
| 353 | + );  | 
                                                        |
| 354 | +  | 
                                                        |
| 355 | + /**  | 
                                                        |
| 356 | + * @var $reg_config EE_Registration_Config  | 
                                                        |
| 357 | + */  | 
                                                        |
| 358 | +				$reg_config = LoaderFactory::getLoader()->getShared('EE_Registration_Config'); | 
                                                        |
| 359 | +  | 
                                                        |
| 360 | + // If we have question groups for additional attendees, then display the copy options  | 
                                                        |
| 361 | + $this->print_copy_info = apply_filters(  | 
                                                        |
| 362 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form___printCopyInfo',  | 
                                                        |
| 363 | + $attendee_nmbr > 1 && $reg_config->copyAttendeeInfo(),  | 
                                                        |
| 364 | + $attendee_nmbr  | 
                                                        |
| 365 | + );  | 
                                                        |
| 366 | +  | 
                                                        |
| 367 | +				if ($registration->is_primary_registrant()) { | 
                                                        |
| 368 | + // generate hidden input  | 
                                                        |
| 369 | + $form_args['subsections']['primary_registrant'] = $this->additionalPrimaryRegistrantInputs(  | 
                                                        |
| 370 | + $registration  | 
                                                        |
| 371 | + );  | 
                                                        |
| 372 | + }  | 
                                                        |
| 373 | + }  | 
                                                        |
| 374 | + }  | 
                                                        |
| 375 | + $attendee_nmbr++;  | 
                                                        |
| 376 | +  | 
                                                        |
| 377 | + // Increment the reg forms number if form is valid.  | 
                                                        |
| 378 | +		if (! empty($form_args)) { | 
                                                        |
| 379 | + $this->reg_form_count++;  | 
                                                        |
| 380 | + }  | 
                                                        |
| 381 | +  | 
                                                        |
| 382 | + return ! empty($form_args)  | 
                                                        |
| 383 | + ? new EE_Form_Section_Proper($form_args)  | 
                                                        |
| 384 | + : new EE_Form_Section_HTML();  | 
                                                        |
| 385 | + }  | 
                                                        |
| 386 | +  | 
                                                        |
| 387 | +  | 
                                                        |
| 388 | + /**  | 
                                                        |
| 389 | + * @param EE_Registration $registration  | 
                                                        |
| 390 | + * @return EE_Form_Input_Base  | 
                                                        |
| 391 | + * @throws EE_Error  | 
                                                        |
| 392 | + */  | 
                                                        |
| 393 | + private function additionalAttendeeRegInfoInput(EE_Registration $registration)  | 
                                                        |
| 394 | +	{ | 
                                                        |
| 395 | + // generate hidden input  | 
                                                        |
| 396 | + return new EE_Hidden_Input(  | 
                                                        |
| 397 | + [  | 
                                                        |
| 398 | + 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),  | 
                                                        |
| 399 | + 'default' => true,  | 
                                                        |
| 400 | + ]  | 
                                                        |
| 401 | + );  | 
                                                        |
| 402 | + }  | 
                                                        |
| 403 | +  | 
                                                        |
| 404 | +  | 
                                                        |
| 405 | + /**  | 
                                                        |
| 406 | + * @param EE_Registration $registration  | 
                                                        |
| 407 | + * @param EE_Question_Group $question_group  | 
                                                        |
| 408 | + * @return EE_Form_Section_Proper  | 
                                                        |
| 409 | + * @throws EE_Error  | 
                                                        |
| 410 | + * @throws InvalidArgumentException  | 
                                                        |
| 411 | + * @throws InvalidDataTypeException  | 
                                                        |
| 412 | + * @throws InvalidInterfaceException  | 
                                                        |
| 413 | + * @throws ReflectionException  | 
                                                        |
| 414 | + */  | 
                                                        |
| 415 | + private function questionGroupRegForm(EE_Registration $registration,  | 
                                                        |
| 416 | + EE_Question_Group $question_group): EE_Form_Section_Proper  | 
                                                        |
| 417 | +	{ | 
                                                        |
| 418 | + // array of params to pass to parent constructor  | 
                                                        |
| 419 | + $form_args = [  | 
                                                        |
| 420 | + 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-' . $registration->ID(),  | 
                                                        |
| 421 | + 'html_class' => $this->reg_step->checkout->admin_request  | 
                                                        |
| 422 | + ? 'form-table ee-reg-form-qstn-grp-dv'  | 
                                                        |
| 423 | + : 'ee-reg-form-qstn-grp-dv',  | 
                                                        |
| 424 | + 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-'  | 
                                                        |
| 425 | + . $registration->ID() . '-lbl',  | 
                                                        |
| 426 | + 'subsections' => [  | 
                                                        |
| 427 | + 'reg_form_qstn_grp_hdr' => $this->questionGroupHeader($question_group),  | 
                                                        |
| 428 | + ],  | 
                                                        |
| 429 | + 'layout_strategy' => $this->reg_step->checkout->admin_request  | 
                                                        |
| 430 | + ? new EE_Admin_Two_Column_Layout()  | 
                                                        |
| 431 | + : new EE_Div_Per_Section_Layout(),  | 
                                                        |
| 432 | + ];  | 
                                                        |
| 433 | + // where params  | 
                                                        |
| 434 | + $query_params = ['QST_deleted' => 0];  | 
                                                        |
| 435 | + // don't load admin only questions on the frontend  | 
                                                        |
| 436 | +		if (! $this->reg_step->checkout->admin_request) { | 
                                                        |
| 437 | + $query_params['QST_admin_only'] = ['!=', true];  | 
                                                        |
| 438 | + }  | 
                                                        |
| 439 | + $questions = $question_group->get_many_related(  | 
                                                        |
| 440 | + 'Question',  | 
                                                        |
| 441 | + apply_filters(  | 
                                                        |
| 442 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__related_questions_query_params',  | 
                                                        |
| 443 | + [  | 
                                                        |
| 444 | + $query_params,  | 
                                                        |
| 445 | + 'order_by' => [  | 
                                                        |
| 446 | + 'Question_Group_Question.QGQ_order' => 'ASC',  | 
                                                        |
| 447 | + ],  | 
                                                        |
| 448 | + ],  | 
                                                        |
| 449 | + $question_group,  | 
                                                        |
| 450 | + $registration,  | 
                                                        |
| 451 | + $this  | 
                                                        |
| 452 | + )  | 
                                                        |
| 453 | + );  | 
                                                        |
| 454 | + // filter for additional content before questions  | 
                                                        |
| 455 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(  | 
                                                        |
| 456 | + apply_filters(  | 
                                                        |
| 457 | + 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions',  | 
                                                        |
| 458 | + '',  | 
                                                        |
| 459 | + $registration,  | 
                                                        |
| 460 | + $question_group,  | 
                                                        |
| 461 | + $this  | 
                                                        |
| 462 | + )  | 
                                                        |
| 463 | + );  | 
                                                        |
| 464 | + // loop thru questions  | 
                                                        |
| 465 | +		foreach ($questions as $question) { | 
                                                        |
| 466 | +			if ($question instanceof EE_Question) { | 
                                                        |
| 467 | + $identifier = $question->is_system_question()  | 
                                                        |
| 468 | + ? $question->system_ID()  | 
                                                        |
| 469 | + : $question->ID();  | 
                                                        |
| 470 | + $form_args['subsections'][ $identifier ] = $this->regFormQuestion($registration, $question);  | 
                                                        |
| 471 | + }  | 
                                                        |
| 472 | + }  | 
                                                        |
| 473 | + $form_args['subsections'] = apply_filters(  | 
                                                        |
| 474 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array',  | 
                                                        |
| 475 | + $form_args['subsections'],  | 
                                                        |
| 476 | + $registration,  | 
                                                        |
| 477 | + $question_group,  | 
                                                        |
| 478 | + $this  | 
                                                        |
| 479 | + );  | 
                                                        |
| 480 | + // filter for additional content after questions  | 
                                                        |
| 481 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(  | 
                                                        |
| 482 | + apply_filters(  | 
                                                        |
| 483 | + 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions',  | 
                                                        |
| 484 | + '',  | 
                                                        |
| 485 | + $registration,  | 
                                                        |
| 486 | + $question_group,  | 
                                                        |
| 487 | + $this  | 
                                                        |
| 488 | + )  | 
                                                        |
| 489 | + );  | 
                                                        |
| 490 | + // d($form_args);  | 
                                                        |
| 491 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args);  | 
                                                        |
| 492 | + return apply_filters(  | 
                                                        |
| 493 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',  | 
                                                        |
| 494 | + $question_group_reg_form,  | 
                                                        |
| 495 | + $registration,  | 
                                                        |
| 496 | + $question_group,  | 
                                                        |
| 497 | + $this  | 
                                                        |
| 498 | + );  | 
                                                        |
| 499 | + }  | 
                                                        |
| 500 | +  | 
                                                        |
| 501 | +  | 
                                                        |
| 502 | + /**  | 
                                                        |
| 503 | + * @param EE_Question_Group $question_group  | 
                                                        |
| 504 | + * @return EE_Form_Section_HTML  | 
                                                        |
| 505 | + */  | 
                                                        |
| 506 | + private function questionGroupHeader(EE_Question_Group $question_group): EE_Form_Section_HTML  | 
                                                        |
| 507 | +	{ | 
                                                        |
| 508 | + $html = '';  | 
                                                        |
| 509 | + // group_name  | 
                                                        |
| 510 | +		if ($question_group->show_group_name() && $question_group->name() !== '') { | 
                                                        |
| 511 | +			if ($this->reg_step->checkout->admin_request) { | 
                                                        |
| 512 | + $html .= EEH_HTML::br();  | 
                                                        |
| 513 | + $html .= EEH_HTML::h3(  | 
                                                        |
| 514 | + $question_group->name(),  | 
                                                        |
| 515 | + '',  | 
                                                        |
| 516 | + 'ee-reg-form-qstn-grp-title title',  | 
                                                        |
| 517 | + 'font-size: 1.3em; padding-left:0;'  | 
                                                        |
| 518 | + );  | 
                                                        |
| 519 | +			} else { | 
                                                        |
| 520 | + $html .= EEH_HTML::h4(  | 
                                                        |
| 521 | + $question_group->name(),  | 
                                                        |
| 522 | + '',  | 
                                                        |
| 523 | + 'ee-reg-form-qstn-grp-title section-title'  | 
                                                        |
| 524 | + );  | 
                                                        |
| 525 | + }  | 
                                                        |
| 526 | + }  | 
                                                        |
| 527 | + // group_desc  | 
                                                        |
| 528 | +		if ($question_group->show_group_desc() && $question_group->desc() !== '') { | 
                                                        |
| 529 | + $html .= EEH_HTML::p(  | 
                                                        |
| 530 | + $question_group->desc(),  | 
                                                        |
| 531 | + '',  | 
                                                        |
| 532 | + $this->reg_step->checkout->admin_request  | 
                                                        |
| 533 | + ? 'ee-reg-form-qstn-grp-desc-pg'  | 
                                                        |
| 534 | + : 'ee-reg-form-qstn-grp-desc-pg small-text lt-grey-text'  | 
                                                        |
| 535 | + );  | 
                                                        |
| 536 | + }  | 
                                                        |
| 537 | + return new EE_Form_Section_HTML($html);  | 
                                                        |
| 538 | + }  | 
                                                        |
| 539 | +  | 
                                                        |
| 540 | +  | 
                                                        |
| 541 | + /**  | 
                                                        |
| 542 | + * @param EE_Registration $registration  | 
                                                        |
| 543 | + * @return EE_Form_Input_Base  | 
                                                        |
| 544 | + * @throws EE_Error  | 
                                                        |
| 545 | + */  | 
                                                        |
| 546 | + private function additionalPrimaryRegistrantInputs(EE_Registration $registration)  | 
                                                        |
| 547 | +	{ | 
                                                        |
| 548 | + // generate hidden input  | 
                                                        |
| 549 | + return new EE_Hidden_Input(  | 
                                                        |
| 550 | + [  | 
                                                        |
| 551 | + 'html_id' => 'primary_registrant',  | 
                                                        |
| 552 | + 'default' => $registration->reg_url_link(),  | 
                                                        |
| 553 | + ]  | 
                                                        |
| 554 | + );  | 
                                                        |
| 555 | + }  | 
                                                        |
| 556 | +  | 
                                                        |
| 557 | +  | 
                                                        |
| 558 | + /**  | 
                                                        |
| 559 | + * @param EE_Registration $registration  | 
                                                        |
| 560 | + * @param EE_Question $question  | 
                                                        |
| 561 | + * @return EE_Form_Input_Base  | 
                                                        |
| 562 | + * @throws EE_Error  | 
                                                        |
| 563 | + * @throws InvalidArgumentException  | 
                                                        |
| 564 | + * @throws InvalidDataTypeException  | 
                                                        |
| 565 | + * @throws InvalidInterfaceException  | 
                                                        |
| 566 | + * @throws ReflectionException  | 
                                                        |
| 567 | + */  | 
                                                        |
| 568 | + public function regFormQuestion(EE_Registration $registration, EE_Question $question): EE_Form_Input_Base  | 
                                                        |
| 569 | +	{ | 
                                                        |
| 570 | +  | 
                                                        |
| 571 | + // if this question was for an attendee detail, then check for that answer  | 
                                                        |
| 572 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value(  | 
                                                        |
| 573 | + $registration,  | 
                                                        |
| 574 | + $question->system_ID()  | 
                                                        |
| 575 | + );  | 
                                                        |
| 576 | + $answer = $answer_value === null  | 
                                                        |
| 577 | + ? EEM_Answer::instance()->get_one(  | 
                                                        |
| 578 | + [['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]  | 
                                                        |
| 579 | + )  | 
                                                        |
| 580 | + : null;  | 
                                                        |
| 581 | + // if NOT returning to edit an existing registration  | 
                                                        |
| 582 | + // OR if this question is for an attendee property  | 
                                                        |
| 583 | + // OR we still don't have an EE_Answer object  | 
                                                        |
| 584 | +		if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) { | 
                                                        |
| 585 | + // create an EE_Answer object for storing everything in  | 
                                                        |
| 586 | + $answer = EE_Answer::new_instance(  | 
                                                        |
| 587 | + [  | 
                                                        |
| 588 | + 'QST_ID' => $question->ID(),  | 
                                                        |
| 589 | + 'REG_ID' => $registration->ID(),  | 
                                                        |
| 590 | + ]  | 
                                                        |
| 591 | + );  | 
                                                        |
| 592 | + }  | 
                                                        |
| 593 | + // verify instance  | 
                                                        |
| 594 | +		if ($answer instanceof EE_Answer) { | 
                                                        |
| 595 | +			if (! empty($answer_value)) { | 
                                                        |
| 596 | +				$answer->set('ANS_value', $answer_value); | 
                                                        |
| 597 | + }  | 
                                                        |
| 598 | +			$answer->cache('Question', $question); | 
                                                        |
| 599 | + // remember system ID had a bug where sometimes it could be null  | 
                                                        |
| 600 | + $answer_cache_id = $question->is_system_question()  | 
                                                        |
| 601 | + ? $question->system_ID() . '-' . $registration->reg_url_link()  | 
                                                        |
| 602 | + : $question->ID() . '-' . $registration->reg_url_link();  | 
                                                        |
| 603 | +			$registration->cache('Answer', $answer, $answer_cache_id); | 
                                                        |
| 604 | + }  | 
                                                        |
| 605 | + return $this->generateQuestionInput($registration, $question, $answer);  | 
                                                        |
| 606 | + }  | 
                                                        |
| 607 | +  | 
                                                        |
| 608 | +  | 
                                                        |
| 609 | + /**  | 
                                                        |
| 610 | + * @param EE_Registration $registration  | 
                                                        |
| 611 | + * @param EE_Question $question  | 
                                                        |
| 612 | + * @param $answer  | 
                                                        |
| 613 | + * @return EE_Form_Input_Base  | 
                                                        |
| 614 | + * @throws EE_Error  | 
                                                        |
| 615 | + * @throws InvalidArgumentException  | 
                                                        |
| 616 | + * @throws ReflectionException  | 
                                                        |
| 617 | + * @throws InvalidDataTypeException  | 
                                                        |
| 618 | + * @throws InvalidInterfaceException  | 
                                                        |
| 619 | + */  | 
                                                        |
| 620 | + private function generateQuestionInput(  | 
                                                        |
| 621 | + EE_Registration $registration,  | 
                                                        |
| 622 | + EE_Question $question,  | 
                                                        |
| 623 | + $answer  | 
                                                        |
| 624 | +	): EE_Form_Input_Base { | 
                                                        |
| 625 | + $identifier = $question->is_system_question()  | 
                                                        |
| 626 | + ? $question->system_ID()  | 
                                                        |
| 627 | + : $question->ID();  | 
                                                        |
| 628 | + $this->required_questions[ $identifier ] = $question->required();  | 
                                                        |
| 629 | + $input_constructor_args = [  | 
                                                        |
| 630 | + 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',  | 
                                                        |
| 631 | + 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,  | 
                                                        |
| 632 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier,  | 
                                                        |
| 633 | + 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,  | 
                                                        |
| 634 | + 'html_label_class' => 'ee-reg-qstn',  | 
                                                        |
| 635 | + ];  | 
                                                        |
| 636 | + $input_constructor_args['html_label_id'] .= '-lbl';  | 
                                                        |
| 637 | +		if ($answer instanceof EE_Answer && $answer->ID()) { | 
                                                        |
| 638 | + $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']';  | 
                                                        |
| 639 | + $input_constructor_args['html_id'] .= '-' . $answer->ID();  | 
                                                        |
| 640 | + $input_constructor_args['html_label_id'] .= '-' . $answer->ID();  | 
                                                        |
| 641 | + }  | 
                                                        |
| 642 | + $form_input = $question->generate_form_input(  | 
                                                        |
| 643 | + $registration,  | 
                                                        |
| 644 | + $answer,  | 
                                                        |
| 645 | + $input_constructor_args  | 
                                                        |
| 646 | + );  | 
                                                        |
| 647 | + remove_filter(  | 
                                                        |
| 648 | + 'FHEE__EE_Question__generate_form_input__country_options',  | 
                                                        |
| 649 | + [$this, 'use_cached_countries_for_form_input']  | 
                                                        |
| 650 | + );  | 
                                                        |
| 651 | + remove_filter(  | 
                                                        |
| 652 | + 'FHEE__EE_Question__generate_form_input__state_options',  | 
                                                        |
| 653 | + [$this, 'use_cached_states_for_form_input']  | 
                                                        |
| 654 | + );  | 
                                                        |
| 655 | + return $form_input;  | 
                                                        |
| 656 | + }  | 
                                                        |
| 657 | 657 | }  | 
                                                        
@@ -181,13 +181,13 @@ discard block  | 
                                                    ||
| 181 | 181 | && $this->reg_step->checkout->visit_allows_processing_of_this_registration($registration)  | 
                                                        
| 182 | 182 |                  ) { | 
                                                        
| 183 | 183 | $reg_url_link = $registration->reg_url_link();  | 
                                                        
| 184 | - $subsections[ $reg_url_link ]  | 
                                                        |
| 184 | + $subsections[$reg_url_link]  | 
                                                        |
| 185 | 185 | = $this->getRegForm($registration);  | 
                                                        
| 186 | - $this->template_args['registrations'][ $reg_url_link ] = $registration;  | 
                                                        |
| 187 | - $this->template_args['ticket_count'][ $registration->ticket()->ID() ] = isset(  | 
                                                        |
| 188 | - $this->template_args['ticket_count'][ $registration->ticket()->ID() ]  | 
                                                        |
| 186 | + $this->template_args['registrations'][$reg_url_link] = $registration;  | 
                                                        |
| 187 | + $this->template_args['ticket_count'][$registration->ticket()->ID()] = isset(  | 
                                                        |
| 188 | + $this->template_args['ticket_count'][$registration->ticket()->ID()]  | 
                                                        |
| 189 | 189 | )  | 
                                                        
| 190 | - ? $this->template_args['ticket_count'][ $registration->ticket()->ID() ] + 1  | 
                                                        |
| 190 | + ? $this->template_args['ticket_count'][$registration->ticket()->ID()] + 1  | 
                                                        |
| 191 | 191 | : 1;  | 
                                                        
| 192 | 192 | $ticket_line_item  | 
                                                        
| 193 | 193 | = EEH_Line_Item::get_line_items_by_object_type_and_IDs(  | 
                                                        
@@ -195,10 +195,10 @@ discard block  | 
                                                    ||
| 195 | 195 | 'Ticket',  | 
                                                        
| 196 | 196 | [$registration->ticket()->ID()]  | 
                                                        
| 197 | 197 | );  | 
                                                        
| 198 | - $ticket_line_item = is_array($ticket_line_item)  | 
                                                        |
| 198 | + $ticket_line_item = is_array($ticket_line_item)  | 
                                                        |
| 199 | 199 | ? reset($ticket_line_item)  | 
                                                        
| 200 | 200 | : $ticket_line_item;  | 
                                                        
| 201 | - $this->template_args['ticket_line_item'][ $registration->ticket()->ID() ]  | 
                                                        |
| 201 | + $this->template_args['ticket_line_item'][$registration->ticket()->ID()]  | 
                                                        |
| 202 | 202 | = $Line_Item_Display->display_line_item($ticket_line_item);  | 
                                                        
| 203 | 203 |                      if ($registration->is_primary_registrant()) { | 
                                                        
| 204 | 204 | $primary_registrant = $reg_url_link;  | 
                                                        
@@ -212,10 +212,10 @@ discard block  | 
                                                    ||
| 212 | 212 | : new LegacyAutoCopyAttendeeInfoForm($this->reg_step->slug());  | 
                                                        
| 213 | 213 | // generate hidden input  | 
                                                        
| 214 | 214 | if (  | 
                                                        
| 215 | - isset($subsections[ $primary_registrant ])  | 
                                                        |
| 216 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper  | 
                                                        |
| 215 | + isset($subsections[$primary_registrant])  | 
                                                        |
| 216 | + && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper  | 
                                                        |
| 217 | 217 |                  ) { | 
                                                        
| 218 | - $subsections[ $primary_registrant ]->add_subsections(  | 
                                                        |
| 218 | + $subsections[$primary_registrant]->add_subsections(  | 
                                                        |
| 219 | 219 | $copy_options,  | 
                                                        
| 220 | 220 | 'primary_registrant',  | 
                                                        
| 221 | 221 | false  | 
                                                        
@@ -227,8 +227,8 @@ discard block  | 
                                                    ||
| 227 | 227 | // Set the registration form template (default: one form per ticket details table).  | 
                                                        
| 228 | 228 | // We decide the template to used based on the number of forms.  | 
                                                        
| 229 | 229 | $template = $this->reg_form_count > 1  | 
                                                        
| 230 | - ? SPCO_REG_STEPS_PATH . $this->reg_step->slug() . '/attendee_info_main.template.php'  | 
                                                        |
| 231 | - : SPCO_REG_STEPS_PATH . $this->reg_step->slug() . '/attendee_info_single.template.php';  | 
                                                        |
| 230 | + ? SPCO_REG_STEPS_PATH . $this->reg_step->slug().'/attendee_info_main.template.php'  | 
                                                        |
| 231 | + : SPCO_REG_STEPS_PATH.$this->reg_step->slug().'/attendee_info_single.template.php';  | 
                                                        |
| 232 | 232 | $this->reg_step->setTemplate($template);  | 
                                                        
| 233 | 233 | |
| 234 | 234 | return $subsections;  | 
                                                        
@@ -242,7 +242,7 @@ discard block  | 
                                                    ||
| 242 | 242 | private function addPrivacyConsentCheckbox(EE_Form_Section_Proper $extra_inputs_section)  | 
                                                        
| 243 | 243 |      { | 
                                                        
| 244 | 244 | // if this isn't a revisit, and they have the privacy consent box enabled, add it  | 
                                                        
| 245 | -        if (! $this->reg_step->checkout->revisit && $this->reg_config->isConsentCheckboxEnabled()) { | 
                                                        |
| 245 | +        if ( ! $this->reg_step->checkout->revisit && $this->reg_config->isConsentCheckboxEnabled()) { | 
                                                        |
| 246 | 246 | $extra_inputs_section->add_subsections(  | 
                                                        
| 247 | 247 | [  | 
                                                        
| 248 | 248 | 'consent_box' => new EE_Form_Section_Proper(  | 
                                                        
@@ -296,7 +296,7 @@ discard block  | 
                                                    ||
| 296 | 296 | $form_args = [];  | 
                                                        
| 297 | 297 | // verify that registration has valid event  | 
                                                        
| 298 | 298 |          if ($registration->event() instanceof EE_Event) { | 
                                                        
| 299 | - $field_name = 'Event_Question_Group.'  | 
                                                        |
| 299 | + $field_name = 'Event_Question_Group.'  | 
                                                        |
| 300 | 300 | . EEM_Event_Question_Group::instance()->fieldNameForContext(  | 
                                                        
| 301 | 301 | $registration->is_primary_registrant()  | 
                                                        
| 302 | 302 | );  | 
                                                        
@@ -319,7 +319,7 @@ discard block  | 
                                                    ||
| 319 | 319 |              if ($question_groups) { | 
                                                        
| 320 | 320 | // array of params to pass to parent constructor  | 
                                                        
| 321 | 321 | $form_args = [  | 
                                                        
| 322 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(),  | 
                                                        |
| 322 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(),  | 
                                                        |
| 323 | 323 | 'html_class' => 'ee-reg-form-attendee-dv',  | 
                                                        
| 324 | 324 | 'html_style' => $this->reg_step->checkout->admin_request  | 
                                                        
| 325 | 325 | ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'  | 
                                                        
@@ -341,7 +341,7 @@ discard block  | 
                                                    ||
| 341 | 341 | ];  | 
                                                        
| 342 | 342 |                  foreach ($question_groups as $question_group) { | 
                                                        
| 343 | 343 |                      if ($question_group instanceof EE_Question_Group) { | 
                                                        
| 344 | - $form_args['subsections'][ $question_group->identifier() ] = $this->questionGroupRegForm(  | 
                                                        |
| 344 | + $form_args['subsections'][$question_group->identifier()] = $this->questionGroupRegForm(  | 
                                                        |
| 345 | 345 | $registration,  | 
                                                        
| 346 | 346 | $question_group  | 
                                                        
| 347 | 347 | );  | 
                                                        
@@ -375,7 +375,7 @@ discard block  | 
                                                    ||
| 375 | 375 | $attendee_nmbr++;  | 
                                                        
| 376 | 376 | |
| 377 | 377 | // Increment the reg forms number if form is valid.  | 
                                                        
| 378 | -        if (! empty($form_args)) { | 
                                                        |
| 378 | +        if ( ! empty($form_args)) { | 
                                                        |
| 379 | 379 | $this->reg_form_count++;  | 
                                                        
| 380 | 380 | }  | 
                                                        
| 381 | 381 | |
@@ -395,7 +395,7 @@ discard block  | 
                                                    ||
| 395 | 395 | // generate hidden input  | 
                                                        
| 396 | 396 | return new EE_Hidden_Input(  | 
                                                        
| 397 | 397 | [  | 
                                                        
| 398 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),  | 
                                                        |
| 398 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(),  | 
                                                        |
| 399 | 399 | 'default' => true,  | 
                                                        
| 400 | 400 | ]  | 
                                                        
| 401 | 401 | );  | 
                                                        
@@ -417,12 +417,12 @@ discard block  | 
                                                    ||
| 417 | 417 |      { | 
                                                        
| 418 | 418 | // array of params to pass to parent constructor  | 
                                                        
| 419 | 419 | $form_args = [  | 
                                                        
| 420 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-' . $registration->ID(),  | 
                                                        |
| 420 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-'.$registration->ID(),  | 
                                                        |
| 421 | 421 | 'html_class' => $this->reg_step->checkout->admin_request  | 
                                                        
| 422 | 422 | ? 'form-table ee-reg-form-qstn-grp-dv'  | 
                                                        
| 423 | 423 | : 'ee-reg-form-qstn-grp-dv',  | 
                                                        
| 424 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-'  | 
                                                        |
| 425 | - . $registration->ID() . '-lbl',  | 
                                                        |
| 424 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-'  | 
                                                        |
| 425 | + . $registration->ID().'-lbl',  | 
                                                        |
| 426 | 426 | 'subsections' => [  | 
                                                        
| 427 | 427 | 'reg_form_qstn_grp_hdr' => $this->questionGroupHeader($question_group),  | 
                                                        
| 428 | 428 | ],  | 
                                                        
@@ -433,7 +433,7 @@ discard block  | 
                                                    ||
| 433 | 433 | // where params  | 
                                                        
| 434 | 434 | $query_params = ['QST_deleted' => 0];  | 
                                                        
| 435 | 435 | // don't load admin only questions on the frontend  | 
                                                        
| 436 | -        if (! $this->reg_step->checkout->admin_request) { | 
                                                        |
| 436 | +        if ( ! $this->reg_step->checkout->admin_request) { | 
                                                        |
| 437 | 437 | $query_params['QST_admin_only'] = ['!=', true];  | 
                                                        
| 438 | 438 | }  | 
                                                        
| 439 | 439 | $questions = $question_group->get_many_related(  | 
                                                        
@@ -467,7 +467,7 @@ discard block  | 
                                                    ||
| 467 | 467 | $identifier = $question->is_system_question()  | 
                                                        
| 468 | 468 | ? $question->system_ID()  | 
                                                        
| 469 | 469 | : $question->ID();  | 
                                                        
| 470 | - $form_args['subsections'][ $identifier ] = $this->regFormQuestion($registration, $question);  | 
                                                        |
| 470 | + $form_args['subsections'][$identifier] = $this->regFormQuestion($registration, $question);  | 
                                                        |
| 471 | 471 | }  | 
                                                        
| 472 | 472 | }  | 
                                                        
| 473 | 473 | $form_args['subsections'] = apply_filters(  | 
                                                        
@@ -573,7 +573,7 @@ discard block  | 
                                                    ||
| 573 | 573 | $registration,  | 
                                                        
| 574 | 574 | $question->system_ID()  | 
                                                        
| 575 | 575 | );  | 
                                                        
| 576 | - $answer = $answer_value === null  | 
                                                        |
| 576 | + $answer = $answer_value === null  | 
                                                        |
| 577 | 577 | ? EEM_Answer::instance()->get_one(  | 
                                                        
| 578 | 578 | [['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]  | 
                                                        
| 579 | 579 | )  | 
                                                        
@@ -592,14 +592,14 @@ discard block  | 
                                                    ||
| 592 | 592 | }  | 
                                                        
| 593 | 593 | // verify instance  | 
                                                        
| 594 | 594 |          if ($answer instanceof EE_Answer) { | 
                                                        
| 595 | -            if (! empty($answer_value)) { | 
                                                        |
| 595 | +            if ( ! empty($answer_value)) { | 
                                                        |
| 596 | 596 |                  $answer->set('ANS_value', $answer_value); | 
                                                        
| 597 | 597 | }  | 
                                                        
| 598 | 598 |              $answer->cache('Question', $question); | 
                                                        
| 599 | 599 | // remember system ID had a bug where sometimes it could be null  | 
                                                        
| 600 | 600 | $answer_cache_id = $question->is_system_question()  | 
                                                        
| 601 | - ? $question->system_ID() . '-' . $registration->reg_url_link()  | 
                                                        |
| 602 | - : $question->ID() . '-' . $registration->reg_url_link();  | 
                                                        |
| 601 | + ? $question->system_ID().'-'.$registration->reg_url_link()  | 
                                                        |
| 602 | + : $question->ID().'-'.$registration->reg_url_link();  | 
                                                        |
| 603 | 603 |              $registration->cache('Answer', $answer, $answer_cache_id); | 
                                                        
| 604 | 604 | }  | 
                                                        
| 605 | 605 | return $this->generateQuestionInput($registration, $question, $answer);  | 
                                                        
@@ -625,19 +625,19 @@ discard block  | 
                                                    ||
| 625 | 625 | $identifier = $question->is_system_question()  | 
                                                        
| 626 | 626 | ? $question->system_ID()  | 
                                                        
| 627 | 627 | : $question->ID();  | 
                                                        
| 628 | - $this->required_questions[ $identifier ] = $question->required();  | 
                                                        |
| 628 | + $this->required_questions[$identifier] = $question->required();  | 
                                                        |
| 629 | 629 | $input_constructor_args = [  | 
                                                        
| 630 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',  | 
                                                        |
| 631 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,  | 
                                                        |
| 632 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier,  | 
                                                        |
| 633 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,  | 
                                                        |
| 630 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',  | 
                                                        |
| 631 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,  | 
                                                        |
| 632 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier,  | 
                                                        |
| 633 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,  | 
                                                        |
| 634 | 634 | 'html_label_class' => 'ee-reg-qstn',  | 
                                                        
| 635 | 635 | ];  | 
                                                        
| 636 | 636 | $input_constructor_args['html_label_id'] .= '-lbl';  | 
                                                        
| 637 | 637 |          if ($answer instanceof EE_Answer && $answer->ID()) { | 
                                                        
| 638 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']';  | 
                                                        |
| 639 | - $input_constructor_args['html_id'] .= '-' . $answer->ID();  | 
                                                        |
| 640 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID();  | 
                                                        |
| 638 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']';  | 
                                                        |
| 639 | + $input_constructor_args['html_id'] .= '-'.$answer->ID();  | 
                                                        |
| 640 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID();  | 
                                                        |
| 641 | 641 | }  | 
                                                        
| 642 | 642 | $form_input = $question->generate_form_input(  | 
                                                        
| 643 | 643 | $registration,  | 
                                                        
@@ -8,21 +8,21 @@  | 
                                                    ||
| 8 | 8 | class LegacyAutoCopyAttendeeInfoForm extends EE_Form_Section_HTML  | 
                                                        
| 9 | 9 |  { | 
                                                        
| 10 | 10 | |
| 11 | - /**  | 
                                                        |
| 12 | - * LegacyCopyAttendeeInfoForm constructor.  | 
                                                        |
| 13 | - */  | 
                                                        |
| 14 | - public function __construct(string $slug)  | 
                                                        |
| 15 | -    { | 
                                                        |
| 16 | - parent::__construct(  | 
                                                        |
| 17 | - EEH_Template::locate_template(  | 
                                                        |
| 18 | - SPCO_REG_STEPS_PATH . $slug . '/_auto_copy_attendee_info.template.php',  | 
                                                        |
| 19 | - apply_filters(  | 
                                                        |
| 20 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',  | 
                                                        |
| 21 | - []  | 
                                                        |
| 22 | - ),  | 
                                                        |
| 23 | - true,  | 
                                                        |
| 24 | - true  | 
                                                        |
| 25 | - )  | 
                                                        |
| 26 | - );  | 
                                                        |
| 27 | - }  | 
                                                        |
| 11 | + /**  | 
                                                        |
| 12 | + * LegacyCopyAttendeeInfoForm constructor.  | 
                                                        |
| 13 | + */  | 
                                                        |
| 14 | + public function __construct(string $slug)  | 
                                                        |
| 15 | +	{ | 
                                                        |
| 16 | + parent::__construct(  | 
                                                        |
| 17 | + EEH_Template::locate_template(  | 
                                                        |
| 18 | + SPCO_REG_STEPS_PATH . $slug . '/_auto_copy_attendee_info.template.php',  | 
                                                        |
| 19 | + apply_filters(  | 
                                                        |
| 20 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',  | 
                                                        |
| 21 | + []  | 
                                                        |
| 22 | + ),  | 
                                                        |
| 23 | + true,  | 
                                                        |
| 24 | + true  | 
                                                        |
| 25 | + )  | 
                                                        |
| 26 | + );  | 
                                                        |
| 27 | + }  | 
                                                        |
| 28 | 28 | }  | 
                                                        
| 29 | 29 | \ No newline at end of file  | 
                                                        
@@ -15,7 +15,7 @@  | 
                                                    ||
| 15 | 15 |      { | 
                                                        
| 16 | 16 | parent::__construct(  | 
                                                        
| 17 | 17 | EEH_Template::locate_template(  | 
                                                        
| 18 | - SPCO_REG_STEPS_PATH . $slug . '/_auto_copy_attendee_info.template.php',  | 
                                                        |
| 18 | + SPCO_REG_STEPS_PATH.$slug.'/_auto_copy_attendee_info.template.php',  | 
                                                        |
| 19 | 19 | apply_filters(  | 
                                                        
| 20 | 20 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',  | 
                                                        
| 21 | 21 | []  | 
                                                        
@@ -19,823 +19,823 @@  | 
                                                    ||
| 19 | 19 |  { | 
                                                        
| 20 | 20 | |
| 21 | 21 | |
| 22 | - /**  | 
                                                        |
| 23 | - * @return EED_Module|EED_Add_New_State  | 
                                                        |
| 24 | - */  | 
                                                        |
| 25 | - public static function instance()  | 
                                                        |
| 26 | -    { | 
                                                        |
| 27 | - return parent::get_instance(__CLASS__);  | 
                                                        |
| 28 | - }  | 
                                                        |
| 29 | -  | 
                                                        |
| 30 | -  | 
                                                        |
| 31 | - /**  | 
                                                        |
| 32 | - * set_hooks - for hooking into EE Core, other modules, etc  | 
                                                        |
| 33 | - *  | 
                                                        |
| 34 | - * @return void  | 
                                                        |
| 35 | - */  | 
                                                        |
| 36 | - public static function set_hooks()  | 
                                                        |
| 37 | -    { | 
                                                        |
| 38 | -        add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); | 
                                                        |
| 39 | -        add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0); | 
                                                        |
| 40 | -        add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10); | 
                                                        |
| 41 | - add_filter(  | 
                                                        |
| 42 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',  | 
                                                        |
| 43 | -            array('EED_Add_New_State', 'display_add_new_state_micro_form'), | 
                                                        |
| 44 | - 1,  | 
                                                        |
| 45 | - 1  | 
                                                        |
| 46 | - );  | 
                                                        |
| 47 | - add_filter(  | 
                                                        |
| 48 | - 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form',  | 
                                                        |
| 49 | -            array('EED_Add_New_State', 'display_add_new_state_micro_form'), | 
                                                        |
| 50 | - 1,  | 
                                                        |
| 51 | - 1  | 
                                                        |
| 52 | - );  | 
                                                        |
| 53 | - add_filter(  | 
                                                        |
| 54 | - 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',  | 
                                                        |
| 55 | -            array('EED_Add_New_State', 'unset_new_state_request_params'), | 
                                                        |
| 56 | - 10,  | 
                                                        |
| 57 | - 1  | 
                                                        |
| 58 | - );  | 
                                                        |
| 59 | - add_filter(  | 
                                                        |
| 60 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options',  | 
                                                        |
| 61 | -            array('EED_Add_New_State', 'inject_new_reg_state_into_options'), | 
                                                        |
| 62 | - 10,  | 
                                                        |
| 63 | - 5  | 
                                                        |
| 64 | - );  | 
                                                        |
| 65 | - add_filter(  | 
                                                        |
| 66 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options',  | 
                                                        |
| 67 | -            array('EED_Add_New_State', 'inject_new_reg_country_into_options'), | 
                                                        |
| 68 | - 10,  | 
                                                        |
| 69 | - 5  | 
                                                        |
| 70 | - );  | 
                                                        |
| 71 | - add_filter(  | 
                                                        |
| 72 | - 'FHEE__EE_State_Select_Input____construct__state_options',  | 
                                                        |
| 73 | -            array('EED_Add_New_State', 'state_options'), | 
                                                        |
| 74 | - 10,  | 
                                                        |
| 75 | - 1  | 
                                                        |
| 76 | - );  | 
                                                        |
| 77 | - add_filter(  | 
                                                        |
| 78 | - 'FHEE__EE_Country_Select_Input____construct__country_options',  | 
                                                        |
| 79 | -            array('EED_Add_New_State', 'country_options'), | 
                                                        |
| 80 | - 10,  | 
                                                        |
| 81 | - 1  | 
                                                        |
| 82 | - );  | 
                                                        |
| 83 | - }  | 
                                                        |
| 84 | -  | 
                                                        |
| 85 | -  | 
                                                        |
| 86 | - /**  | 
                                                        |
| 87 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc  | 
                                                        |
| 88 | - *  | 
                                                        |
| 89 | - * @return void  | 
                                                        |
| 90 | - */  | 
                                                        |
| 91 | - public static function set_hooks_admin()  | 
                                                        |
| 92 | -    { | 
                                                        |
| 93 | -        add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); | 
                                                        |
| 94 | - add_filter(  | 
                                                        |
| 95 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',  | 
                                                        |
| 96 | -            array('EED_Add_New_State', 'display_add_new_state_micro_form'), | 
                                                        |
| 97 | - 1,  | 
                                                        |
| 98 | - 1  | 
                                                        |
| 99 | - );  | 
                                                        |
| 100 | - add_filter(  | 
                                                        |
| 101 | - 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form',  | 
                                                        |
| 102 | -            array('EED_Add_New_State', 'display_add_new_state_micro_form'), | 
                                                        |
| 103 | - 1,  | 
                                                        |
| 104 | - 1  | 
                                                        |
| 105 | - );  | 
                                                        |
| 106 | -        add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); | 
                                                        |
| 107 | -        add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); | 
                                                        |
| 108 | - add_filter(  | 
                                                        |
| 109 | - 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',  | 
                                                        |
| 110 | -            array('EED_Add_New_State', 'unset_new_state_request_params'), | 
                                                        |
| 111 | - 10,  | 
                                                        |
| 112 | - 1  | 
                                                        |
| 113 | - );  | 
                                                        |
| 114 | - add_action(  | 
                                                        |
| 115 | - 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved',  | 
                                                        |
| 116 | -            array('EED_Add_New_State', 'update_country_settings'), | 
                                                        |
| 117 | - 10,  | 
                                                        |
| 118 | - 3  | 
                                                        |
| 119 | - );  | 
                                                        |
| 120 | - add_action(  | 
                                                        |
| 121 | - 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted',  | 
                                                        |
| 122 | -            array('EED_Add_New_State', 'update_country_settings'), | 
                                                        |
| 123 | - 10,  | 
                                                        |
| 124 | - 3  | 
                                                        |
| 125 | - );  | 
                                                        |
| 126 | - add_filter(  | 
                                                        |
| 127 | - 'FHEE__EE_State_Select_Input____construct__state_options',  | 
                                                        |
| 128 | -            array('EED_Add_New_State', 'state_options'), | 
                                                        |
| 129 | - 10,  | 
                                                        |
| 130 | - 1  | 
                                                        |
| 131 | - );  | 
                                                        |
| 132 | - add_filter(  | 
                                                        |
| 133 | - 'FHEE__EE_Country_Select_Input____construct__country_options',  | 
                                                        |
| 134 | -            array('EED_Add_New_State', 'country_options'), | 
                                                        |
| 135 | - 10,  | 
                                                        |
| 136 | - 1  | 
                                                        |
| 137 | - );  | 
                                                        |
| 138 | - add_filter(  | 
                                                        |
| 139 | - 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data',  | 
                                                        |
| 140 | -            array('EED_Add_New_State', 'filter_checkout_request_params'), | 
                                                        |
| 141 | - 10,  | 
                                                        |
| 142 | - 1  | 
                                                        |
| 143 | - );  | 
                                                        |
| 144 | - add_filter(  | 
                                                        |
| 145 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options',  | 
                                                        |
| 146 | -            array('EED_Add_New_State', 'inject_new_reg_state_into_options'), | 
                                                        |
| 147 | - 10,  | 
                                                        |
| 148 | - 5  | 
                                                        |
| 149 | - );  | 
                                                        |
| 150 | - add_filter(  | 
                                                        |
| 151 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options',  | 
                                                        |
| 152 | -            array('EED_Add_New_State', 'inject_new_reg_country_into_options'), | 
                                                        |
| 153 | - 10,  | 
                                                        |
| 154 | - 5  | 
                                                        |
| 155 | - );  | 
                                                        |
| 156 | - }  | 
                                                        |
| 157 | -  | 
                                                        |
| 158 | -  | 
                                                        |
| 159 | - /**  | 
                                                        |
| 160 | - * @return void  | 
                                                        |
| 161 | - */  | 
                                                        |
| 162 | - public static function set_definitions()  | 
                                                        |
| 163 | -    { | 
                                                        |
| 164 | -        define('ANS_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/'); | 
                                                        |
| 165 | - define(  | 
                                                        |
| 166 | - 'ANS_TEMPLATES_PATH',  | 
                                                        |
| 167 | - str_replace(  | 
                                                        |
| 168 | - '\\',  | 
                                                        |
| 169 | - '/',  | 
                                                        |
| 170 | - plugin_dir_path(__FILE__)  | 
                                                        |
| 171 | - ) . 'templates/'  | 
                                                        |
| 172 | - );  | 
                                                        |
| 173 | - }  | 
                                                        |
| 174 | -  | 
                                                        |
| 175 | -  | 
                                                        |
| 176 | - /**  | 
                                                        |
| 177 | - * @param WP $WP  | 
                                                        |
| 178 | - * @return void  | 
                                                        |
| 179 | - */  | 
                                                        |
| 180 | - public function run($WP)  | 
                                                        |
| 181 | -    { | 
                                                        |
| 182 | - }  | 
                                                        |
| 183 | -  | 
                                                        |
| 184 | -  | 
                                                        |
| 185 | - /**  | 
                                                        |
| 186 | - * @return void  | 
                                                        |
| 187 | - */  | 
                                                        |
| 188 | - public static function translate_js_strings()  | 
                                                        |
| 189 | -    { | 
                                                        |
| 190 | - EE_Registry::$i18n_js_strings['ans_no_country'] = esc_html__(  | 
                                                        |
| 191 | - 'In order to proceed, you need to select the Country that your State/Province belongs to.',  | 
                                                        |
| 192 | - 'event_espresso'  | 
                                                        |
| 193 | - );  | 
                                                        |
| 194 | - EE_Registry::$i18n_js_strings['ans_no_name'] = esc_html__(  | 
                                                        |
| 195 | - 'In order to proceed, you need to enter the name of your State/Province.',  | 
                                                        |
| 196 | - 'event_espresso'  | 
                                                        |
| 197 | - );  | 
                                                        |
| 198 | - EE_Registry::$i18n_js_strings['ans_no_abbreviation'] = esc_html__(  | 
                                                        |
| 199 | - 'In order to proceed, you need to enter an abbreviation for the name of your State/Province.',  | 
                                                        |
| 200 | - 'event_espresso'  | 
                                                        |
| 201 | - );  | 
                                                        |
| 202 | - EE_Registry::$i18n_js_strings['ans_save_success'] = esc_html__(  | 
                                                        |
| 203 | - 'The new state was successfully saved to the database.',  | 
                                                        |
| 204 | - 'event_espresso'  | 
                                                        |
| 205 | - );  | 
                                                        |
| 206 | - EE_Registry::$i18n_js_strings['ans_server_save_error'] = esc_html__(  | 
                                                        |
| 207 | - 'An unknown error has occurred on the server while saving the new state to the database.',  | 
                                                        |
| 208 | - 'event_espresso'  | 
                                                        |
| 209 | - );  | 
                                                        |
| 210 | - }  | 
                                                        |
| 211 | -  | 
                                                        |
| 212 | -  | 
                                                        |
| 213 | - /**  | 
                                                        |
| 214 | - * @return void  | 
                                                        |
| 215 | - */  | 
                                                        |
| 216 | - public static function wp_enqueue_scripts()  | 
                                                        |
| 217 | -    { | 
                                                        |
| 218 | -        if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { | 
                                                        |
| 219 | - wp_register_script(  | 
                                                        |
| 220 | - 'add_new_state',  | 
                                                        |
| 221 | - ANS_ASSETS_URL . 'add_new_state.js',  | 
                                                        |
| 222 | -                array('espresso_core', 'single_page_checkout'), | 
                                                        |
| 223 | - EVENT_ESPRESSO_VERSION,  | 
                                                        |
| 224 | - true  | 
                                                        |
| 225 | - );  | 
                                                        |
| 226 | -            wp_enqueue_script('add_new_state'); | 
                                                        |
| 227 | - }  | 
                                                        |
| 228 | - }  | 
                                                        |
| 229 | -  | 
                                                        |
| 230 | -  | 
                                                        |
| 231 | -  | 
                                                        |
| 232 | - /**  | 
                                                        |
| 233 | - * display_add_new_state_micro_form  | 
                                                        |
| 234 | - *  | 
                                                        |
| 235 | - * @param EE_Form_Section_Proper $question_group_reg_form  | 
                                                        |
| 236 | - * @return string  | 
                                                        |
| 237 | - * @throws EE_Error  | 
                                                        |
| 238 | - * @throws InvalidArgumentException  | 
                                                        |
| 239 | - * @throws InvalidDataTypeException  | 
                                                        |
| 240 | - * @throws InvalidInterfaceException  | 
                                                        |
| 241 | - */  | 
                                                        |
| 242 | - public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form)  | 
                                                        |
| 243 | -    { | 
                                                        |
| 244 | - // only add the 'new_state_micro_form' when displaying reg forms,  | 
                                                        |
| 245 | - // not during processing since we process the 'new_state_micro_form' in it's own AJAX request  | 
                                                        |
| 246 | -        $action = EE_Registry::instance()->REQ->get('action', ''); | 
                                                        |
| 247 | - // is the "state" question in this form section?  | 
                                                        |
| 248 | -        $input = $question_group_reg_form->get_subsection('state'); | 
                                                        |
| 249 | -        if ($action === 'process_reg_step' || $action === 'update_reg_step') { | 
                                                        |
| 250 | - // ok then all we need to do is make sure the input's HTML name is consistent  | 
                                                        |
| 251 | - // by forcing it to set it now, like it did while getting the form for display  | 
                                                        |
| 252 | -            if ($input instanceof EE_State_Select_Input) { | 
                                                        |
| 253 | - $input->html_name();  | 
                                                        |
| 254 | - }  | 
                                                        |
| 255 | - return $question_group_reg_form;  | 
                                                        |
| 256 | - }  | 
                                                        |
| 257 | - // we're only doing this for state select inputs  | 
                                                        |
| 258 | - if (  | 
                                                        |
| 259 | - $input instanceof EE_State_Select_Input  | 
                                                        |
| 260 | - && ! $input->get_display_strategy() instanceof EE_Hidden_Display_Strategy  | 
                                                        |
| 261 | -        ) { | 
                                                        |
| 262 | - // grab any set values from the request  | 
                                                        |
| 263 | -            $country_name = str_replace('state', 'nsmf_new_state_country', $input->html_name()); | 
                                                        |
| 264 | -            $state_name = str_replace('state', 'nsmf_new_state_name', $input->html_name()); | 
                                                        |
| 265 | -            $abbrv_name = str_replace('state', 'nsmf_new_state_abbrv', $input->html_name()); | 
                                                        |
| 266 | -            $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); | 
                                                        |
| 267 | - $country_options = array();  | 
                                                        |
| 268 | - $countries = EEM_Country::instance()->get_all_countries();  | 
                                                        |
| 269 | -            if (! empty($countries)) { | 
                                                        |
| 270 | -                foreach ($countries as $country) { | 
                                                        |
| 271 | -                    if ($country instanceof EE_Country) { | 
                                                        |
| 272 | - $country_options[ $country->ID() ] = $country->name();  | 
                                                        |
| 273 | - }  | 
                                                        |
| 274 | - }  | 
                                                        |
| 275 | - }  | 
                                                        |
| 276 | - $new_state_micro_form = new EE_Form_Section_Proper(  | 
                                                        |
| 277 | - array(  | 
                                                        |
| 278 | - 'name' => 'new_state_micro_form',  | 
                                                        |
| 279 | - 'html_id' => 'new_state_micro_form',  | 
                                                        |
| 280 | - 'layout_strategy' => new EE_Div_Per_Section_Layout(),  | 
                                                        |
| 281 | - 'subsections' => array(  | 
                                                        |
| 282 | - // add hidden input to indicate that a new state is being added  | 
                                                        |
| 283 | - 'add_new_state' => new EE_Hidden_Input(  | 
                                                        |
| 284 | - array(  | 
                                                        |
| 285 | - 'html_name' => str_replace(  | 
                                                        |
| 286 | - 'state',  | 
                                                        |
| 287 | - 'nsmf_add_new_state',  | 
                                                        |
| 288 | - $input->html_name()  | 
                                                        |
| 289 | - ),  | 
                                                        |
| 290 | - 'html_id' => str_replace(  | 
                                                        |
| 291 | - 'state',  | 
                                                        |
| 292 | - 'nsmf_add_new_state',  | 
                                                        |
| 293 | - $input->html_id()  | 
                                                        |
| 294 | - ),  | 
                                                        |
| 295 | - 'default' => 0,  | 
                                                        |
| 296 | - )  | 
                                                        |
| 297 | - ),  | 
                                                        |
| 298 | - // add link for displaying hidden container  | 
                                                        |
| 299 | - 'click_here_link' => new EE_Form_Section_HTML(  | 
                                                        |
| 300 | - apply_filters(  | 
                                                        |
| 301 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__click_here_link',  | 
                                                        |
| 302 | - EEH_HTML::link(  | 
                                                        |
| 303 | - '',  | 
                                                        |
| 304 | -                                    esc_html__('click here to add a new state/province', 'event_espresso'), | 
                                                        |
| 305 | - '',  | 
                                                        |
| 306 | - 'display-' . $input->html_id(),  | 
                                                        |
| 307 | - 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js',  | 
                                                        |
| 308 | - '',  | 
                                                        |
| 309 | - 'data-target="' . $input->html_id() . '"'  | 
                                                        |
| 310 | - )  | 
                                                        |
| 311 | - )  | 
                                                        |
| 312 | - ),  | 
                                                        |
| 313 | - // add initial html for hidden container  | 
                                                        |
| 314 | - 'add_new_state_micro_form' => new EE_Form_Section_HTML(  | 
                                                        |
| 315 | - apply_filters(  | 
                                                        |
| 316 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form',  | 
                                                        |
| 317 | - EEH_HTML::div(  | 
                                                        |
| 318 | - '',  | 
                                                        |
| 319 | - $input->html_id() . '-dv',  | 
                                                        |
| 320 | - 'ee-form-add-new-state-dv',  | 
                                                        |
| 321 | - 'display: none;'  | 
                                                        |
| 322 | - ) .  | 
                                                        |
| 323 | - EEH_HTML::h6(  | 
                                                        |
| 324 | - esc_html__(  | 
                                                        |
| 325 | - 'Is your state/province missing from the dropdown menu above? You can add it by completing the following steps:',  | 
                                                        |
| 326 | - 'event_espresso'  | 
                                                        |
| 327 | - )  | 
                                                        |
| 328 | - ) .  | 
                                                        |
| 329 | - EEH_HTML::ul() .  | 
                                                        |
| 330 | - EEH_HTML::li(  | 
                                                        |
| 331 | - esc_html__(  | 
                                                        |
| 332 | - 'first select the Country that your State/Province belongs to',  | 
                                                        |
| 333 | - 'event_espresso'  | 
                                                        |
| 334 | - )  | 
                                                        |
| 335 | - ) .  | 
                                                        |
| 336 | - EEH_HTML::li(  | 
                                                        |
| 337 | -                                    esc_html__('enter the name of your State/Province', 'event_espresso') | 
                                                        |
| 338 | - ) .  | 
                                                        |
| 339 | - EEH_HTML::li(  | 
                                                        |
| 340 | - esc_html__(  | 
                                                        |
| 341 | - 'enter a two to six letter abbreviation for the name of your State/Province',  | 
                                                        |
| 342 | - 'event_espresso'  | 
                                                        |
| 343 | - )  | 
                                                        |
| 344 | - ) .  | 
                                                        |
| 345 | -                                EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')) . | 
                                                        |
| 346 | - EEH_HTML::ulx()  | 
                                                        |
| 347 | - )  | 
                                                        |
| 348 | - ),  | 
                                                        |
| 349 | - // NEW STATE COUNTRY  | 
                                                        |
| 350 | - 'new_state_country' => new EE_Country_Select_Input(  | 
                                                        |
| 351 | - $country_options,  | 
                                                        |
| 352 | - array(  | 
                                                        |
| 353 | - 'html_name' => $country_name,  | 
                                                        |
| 354 | - 'html_id' => str_replace(  | 
                                                        |
| 355 | - 'state',  | 
                                                        |
| 356 | - 'nsmf_new_state_country',  | 
                                                        |
| 357 | - $input->html_id()  | 
                                                        |
| 358 | - ),  | 
                                                        |
| 359 | - 'html_class' => $input->html_class() . ' new-state-country',  | 
                                                        |
| 360 | -                                'html_label_text' => esc_html__('New State/Province Country', 'event_espresso'), | 
                                                        |
| 361 | - 'default' => EE_Registry::instance()->REQ->get($country_name, ''),  | 
                                                        |
| 362 | - 'required' => false,  | 
                                                        |
| 363 | - )  | 
                                                        |
| 364 | - ),  | 
                                                        |
| 365 | - // NEW STATE NAME  | 
                                                        |
| 366 | - 'new_state_name' => new EE_Text_Input(  | 
                                                        |
| 367 | - array(  | 
                                                        |
| 368 | - 'html_name' => $state_name,  | 
                                                        |
| 369 | - 'html_id' => str_replace(  | 
                                                        |
| 370 | - 'state',  | 
                                                        |
| 371 | - 'nsmf_new_state_name',  | 
                                                        |
| 372 | - $input->html_id()  | 
                                                        |
| 373 | - ),  | 
                                                        |
| 374 | - 'html_class' => $input->html_class() . ' new-state-state',  | 
                                                        |
| 375 | - 'html_label_text' => esc_html__(  | 
                                                        |
| 376 | - 'New State/Province Name',  | 
                                                        |
| 377 | - 'event_espresso'  | 
                                                        |
| 378 | - ),  | 
                                                        |
| 379 | - 'default' => EE_Registry::instance()->REQ->get($state_name, ''),  | 
                                                        |
| 380 | - 'required' => false,  | 
                                                        |
| 381 | - )  | 
                                                        |
| 382 | - ),  | 
                                                        |
| 383 | - 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()),  | 
                                                        |
| 384 | - // NEW STATE NAME  | 
                                                        |
| 385 | - 'new_state_abbrv' => new EE_Text_Input(  | 
                                                        |
| 386 | - array(  | 
                                                        |
| 387 | - 'html_name' => $abbrv_name,  | 
                                                        |
| 388 | - 'html_id' => str_replace(  | 
                                                        |
| 389 | - 'state',  | 
                                                        |
| 390 | - 'nsmf_new_state_abbrv',  | 
                                                        |
| 391 | - $input->html_id()  | 
                                                        |
| 392 | - ),  | 
                                                        |
| 393 | - 'html_class' => $input->html_class() . ' new-state-abbrv',  | 
                                                        |
| 394 | - 'html_label_text' => esc_html__(  | 
                                                        |
| 395 | - 'New State/Province Abbreviation',  | 
                                                        |
| 396 | - 'event_espresso'  | 
                                                        |
| 397 | - ) . ' *',  | 
                                                        |
| 398 | - 'other_html_attributes' => 'size="24"',  | 
                                                        |
| 399 | - 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''),  | 
                                                        |
| 400 | - 'required' => false,  | 
                                                        |
| 401 | - )  | 
                                                        |
| 402 | - ),  | 
                                                        |
| 403 | - // "submit" button  | 
                                                        |
| 404 | - 'add_new_state_submit_button' => new EE_Form_Section_HTML(  | 
                                                        |
| 405 | - apply_filters(  | 
                                                        |
| 406 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button',  | 
                                                        |
| 407 | - EEH_HTML::nbsp(3) .  | 
                                                        |
| 408 | - EEH_HTML::link(  | 
                                                        |
| 409 | - '',  | 
                                                        |
| 410 | -                                    esc_html__('ADD', 'event_espresso'), | 
                                                        |
| 411 | - '',  | 
                                                        |
| 412 | - 'submit-' . $new_state_submit_id,  | 
                                                        |
| 413 | - 'ee-form-add-new-state-submit button button-secondary',  | 
                                                        |
| 414 | - '',  | 
                                                        |
| 415 | - 'data-target="' . $new_state_submit_id . '" data-value-field-name="' . $input->valueFieldName() . '"'  | 
                                                        |
| 416 | - )  | 
                                                        |
| 417 | - )  | 
                                                        |
| 418 | - ),  | 
                                                        |
| 419 | - // extra info  | 
                                                        |
| 420 | - 'add_new_state_extra' => new EE_Form_Section_HTML(  | 
                                                        |
| 421 | - apply_filters(  | 
                                                        |
| 422 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra',  | 
                                                        |
| 423 | - EEH_HTML::br(2)  | 
                                                        |
| 424 | - .  | 
                                                        |
| 425 | -                                EEH_HTML::div('', '', 'small-text') | 
                                                        |
| 426 | - .  | 
                                                        |
| 427 | - EEH_HTML::strong(  | 
                                                        |
| 428 | - '* ' .  | 
                                                        |
| 429 | - esc_html__(  | 
                                                        |
| 430 | - 'Don\'t know your State/Province Abbreviation?',  | 
                                                        |
| 431 | - 'event_espresso'  | 
                                                        |
| 432 | - )  | 
                                                        |
| 433 | - )  | 
                                                        |
| 434 | - .  | 
                                                        |
| 435 | - EEH_HTML::br()  | 
                                                        |
| 436 | - .  | 
                                                        |
| 437 | - sprintf(  | 
                                                        |
| 438 | - esc_html__(  | 
                                                        |
| 439 | -                                        'You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', | 
                                                        |
| 440 | - 'event_espresso'  | 
                                                        |
| 441 | - ),  | 
                                                        |
| 442 | - EEH_HTML::link(  | 
                                                        |
| 443 | - 'http://en.wikipedia.org/wiki/ISO_3166-2',  | 
                                                        |
| 444 | - 'http://en.wikipedia.org/wiki/ISO_3166-2',  | 
                                                        |
| 445 | - '',  | 
                                                        |
| 446 | - '',  | 
                                                        |
| 447 | - 'ee-form-add-new-state-wiki-lnk',  | 
                                                        |
| 448 | - '',  | 
                                                        |
| 449 | - 'target="_blank"'  | 
                                                        |
| 450 | - )  | 
                                                        |
| 451 | - )  | 
                                                        |
| 452 | - .  | 
                                                        |
| 453 | - EEH_HTML::divx()  | 
                                                        |
| 454 | - .  | 
                                                        |
| 455 | - EEH_HTML::br()  | 
                                                        |
| 456 | - .  | 
                                                        |
| 457 | - EEH_HTML::link(  | 
                                                        |
| 458 | - '',  | 
                                                        |
| 459 | -                                    esc_html__('cancel new State/Province', 'event_espresso'), | 
                                                        |
| 460 | - '',  | 
                                                        |
| 461 | - 'hide-' . $input->html_id(),  | 
                                                        |
| 462 | - 'ee-form-cancel-new-state-lnk smaller-text',  | 
                                                        |
| 463 | - '',  | 
                                                        |
| 464 | - 'data-target="' . $input->html_id() . '"'  | 
                                                        |
| 465 | - )  | 
                                                        |
| 466 | - .  | 
                                                        |
| 467 | - EEH_HTML::divx()  | 
                                                        |
| 468 | - .  | 
                                                        |
| 469 | - EEH_HTML::br()  | 
                                                        |
| 470 | - )  | 
                                                        |
| 471 | - ),  | 
                                                        |
| 472 | - ),  | 
                                                        |
| 473 | - )  | 
                                                        |
| 474 | - );  | 
                                                        |
| 475 | - $question_group_reg_form->add_subsections(  | 
                                                        |
| 476 | -                array('new_state_micro_form' => $new_state_micro_form), | 
                                                        |
| 477 | - 'state',  | 
                                                        |
| 478 | - false  | 
                                                        |
| 479 | - );  | 
                                                        |
| 480 | - }  | 
                                                        |
| 481 | - return $question_group_reg_form;  | 
                                                        |
| 482 | - }  | 
                                                        |
| 483 | -  | 
                                                        |
| 484 | -  | 
                                                        |
| 485 | - /**  | 
                                                        |
| 486 | - * set_new_state_input_width  | 
                                                        |
| 487 | - *  | 
                                                        |
| 488 | - * @return int|string  | 
                                                        |
| 489 | - * @throws EE_Error  | 
                                                        |
| 490 | - * @throws InvalidArgumentException  | 
                                                        |
| 491 | - * @throws InvalidDataTypeException  | 
                                                        |
| 492 | - * @throws InvalidInterfaceException  | 
                                                        |
| 493 | - * @throws ReflectionException  | 
                                                        |
| 494 | - */  | 
                                                        |
| 495 | - public static function add_new_state()  | 
                                                        |
| 496 | -    { | 
                                                        |
| 497 | -        $REQ = EE_Registry::instance()->load_core('Request_Handler'); | 
                                                        |
| 498 | -        if (absint($REQ->get('nsmf_add_new_state')) === 1) { | 
                                                        |
| 499 | -            EE_Registry::instance()->load_model('State'); | 
                                                        |
| 500 | - // grab country ISO code, new state name, and new state abbreviation  | 
                                                        |
| 501 | -            $state_country = $REQ->is_set('nsmf_new_state_country') | 
                                                        |
| 502 | -                ? sanitize_text_field($REQ->get('nsmf_new_state_country')) | 
                                                        |
| 503 | - : false;  | 
                                                        |
| 504 | -            $state_name = $REQ->is_set('nsmf_new_state_name') | 
                                                        |
| 505 | -                ? sanitize_text_field($REQ->get('nsmf_new_state_name')) | 
                                                        |
| 506 | - : false;  | 
                                                        |
| 507 | -            $state_abbr = $REQ->is_set('nsmf_new_state_abbrv') | 
                                                        |
| 508 | -                ? sanitize_text_field($REQ->get('nsmf_new_state_abbrv')) | 
                                                        |
| 509 | - : false;  | 
                                                        |
| 510 | -            if ($state_country && $state_name && $state_abbr) { | 
                                                        |
| 511 | - $new_state = EED_Add_New_State::save_new_state_to_db(  | 
                                                        |
| 512 | - array(  | 
                                                        |
| 513 | - 'CNT_ISO' => strtoupper($state_country),  | 
                                                        |
| 514 | - 'STA_abbrev' => strtoupper($state_abbr),  | 
                                                        |
| 515 | - 'STA_name' => ucwords($state_name),  | 
                                                        |
| 516 | - 'STA_active' => false,  | 
                                                        |
| 517 | - )  | 
                                                        |
| 518 | - );  | 
                                                        |
| 519 | -                if ($new_state instanceof EE_State) { | 
                                                        |
| 520 | - // clean house  | 
                                                        |
| 521 | -                    EE_Registry::instance()->REQ->un_set('nsmf_add_new_state'); | 
                                                        |
| 522 | -                    EE_Registry::instance()->REQ->un_set('nsmf_new_state_country'); | 
                                                        |
| 523 | -                    EE_Registry::instance()->REQ->un_set('nsmf_new_state_name'); | 
                                                        |
| 524 | -                    EE_Registry::instance()->REQ->un_set('nsmf_new_state_abbrv'); | 
                                                        |
| 525 | - // get any existing new states  | 
                                                        |
| 526 | - $new_states = EE_Registry::instance()->SSN->get_session_data(  | 
                                                        |
| 527 | - 'nsmf_new_states'  | 
                                                        |
| 528 | - );  | 
                                                        |
| 529 | - $new_states[ $new_state->ID() ] = $new_state;  | 
                                                        |
| 530 | - EE_Registry::instance()->SSN->set_session_data(  | 
                                                        |
| 531 | -                        array('nsmf_new_states' => $new_states) | 
                                                        |
| 532 | - );  | 
                                                        |
| 533 | -                    if (EE_Registry::instance()->REQ->ajax) { | 
                                                        |
| 534 | - echo wp_json_encode(  | 
                                                        |
| 535 | - array(  | 
                                                        |
| 536 | - 'success' => true,  | 
                                                        |
| 537 | - 'id' => $new_state->ID(),  | 
                                                        |
| 538 | - 'name' => $new_state->name(),  | 
                                                        |
| 539 | - 'abbrev' => $new_state->abbrev(),  | 
                                                        |
| 540 | - 'country_iso' => $new_state->country_iso(),  | 
                                                        |
| 541 | - 'country_name' => $new_state->country()->name(),  | 
                                                        |
| 542 | - )  | 
                                                        |
| 543 | - );  | 
                                                        |
| 544 | - exit();  | 
                                                        |
| 545 | - }  | 
                                                        |
| 546 | - return $new_state->ID();  | 
                                                        |
| 547 | - }  | 
                                                        |
| 548 | -            } else { | 
                                                        |
| 549 | - $error = esc_html__(  | 
                                                        |
| 550 | - 'A new State/Province could not be added because invalid or missing data was received.',  | 
                                                        |
| 551 | - 'event_espresso'  | 
                                                        |
| 552 | - );  | 
                                                        |
| 553 | -                if (EE_Registry::instance()->REQ->ajax) { | 
                                                        |
| 554 | -                    echo wp_json_encode(array('error' => $error)); | 
                                                        |
| 555 | - exit();  | 
                                                        |
| 556 | - }  | 
                                                        |
| 557 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 558 | - }  | 
                                                        |
| 559 | - }  | 
                                                        |
| 560 | - return false;  | 
                                                        |
| 561 | - }  | 
                                                        |
| 562 | -  | 
                                                        |
| 563 | -  | 
                                                        |
| 564 | - /**  | 
                                                        |
| 565 | - * recursively drills down through request params to remove any that were added by this module  | 
                                                        |
| 566 | - *  | 
                                                        |
| 567 | - * @param array $request_params  | 
                                                        |
| 568 | - * @return array  | 
                                                        |
| 569 | - */  | 
                                                        |
| 570 | - public static function filter_checkout_request_params($request_params)  | 
                                                        |
| 571 | -    { | 
                                                        |
| 572 | -        foreach ($request_params as $form_section) { | 
                                                        |
| 573 | -            if (is_array($form_section)) { | 
                                                        |
| 574 | - EED_Add_New_State::unset_new_state_request_params($form_section);  | 
                                                        |
| 575 | - EED_Add_New_State::filter_checkout_request_params($form_section);  | 
                                                        |
| 576 | - }  | 
                                                        |
| 577 | - }  | 
                                                        |
| 578 | - return $request_params;  | 
                                                        |
| 579 | - }  | 
                                                        |
| 580 | -  | 
                                                        |
| 581 | -  | 
                                                        |
| 582 | - /**  | 
                                                        |
| 583 | - * @param array $request_params  | 
                                                        |
| 584 | - * @return array  | 
                                                        |
| 585 | - */  | 
                                                        |
| 586 | - public static function unset_new_state_request_params($request_params)  | 
                                                        |
| 587 | -    { | 
                                                        |
| 588 | - unset(  | 
                                                        |
| 589 | - $request_params['new_state_micro_form'],  | 
                                                        |
| 590 | - $request_params['new_state_micro_add_new_state'],  | 
                                                        |
| 591 | - $request_params['new_state_micro_new_state_country'],  | 
                                                        |
| 592 | - $request_params['new_state_micro_new_state_name'],  | 
                                                        |
| 593 | - $request_params['new_state_micro_new_state_abbrv']  | 
                                                        |
| 594 | - );  | 
                                                        |
| 595 | - return $request_params;  | 
                                                        |
| 596 | - }  | 
                                                        |
| 597 | -  | 
                                                        |
| 598 | -  | 
                                                        |
| 599 | - /**  | 
                                                        |
| 600 | - * @param array $props_n_values  | 
                                                        |
| 601 | - * @return bool  | 
                                                        |
| 602 | - * @throws EE_Error  | 
                                                        |
| 603 | - * @throws InvalidArgumentException  | 
                                                        |
| 604 | - * @throws InvalidDataTypeException  | 
                                                        |
| 605 | - * @throws InvalidInterfaceException  | 
                                                        |
| 606 | - */  | 
                                                        |
| 607 | - public static function save_new_state_to_db($props_n_values = array())  | 
                                                        |
| 608 | -    { | 
                                                        |
| 609 | - $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1));  | 
                                                        |
| 610 | -        if (! empty($existing_state)) { | 
                                                        |
| 611 | - return array_pop($existing_state);  | 
                                                        |
| 612 | - }  | 
                                                        |
| 613 | - $new_state = EE_State::new_instance($props_n_values);  | 
                                                        |
| 614 | -        if ($new_state instanceof EE_State) { | 
                                                        |
| 615 | - $country_settings_url = add_query_arg(  | 
                                                        |
| 616 | - array(  | 
                                                        |
| 617 | - 'page' => 'espresso_general_settings',  | 
                                                        |
| 618 | - 'action' => 'country_settings',  | 
                                                        |
| 619 | - 'country' => $new_state->country_iso(),  | 
                                                        |
| 620 | - ),  | 
                                                        |
| 621 | -                admin_url('admin.php') | 
                                                        |
| 622 | - );  | 
                                                        |
| 623 | - // if not non-ajax admin  | 
                                                        |
| 624 | - new PersistentAdminNotice(  | 
                                                        |
| 625 | - 'new-state-added-' . $new_state->country_iso() . '-' . $new_state->abbrev(),  | 
                                                        |
| 626 | - sprintf(  | 
                                                        |
| 627 | - esc_html__(  | 
                                                        |
| 628 | - 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.',  | 
                                                        |
| 629 | - 'event_espresso'  | 
                                                        |
| 630 | - ),  | 
                                                        |
| 631 | - '<b>' . $new_state->name() . '</b>',  | 
                                                        |
| 632 | - '<b>' . $new_state->abbrev() . '</b>',  | 
                                                        |
| 633 | - '<b>' . $new_state->country()->name() . '</b>',  | 
                                                        |
| 634 | - '<a href="'  | 
                                                        |
| 635 | - . $country_settings_url  | 
                                                        |
| 636 | - . '">'  | 
                                                        |
| 637 | - . esc_html__(  | 
                                                        |
| 638 | - 'Event Espresso - General Settings > Countries Tab',  | 
                                                        |
| 639 | - 'event_espresso'  | 
                                                        |
| 640 | - )  | 
                                                        |
| 641 | - . '</a>',  | 
                                                        |
| 642 | - '<br />'  | 
                                                        |
| 643 | - )  | 
                                                        |
| 644 | - );  | 
                                                        |
| 645 | - $new_state->save();  | 
                                                        |
| 646 | - EEM_State::instance()->reset_cached_states();  | 
                                                        |
| 647 | - return $new_state;  | 
                                                        |
| 648 | - }  | 
                                                        |
| 649 | - return false;  | 
                                                        |
| 650 | - }  | 
                                                        |
| 651 | -  | 
                                                        |
| 652 | -  | 
                                                        |
| 653 | - /**  | 
                                                        |
| 654 | - * @param string $CNT_ISO  | 
                                                        |
| 655 | - * @param string $STA_ID  | 
                                                        |
| 656 | - * @param array $cols_n_values  | 
                                                        |
| 657 | - * @return void  | 
                                                        |
| 658 | - * @throws DomainException  | 
                                                        |
| 659 | - * @throws EE_Error  | 
                                                        |
| 660 | - * @throws InvalidArgumentException  | 
                                                        |
| 661 | - * @throws InvalidDataTypeException  | 
                                                        |
| 662 | - * @throws InvalidInterfaceException  | 
                                                        |
| 663 | - */  | 
                                                        |
| 664 | - public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array())  | 
                                                        |
| 665 | -    { | 
                                                        |
| 666 | -        if (! $CNT_ISO) { | 
                                                        |
| 667 | - EE_Error::add_error(  | 
                                                        |
| 668 | -                esc_html__('An invalid or missing Country ISO Code was received.', 'event_espresso'), | 
                                                        |
| 669 | - __FILE__,  | 
                                                        |
| 670 | - __FUNCTION__,  | 
                                                        |
| 671 | - __LINE__  | 
                                                        |
| 672 | - );  | 
                                                        |
| 673 | - }  | 
                                                        |
| 674 | - $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev']  | 
                                                        |
| 675 | - : false;  | 
                                                        |
| 676 | -        if (! $STA_abbrev && ! empty($STA_ID)) { | 
                                                        |
| 677 | - $state = EEM_State::instance()->get_one_by_ID($STA_ID);  | 
                                                        |
| 678 | -            if ($state instanceof EE_State) { | 
                                                        |
| 679 | - $STA_abbrev = $state->abbrev();  | 
                                                        |
| 680 | - }  | 
                                                        |
| 681 | - }  | 
                                                        |
| 682 | -        if (! $STA_abbrev) { | 
                                                        |
| 683 | - EE_Error::add_error(  | 
                                                        |
| 684 | -                esc_html__('An invalid or missing State Abbreviation was received.', 'event_espresso'), | 
                                                        |
| 685 | - __FILE__,  | 
                                                        |
| 686 | - __FUNCTION__,  | 
                                                        |
| 687 | - __LINE__  | 
                                                        |
| 688 | - );  | 
                                                        |
| 689 | - }  | 
                                                        |
| 690 | - /** @var PersistentAdminNoticeManager $persistent_admin_notice_manager */  | 
                                                        |
| 691 | - $persistent_admin_notice_manager = LoaderFactory::getLoader()->getShared(  | 
                                                        |
| 692 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'  | 
                                                        |
| 693 | - );  | 
                                                        |
| 694 | - $persistent_admin_notice_manager->dismissNotice($CNT_ISO . '-' . $STA_abbrev, true, true);  | 
                                                        |
| 695 | - }  | 
                                                        |
| 696 | -  | 
                                                        |
| 697 | -  | 
                                                        |
| 698 | - /**  | 
                                                        |
| 699 | - * @param EE_State[] $state_options  | 
                                                        |
| 700 | - * @param EE_SPCO_Reg_Step_Attendee_Information|StateOptions $deprecated  | 
                                                        |
| 701 | - * @param EE_Registration $registration  | 
                                                        |
| 702 | - * @param EE_Question $question  | 
                                                        |
| 703 | - * @param $answer  | 
                                                        |
| 704 | - * @return array  | 
                                                        |
| 705 | - * @throws EE_Error  | 
                                                        |
| 706 | - * @throws InvalidArgumentException  | 
                                                        |
| 707 | - * @throws InvalidDataTypeException  | 
                                                        |
| 708 | - * @throws InvalidInterfaceException  | 
                                                        |
| 709 | - */  | 
                                                        |
| 710 | - public static function inject_new_reg_state_into_options(  | 
                                                        |
| 711 | - $state_options = array(),  | 
                                                        |
| 712 | - $deprecated,  | 
                                                        |
| 713 | - EE_Registration $registration,  | 
                                                        |
| 714 | - EE_Question $question,  | 
                                                        |
| 715 | - $answer  | 
                                                        |
| 716 | -    ) { | 
                                                        |
| 717 | - if (  | 
                                                        |
| 718 | - $answer instanceof EE_Answer && $question instanceof EE_Question  | 
                                                        |
| 719 | - && $question->type() === EEM_Question::QST_type_state  | 
                                                        |
| 720 | -        ) { | 
                                                        |
| 721 | - $STA_ID = $answer->value();  | 
                                                        |
| 722 | -            if (! empty($STA_ID)) { | 
                                                        |
| 723 | - $state = EEM_State::instance()->get_one_by_ID($STA_ID);  | 
                                                        |
| 724 | -                if ($state instanceof EE_State) { | 
                                                        |
| 725 | - $country = $state->country();  | 
                                                        |
| 726 | -                    if ($country instanceof EE_Country) { | 
                                                        |
| 727 | -                        if (! isset($state_options[ $country->name() ])) { | 
                                                        |
| 728 | - $state_options[ $country->name() ] = array();  | 
                                                        |
| 729 | - }  | 
                                                        |
| 730 | -                        if (! isset($state_options[ $country->name() ][ $STA_ID ])) { | 
                                                        |
| 731 | - $state_options[ $country->name() ][ $STA_ID ] = $state->name();  | 
                                                        |
| 732 | - }  | 
                                                        |
| 733 | - }  | 
                                                        |
| 734 | - }  | 
                                                        |
| 735 | - }  | 
                                                        |
| 736 | - }  | 
                                                        |
| 737 | - return $state_options;  | 
                                                        |
| 738 | - }  | 
                                                        |
| 739 | -  | 
                                                        |
| 740 | -  | 
                                                        |
| 741 | - /**  | 
                                                        |
| 742 | - * @param EE_Country[] $country_options  | 
                                                        |
| 743 | - * @param EE_SPCO_Reg_Step_Attendee_Information|CountryOptions $deprecated  | 
                                                        |
| 744 | - * @param EE_Registration $registration  | 
                                                        |
| 745 | - * @param EE_Question $question  | 
                                                        |
| 746 | - * @param $answer  | 
                                                        |
| 747 | - * @return array  | 
                                                        |
| 748 | - * @throws EE_Error  | 
                                                        |
| 749 | - * @throws InvalidArgumentException  | 
                                                        |
| 750 | - * @throws InvalidDataTypeException  | 
                                                        |
| 751 | - * @throws InvalidInterfaceException  | 
                                                        |
| 752 | - * @throws ReflectionException  | 
                                                        |
| 753 | - */  | 
                                                        |
| 754 | - public static function inject_new_reg_country_into_options(  | 
                                                        |
| 755 | - $country_options = array(),  | 
                                                        |
| 756 | - $deprecated,  | 
                                                        |
| 757 | - EE_Registration $registration,  | 
                                                        |
| 758 | - EE_Question $question,  | 
                                                        |
| 759 | - $answer  | 
                                                        |
| 760 | -    ) { | 
                                                        |
| 761 | - if (  | 
                                                        |
| 762 | - $answer instanceof EE_Answer && $question instanceof EE_Question  | 
                                                        |
| 763 | - && $question->type() === EEM_Question::QST_type_country  | 
                                                        |
| 764 | -        ) { | 
                                                        |
| 765 | - $CNT_ISO = $answer->value();  | 
                                                        |
| 766 | -            if (! empty($CNT_ISO)) { | 
                                                        |
| 767 | - $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);  | 
                                                        |
| 768 | -                if ($country instanceof EE_Country) { | 
                                                        |
| 769 | -                    if (! isset($country_options[ $CNT_ISO ])) { | 
                                                        |
| 770 | - $country_options[ $CNT_ISO ] = $country->name();  | 
                                                        |
| 771 | - }  | 
                                                        |
| 772 | - }  | 
                                                        |
| 773 | - }  | 
                                                        |
| 774 | - }  | 
                                                        |
| 775 | - return $country_options;  | 
                                                        |
| 776 | - }  | 
                                                        |
| 777 | -  | 
                                                        |
| 778 | -  | 
                                                        |
| 779 | - /**  | 
                                                        |
| 780 | - * @param EE_State[] $state_options  | 
                                                        |
| 781 | - * @return array  | 
                                                        |
| 782 | - * @throws EE_Error  | 
                                                        |
| 783 | - * @throws InvalidArgumentException  | 
                                                        |
| 784 | - * @throws InvalidDataTypeException  | 
                                                        |
| 785 | - * @throws InvalidInterfaceException  | 
                                                        |
| 786 | - */  | 
                                                        |
| 787 | - public static function state_options($state_options = array())  | 
                                                        |
| 788 | -    { | 
                                                        |
| 789 | - $new_states = EED_Add_New_State::_get_new_states();  | 
                                                        |
| 790 | -        foreach ($new_states as $new_state) { | 
                                                        |
| 791 | - if (  | 
                                                        |
| 792 | - $new_state instanceof EE_State  | 
                                                        |
| 793 | - && $new_state->country() instanceof EE_Country  | 
                                                        |
| 794 | -            ) { | 
                                                        |
| 795 | - $state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name();  | 
                                                        |
| 796 | - }  | 
                                                        |
| 797 | - }  | 
                                                        |
| 798 | - return $state_options;  | 
                                                        |
| 799 | - }  | 
                                                        |
| 800 | -  | 
                                                        |
| 801 | -  | 
                                                        |
| 802 | - /**  | 
                                                        |
| 803 | - * @return array  | 
                                                        |
| 804 | - * @throws InvalidArgumentException  | 
                                                        |
| 805 | - * @throws InvalidDataTypeException  | 
                                                        |
| 806 | - * @throws InvalidInterfaceException  | 
                                                        |
| 807 | - */  | 
                                                        |
| 808 | - protected static function _get_new_states()  | 
                                                        |
| 809 | -    { | 
                                                        |
| 810 | - $new_states = array();  | 
                                                        |
| 811 | -        if (EE_Registry::instance()->SSN instanceof EE_Session) { | 
                                                        |
| 812 | - $new_states = EE_Registry::instance()->SSN->get_session_data(  | 
                                                        |
| 813 | - 'nsmf_new_states'  | 
                                                        |
| 814 | - );  | 
                                                        |
| 815 | - }  | 
                                                        |
| 816 | - return is_array($new_states) ? $new_states : array();  | 
                                                        |
| 817 | - }  | 
                                                        |
| 818 | -  | 
                                                        |
| 819 | -  | 
                                                        |
| 820 | - /**  | 
                                                        |
| 821 | - * @param EE_Country[] $country_options  | 
                                                        |
| 822 | - * @return array  | 
                                                        |
| 823 | - * @throws EE_Error  | 
                                                        |
| 824 | - * @throws InvalidArgumentException  | 
                                                        |
| 825 | - * @throws InvalidDataTypeException  | 
                                                        |
| 826 | - * @throws InvalidInterfaceException  | 
                                                        |
| 827 | - */  | 
                                                        |
| 828 | - public static function country_options($country_options = array())  | 
                                                        |
| 829 | -    { | 
                                                        |
| 830 | - $new_states = EED_Add_New_State::_get_new_states();  | 
                                                        |
| 831 | -        foreach ($new_states as $new_state) { | 
                                                        |
| 832 | - if (  | 
                                                        |
| 833 | - $new_state instanceof EE_State  | 
                                                        |
| 834 | - && $new_state->country() instanceof EE_Country  | 
                                                        |
| 835 | -            ) { | 
                                                        |
| 836 | - $country_options[ $new_state->country()->ID() ] = $new_state->country()->name();  | 
                                                        |
| 837 | - }  | 
                                                        |
| 838 | - }  | 
                                                        |
| 839 | - return $country_options;  | 
                                                        |
| 840 | - }  | 
                                                        |
| 22 | + /**  | 
                                                        |
| 23 | + * @return EED_Module|EED_Add_New_State  | 
                                                        |
| 24 | + */  | 
                                                        |
| 25 | + public static function instance()  | 
                                                        |
| 26 | +	{ | 
                                                        |
| 27 | + return parent::get_instance(__CLASS__);  | 
                                                        |
| 28 | + }  | 
                                                        |
| 29 | +  | 
                                                        |
| 30 | +  | 
                                                        |
| 31 | + /**  | 
                                                        |
| 32 | + * set_hooks - for hooking into EE Core, other modules, etc  | 
                                                        |
| 33 | + *  | 
                                                        |
| 34 | + * @return void  | 
                                                        |
| 35 | + */  | 
                                                        |
| 36 | + public static function set_hooks()  | 
                                                        |
| 37 | +	{ | 
                                                        |
| 38 | +		add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); | 
                                                        |
| 39 | +		add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0); | 
                                                        |
| 40 | +		add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10); | 
                                                        |
| 41 | + add_filter(  | 
                                                        |
| 42 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',  | 
                                                        |
| 43 | +			array('EED_Add_New_State', 'display_add_new_state_micro_form'), | 
                                                        |
| 44 | + 1,  | 
                                                        |
| 45 | + 1  | 
                                                        |
| 46 | + );  | 
                                                        |
| 47 | + add_filter(  | 
                                                        |
| 48 | + 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form',  | 
                                                        |
| 49 | +			array('EED_Add_New_State', 'display_add_new_state_micro_form'), | 
                                                        |
| 50 | + 1,  | 
                                                        |
| 51 | + 1  | 
                                                        |
| 52 | + );  | 
                                                        |
| 53 | + add_filter(  | 
                                                        |
| 54 | + 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',  | 
                                                        |
| 55 | +			array('EED_Add_New_State', 'unset_new_state_request_params'), | 
                                                        |
| 56 | + 10,  | 
                                                        |
| 57 | + 1  | 
                                                        |
| 58 | + );  | 
                                                        |
| 59 | + add_filter(  | 
                                                        |
| 60 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options',  | 
                                                        |
| 61 | +			array('EED_Add_New_State', 'inject_new_reg_state_into_options'), | 
                                                        |
| 62 | + 10,  | 
                                                        |
| 63 | + 5  | 
                                                        |
| 64 | + );  | 
                                                        |
| 65 | + add_filter(  | 
                                                        |
| 66 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options',  | 
                                                        |
| 67 | +			array('EED_Add_New_State', 'inject_new_reg_country_into_options'), | 
                                                        |
| 68 | + 10,  | 
                                                        |
| 69 | + 5  | 
                                                        |
| 70 | + );  | 
                                                        |
| 71 | + add_filter(  | 
                                                        |
| 72 | + 'FHEE__EE_State_Select_Input____construct__state_options',  | 
                                                        |
| 73 | +			array('EED_Add_New_State', 'state_options'), | 
                                                        |
| 74 | + 10,  | 
                                                        |
| 75 | + 1  | 
                                                        |
| 76 | + );  | 
                                                        |
| 77 | + add_filter(  | 
                                                        |
| 78 | + 'FHEE__EE_Country_Select_Input____construct__country_options',  | 
                                                        |
| 79 | +			array('EED_Add_New_State', 'country_options'), | 
                                                        |
| 80 | + 10,  | 
                                                        |
| 81 | + 1  | 
                                                        |
| 82 | + );  | 
                                                        |
| 83 | + }  | 
                                                        |
| 84 | +  | 
                                                        |
| 85 | +  | 
                                                        |
| 86 | + /**  | 
                                                        |
| 87 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc  | 
                                                        |
| 88 | + *  | 
                                                        |
| 89 | + * @return void  | 
                                                        |
| 90 | + */  | 
                                                        |
| 91 | + public static function set_hooks_admin()  | 
                                                        |
| 92 | +	{ | 
                                                        |
| 93 | +		add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); | 
                                                        |
| 94 | + add_filter(  | 
                                                        |
| 95 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',  | 
                                                        |
| 96 | +			array('EED_Add_New_State', 'display_add_new_state_micro_form'), | 
                                                        |
| 97 | + 1,  | 
                                                        |
| 98 | + 1  | 
                                                        |
| 99 | + );  | 
                                                        |
| 100 | + add_filter(  | 
                                                        |
| 101 | + 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form',  | 
                                                        |
| 102 | +			array('EED_Add_New_State', 'display_add_new_state_micro_form'), | 
                                                        |
| 103 | + 1,  | 
                                                        |
| 104 | + 1  | 
                                                        |
| 105 | + );  | 
                                                        |
| 106 | +		add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); | 
                                                        |
| 107 | +		add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); | 
                                                        |
| 108 | + add_filter(  | 
                                                        |
| 109 | + 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',  | 
                                                        |
| 110 | +			array('EED_Add_New_State', 'unset_new_state_request_params'), | 
                                                        |
| 111 | + 10,  | 
                                                        |
| 112 | + 1  | 
                                                        |
| 113 | + );  | 
                                                        |
| 114 | + add_action(  | 
                                                        |
| 115 | + 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved',  | 
                                                        |
| 116 | +			array('EED_Add_New_State', 'update_country_settings'), | 
                                                        |
| 117 | + 10,  | 
                                                        |
| 118 | + 3  | 
                                                        |
| 119 | + );  | 
                                                        |
| 120 | + add_action(  | 
                                                        |
| 121 | + 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted',  | 
                                                        |
| 122 | +			array('EED_Add_New_State', 'update_country_settings'), | 
                                                        |
| 123 | + 10,  | 
                                                        |
| 124 | + 3  | 
                                                        |
| 125 | + );  | 
                                                        |
| 126 | + add_filter(  | 
                                                        |
| 127 | + 'FHEE__EE_State_Select_Input____construct__state_options',  | 
                                                        |
| 128 | +			array('EED_Add_New_State', 'state_options'), | 
                                                        |
| 129 | + 10,  | 
                                                        |
| 130 | + 1  | 
                                                        |
| 131 | + );  | 
                                                        |
| 132 | + add_filter(  | 
                                                        |
| 133 | + 'FHEE__EE_Country_Select_Input____construct__country_options',  | 
                                                        |
| 134 | +			array('EED_Add_New_State', 'country_options'), | 
                                                        |
| 135 | + 10,  | 
                                                        |
| 136 | + 1  | 
                                                        |
| 137 | + );  | 
                                                        |
| 138 | + add_filter(  | 
                                                        |
| 139 | + 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data',  | 
                                                        |
| 140 | +			array('EED_Add_New_State', 'filter_checkout_request_params'), | 
                                                        |
| 141 | + 10,  | 
                                                        |
| 142 | + 1  | 
                                                        |
| 143 | + );  | 
                                                        |
| 144 | + add_filter(  | 
                                                        |
| 145 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options',  | 
                                                        |
| 146 | +			array('EED_Add_New_State', 'inject_new_reg_state_into_options'), | 
                                                        |
| 147 | + 10,  | 
                                                        |
| 148 | + 5  | 
                                                        |
| 149 | + );  | 
                                                        |
| 150 | + add_filter(  | 
                                                        |
| 151 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options',  | 
                                                        |
| 152 | +			array('EED_Add_New_State', 'inject_new_reg_country_into_options'), | 
                                                        |
| 153 | + 10,  | 
                                                        |
| 154 | + 5  | 
                                                        |
| 155 | + );  | 
                                                        |
| 156 | + }  | 
                                                        |
| 157 | +  | 
                                                        |
| 158 | +  | 
                                                        |
| 159 | + /**  | 
                                                        |
| 160 | + * @return void  | 
                                                        |
| 161 | + */  | 
                                                        |
| 162 | + public static function set_definitions()  | 
                                                        |
| 163 | +	{ | 
                                                        |
| 164 | +		define('ANS_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/'); | 
                                                        |
| 165 | + define(  | 
                                                        |
| 166 | + 'ANS_TEMPLATES_PATH',  | 
                                                        |
| 167 | + str_replace(  | 
                                                        |
| 168 | + '\\',  | 
                                                        |
| 169 | + '/',  | 
                                                        |
| 170 | + plugin_dir_path(__FILE__)  | 
                                                        |
| 171 | + ) . 'templates/'  | 
                                                        |
| 172 | + );  | 
                                                        |
| 173 | + }  | 
                                                        |
| 174 | +  | 
                                                        |
| 175 | +  | 
                                                        |
| 176 | + /**  | 
                                                        |
| 177 | + * @param WP $WP  | 
                                                        |
| 178 | + * @return void  | 
                                                        |
| 179 | + */  | 
                                                        |
| 180 | + public function run($WP)  | 
                                                        |
| 181 | +	{ | 
                                                        |
| 182 | + }  | 
                                                        |
| 183 | +  | 
                                                        |
| 184 | +  | 
                                                        |
| 185 | + /**  | 
                                                        |
| 186 | + * @return void  | 
                                                        |
| 187 | + */  | 
                                                        |
| 188 | + public static function translate_js_strings()  | 
                                                        |
| 189 | +	{ | 
                                                        |
| 190 | + EE_Registry::$i18n_js_strings['ans_no_country'] = esc_html__(  | 
                                                        |
| 191 | + 'In order to proceed, you need to select the Country that your State/Province belongs to.',  | 
                                                        |
| 192 | + 'event_espresso'  | 
                                                        |
| 193 | + );  | 
                                                        |
| 194 | + EE_Registry::$i18n_js_strings['ans_no_name'] = esc_html__(  | 
                                                        |
| 195 | + 'In order to proceed, you need to enter the name of your State/Province.',  | 
                                                        |
| 196 | + 'event_espresso'  | 
                                                        |
| 197 | + );  | 
                                                        |
| 198 | + EE_Registry::$i18n_js_strings['ans_no_abbreviation'] = esc_html__(  | 
                                                        |
| 199 | + 'In order to proceed, you need to enter an abbreviation for the name of your State/Province.',  | 
                                                        |
| 200 | + 'event_espresso'  | 
                                                        |
| 201 | + );  | 
                                                        |
| 202 | + EE_Registry::$i18n_js_strings['ans_save_success'] = esc_html__(  | 
                                                        |
| 203 | + 'The new state was successfully saved to the database.',  | 
                                                        |
| 204 | + 'event_espresso'  | 
                                                        |
| 205 | + );  | 
                                                        |
| 206 | + EE_Registry::$i18n_js_strings['ans_server_save_error'] = esc_html__(  | 
                                                        |
| 207 | + 'An unknown error has occurred on the server while saving the new state to the database.',  | 
                                                        |
| 208 | + 'event_espresso'  | 
                                                        |
| 209 | + );  | 
                                                        |
| 210 | + }  | 
                                                        |
| 211 | +  | 
                                                        |
| 212 | +  | 
                                                        |
| 213 | + /**  | 
                                                        |
| 214 | + * @return void  | 
                                                        |
| 215 | + */  | 
                                                        |
| 216 | + public static function wp_enqueue_scripts()  | 
                                                        |
| 217 | +	{ | 
                                                        |
| 218 | +		if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { | 
                                                        |
| 219 | + wp_register_script(  | 
                                                        |
| 220 | + 'add_new_state',  | 
                                                        |
| 221 | + ANS_ASSETS_URL . 'add_new_state.js',  | 
                                                        |
| 222 | +				array('espresso_core', 'single_page_checkout'), | 
                                                        |
| 223 | + EVENT_ESPRESSO_VERSION,  | 
                                                        |
| 224 | + true  | 
                                                        |
| 225 | + );  | 
                                                        |
| 226 | +			wp_enqueue_script('add_new_state'); | 
                                                        |
| 227 | + }  | 
                                                        |
| 228 | + }  | 
                                                        |
| 229 | +  | 
                                                        |
| 230 | +  | 
                                                        |
| 231 | +  | 
                                                        |
| 232 | + /**  | 
                                                        |
| 233 | + * display_add_new_state_micro_form  | 
                                                        |
| 234 | + *  | 
                                                        |
| 235 | + * @param EE_Form_Section_Proper $question_group_reg_form  | 
                                                        |
| 236 | + * @return string  | 
                                                        |
| 237 | + * @throws EE_Error  | 
                                                        |
| 238 | + * @throws InvalidArgumentException  | 
                                                        |
| 239 | + * @throws InvalidDataTypeException  | 
                                                        |
| 240 | + * @throws InvalidInterfaceException  | 
                                                        |
| 241 | + */  | 
                                                        |
| 242 | + public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form)  | 
                                                        |
| 243 | +	{ | 
                                                        |
| 244 | + // only add the 'new_state_micro_form' when displaying reg forms,  | 
                                                        |
| 245 | + // not during processing since we process the 'new_state_micro_form' in it's own AJAX request  | 
                                                        |
| 246 | +		$action = EE_Registry::instance()->REQ->get('action', ''); | 
                                                        |
| 247 | + // is the "state" question in this form section?  | 
                                                        |
| 248 | +		$input = $question_group_reg_form->get_subsection('state'); | 
                                                        |
| 249 | +		if ($action === 'process_reg_step' || $action === 'update_reg_step') { | 
                                                        |
| 250 | + // ok then all we need to do is make sure the input's HTML name is consistent  | 
                                                        |
| 251 | + // by forcing it to set it now, like it did while getting the form for display  | 
                                                        |
| 252 | +			if ($input instanceof EE_State_Select_Input) { | 
                                                        |
| 253 | + $input->html_name();  | 
                                                        |
| 254 | + }  | 
                                                        |
| 255 | + return $question_group_reg_form;  | 
                                                        |
| 256 | + }  | 
                                                        |
| 257 | + // we're only doing this for state select inputs  | 
                                                        |
| 258 | + if (  | 
                                                        |
| 259 | + $input instanceof EE_State_Select_Input  | 
                                                        |
| 260 | + && ! $input->get_display_strategy() instanceof EE_Hidden_Display_Strategy  | 
                                                        |
| 261 | +		) { | 
                                                        |
| 262 | + // grab any set values from the request  | 
                                                        |
| 263 | +			$country_name = str_replace('state', 'nsmf_new_state_country', $input->html_name()); | 
                                                        |
| 264 | +			$state_name = str_replace('state', 'nsmf_new_state_name', $input->html_name()); | 
                                                        |
| 265 | +			$abbrv_name = str_replace('state', 'nsmf_new_state_abbrv', $input->html_name()); | 
                                                        |
| 266 | +			$new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); | 
                                                        |
| 267 | + $country_options = array();  | 
                                                        |
| 268 | + $countries = EEM_Country::instance()->get_all_countries();  | 
                                                        |
| 269 | +			if (! empty($countries)) { | 
                                                        |
| 270 | +				foreach ($countries as $country) { | 
                                                        |
| 271 | +					if ($country instanceof EE_Country) { | 
                                                        |
| 272 | + $country_options[ $country->ID() ] = $country->name();  | 
                                                        |
| 273 | + }  | 
                                                        |
| 274 | + }  | 
                                                        |
| 275 | + }  | 
                                                        |
| 276 | + $new_state_micro_form = new EE_Form_Section_Proper(  | 
                                                        |
| 277 | + array(  | 
                                                        |
| 278 | + 'name' => 'new_state_micro_form',  | 
                                                        |
| 279 | + 'html_id' => 'new_state_micro_form',  | 
                                                        |
| 280 | + 'layout_strategy' => new EE_Div_Per_Section_Layout(),  | 
                                                        |
| 281 | + 'subsections' => array(  | 
                                                        |
| 282 | + // add hidden input to indicate that a new state is being added  | 
                                                        |
| 283 | + 'add_new_state' => new EE_Hidden_Input(  | 
                                                        |
| 284 | + array(  | 
                                                        |
| 285 | + 'html_name' => str_replace(  | 
                                                        |
| 286 | + 'state',  | 
                                                        |
| 287 | + 'nsmf_add_new_state',  | 
                                                        |
| 288 | + $input->html_name()  | 
                                                        |
| 289 | + ),  | 
                                                        |
| 290 | + 'html_id' => str_replace(  | 
                                                        |
| 291 | + 'state',  | 
                                                        |
| 292 | + 'nsmf_add_new_state',  | 
                                                        |
| 293 | + $input->html_id()  | 
                                                        |
| 294 | + ),  | 
                                                        |
| 295 | + 'default' => 0,  | 
                                                        |
| 296 | + )  | 
                                                        |
| 297 | + ),  | 
                                                        |
| 298 | + // add link for displaying hidden container  | 
                                                        |
| 299 | + 'click_here_link' => new EE_Form_Section_HTML(  | 
                                                        |
| 300 | + apply_filters(  | 
                                                        |
| 301 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__click_here_link',  | 
                                                        |
| 302 | + EEH_HTML::link(  | 
                                                        |
| 303 | + '',  | 
                                                        |
| 304 | +									esc_html__('click here to add a new state/province', 'event_espresso'), | 
                                                        |
| 305 | + '',  | 
                                                        |
| 306 | + 'display-' . $input->html_id(),  | 
                                                        |
| 307 | + 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js',  | 
                                                        |
| 308 | + '',  | 
                                                        |
| 309 | + 'data-target="' . $input->html_id() . '"'  | 
                                                        |
| 310 | + )  | 
                                                        |
| 311 | + )  | 
                                                        |
| 312 | + ),  | 
                                                        |
| 313 | + // add initial html for hidden container  | 
                                                        |
| 314 | + 'add_new_state_micro_form' => new EE_Form_Section_HTML(  | 
                                                        |
| 315 | + apply_filters(  | 
                                                        |
| 316 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form',  | 
                                                        |
| 317 | + EEH_HTML::div(  | 
                                                        |
| 318 | + '',  | 
                                                        |
| 319 | + $input->html_id() . '-dv',  | 
                                                        |
| 320 | + 'ee-form-add-new-state-dv',  | 
                                                        |
| 321 | + 'display: none;'  | 
                                                        |
| 322 | + ) .  | 
                                                        |
| 323 | + EEH_HTML::h6(  | 
                                                        |
| 324 | + esc_html__(  | 
                                                        |
| 325 | + 'Is your state/province missing from the dropdown menu above? You can add it by completing the following steps:',  | 
                                                        |
| 326 | + 'event_espresso'  | 
                                                        |
| 327 | + )  | 
                                                        |
| 328 | + ) .  | 
                                                        |
| 329 | + EEH_HTML::ul() .  | 
                                                        |
| 330 | + EEH_HTML::li(  | 
                                                        |
| 331 | + esc_html__(  | 
                                                        |
| 332 | + 'first select the Country that your State/Province belongs to',  | 
                                                        |
| 333 | + 'event_espresso'  | 
                                                        |
| 334 | + )  | 
                                                        |
| 335 | + ) .  | 
                                                        |
| 336 | + EEH_HTML::li(  | 
                                                        |
| 337 | +									esc_html__('enter the name of your State/Province', 'event_espresso') | 
                                                        |
| 338 | + ) .  | 
                                                        |
| 339 | + EEH_HTML::li(  | 
                                                        |
| 340 | + esc_html__(  | 
                                                        |
| 341 | + 'enter a two to six letter abbreviation for the name of your State/Province',  | 
                                                        |
| 342 | + 'event_espresso'  | 
                                                        |
| 343 | + )  | 
                                                        |
| 344 | + ) .  | 
                                                        |
| 345 | +								EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')) . | 
                                                        |
| 346 | + EEH_HTML::ulx()  | 
                                                        |
| 347 | + )  | 
                                                        |
| 348 | + ),  | 
                                                        |
| 349 | + // NEW STATE COUNTRY  | 
                                                        |
| 350 | + 'new_state_country' => new EE_Country_Select_Input(  | 
                                                        |
| 351 | + $country_options,  | 
                                                        |
| 352 | + array(  | 
                                                        |
| 353 | + 'html_name' => $country_name,  | 
                                                        |
| 354 | + 'html_id' => str_replace(  | 
                                                        |
| 355 | + 'state',  | 
                                                        |
| 356 | + 'nsmf_new_state_country',  | 
                                                        |
| 357 | + $input->html_id()  | 
                                                        |
| 358 | + ),  | 
                                                        |
| 359 | + 'html_class' => $input->html_class() . ' new-state-country',  | 
                                                        |
| 360 | +								'html_label_text' => esc_html__('New State/Province Country', 'event_espresso'), | 
                                                        |
| 361 | + 'default' => EE_Registry::instance()->REQ->get($country_name, ''),  | 
                                                        |
| 362 | + 'required' => false,  | 
                                                        |
| 363 | + )  | 
                                                        |
| 364 | + ),  | 
                                                        |
| 365 | + // NEW STATE NAME  | 
                                                        |
| 366 | + 'new_state_name' => new EE_Text_Input(  | 
                                                        |
| 367 | + array(  | 
                                                        |
| 368 | + 'html_name' => $state_name,  | 
                                                        |
| 369 | + 'html_id' => str_replace(  | 
                                                        |
| 370 | + 'state',  | 
                                                        |
| 371 | + 'nsmf_new_state_name',  | 
                                                        |
| 372 | + $input->html_id()  | 
                                                        |
| 373 | + ),  | 
                                                        |
| 374 | + 'html_class' => $input->html_class() . ' new-state-state',  | 
                                                        |
| 375 | + 'html_label_text' => esc_html__(  | 
                                                        |
| 376 | + 'New State/Province Name',  | 
                                                        |
| 377 | + 'event_espresso'  | 
                                                        |
| 378 | + ),  | 
                                                        |
| 379 | + 'default' => EE_Registry::instance()->REQ->get($state_name, ''),  | 
                                                        |
| 380 | + 'required' => false,  | 
                                                        |
| 381 | + )  | 
                                                        |
| 382 | + ),  | 
                                                        |
| 383 | + 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()),  | 
                                                        |
| 384 | + // NEW STATE NAME  | 
                                                        |
| 385 | + 'new_state_abbrv' => new EE_Text_Input(  | 
                                                        |
| 386 | + array(  | 
                                                        |
| 387 | + 'html_name' => $abbrv_name,  | 
                                                        |
| 388 | + 'html_id' => str_replace(  | 
                                                        |
| 389 | + 'state',  | 
                                                        |
| 390 | + 'nsmf_new_state_abbrv',  | 
                                                        |
| 391 | + $input->html_id()  | 
                                                        |
| 392 | + ),  | 
                                                        |
| 393 | + 'html_class' => $input->html_class() . ' new-state-abbrv',  | 
                                                        |
| 394 | + 'html_label_text' => esc_html__(  | 
                                                        |
| 395 | + 'New State/Province Abbreviation',  | 
                                                        |
| 396 | + 'event_espresso'  | 
                                                        |
| 397 | + ) . ' *',  | 
                                                        |
| 398 | + 'other_html_attributes' => 'size="24"',  | 
                                                        |
| 399 | + 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''),  | 
                                                        |
| 400 | + 'required' => false,  | 
                                                        |
| 401 | + )  | 
                                                        |
| 402 | + ),  | 
                                                        |
| 403 | + // "submit" button  | 
                                                        |
| 404 | + 'add_new_state_submit_button' => new EE_Form_Section_HTML(  | 
                                                        |
| 405 | + apply_filters(  | 
                                                        |
| 406 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button',  | 
                                                        |
| 407 | + EEH_HTML::nbsp(3) .  | 
                                                        |
| 408 | + EEH_HTML::link(  | 
                                                        |
| 409 | + '',  | 
                                                        |
| 410 | +									esc_html__('ADD', 'event_espresso'), | 
                                                        |
| 411 | + '',  | 
                                                        |
| 412 | + 'submit-' . $new_state_submit_id,  | 
                                                        |
| 413 | + 'ee-form-add-new-state-submit button button-secondary',  | 
                                                        |
| 414 | + '',  | 
                                                        |
| 415 | + 'data-target="' . $new_state_submit_id . '" data-value-field-name="' . $input->valueFieldName() . '"'  | 
                                                        |
| 416 | + )  | 
                                                        |
| 417 | + )  | 
                                                        |
| 418 | + ),  | 
                                                        |
| 419 | + // extra info  | 
                                                        |
| 420 | + 'add_new_state_extra' => new EE_Form_Section_HTML(  | 
                                                        |
| 421 | + apply_filters(  | 
                                                        |
| 422 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra',  | 
                                                        |
| 423 | + EEH_HTML::br(2)  | 
                                                        |
| 424 | + .  | 
                                                        |
| 425 | +								EEH_HTML::div('', '', 'small-text') | 
                                                        |
| 426 | + .  | 
                                                        |
| 427 | + EEH_HTML::strong(  | 
                                                        |
| 428 | + '* ' .  | 
                                                        |
| 429 | + esc_html__(  | 
                                                        |
| 430 | + 'Don\'t know your State/Province Abbreviation?',  | 
                                                        |
| 431 | + 'event_espresso'  | 
                                                        |
| 432 | + )  | 
                                                        |
| 433 | + )  | 
                                                        |
| 434 | + .  | 
                                                        |
| 435 | + EEH_HTML::br()  | 
                                                        |
| 436 | + .  | 
                                                        |
| 437 | + sprintf(  | 
                                                        |
| 438 | + esc_html__(  | 
                                                        |
| 439 | +										'You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', | 
                                                        |
| 440 | + 'event_espresso'  | 
                                                        |
| 441 | + ),  | 
                                                        |
| 442 | + EEH_HTML::link(  | 
                                                        |
| 443 | + 'http://en.wikipedia.org/wiki/ISO_3166-2',  | 
                                                        |
| 444 | + 'http://en.wikipedia.org/wiki/ISO_3166-2',  | 
                                                        |
| 445 | + '',  | 
                                                        |
| 446 | + '',  | 
                                                        |
| 447 | + 'ee-form-add-new-state-wiki-lnk',  | 
                                                        |
| 448 | + '',  | 
                                                        |
| 449 | + 'target="_blank"'  | 
                                                        |
| 450 | + )  | 
                                                        |
| 451 | + )  | 
                                                        |
| 452 | + .  | 
                                                        |
| 453 | + EEH_HTML::divx()  | 
                                                        |
| 454 | + .  | 
                                                        |
| 455 | + EEH_HTML::br()  | 
                                                        |
| 456 | + .  | 
                                                        |
| 457 | + EEH_HTML::link(  | 
                                                        |
| 458 | + '',  | 
                                                        |
| 459 | +									esc_html__('cancel new State/Province', 'event_espresso'), | 
                                                        |
| 460 | + '',  | 
                                                        |
| 461 | + 'hide-' . $input->html_id(),  | 
                                                        |
| 462 | + 'ee-form-cancel-new-state-lnk smaller-text',  | 
                                                        |
| 463 | + '',  | 
                                                        |
| 464 | + 'data-target="' . $input->html_id() . '"'  | 
                                                        |
| 465 | + )  | 
                                                        |
| 466 | + .  | 
                                                        |
| 467 | + EEH_HTML::divx()  | 
                                                        |
| 468 | + .  | 
                                                        |
| 469 | + EEH_HTML::br()  | 
                                                        |
| 470 | + )  | 
                                                        |
| 471 | + ),  | 
                                                        |
| 472 | + ),  | 
                                                        |
| 473 | + )  | 
                                                        |
| 474 | + );  | 
                                                        |
| 475 | + $question_group_reg_form->add_subsections(  | 
                                                        |
| 476 | +				array('new_state_micro_form' => $new_state_micro_form), | 
                                                        |
| 477 | + 'state',  | 
                                                        |
| 478 | + false  | 
                                                        |
| 479 | + );  | 
                                                        |
| 480 | + }  | 
                                                        |
| 481 | + return $question_group_reg_form;  | 
                                                        |
| 482 | + }  | 
                                                        |
| 483 | +  | 
                                                        |
| 484 | +  | 
                                                        |
| 485 | + /**  | 
                                                        |
| 486 | + * set_new_state_input_width  | 
                                                        |
| 487 | + *  | 
                                                        |
| 488 | + * @return int|string  | 
                                                        |
| 489 | + * @throws EE_Error  | 
                                                        |
| 490 | + * @throws InvalidArgumentException  | 
                                                        |
| 491 | + * @throws InvalidDataTypeException  | 
                                                        |
| 492 | + * @throws InvalidInterfaceException  | 
                                                        |
| 493 | + * @throws ReflectionException  | 
                                                        |
| 494 | + */  | 
                                                        |
| 495 | + public static function add_new_state()  | 
                                                        |
| 496 | +	{ | 
                                                        |
| 497 | +		$REQ = EE_Registry::instance()->load_core('Request_Handler'); | 
                                                        |
| 498 | +		if (absint($REQ->get('nsmf_add_new_state')) === 1) { | 
                                                        |
| 499 | +			EE_Registry::instance()->load_model('State'); | 
                                                        |
| 500 | + // grab country ISO code, new state name, and new state abbreviation  | 
                                                        |
| 501 | +			$state_country = $REQ->is_set('nsmf_new_state_country') | 
                                                        |
| 502 | +				? sanitize_text_field($REQ->get('nsmf_new_state_country')) | 
                                                        |
| 503 | + : false;  | 
                                                        |
| 504 | +			$state_name = $REQ->is_set('nsmf_new_state_name') | 
                                                        |
| 505 | +				? sanitize_text_field($REQ->get('nsmf_new_state_name')) | 
                                                        |
| 506 | + : false;  | 
                                                        |
| 507 | +			$state_abbr = $REQ->is_set('nsmf_new_state_abbrv') | 
                                                        |
| 508 | +				? sanitize_text_field($REQ->get('nsmf_new_state_abbrv')) | 
                                                        |
| 509 | + : false;  | 
                                                        |
| 510 | +			if ($state_country && $state_name && $state_abbr) { | 
                                                        |
| 511 | + $new_state = EED_Add_New_State::save_new_state_to_db(  | 
                                                        |
| 512 | + array(  | 
                                                        |
| 513 | + 'CNT_ISO' => strtoupper($state_country),  | 
                                                        |
| 514 | + 'STA_abbrev' => strtoupper($state_abbr),  | 
                                                        |
| 515 | + 'STA_name' => ucwords($state_name),  | 
                                                        |
| 516 | + 'STA_active' => false,  | 
                                                        |
| 517 | + )  | 
                                                        |
| 518 | + );  | 
                                                        |
| 519 | +				if ($new_state instanceof EE_State) { | 
                                                        |
| 520 | + // clean house  | 
                                                        |
| 521 | +					EE_Registry::instance()->REQ->un_set('nsmf_add_new_state'); | 
                                                        |
| 522 | +					EE_Registry::instance()->REQ->un_set('nsmf_new_state_country'); | 
                                                        |
| 523 | +					EE_Registry::instance()->REQ->un_set('nsmf_new_state_name'); | 
                                                        |
| 524 | +					EE_Registry::instance()->REQ->un_set('nsmf_new_state_abbrv'); | 
                                                        |
| 525 | + // get any existing new states  | 
                                                        |
| 526 | + $new_states = EE_Registry::instance()->SSN->get_session_data(  | 
                                                        |
| 527 | + 'nsmf_new_states'  | 
                                                        |
| 528 | + );  | 
                                                        |
| 529 | + $new_states[ $new_state->ID() ] = $new_state;  | 
                                                        |
| 530 | + EE_Registry::instance()->SSN->set_session_data(  | 
                                                        |
| 531 | +						array('nsmf_new_states' => $new_states) | 
                                                        |
| 532 | + );  | 
                                                        |
| 533 | +					if (EE_Registry::instance()->REQ->ajax) { | 
                                                        |
| 534 | + echo wp_json_encode(  | 
                                                        |
| 535 | + array(  | 
                                                        |
| 536 | + 'success' => true,  | 
                                                        |
| 537 | + 'id' => $new_state->ID(),  | 
                                                        |
| 538 | + 'name' => $new_state->name(),  | 
                                                        |
| 539 | + 'abbrev' => $new_state->abbrev(),  | 
                                                        |
| 540 | + 'country_iso' => $new_state->country_iso(),  | 
                                                        |
| 541 | + 'country_name' => $new_state->country()->name(),  | 
                                                        |
| 542 | + )  | 
                                                        |
| 543 | + );  | 
                                                        |
| 544 | + exit();  | 
                                                        |
| 545 | + }  | 
                                                        |
| 546 | + return $new_state->ID();  | 
                                                        |
| 547 | + }  | 
                                                        |
| 548 | +			} else { | 
                                                        |
| 549 | + $error = esc_html__(  | 
                                                        |
| 550 | + 'A new State/Province could not be added because invalid or missing data was received.',  | 
                                                        |
| 551 | + 'event_espresso'  | 
                                                        |
| 552 | + );  | 
                                                        |
| 553 | +				if (EE_Registry::instance()->REQ->ajax) { | 
                                                        |
| 554 | +					echo wp_json_encode(array('error' => $error)); | 
                                                        |
| 555 | + exit();  | 
                                                        |
| 556 | + }  | 
                                                        |
| 557 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 558 | + }  | 
                                                        |
| 559 | + }  | 
                                                        |
| 560 | + return false;  | 
                                                        |
| 561 | + }  | 
                                                        |
| 562 | +  | 
                                                        |
| 563 | +  | 
                                                        |
| 564 | + /**  | 
                                                        |
| 565 | + * recursively drills down through request params to remove any that were added by this module  | 
                                                        |
| 566 | + *  | 
                                                        |
| 567 | + * @param array $request_params  | 
                                                        |
| 568 | + * @return array  | 
                                                        |
| 569 | + */  | 
                                                        |
| 570 | + public static function filter_checkout_request_params($request_params)  | 
                                                        |
| 571 | +	{ | 
                                                        |
| 572 | +		foreach ($request_params as $form_section) { | 
                                                        |
| 573 | +			if (is_array($form_section)) { | 
                                                        |
| 574 | + EED_Add_New_State::unset_new_state_request_params($form_section);  | 
                                                        |
| 575 | + EED_Add_New_State::filter_checkout_request_params($form_section);  | 
                                                        |
| 576 | + }  | 
                                                        |
| 577 | + }  | 
                                                        |
| 578 | + return $request_params;  | 
                                                        |
| 579 | + }  | 
                                                        |
| 580 | +  | 
                                                        |
| 581 | +  | 
                                                        |
| 582 | + /**  | 
                                                        |
| 583 | + * @param array $request_params  | 
                                                        |
| 584 | + * @return array  | 
                                                        |
| 585 | + */  | 
                                                        |
| 586 | + public static function unset_new_state_request_params($request_params)  | 
                                                        |
| 587 | +	{ | 
                                                        |
| 588 | + unset(  | 
                                                        |
| 589 | + $request_params['new_state_micro_form'],  | 
                                                        |
| 590 | + $request_params['new_state_micro_add_new_state'],  | 
                                                        |
| 591 | + $request_params['new_state_micro_new_state_country'],  | 
                                                        |
| 592 | + $request_params['new_state_micro_new_state_name'],  | 
                                                        |
| 593 | + $request_params['new_state_micro_new_state_abbrv']  | 
                                                        |
| 594 | + );  | 
                                                        |
| 595 | + return $request_params;  | 
                                                        |
| 596 | + }  | 
                                                        |
| 597 | +  | 
                                                        |
| 598 | +  | 
                                                        |
| 599 | + /**  | 
                                                        |
| 600 | + * @param array $props_n_values  | 
                                                        |
| 601 | + * @return bool  | 
                                                        |
| 602 | + * @throws EE_Error  | 
                                                        |
| 603 | + * @throws InvalidArgumentException  | 
                                                        |
| 604 | + * @throws InvalidDataTypeException  | 
                                                        |
| 605 | + * @throws InvalidInterfaceException  | 
                                                        |
| 606 | + */  | 
                                                        |
| 607 | + public static function save_new_state_to_db($props_n_values = array())  | 
                                                        |
| 608 | +	{ | 
                                                        |
| 609 | + $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1));  | 
                                                        |
| 610 | +		if (! empty($existing_state)) { | 
                                                        |
| 611 | + return array_pop($existing_state);  | 
                                                        |
| 612 | + }  | 
                                                        |
| 613 | + $new_state = EE_State::new_instance($props_n_values);  | 
                                                        |
| 614 | +		if ($new_state instanceof EE_State) { | 
                                                        |
| 615 | + $country_settings_url = add_query_arg(  | 
                                                        |
| 616 | + array(  | 
                                                        |
| 617 | + 'page' => 'espresso_general_settings',  | 
                                                        |
| 618 | + 'action' => 'country_settings',  | 
                                                        |
| 619 | + 'country' => $new_state->country_iso(),  | 
                                                        |
| 620 | + ),  | 
                                                        |
| 621 | +				admin_url('admin.php') | 
                                                        |
| 622 | + );  | 
                                                        |
| 623 | + // if not non-ajax admin  | 
                                                        |
| 624 | + new PersistentAdminNotice(  | 
                                                        |
| 625 | + 'new-state-added-' . $new_state->country_iso() . '-' . $new_state->abbrev(),  | 
                                                        |
| 626 | + sprintf(  | 
                                                        |
| 627 | + esc_html__(  | 
                                                        |
| 628 | + 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.',  | 
                                                        |
| 629 | + 'event_espresso'  | 
                                                        |
| 630 | + ),  | 
                                                        |
| 631 | + '<b>' . $new_state->name() . '</b>',  | 
                                                        |
| 632 | + '<b>' . $new_state->abbrev() . '</b>',  | 
                                                        |
| 633 | + '<b>' . $new_state->country()->name() . '</b>',  | 
                                                        |
| 634 | + '<a href="'  | 
                                                        |
| 635 | + . $country_settings_url  | 
                                                        |
| 636 | + . '">'  | 
                                                        |
| 637 | + . esc_html__(  | 
                                                        |
| 638 | + 'Event Espresso - General Settings > Countries Tab',  | 
                                                        |
| 639 | + 'event_espresso'  | 
                                                        |
| 640 | + )  | 
                                                        |
| 641 | + . '</a>',  | 
                                                        |
| 642 | + '<br />'  | 
                                                        |
| 643 | + )  | 
                                                        |
| 644 | + );  | 
                                                        |
| 645 | + $new_state->save();  | 
                                                        |
| 646 | + EEM_State::instance()->reset_cached_states();  | 
                                                        |
| 647 | + return $new_state;  | 
                                                        |
| 648 | + }  | 
                                                        |
| 649 | + return false;  | 
                                                        |
| 650 | + }  | 
                                                        |
| 651 | +  | 
                                                        |
| 652 | +  | 
                                                        |
| 653 | + /**  | 
                                                        |
| 654 | + * @param string $CNT_ISO  | 
                                                        |
| 655 | + * @param string $STA_ID  | 
                                                        |
| 656 | + * @param array $cols_n_values  | 
                                                        |
| 657 | + * @return void  | 
                                                        |
| 658 | + * @throws DomainException  | 
                                                        |
| 659 | + * @throws EE_Error  | 
                                                        |
| 660 | + * @throws InvalidArgumentException  | 
                                                        |
| 661 | + * @throws InvalidDataTypeException  | 
                                                        |
| 662 | + * @throws InvalidInterfaceException  | 
                                                        |
| 663 | + */  | 
                                                        |
| 664 | + public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array())  | 
                                                        |
| 665 | +	{ | 
                                                        |
| 666 | +		if (! $CNT_ISO) { | 
                                                        |
| 667 | + EE_Error::add_error(  | 
                                                        |
| 668 | +				esc_html__('An invalid or missing Country ISO Code was received.', 'event_espresso'), | 
                                                        |
| 669 | + __FILE__,  | 
                                                        |
| 670 | + __FUNCTION__,  | 
                                                        |
| 671 | + __LINE__  | 
                                                        |
| 672 | + );  | 
                                                        |
| 673 | + }  | 
                                                        |
| 674 | + $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev']  | 
                                                        |
| 675 | + : false;  | 
                                                        |
| 676 | +		if (! $STA_abbrev && ! empty($STA_ID)) { | 
                                                        |
| 677 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID);  | 
                                                        |
| 678 | +			if ($state instanceof EE_State) { | 
                                                        |
| 679 | + $STA_abbrev = $state->abbrev();  | 
                                                        |
| 680 | + }  | 
                                                        |
| 681 | + }  | 
                                                        |
| 682 | +		if (! $STA_abbrev) { | 
                                                        |
| 683 | + EE_Error::add_error(  | 
                                                        |
| 684 | +				esc_html__('An invalid or missing State Abbreviation was received.', 'event_espresso'), | 
                                                        |
| 685 | + __FILE__,  | 
                                                        |
| 686 | + __FUNCTION__,  | 
                                                        |
| 687 | + __LINE__  | 
                                                        |
| 688 | + );  | 
                                                        |
| 689 | + }  | 
                                                        |
| 690 | + /** @var PersistentAdminNoticeManager $persistent_admin_notice_manager */  | 
                                                        |
| 691 | + $persistent_admin_notice_manager = LoaderFactory::getLoader()->getShared(  | 
                                                        |
| 692 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'  | 
                                                        |
| 693 | + );  | 
                                                        |
| 694 | + $persistent_admin_notice_manager->dismissNotice($CNT_ISO . '-' . $STA_abbrev, true, true);  | 
                                                        |
| 695 | + }  | 
                                                        |
| 696 | +  | 
                                                        |
| 697 | +  | 
                                                        |
| 698 | + /**  | 
                                                        |
| 699 | + * @param EE_State[] $state_options  | 
                                                        |
| 700 | + * @param EE_SPCO_Reg_Step_Attendee_Information|StateOptions $deprecated  | 
                                                        |
| 701 | + * @param EE_Registration $registration  | 
                                                        |
| 702 | + * @param EE_Question $question  | 
                                                        |
| 703 | + * @param $answer  | 
                                                        |
| 704 | + * @return array  | 
                                                        |
| 705 | + * @throws EE_Error  | 
                                                        |
| 706 | + * @throws InvalidArgumentException  | 
                                                        |
| 707 | + * @throws InvalidDataTypeException  | 
                                                        |
| 708 | + * @throws InvalidInterfaceException  | 
                                                        |
| 709 | + */  | 
                                                        |
| 710 | + public static function inject_new_reg_state_into_options(  | 
                                                        |
| 711 | + $state_options = array(),  | 
                                                        |
| 712 | + $deprecated,  | 
                                                        |
| 713 | + EE_Registration $registration,  | 
                                                        |
| 714 | + EE_Question $question,  | 
                                                        |
| 715 | + $answer  | 
                                                        |
| 716 | +	) { | 
                                                        |
| 717 | + if (  | 
                                                        |
| 718 | + $answer instanceof EE_Answer && $question instanceof EE_Question  | 
                                                        |
| 719 | + && $question->type() === EEM_Question::QST_type_state  | 
                                                        |
| 720 | +		) { | 
                                                        |
| 721 | + $STA_ID = $answer->value();  | 
                                                        |
| 722 | +			if (! empty($STA_ID)) { | 
                                                        |
| 723 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID);  | 
                                                        |
| 724 | +				if ($state instanceof EE_State) { | 
                                                        |
| 725 | + $country = $state->country();  | 
                                                        |
| 726 | +					if ($country instanceof EE_Country) { | 
                                                        |
| 727 | +						if (! isset($state_options[ $country->name() ])) { | 
                                                        |
| 728 | + $state_options[ $country->name() ] = array();  | 
                                                        |
| 729 | + }  | 
                                                        |
| 730 | +						if (! isset($state_options[ $country->name() ][ $STA_ID ])) { | 
                                                        |
| 731 | + $state_options[ $country->name() ][ $STA_ID ] = $state->name();  | 
                                                        |
| 732 | + }  | 
                                                        |
| 733 | + }  | 
                                                        |
| 734 | + }  | 
                                                        |
| 735 | + }  | 
                                                        |
| 736 | + }  | 
                                                        |
| 737 | + return $state_options;  | 
                                                        |
| 738 | + }  | 
                                                        |
| 739 | +  | 
                                                        |
| 740 | +  | 
                                                        |
| 741 | + /**  | 
                                                        |
| 742 | + * @param EE_Country[] $country_options  | 
                                                        |
| 743 | + * @param EE_SPCO_Reg_Step_Attendee_Information|CountryOptions $deprecated  | 
                                                        |
| 744 | + * @param EE_Registration $registration  | 
                                                        |
| 745 | + * @param EE_Question $question  | 
                                                        |
| 746 | + * @param $answer  | 
                                                        |
| 747 | + * @return array  | 
                                                        |
| 748 | + * @throws EE_Error  | 
                                                        |
| 749 | + * @throws InvalidArgumentException  | 
                                                        |
| 750 | + * @throws InvalidDataTypeException  | 
                                                        |
| 751 | + * @throws InvalidInterfaceException  | 
                                                        |
| 752 | + * @throws ReflectionException  | 
                                                        |
| 753 | + */  | 
                                                        |
| 754 | + public static function inject_new_reg_country_into_options(  | 
                                                        |
| 755 | + $country_options = array(),  | 
                                                        |
| 756 | + $deprecated,  | 
                                                        |
| 757 | + EE_Registration $registration,  | 
                                                        |
| 758 | + EE_Question $question,  | 
                                                        |
| 759 | + $answer  | 
                                                        |
| 760 | +	) { | 
                                                        |
| 761 | + if (  | 
                                                        |
| 762 | + $answer instanceof EE_Answer && $question instanceof EE_Question  | 
                                                        |
| 763 | + && $question->type() === EEM_Question::QST_type_country  | 
                                                        |
| 764 | +		) { | 
                                                        |
| 765 | + $CNT_ISO = $answer->value();  | 
                                                        |
| 766 | +			if (! empty($CNT_ISO)) { | 
                                                        |
| 767 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);  | 
                                                        |
| 768 | +				if ($country instanceof EE_Country) { | 
                                                        |
| 769 | +					if (! isset($country_options[ $CNT_ISO ])) { | 
                                                        |
| 770 | + $country_options[ $CNT_ISO ] = $country->name();  | 
                                                        |
| 771 | + }  | 
                                                        |
| 772 | + }  | 
                                                        |
| 773 | + }  | 
                                                        |
| 774 | + }  | 
                                                        |
| 775 | + return $country_options;  | 
                                                        |
| 776 | + }  | 
                                                        |
| 777 | +  | 
                                                        |
| 778 | +  | 
                                                        |
| 779 | + /**  | 
                                                        |
| 780 | + * @param EE_State[] $state_options  | 
                                                        |
| 781 | + * @return array  | 
                                                        |
| 782 | + * @throws EE_Error  | 
                                                        |
| 783 | + * @throws InvalidArgumentException  | 
                                                        |
| 784 | + * @throws InvalidDataTypeException  | 
                                                        |
| 785 | + * @throws InvalidInterfaceException  | 
                                                        |
| 786 | + */  | 
                                                        |
| 787 | + public static function state_options($state_options = array())  | 
                                                        |
| 788 | +	{ | 
                                                        |
| 789 | + $new_states = EED_Add_New_State::_get_new_states();  | 
                                                        |
| 790 | +		foreach ($new_states as $new_state) { | 
                                                        |
| 791 | + if (  | 
                                                        |
| 792 | + $new_state instanceof EE_State  | 
                                                        |
| 793 | + && $new_state->country() instanceof EE_Country  | 
                                                        |
| 794 | +			) { | 
                                                        |
| 795 | + $state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name();  | 
                                                        |
| 796 | + }  | 
                                                        |
| 797 | + }  | 
                                                        |
| 798 | + return $state_options;  | 
                                                        |
| 799 | + }  | 
                                                        |
| 800 | +  | 
                                                        |
| 801 | +  | 
                                                        |
| 802 | + /**  | 
                                                        |
| 803 | + * @return array  | 
                                                        |
| 804 | + * @throws InvalidArgumentException  | 
                                                        |
| 805 | + * @throws InvalidDataTypeException  | 
                                                        |
| 806 | + * @throws InvalidInterfaceException  | 
                                                        |
| 807 | + */  | 
                                                        |
| 808 | + protected static function _get_new_states()  | 
                                                        |
| 809 | +	{ | 
                                                        |
| 810 | + $new_states = array();  | 
                                                        |
| 811 | +		if (EE_Registry::instance()->SSN instanceof EE_Session) { | 
                                                        |
| 812 | + $new_states = EE_Registry::instance()->SSN->get_session_data(  | 
                                                        |
| 813 | + 'nsmf_new_states'  | 
                                                        |
| 814 | + );  | 
                                                        |
| 815 | + }  | 
                                                        |
| 816 | + return is_array($new_states) ? $new_states : array();  | 
                                                        |
| 817 | + }  | 
                                                        |
| 818 | +  | 
                                                        |
| 819 | +  | 
                                                        |
| 820 | + /**  | 
                                                        |
| 821 | + * @param EE_Country[] $country_options  | 
                                                        |
| 822 | + * @return array  | 
                                                        |
| 823 | + * @throws EE_Error  | 
                                                        |
| 824 | + * @throws InvalidArgumentException  | 
                                                        |
| 825 | + * @throws InvalidDataTypeException  | 
                                                        |
| 826 | + * @throws InvalidInterfaceException  | 
                                                        |
| 827 | + */  | 
                                                        |
| 828 | + public static function country_options($country_options = array())  | 
                                                        |
| 829 | +	{ | 
                                                        |
| 830 | + $new_states = EED_Add_New_State::_get_new_states();  | 
                                                        |
| 831 | +		foreach ($new_states as $new_state) { | 
                                                        |
| 832 | + if (  | 
                                                        |
| 833 | + $new_state instanceof EE_State  | 
                                                        |
| 834 | + && $new_state->country() instanceof EE_Country  | 
                                                        |
| 835 | +			) { | 
                                                        |
| 836 | + $country_options[ $new_state->country()->ID() ] = $new_state->country()->name();  | 
                                                        |
| 837 | + }  | 
                                                        |
| 838 | + }  | 
                                                        |
| 839 | + return $country_options;  | 
                                                        |
| 840 | + }  | 
                                                        |
| 841 | 841 | }  | 
                                                        
@@ -161,14 +161,14 @@ discard block  | 
                                                    ||
| 161 | 161 | */  | 
                                                        
| 162 | 162 | public static function set_definitions()  | 
                                                        
| 163 | 163 |      { | 
                                                        
| 164 | -        define('ANS_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/'); | 
                                                        |
| 164 | +        define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets/'); | 
                                                        |
| 165 | 165 | define(  | 
                                                        
| 166 | 166 | 'ANS_TEMPLATES_PATH',  | 
                                                        
| 167 | 167 | str_replace(  | 
                                                        
| 168 | 168 | '\\',  | 
                                                        
| 169 | 169 | '/',  | 
                                                        
| 170 | 170 | plugin_dir_path(__FILE__)  | 
                                                        
| 171 | - ) . 'templates/'  | 
                                                        |
| 171 | + ).'templates/'  | 
                                                        |
| 172 | 172 | );  | 
                                                        
| 173 | 173 | }  | 
                                                        
| 174 | 174 | |
@@ -218,7 +218,7 @@ discard block  | 
                                                    ||
| 218 | 218 |          if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { | 
                                                        
| 219 | 219 | wp_register_script(  | 
                                                        
| 220 | 220 | 'add_new_state',  | 
                                                        
| 221 | - ANS_ASSETS_URL . 'add_new_state.js',  | 
                                                        |
| 221 | + ANS_ASSETS_URL.'add_new_state.js',  | 
                                                        |
| 222 | 222 |                  array('espresso_core', 'single_page_checkout'), | 
                                                        
| 223 | 223 | EVENT_ESPRESSO_VERSION,  | 
                                                        
| 224 | 224 | true  | 
                                                        
@@ -266,10 +266,10 @@ discard block  | 
                                                    ||
| 266 | 266 |              $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); | 
                                                        
| 267 | 267 | $country_options = array();  | 
                                                        
| 268 | 268 | $countries = EEM_Country::instance()->get_all_countries();  | 
                                                        
| 269 | -            if (! empty($countries)) { | 
                                                        |
| 269 | +            if ( ! empty($countries)) { | 
                                                        |
| 270 | 270 |                  foreach ($countries as $country) { | 
                                                        
| 271 | 271 |                      if ($country instanceof EE_Country) { | 
                                                        
| 272 | - $country_options[ $country->ID() ] = $country->name();  | 
                                                        |
| 272 | + $country_options[$country->ID()] = $country->name();  | 
                                                        |
| 273 | 273 | }  | 
                                                        
| 274 | 274 | }  | 
                                                        
| 275 | 275 | }  | 
                                                        
@@ -303,10 +303,10 @@ discard block  | 
                                                    ||
| 303 | 303 | '',  | 
                                                        
| 304 | 304 |                                      esc_html__('click here to add a new state/province', 'event_espresso'), | 
                                                        
| 305 | 305 | '',  | 
                                                        
| 306 | - 'display-' . $input->html_id(),  | 
                                                        |
| 306 | + 'display-'.$input->html_id(),  | 
                                                        |
| 307 | 307 | 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js',  | 
                                                        
| 308 | 308 | '',  | 
                                                        
| 309 | - 'data-target="' . $input->html_id() . '"'  | 
                                                        |
| 309 | + 'data-target="'.$input->html_id().'"'  | 
                                                        |
| 310 | 310 | )  | 
                                                        
| 311 | 311 | )  | 
                                                        
| 312 | 312 | ),  | 
                                                        
@@ -316,33 +316,33 @@ discard block  | 
                                                    ||
| 316 | 316 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form',  | 
                                                        
| 317 | 317 | EEH_HTML::div(  | 
                                                        
| 318 | 318 | '',  | 
                                                        
| 319 | - $input->html_id() . '-dv',  | 
                                                        |
| 319 | + $input->html_id().'-dv',  | 
                                                        |
| 320 | 320 | 'ee-form-add-new-state-dv',  | 
                                                        
| 321 | 321 | 'display: none;'  | 
                                                        
| 322 | - ) .  | 
                                                        |
| 322 | + ).  | 
                                                        |
| 323 | 323 | EEH_HTML::h6(  | 
                                                        
| 324 | 324 | esc_html__(  | 
                                                        
| 325 | 325 | 'Is your state/province missing from the dropdown menu above? You can add it by completing the following steps:',  | 
                                                        
| 326 | 326 | 'event_espresso'  | 
                                                        
| 327 | 327 | )  | 
                                                        
| 328 | - ) .  | 
                                                        |
| 329 | - EEH_HTML::ul() .  | 
                                                        |
| 328 | + ).  | 
                                                        |
| 329 | + EEH_HTML::ul().  | 
                                                        |
| 330 | 330 | EEH_HTML::li(  | 
                                                        
| 331 | 331 | esc_html__(  | 
                                                        
| 332 | 332 | 'first select the Country that your State/Province belongs to',  | 
                                                        
| 333 | 333 | 'event_espresso'  | 
                                                        
| 334 | 334 | )  | 
                                                        
| 335 | - ) .  | 
                                                        |
| 335 | + ).  | 
                                                        |
| 336 | 336 | EEH_HTML::li(  | 
                                                        
| 337 | 337 |                                      esc_html__('enter the name of your State/Province', 'event_espresso') | 
                                                        
| 338 | - ) .  | 
                                                        |
| 338 | + ).  | 
                                                        |
| 339 | 339 | EEH_HTML::li(  | 
                                                        
| 340 | 340 | esc_html__(  | 
                                                        
| 341 | 341 | 'enter a two to six letter abbreviation for the name of your State/Province',  | 
                                                        
| 342 | 342 | 'event_espresso'  | 
                                                        
| 343 | 343 | )  | 
                                                        
| 344 | - ) .  | 
                                                        |
| 345 | -                                EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')) . | 
                                                        |
| 344 | + ).  | 
                                                        |
| 345 | +                                EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')). | 
                                                        |
| 346 | 346 | EEH_HTML::ulx()  | 
                                                        
| 347 | 347 | )  | 
                                                        
| 348 | 348 | ),  | 
                                                        
@@ -356,7 +356,7 @@ discard block  | 
                                                    ||
| 356 | 356 | 'nsmf_new_state_country',  | 
                                                        
| 357 | 357 | $input->html_id()  | 
                                                        
| 358 | 358 | ),  | 
                                                        
| 359 | - 'html_class' => $input->html_class() . ' new-state-country',  | 
                                                        |
| 359 | + 'html_class' => $input->html_class().' new-state-country',  | 
                                                        |
| 360 | 360 |                                  'html_label_text' => esc_html__('New State/Province Country', 'event_espresso'), | 
                                                        
| 361 | 361 | 'default' => EE_Registry::instance()->REQ->get($country_name, ''),  | 
                                                        
| 362 | 362 | 'required' => false,  | 
                                                        
@@ -371,7 +371,7 @@ discard block  | 
                                                    ||
| 371 | 371 | 'nsmf_new_state_name',  | 
                                                        
| 372 | 372 | $input->html_id()  | 
                                                        
| 373 | 373 | ),  | 
                                                        
| 374 | - 'html_class' => $input->html_class() . ' new-state-state',  | 
                                                        |
| 374 | + 'html_class' => $input->html_class().' new-state-state',  | 
                                                        |
| 375 | 375 | 'html_label_text' => esc_html__(  | 
                                                        
| 376 | 376 | 'New State/Province Name',  | 
                                                        
| 377 | 377 | 'event_espresso'  | 
                                                        
@@ -390,11 +390,11 @@ discard block  | 
                                                    ||
| 390 | 390 | 'nsmf_new_state_abbrv',  | 
                                                        
| 391 | 391 | $input->html_id()  | 
                                                        
| 392 | 392 | ),  | 
                                                        
| 393 | - 'html_class' => $input->html_class() . ' new-state-abbrv',  | 
                                                        |
| 393 | + 'html_class' => $input->html_class().' new-state-abbrv',  | 
                                                        |
| 394 | 394 | 'html_label_text' => esc_html__(  | 
                                                        
| 395 | 395 | 'New State/Province Abbreviation',  | 
                                                        
| 396 | 396 | 'event_espresso'  | 
                                                        
| 397 | - ) . ' *',  | 
                                                        |
| 397 | + ).' *',  | 
                                                        |
| 398 | 398 | 'other_html_attributes' => 'size="24"',  | 
                                                        
| 399 | 399 | 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''),  | 
                                                        
| 400 | 400 | 'required' => false,  | 
                                                        
@@ -404,15 +404,15 @@ discard block  | 
                                                    ||
| 404 | 404 | 'add_new_state_submit_button' => new EE_Form_Section_HTML(  | 
                                                        
| 405 | 405 | apply_filters(  | 
                                                        
| 406 | 406 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button',  | 
                                                        
| 407 | - EEH_HTML::nbsp(3) .  | 
                                                        |
| 407 | + EEH_HTML::nbsp(3).  | 
                                                        |
| 408 | 408 | EEH_HTML::link(  | 
                                                        
| 409 | 409 | '',  | 
                                                        
| 410 | 410 |                                      esc_html__('ADD', 'event_espresso'), | 
                                                        
| 411 | 411 | '',  | 
                                                        
| 412 | - 'submit-' . $new_state_submit_id,  | 
                                                        |
| 412 | + 'submit-'.$new_state_submit_id,  | 
                                                        |
| 413 | 413 | 'ee-form-add-new-state-submit button button-secondary',  | 
                                                        
| 414 | 414 | '',  | 
                                                        
| 415 | - 'data-target="' . $new_state_submit_id . '" data-value-field-name="' . $input->valueFieldName() . '"'  | 
                                                        |
| 415 | + 'data-target="'.$new_state_submit_id.'" data-value-field-name="'.$input->valueFieldName().'"'  | 
                                                        |
| 416 | 416 | )  | 
                                                        
| 417 | 417 | )  | 
                                                        
| 418 | 418 | ),  | 
                                                        
@@ -425,7 +425,7 @@ discard block  | 
                                                    ||
| 425 | 425 |                                  EEH_HTML::div('', '', 'small-text') | 
                                                        
| 426 | 426 | .  | 
                                                        
| 427 | 427 | EEH_HTML::strong(  | 
                                                        
| 428 | - '* ' .  | 
                                                        |
| 428 | + '* '.  | 
                                                        |
| 429 | 429 | esc_html__(  | 
                                                        
| 430 | 430 | 'Don\'t know your State/Province Abbreviation?',  | 
                                                        
| 431 | 431 | 'event_espresso'  | 
                                                        
@@ -458,10 +458,10 @@ discard block  | 
                                                    ||
| 458 | 458 | '',  | 
                                                        
| 459 | 459 |                                      esc_html__('cancel new State/Province', 'event_espresso'), | 
                                                        
| 460 | 460 | '',  | 
                                                        
| 461 | - 'hide-' . $input->html_id(),  | 
                                                        |
| 461 | + 'hide-'.$input->html_id(),  | 
                                                        |
| 462 | 462 | 'ee-form-cancel-new-state-lnk smaller-text',  | 
                                                        
| 463 | 463 | '',  | 
                                                        
| 464 | - 'data-target="' . $input->html_id() . '"'  | 
                                                        |
| 464 | + 'data-target="'.$input->html_id().'"'  | 
                                                        |
| 465 | 465 | )  | 
                                                        
| 466 | 466 | .  | 
                                                        
| 467 | 467 | EEH_HTML::divx()  | 
                                                        
@@ -526,7 +526,7 @@ discard block  | 
                                                    ||
| 526 | 526 | $new_states = EE_Registry::instance()->SSN->get_session_data(  | 
                                                        
| 527 | 527 | 'nsmf_new_states'  | 
                                                        
| 528 | 528 | );  | 
                                                        
| 529 | - $new_states[ $new_state->ID() ] = $new_state;  | 
                                                        |
| 529 | + $new_states[$new_state->ID()] = $new_state;  | 
                                                        |
| 530 | 530 | EE_Registry::instance()->SSN->set_session_data(  | 
                                                        
| 531 | 531 |                          array('nsmf_new_states' => $new_states) | 
                                                        
| 532 | 532 | );  | 
                                                        
@@ -607,7 +607,7 @@ discard block  | 
                                                    ||
| 607 | 607 | public static function save_new_state_to_db($props_n_values = array())  | 
                                                        
| 608 | 608 |      { | 
                                                        
| 609 | 609 | $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1));  | 
                                                        
| 610 | -        if (! empty($existing_state)) { | 
                                                        |
| 610 | +        if ( ! empty($existing_state)) { | 
                                                        |
| 611 | 611 | return array_pop($existing_state);  | 
                                                        
| 612 | 612 | }  | 
                                                        
| 613 | 613 | $new_state = EE_State::new_instance($props_n_values);  | 
                                                        
@@ -622,15 +622,15 @@ discard block  | 
                                                    ||
| 622 | 622 | );  | 
                                                        
| 623 | 623 | // if not non-ajax admin  | 
                                                        
| 624 | 624 | new PersistentAdminNotice(  | 
                                                        
| 625 | - 'new-state-added-' . $new_state->country_iso() . '-' . $new_state->abbrev(),  | 
                                                        |
| 625 | + 'new-state-added-'.$new_state->country_iso().'-'.$new_state->abbrev(),  | 
                                                        |
| 626 | 626 | sprintf(  | 
                                                        
| 627 | 627 | esc_html__(  | 
                                                        
| 628 | 628 | 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.',  | 
                                                        
| 629 | 629 | 'event_espresso'  | 
                                                        
| 630 | 630 | ),  | 
                                                        
| 631 | - '<b>' . $new_state->name() . '</b>',  | 
                                                        |
| 632 | - '<b>' . $new_state->abbrev() . '</b>',  | 
                                                        |
| 633 | - '<b>' . $new_state->country()->name() . '</b>',  | 
                                                        |
| 631 | + '<b>'.$new_state->name().'</b>',  | 
                                                        |
| 632 | + '<b>'.$new_state->abbrev().'</b>',  | 
                                                        |
| 633 | + '<b>'.$new_state->country()->name().'</b>',  | 
                                                        |
| 634 | 634 | '<a href="'  | 
                                                        
| 635 | 635 | . $country_settings_url  | 
                                                        
| 636 | 636 | . '">'  | 
                                                        
@@ -663,7 +663,7 @@ discard block  | 
                                                    ||
| 663 | 663 | */  | 
                                                        
| 664 | 664 | public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array())  | 
                                                        
| 665 | 665 |      { | 
                                                        
| 666 | -        if (! $CNT_ISO) { | 
                                                        |
| 666 | +        if ( ! $CNT_ISO) { | 
                                                        |
| 667 | 667 | EE_Error::add_error(  | 
                                                        
| 668 | 668 |                  esc_html__('An invalid or missing Country ISO Code was received.', 'event_espresso'), | 
                                                        
| 669 | 669 | __FILE__,  | 
                                                        
@@ -673,13 +673,13 @@ discard block  | 
                                                    ||
| 673 | 673 | }  | 
                                                        
| 674 | 674 | $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev']  | 
                                                        
| 675 | 675 | : false;  | 
                                                        
| 676 | -        if (! $STA_abbrev && ! empty($STA_ID)) { | 
                                                        |
| 676 | +        if ( ! $STA_abbrev && ! empty($STA_ID)) { | 
                                                        |
| 677 | 677 | $state = EEM_State::instance()->get_one_by_ID($STA_ID);  | 
                                                        
| 678 | 678 |              if ($state instanceof EE_State) { | 
                                                        
| 679 | 679 | $STA_abbrev = $state->abbrev();  | 
                                                        
| 680 | 680 | }  | 
                                                        
| 681 | 681 | }  | 
                                                        
| 682 | -        if (! $STA_abbrev) { | 
                                                        |
| 682 | +        if ( ! $STA_abbrev) { | 
                                                        |
| 683 | 683 | EE_Error::add_error(  | 
                                                        
| 684 | 684 |                  esc_html__('An invalid or missing State Abbreviation was received.', 'event_espresso'), | 
                                                        
| 685 | 685 | __FILE__,  | 
                                                        
@@ -691,7 +691,7 @@ discard block  | 
                                                    ||
| 691 | 691 | $persistent_admin_notice_manager = LoaderFactory::getLoader()->getShared(  | 
                                                        
| 692 | 692 | 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'  | 
                                                        
| 693 | 693 | );  | 
                                                        
| 694 | - $persistent_admin_notice_manager->dismissNotice($CNT_ISO . '-' . $STA_abbrev, true, true);  | 
                                                        |
| 694 | + $persistent_admin_notice_manager->dismissNotice($CNT_ISO.'-'.$STA_abbrev, true, true);  | 
                                                        |
| 695 | 695 | }  | 
                                                        
| 696 | 696 | |
| 697 | 697 | |
@@ -719,16 +719,16 @@ discard block  | 
                                                    ||
| 719 | 719 | && $question->type() === EEM_Question::QST_type_state  | 
                                                        
| 720 | 720 |          ) { | 
                                                        
| 721 | 721 | $STA_ID = $answer->value();  | 
                                                        
| 722 | -            if (! empty($STA_ID)) { | 
                                                        |
| 722 | +            if ( ! empty($STA_ID)) { | 
                                                        |
| 723 | 723 | $state = EEM_State::instance()->get_one_by_ID($STA_ID);  | 
                                                        
| 724 | 724 |                  if ($state instanceof EE_State) { | 
                                                        
| 725 | 725 | $country = $state->country();  | 
                                                        
| 726 | 726 |                      if ($country instanceof EE_Country) { | 
                                                        
| 727 | -                        if (! isset($state_options[ $country->name() ])) { | 
                                                        |
| 728 | - $state_options[ $country->name() ] = array();  | 
                                                        |
| 727 | +                        if ( ! isset($state_options[$country->name()])) { | 
                                                        |
| 728 | + $state_options[$country->name()] = array();  | 
                                                        |
| 729 | 729 | }  | 
                                                        
| 730 | -                        if (! isset($state_options[ $country->name() ][ $STA_ID ])) { | 
                                                        |
| 731 | - $state_options[ $country->name() ][ $STA_ID ] = $state->name();  | 
                                                        |
| 730 | +                        if ( ! isset($state_options[$country->name()][$STA_ID])) { | 
                                                        |
| 731 | + $state_options[$country->name()][$STA_ID] = $state->name();  | 
                                                        |
| 732 | 732 | }  | 
                                                        
| 733 | 733 | }  | 
                                                        
| 734 | 734 | }  | 
                                                        
@@ -763,11 +763,11 @@ discard block  | 
                                                    ||
| 763 | 763 | && $question->type() === EEM_Question::QST_type_country  | 
                                                        
| 764 | 764 |          ) { | 
                                                        
| 765 | 765 | $CNT_ISO = $answer->value();  | 
                                                        
| 766 | -            if (! empty($CNT_ISO)) { | 
                                                        |
| 766 | +            if ( ! empty($CNT_ISO)) { | 
                                                        |
| 767 | 767 | $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);  | 
                                                        
| 768 | 768 |                  if ($country instanceof EE_Country) { | 
                                                        
| 769 | -                    if (! isset($country_options[ $CNT_ISO ])) { | 
                                                        |
| 770 | - $country_options[ $CNT_ISO ] = $country->name();  | 
                                                        |
| 769 | +                    if ( ! isset($country_options[$CNT_ISO])) { | 
                                                        |
| 770 | + $country_options[$CNT_ISO] = $country->name();  | 
                                                        |
| 771 | 771 | }  | 
                                                        
| 772 | 772 | }  | 
                                                        
| 773 | 773 | }  | 
                                                        
@@ -792,7 +792,7 @@ discard block  | 
                                                    ||
| 792 | 792 | $new_state instanceof EE_State  | 
                                                        
| 793 | 793 | && $new_state->country() instanceof EE_Country  | 
                                                        
| 794 | 794 |              ) { | 
                                                        
| 795 | - $state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name();  | 
                                                        |
| 795 | + $state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name();  | 
                                                        |
| 796 | 796 | }  | 
                                                        
| 797 | 797 | }  | 
                                                        
| 798 | 798 | return $state_options;  | 
                                                        
@@ -833,7 +833,7 @@ discard block  | 
                                                    ||
| 833 | 833 | $new_state instanceof EE_State  | 
                                                        
| 834 | 834 | && $new_state->country() instanceof EE_Country  | 
                                                        
| 835 | 835 |              ) { | 
                                                        
| 836 | - $country_options[ $new_state->country()->ID() ] = $new_state->country()->name();  | 
                                                        |
| 836 | + $country_options[$new_state->country()->ID()] = $new_state->country()->name();  | 
                                                        |
| 837 | 837 | }  | 
                                                        
| 838 | 838 | }  | 
                                                        
| 839 | 839 | return $country_options;  | 
                                                        
@@ -12,640 +12,640 @@  | 
                                                    ||
| 12 | 12 | abstract class EE_SPCO_Reg_Step  | 
                                                        
| 13 | 13 |  { | 
                                                        
| 14 | 14 | |
| 15 | - /**  | 
                                                        |
| 16 | - * $_completed - TRUE if this step has fully completed it's duties  | 
                                                        |
| 17 | - *  | 
                                                        |
| 18 | - * @access protected  | 
                                                        |
| 19 | - * @type bool $_completed  | 
                                                        |
| 20 | - */  | 
                                                        |
| 21 | - protected $_completed = false;  | 
                                                        |
| 22 | -  | 
                                                        |
| 23 | - /**  | 
                                                        |
| 24 | - * $_is_current_step - TRUE if this is the current step  | 
                                                        |
| 25 | - *  | 
                                                        |
| 26 | - * @access protected  | 
                                                        |
| 27 | - * @type bool $_is_current_step  | 
                                                        |
| 28 | - */  | 
                                                        |
| 29 | - protected $_is_current_step = false;  | 
                                                        |
| 30 | -  | 
                                                        |
| 31 | - /**  | 
                                                        |
| 32 | - * $_order - when the reg step should be run relative to other steps  | 
                                                        |
| 33 | - *  | 
                                                        |
| 34 | - * @access protected  | 
                                                        |
| 35 | - * @type int $_template  | 
                                                        |
| 36 | - */  | 
                                                        |
| 37 | - protected $_order = 0;  | 
                                                        |
| 38 | -  | 
                                                        |
| 39 | - /**  | 
                                                        |
| 40 | - * $_slug - URL param for this step  | 
                                                        |
| 41 | - *  | 
                                                        |
| 42 | - * @access protected  | 
                                                        |
| 43 | - * @type string $_slug  | 
                                                        |
| 44 | - */  | 
                                                        |
| 45 | - protected $_slug;  | 
                                                        |
| 46 | -  | 
                                                        |
| 47 | - /**  | 
                                                        |
| 48 | - * $_name - Step Name - translatable string  | 
                                                        |
| 49 | - *  | 
                                                        |
| 50 | - * @access protected  | 
                                                        |
| 51 | - * @type string $_slug  | 
                                                        |
| 52 | - */  | 
                                                        |
| 53 | - protected $_name;  | 
                                                        |
| 54 | -  | 
                                                        |
| 55 | - /**  | 
                                                        |
| 56 | - * $_submit_button_text - translatable string that appears on this step's submit button  | 
                                                        |
| 57 | - *  | 
                                                        |
| 58 | - * @access protected  | 
                                                        |
| 59 | - * @type string $_slug  | 
                                                        |
| 60 | - */  | 
                                                        |
| 61 | - protected $_submit_button_text;  | 
                                                        |
| 62 | -  | 
                                                        |
| 63 | - /**  | 
                                                        |
| 64 | - * $_template - template name  | 
                                                        |
| 65 | - *  | 
                                                        |
| 66 | - * @access protected  | 
                                                        |
| 67 | - * @type string $_template  | 
                                                        |
| 68 | - */  | 
                                                        |
| 69 | - protected $_template;  | 
                                                        |
| 70 | -  | 
                                                        |
| 71 | - /**  | 
                                                        |
| 72 | - * $_reg_form_name - the form input name and id attribute  | 
                                                        |
| 73 | - *  | 
                                                        |
| 74 | - * @access protected  | 
                                                        |
| 75 | - * @var string $_reg_form_name  | 
                                                        |
| 76 | - */  | 
                                                        |
| 77 | - protected $_reg_form_name;  | 
                                                        |
| 78 | -  | 
                                                        |
| 79 | - /**  | 
                                                        |
| 80 | - * $_success_message - text to display upon successful form submission  | 
                                                        |
| 81 | - *  | 
                                                        |
| 82 | - * @access private  | 
                                                        |
| 83 | - * @var string $_success_message  | 
                                                        |
| 84 | - */  | 
                                                        |
| 85 | - protected $_success_message;  | 
                                                        |
| 86 | -  | 
                                                        |
| 87 | - /**  | 
                                                        |
| 88 | - * $_instructions - a brief description of how to complete the reg step.  | 
                                                        |
| 89 | - * Usually displayed in conjunction with the previous step's success message.  | 
                                                        |
| 90 | - *  | 
                                                        |
| 91 | - * @access private  | 
                                                        |
| 92 | - * @var string $_instructions  | 
                                                        |
| 93 | - */  | 
                                                        |
| 94 | - protected $_instructions;  | 
                                                        |
| 95 | -  | 
                                                        |
| 96 | - /**  | 
                                                        |
| 97 | - * $_valid_data - the normalized and validated data for this step  | 
                                                        |
| 98 | - *  | 
                                                        |
| 99 | - * @access public  | 
                                                        |
| 100 | - * @var array $_valid_data  | 
                                                        |
| 101 | - */  | 
                                                        |
| 102 | - protected $_valid_data = array();  | 
                                                        |
| 103 | -  | 
                                                        |
| 104 | - /**  | 
                                                        |
| 105 | - * $reg_form - the registration form for this step  | 
                                                        |
| 106 | - *  | 
                                                        |
| 107 | - * @access public  | 
                                                        |
| 108 | - * @var EE_Form_Section_Proper $reg_form  | 
                                                        |
| 109 | - */  | 
                                                        |
| 110 | - public $reg_form;  | 
                                                        |
| 111 | -  | 
                                                        |
| 112 | - /**  | 
                                                        |
| 113 | - * $checkout - EE_Checkout object for handling the properties of the current checkout process  | 
                                                        |
| 114 | - *  | 
                                                        |
| 115 | - * @access public  | 
                                                        |
| 116 | - * @var EE_Checkout $checkout  | 
                                                        |
| 117 | - */  | 
                                                        |
| 118 | - public $checkout;  | 
                                                        |
| 119 | -  | 
                                                        |
| 120 | -  | 
                                                        |
| 121 | - /**  | 
                                                        |
| 122 | - * @return void  | 
                                                        |
| 123 | - */  | 
                                                        |
| 124 | - abstract public function translate_js_strings();  | 
                                                        |
| 125 | -  | 
                                                        |
| 126 | -  | 
                                                        |
| 127 | - /**  | 
                                                        |
| 128 | - * @return void  | 
                                                        |
| 129 | - */  | 
                                                        |
| 130 | - abstract public function enqueue_styles_and_scripts();  | 
                                                        |
| 131 | -  | 
                                                        |
| 132 | -  | 
                                                        |
| 133 | - /**  | 
                                                        |
| 134 | - * @return boolean  | 
                                                        |
| 135 | - */  | 
                                                        |
| 136 | - abstract public function initialize_reg_step();  | 
                                                        |
| 137 | -  | 
                                                        |
| 138 | -  | 
                                                        |
| 139 | - /**  | 
                                                        |
| 140 | - * @return string  | 
                                                        |
| 141 | - */  | 
                                                        |
| 142 | - abstract public function generate_reg_form();  | 
                                                        |
| 143 | -  | 
                                                        |
| 144 | -  | 
                                                        |
| 145 | - /**  | 
                                                        |
| 146 | - * @return boolean  | 
                                                        |
| 147 | - */  | 
                                                        |
| 148 | - abstract public function process_reg_step();  | 
                                                        |
| 149 | -  | 
                                                        |
| 150 | -  | 
                                                        |
| 151 | - /**  | 
                                                        |
| 152 | - * @return boolean  | 
                                                        |
| 153 | - */  | 
                                                        |
| 154 | - abstract public function update_reg_step();  | 
                                                        |
| 155 | -  | 
                                                        |
| 156 | -  | 
                                                        |
| 157 | - /**  | 
                                                        |
| 158 | - * @return boolean  | 
                                                        |
| 159 | - */  | 
                                                        |
| 160 | - public function completed()  | 
                                                        |
| 161 | -    { | 
                                                        |
| 162 | - return $this->_completed;  | 
                                                        |
| 163 | - }  | 
                                                        |
| 164 | -  | 
                                                        |
| 165 | -  | 
                                                        |
| 166 | - /**  | 
                                                        |
| 167 | - * set_completed - toggles $_completed to TRUE  | 
                                                        |
| 168 | - */  | 
                                                        |
| 169 | - public function set_completed()  | 
                                                        |
| 170 | -    { | 
                                                        |
| 171 | - // DEBUG LOG  | 
                                                        |
| 172 | - // $this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 173 | -        $this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this); | 
                                                        |
| 174 | - }  | 
                                                        |
| 175 | -  | 
                                                        |
| 176 | -  | 
                                                        |
| 177 | - /**  | 
                                                        |
| 178 | - * set_completed - toggles $_completed to FALSE  | 
                                                        |
| 179 | - */  | 
                                                        |
| 180 | - public function set_not_completed()  | 
                                                        |
| 181 | -    { | 
                                                        |
| 182 | - $this->_completed = false;  | 
                                                        |
| 183 | - }  | 
                                                        |
| 184 | -  | 
                                                        |
| 185 | -  | 
                                                        |
| 186 | - /**  | 
                                                        |
| 187 | - * @return string  | 
                                                        |
| 188 | - */  | 
                                                        |
| 189 | - public function name()  | 
                                                        |
| 190 | -    { | 
                                                        |
| 191 | - return $this->_name;  | 
                                                        |
| 192 | - }  | 
                                                        |
| 193 | -  | 
                                                        |
| 194 | -  | 
                                                        |
| 195 | - /**  | 
                                                        |
| 196 | - * @return string  | 
                                                        |
| 197 | - */  | 
                                                        |
| 198 | - public function slug()  | 
                                                        |
| 199 | -    { | 
                                                        |
| 200 | - return $this->_slug;  | 
                                                        |
| 201 | - }  | 
                                                        |
| 202 | -  | 
                                                        |
| 203 | -  | 
                                                        |
| 204 | - /**  | 
                                                        |
| 205 | - * submit_button_text  | 
                                                        |
| 206 | - * the text that appears on the reg step form submit button  | 
                                                        |
| 207 | - *  | 
                                                        |
| 208 | - * @return string  | 
                                                        |
| 209 | - */  | 
                                                        |
| 210 | - public function submit_button_text()  | 
                                                        |
| 211 | -    { | 
                                                        |
| 212 | - return $this->_submit_button_text;  | 
                                                        |
| 213 | - }  | 
                                                        |
| 214 | -  | 
                                                        |
| 215 | -  | 
                                                        |
| 216 | - /**  | 
                                                        |
| 217 | - * set_submit_button_text  | 
                                                        |
| 218 | - * sets the text that appears on the reg step form submit button  | 
                                                        |
| 219 | - *  | 
                                                        |
| 220 | - * @param string $submit_button_text  | 
                                                        |
| 221 | - */  | 
                                                        |
| 222 | - public function set_submit_button_text($submit_button_text = '')  | 
                                                        |
| 223 | -    { | 
                                                        |
| 224 | -        if (! empty($submit_button_text)) { | 
                                                        |
| 225 | - $this->_submit_button_text = $submit_button_text;  | 
                                                        |
| 226 | -        } elseif ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) { | 
                                                        |
| 227 | -            if ($this->checkout->revisit) { | 
                                                        |
| 228 | - $this->_submit_button_text = sprintf(  | 
                                                        |
| 229 | -                    __('Update %s', 'event_espresso'), | 
                                                        |
| 230 | - $this->checkout->current_step->name()  | 
                                                        |
| 231 | - );  | 
                                                        |
| 232 | -            } else { | 
                                                        |
| 233 | - $this->_submit_button_text = sprintf(  | 
                                                        |
| 234 | -                    __('Proceed to %s', 'event_espresso'), | 
                                                        |
| 235 | - $this->checkout->next_step->name()  | 
                                                        |
| 236 | - );  | 
                                                        |
| 237 | - }  | 
                                                        |
| 238 | - }  | 
                                                        |
| 239 | - // filters the submit button text  | 
                                                        |
| 240 | - $this->_submit_button_text = apply_filters(  | 
                                                        |
| 241 | - 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',  | 
                                                        |
| 242 | - $this->_submit_button_text,  | 
                                                        |
| 243 | - $this->checkout  | 
                                                        |
| 244 | - );  | 
                                                        |
| 245 | - }  | 
                                                        |
| 246 | -  | 
                                                        |
| 247 | -  | 
                                                        |
| 248 | - /**  | 
                                                        |
| 249 | - * @param boolean $is_current_step  | 
                                                        |
| 250 | - */  | 
                                                        |
| 251 | - public function set_is_current_step($is_current_step)  | 
                                                        |
| 252 | -    { | 
                                                        |
| 253 | - $this->_is_current_step = $is_current_step;  | 
                                                        |
| 254 | - }  | 
                                                        |
| 255 | -  | 
                                                        |
| 256 | -  | 
                                                        |
| 257 | - /**  | 
                                                        |
| 258 | - * @return boolean  | 
                                                        |
| 259 | - */  | 
                                                        |
| 260 | - public function is_current_step()  | 
                                                        |
| 261 | -    { | 
                                                        |
| 262 | - return $this->_is_current_step;  | 
                                                        |
| 263 | - }  | 
                                                        |
| 264 | -  | 
                                                        |
| 265 | -  | 
                                                        |
| 266 | - /**  | 
                                                        |
| 267 | - * @return boolean  | 
                                                        |
| 268 | - */  | 
                                                        |
| 269 | - public function is_final_step()  | 
                                                        |
| 270 | -    { | 
                                                        |
| 271 | - return $this instanceof EE_SPCO_Reg_Step_Finalize_Registration ? true : false;  | 
                                                        |
| 272 | - }  | 
                                                        |
| 273 | -  | 
                                                        |
| 274 | -  | 
                                                        |
| 275 | - /**  | 
                                                        |
| 276 | - * @param int $order  | 
                                                        |
| 277 | - */  | 
                                                        |
| 278 | - public function set_order($order)  | 
                                                        |
| 279 | -    { | 
                                                        |
| 280 | - $this->_order = $order;  | 
                                                        |
| 281 | - }  | 
                                                        |
| 282 | -  | 
                                                        |
| 283 | -  | 
                                                        |
| 284 | - /**  | 
                                                        |
| 285 | - * @return int  | 
                                                        |
| 286 | - */  | 
                                                        |
| 287 | - public function order()  | 
                                                        |
| 288 | -    { | 
                                                        |
| 289 | - return $this->_order;  | 
                                                        |
| 290 | - }  | 
                                                        |
| 291 | -  | 
                                                        |
| 292 | -  | 
                                                        |
| 293 | - /**  | 
                                                        |
| 294 | - * @return string  | 
                                                        |
| 295 | - */  | 
                                                        |
| 296 | - public function template(): string  | 
                                                        |
| 297 | -    { | 
                                                        |
| 298 | - return $this->_template;  | 
                                                        |
| 299 | - }  | 
                                                        |
| 300 | -  | 
                                                        |
| 301 | -  | 
                                                        |
| 302 | - /**  | 
                                                        |
| 303 | - * @param string $template  | 
                                                        |
| 304 | - */  | 
                                                        |
| 305 | - public function setTemplate(string $template): void  | 
                                                        |
| 306 | -    { | 
                                                        |
| 307 | - $this->_template = $template;  | 
                                                        |
| 308 | - }  | 
                                                        |
| 309 | -  | 
                                                        |
| 310 | -  | 
                                                        |
| 311 | - /**  | 
                                                        |
| 312 | - * @return string  | 
                                                        |
| 313 | - */  | 
                                                        |
| 314 | - public function success_message()  | 
                                                        |
| 315 | -    { | 
                                                        |
| 316 | - return $this->_success_message;  | 
                                                        |
| 317 | - }  | 
                                                        |
| 318 | -  | 
                                                        |
| 319 | -  | 
                                                        |
| 320 | - /**  | 
                                                        |
| 321 | - * _set_success_message  | 
                                                        |
| 322 | - *  | 
                                                        |
| 323 | - * @param string $success_message  | 
                                                        |
| 324 | - */  | 
                                                        |
| 325 | - protected function _set_success_message($success_message)  | 
                                                        |
| 326 | -    { | 
                                                        |
| 327 | - $this->_success_message = $success_message;  | 
                                                        |
| 328 | - }  | 
                                                        |
| 329 | -  | 
                                                        |
| 330 | -  | 
                                                        |
| 331 | - /**  | 
                                                        |
| 332 | - * _reset_success_message  | 
                                                        |
| 333 | - *  | 
                                                        |
| 334 | - * @return void  | 
                                                        |
| 335 | - */  | 
                                                        |
| 336 | - protected function _reset_success_message()  | 
                                                        |
| 337 | -    { | 
                                                        |
| 338 | - $this->_success_message = '';  | 
                                                        |
| 339 | - }  | 
                                                        |
| 340 | -  | 
                                                        |
| 341 | -  | 
                                                        |
| 342 | - /**  | 
                                                        |
| 343 | - * @return string  | 
                                                        |
| 344 | - */  | 
                                                        |
| 345 | - public function _instructions()  | 
                                                        |
| 346 | -    { | 
                                                        |
| 347 | - return $this->_instructions;  | 
                                                        |
| 348 | - }  | 
                                                        |
| 349 | -  | 
                                                        |
| 350 | -  | 
                                                        |
| 351 | - /**  | 
                                                        |
| 352 | - * @param string $instructions  | 
                                                        |
| 353 | - */  | 
                                                        |
| 354 | - public function set_instructions($instructions)  | 
                                                        |
| 355 | -    { | 
                                                        |
| 356 | - $this->_instructions = apply_filters(  | 
                                                        |
| 357 | - 'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions',  | 
                                                        |
| 358 | - $instructions,  | 
                                                        |
| 359 | - $this  | 
                                                        |
| 360 | - );  | 
                                                        |
| 361 | - }  | 
                                                        |
| 362 | -  | 
                                                        |
| 363 | -  | 
                                                        |
| 364 | - /**  | 
                                                        |
| 365 | - * @param array $valid_data  | 
                                                        |
| 366 | - */  | 
                                                        |
| 367 | - public function set_valid_data($valid_data)  | 
                                                        |
| 368 | -    { | 
                                                        |
| 369 | - $this->_valid_data = $valid_data;  | 
                                                        |
| 370 | - }  | 
                                                        |
| 371 | -  | 
                                                        |
| 372 | -  | 
                                                        |
| 373 | - /**  | 
                                                        |
| 374 | - * @return array  | 
                                                        |
| 375 | - */  | 
                                                        |
| 376 | - public function valid_data()  | 
                                                        |
| 377 | -    { | 
                                                        |
| 378 | -        if (empty($this->_valid_data)) { | 
                                                        |
| 379 | - $this->_valid_data = $this->reg_form->valid_data();  | 
                                                        |
| 380 | - }  | 
                                                        |
| 381 | - return $this->_valid_data;  | 
                                                        |
| 382 | - }  | 
                                                        |
| 383 | -  | 
                                                        |
| 384 | -  | 
                                                        |
| 385 | - /**  | 
                                                        |
| 386 | - * @return string  | 
                                                        |
| 387 | - */  | 
                                                        |
| 388 | - public function reg_form_name()  | 
                                                        |
| 389 | -    { | 
                                                        |
| 390 | -        if (empty($this->_reg_form_name)) { | 
                                                        |
| 391 | -            $this->set_reg_form_name('ee-spco-' . $this->slug() . '-reg-step-form'); | 
                                                        |
| 392 | - }  | 
                                                        |
| 393 | - return $this->_reg_form_name;  | 
                                                        |
| 394 | - }  | 
                                                        |
| 395 | -  | 
                                                        |
| 396 | -  | 
                                                        |
| 397 | - /**  | 
                                                        |
| 398 | - * @param string $reg_form_name  | 
                                                        |
| 399 | - */  | 
                                                        |
| 400 | - protected function set_reg_form_name($reg_form_name)  | 
                                                        |
| 401 | -    { | 
                                                        |
| 402 | - $this->_reg_form_name = $reg_form_name;  | 
                                                        |
| 403 | - }  | 
                                                        |
| 404 | -  | 
                                                        |
| 405 | -  | 
                                                        |
| 406 | - /**  | 
                                                        |
| 407 | - * reg_step_url  | 
                                                        |
| 408 | - *  | 
                                                        |
| 409 | - * @param string $action  | 
                                                        |
| 410 | - * @return string  | 
                                                        |
| 411 | - */  | 
                                                        |
| 412 | - public function reg_step_url($action = '')  | 
                                                        |
| 413 | -    { | 
                                                        |
| 414 | -        $query_args = array('step' => $this->slug()); | 
                                                        |
| 415 | -        if (! empty($action)) { | 
                                                        |
| 416 | - $query_args['action'] = $action;  | 
                                                        |
| 417 | - }  | 
                                                        |
| 418 | - // final step has no display  | 
                                                        |
| 419 | -        if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action === 'display_spco_reg_step') { | 
                                                        |
| 420 | - $query_args['action'] = 'process_reg_step';  | 
                                                        |
| 421 | - }  | 
                                                        |
| 422 | -        if ($this->checkout->revisit) { | 
                                                        |
| 423 | - $query_args['revisit'] = true;  | 
                                                        |
| 424 | - }  | 
                                                        |
| 425 | -        if ($this->checkout->reg_url_link) { | 
                                                        |
| 426 | - $query_args['e_reg_url_link'] = $this->checkout->reg_url_link;  | 
                                                        |
| 427 | - }  | 
                                                        |
| 428 | - return add_query_arg($query_args, $this->checkout->reg_page_base_url);  | 
                                                        |
| 429 | - }  | 
                                                        |
| 430 | -  | 
                                                        |
| 431 | -  | 
                                                        |
| 432 | - /**  | 
                                                        |
| 433 | - * creates the default hidden inputs section  | 
                                                        |
| 434 | - *  | 
                                                        |
| 435 | - * @return EE_Form_Section_Proper  | 
                                                        |
| 436 | - * @throws \EE_Error  | 
                                                        |
| 437 | - */  | 
                                                        |
| 438 | - public function reg_step_hidden_inputs()  | 
                                                        |
| 439 | -    { | 
                                                        |
| 440 | - // hidden inputs for admin registrations  | 
                                                        |
| 441 | -        if ($this->checkout->admin_request) { | 
                                                        |
| 442 | - return new EE_Form_Section_Proper(  | 
                                                        |
| 443 | - array(  | 
                                                        |
| 444 | - 'layout_strategy' => new EE_Div_Per_Section_Layout(),  | 
                                                        |
| 445 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs',  | 
                                                        |
| 446 | - 'subsections' => array(  | 
                                                        |
| 447 | - 'next_step' => new EE_Fixed_Hidden_Input(  | 
                                                        |
| 448 | - array(  | 
                                                        |
| 449 | - 'html_name' => 'next_step',  | 
                                                        |
| 450 | - 'html_id' => 'spco-' . $this->slug() . '-next-step',  | 
                                                        |
| 451 | - 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step  | 
                                                        |
| 452 | - ? $this->checkout->next_step->slug()  | 
                                                        |
| 453 | - : '',  | 
                                                        |
| 454 | - )  | 
                                                        |
| 455 | - ),  | 
                                                        |
| 456 | - ),  | 
                                                        |
| 457 | - )  | 
                                                        |
| 458 | - );  | 
                                                        |
| 459 | - }  | 
                                                        |
| 460 | - // hidden inputs for frontend registrations  | 
                                                        |
| 461 | - return new EE_Form_Section_Proper(  | 
                                                        |
| 462 | - array(  | 
                                                        |
| 463 | - 'layout_strategy' => new EE_Div_Per_Section_Layout(),  | 
                                                        |
| 464 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs',  | 
                                                        |
| 465 | - 'subsections' => array(  | 
                                                        |
| 466 | - 'action' => new EE_Fixed_Hidden_Input(  | 
                                                        |
| 467 | - array(  | 
                                                        |
| 468 | - 'html_name' => 'action',  | 
                                                        |
| 469 | - 'html_id' => 'spco-' . $this->slug() . '-action',  | 
                                                        |
| 470 | - 'default' => apply_filters(  | 
                                                        |
| 471 | - 'FHEE__EE_SPCO_Reg_Step__reg_step_hidden_inputs__default_form_action',  | 
                                                        |
| 472 | - empty($this->checkout->reg_url_link)  | 
                                                        |
| 473 | - ? 'process_reg_step'  | 
                                                        |
| 474 | - : 'update_reg_step',  | 
                                                        |
| 475 | - $this  | 
                                                        |
| 476 | - ),  | 
                                                        |
| 477 | - )  | 
                                                        |
| 478 | - ),  | 
                                                        |
| 479 | - 'next_step' => new EE_Fixed_Hidden_Input(  | 
                                                        |
| 480 | - array(  | 
                                                        |
| 481 | - 'html_name' => 'next_step',  | 
                                                        |
| 482 | - 'html_id' => 'spco-' . $this->slug() . '-next-step',  | 
                                                        |
| 483 | - 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step  | 
                                                        |
| 484 | - ? $this->checkout->next_step->slug()  | 
                                                        |
| 485 | - : '',  | 
                                                        |
| 486 | - )  | 
                                                        |
| 487 | - ),  | 
                                                        |
| 488 | - 'e_reg_url_link' => new EE_Fixed_Hidden_Input(  | 
                                                        |
| 489 | - array(  | 
                                                        |
| 490 | - 'html_name' => 'e_reg_url_link',  | 
                                                        |
| 491 | - 'html_id' => 'spco-reg_url_link',  | 
                                                        |
| 492 | - 'default' => $this->checkout->reg_url_link,  | 
                                                        |
| 493 | - )  | 
                                                        |
| 494 | - ),  | 
                                                        |
| 495 | - 'revisit' => new EE_Fixed_Hidden_Input(  | 
                                                        |
| 496 | - array(  | 
                                                        |
| 497 | - 'html_name' => 'revisit',  | 
                                                        |
| 498 | - 'html_id' => 'spco-revisit',  | 
                                                        |
| 499 | - 'default' => $this->checkout->revisit,  | 
                                                        |
| 500 | - )  | 
                                                        |
| 501 | - ),  | 
                                                        |
| 502 | - ),  | 
                                                        |
| 503 | - )  | 
                                                        |
| 504 | - );  | 
                                                        |
| 505 | - }  | 
                                                        |
| 506 | -  | 
                                                        |
| 507 | -  | 
                                                        |
| 508 | - /**  | 
                                                        |
| 509 | - * generate_reg_form_for_actions  | 
                                                        |
| 510 | - *  | 
                                                        |
| 511 | - * @param array $actions  | 
                                                        |
| 512 | - * @return void  | 
                                                        |
| 513 | - */  | 
                                                        |
| 514 | - public function generate_reg_form_for_actions($actions = array())  | 
                                                        |
| 515 | -    { | 
                                                        |
| 516 | - $actions = array_merge(  | 
                                                        |
| 517 | - array(  | 
                                                        |
| 518 | - 'generate_reg_form',  | 
                                                        |
| 519 | - 'display_spco_reg_step',  | 
                                                        |
| 520 | - 'process_reg_step',  | 
                                                        |
| 521 | - 'update_reg_step',  | 
                                                        |
| 522 | - ),  | 
                                                        |
| 523 | - $actions  | 
                                                        |
| 524 | - );  | 
                                                        |
| 525 | - $this->checkout->generate_reg_form = in_array($this->checkout->action, $actions, true) ? true : false;  | 
                                                        |
| 526 | - }  | 
                                                        |
| 527 | -  | 
                                                        |
| 528 | -  | 
                                                        |
| 529 | - /**  | 
                                                        |
| 530 | - * @return string  | 
                                                        |
| 531 | - * @throws \EE_Error  | 
                                                        |
| 532 | - */  | 
                                                        |
| 533 | - public function display_reg_form()  | 
                                                        |
| 534 | -    { | 
                                                        |
| 535 | - $html = '';  | 
                                                        |
| 536 | -        if ($this->reg_form instanceof EE_Form_Section_Proper) { | 
                                                        |
| 537 | -            do_action('AHEE__EE_SPCO_Reg_Step__display_reg_form__reg_form', $this->reg_form, $this); | 
                                                        |
| 538 | - $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : '';  | 
                                                        |
| 539 | -            if (EE_Registry::instance()->REQ->ajax) { | 
                                                        |
| 540 | - $this->reg_form->localize_validation_rules();  | 
                                                        |
| 541 | - $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());  | 
                                                        |
| 542 | - }  | 
                                                        |
| 543 | - $html .= $this->reg_form->get_html();  | 
                                                        |
| 544 | - $html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : '';  | 
                                                        |
| 545 | - $html .= ! $this->checkout->admin_request ? $this->reg_form->form_close() : '';  | 
                                                        |
| 546 | - }  | 
                                                        |
| 547 | - return $html;  | 
                                                        |
| 548 | - }  | 
                                                        |
| 549 | -  | 
                                                        |
| 550 | -  | 
                                                        |
| 551 | - /**  | 
                                                        |
| 552 | - * div_class - returns nothing for current step, but a css class of "hidden" for others  | 
                                                        |
| 553 | - *  | 
                                                        |
| 554 | - * @return string  | 
                                                        |
| 555 | - * @throws \EE_Error  | 
                                                        |
| 556 | - */  | 
                                                        |
| 557 | - public function reg_step_submit_button()  | 
                                                        |
| 558 | -    { | 
                                                        |
| 559 | -        if (! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { | 
                                                        |
| 560 | - return '';  | 
                                                        |
| 561 | - }  | 
                                                        |
| 562 | - ob_start();  | 
                                                        |
| 563 | - do_action(  | 
                                                        |
| 564 | - 'AHEE__before_spco_whats_next_buttons',  | 
                                                        |
| 565 | - $this->slug(),  | 
                                                        |
| 566 | - $this->checkout->next_step->slug(),  | 
                                                        |
| 567 | - $this->checkout  | 
                                                        |
| 568 | - );  | 
                                                        |
| 569 | - $html = ob_get_clean();  | 
                                                        |
| 570 | - // generate submit button  | 
                                                        |
| 571 | - $sbmt_btn = new EE_Submit_Input(  | 
                                                        |
| 572 | - array(  | 
                                                        |
| 573 | - 'html_name' => 'spco-go-to-step-' . $this->checkout->next_step->slug(),  | 
                                                        |
| 574 | - 'html_id' => 'spco-go-to-step-' . $this->checkout->next_step->slug(),  | 
                                                        |
| 575 | - 'html_class' => 'spco-next-step-btn',  | 
                                                        |
| 576 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"',  | 
                                                        |
| 577 | - 'default' => $this->submit_button_text(),  | 
                                                        |
| 578 | - )  | 
                                                        |
| 579 | - );  | 
                                                        |
| 580 | - $sbmt_btn->set_button_css_attributes(true, 'large');  | 
                                                        |
| 581 | - $sbmt_btn_html = $sbmt_btn->get_html_for_input();  | 
                                                        |
| 582 | - $html .= EEH_HTML::div(  | 
                                                        |
| 583 | -            apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this), | 
                                                        |
| 584 | - 'spco-' . $this->slug() . '-whats-next-buttons-dv',  | 
                                                        |
| 585 | - 'spco-whats-next-buttons'  | 
                                                        |
| 586 | - );  | 
                                                        |
| 587 | - return $html;  | 
                                                        |
| 588 | - }  | 
                                                        |
| 589 | -  | 
                                                        |
| 590 | -  | 
                                                        |
| 591 | - /**  | 
                                                        |
| 592 | - * div_class - returns nothing for current step, but a css class of "hidden" for others  | 
                                                        |
| 593 | - *  | 
                                                        |
| 594 | - * @return string  | 
                                                        |
| 595 | - */  | 
                                                        |
| 596 | - public function div_class()  | 
                                                        |
| 597 | -    { | 
                                                        |
| 598 | - return $this->is_current_step() ? '' : ' hidden';  | 
                                                        |
| 599 | - }  | 
                                                        |
| 600 | -  | 
                                                        |
| 601 | -  | 
                                                        |
| 602 | - /**  | 
                                                        |
| 603 | - * div_class - returns a css class of "hidden" for current step, but nothing for others  | 
                                                        |
| 604 | - *  | 
                                                        |
| 605 | - * @return string  | 
                                                        |
| 606 | - */  | 
                                                        |
| 607 | - public function edit_lnk_url()  | 
                                                        |
| 608 | -    { | 
                                                        |
| 609 | -        return add_query_arg(array('step' => $this->slug()), $this->checkout->reg_page_base_url); | 
                                                        |
| 610 | - }  | 
                                                        |
| 611 | -  | 
                                                        |
| 612 | -  | 
                                                        |
| 613 | - /**  | 
                                                        |
| 614 | - * div_class - returns a css class of "hidden" for current step, but nothing for others  | 
                                                        |
| 615 | - *  | 
                                                        |
| 616 | - * @return string  | 
                                                        |
| 617 | - */  | 
                                                        |
| 618 | - public function edit_link_class()  | 
                                                        |
| 619 | -    { | 
                                                        |
| 620 | - return $this->is_current_step() ? ' hidden' : '';  | 
                                                        |
| 621 | - }  | 
                                                        |
| 622 | -  | 
                                                        |
| 623 | -  | 
                                                        |
| 624 | - /**  | 
                                                        |
| 625 | - * update_checkout with changes that have been made to the cart  | 
                                                        |
| 626 | - *  | 
                                                        |
| 627 | - * @return void  | 
                                                        |
| 628 | - * @throws \EE_Error  | 
                                                        |
| 629 | - */  | 
                                                        |
| 630 | - public function update_checkout()  | 
                                                        |
| 631 | -    { | 
                                                        |
| 632 | - // grab the cart grand total and reset TXN total  | 
                                                        |
| 633 | - $this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total());  | 
                                                        |
| 634 | - $this->checkout->stash_transaction_and_checkout();  | 
                                                        |
| 635 | - }  | 
                                                        |
| 636 | -  | 
                                                        |
| 637 | -  | 
                                                        |
| 638 | - /**  | 
                                                        |
| 639 | - * __sleep  | 
                                                        |
| 640 | - * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon  | 
                                                        |
| 641 | - * serialization EE_Checkout will handle the reimplementation of itself upon waking, but we won't bother with the  | 
                                                        |
| 642 | - * reg form, because if needed, it will be regenerated anyways  | 
                                                        |
| 643 | - *  | 
                                                        |
| 644 | - * @return array  | 
                                                        |
| 645 | - */  | 
                                                        |
| 646 | - public function __sleep()  | 
                                                        |
| 647 | -    { | 
                                                        |
| 648 | - // remove the reg form and the checkout  | 
                                                        |
| 649 | -        return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout')); | 
                                                        |
| 650 | - }  | 
                                                        |
| 15 | + /**  | 
                                                        |
| 16 | + * $_completed - TRUE if this step has fully completed it's duties  | 
                                                        |
| 17 | + *  | 
                                                        |
| 18 | + * @access protected  | 
                                                        |
| 19 | + * @type bool $_completed  | 
                                                        |
| 20 | + */  | 
                                                        |
| 21 | + protected $_completed = false;  | 
                                                        |
| 22 | +  | 
                                                        |
| 23 | + /**  | 
                                                        |
| 24 | + * $_is_current_step - TRUE if this is the current step  | 
                                                        |
| 25 | + *  | 
                                                        |
| 26 | + * @access protected  | 
                                                        |
| 27 | + * @type bool $_is_current_step  | 
                                                        |
| 28 | + */  | 
                                                        |
| 29 | + protected $_is_current_step = false;  | 
                                                        |
| 30 | +  | 
                                                        |
| 31 | + /**  | 
                                                        |
| 32 | + * $_order - when the reg step should be run relative to other steps  | 
                                                        |
| 33 | + *  | 
                                                        |
| 34 | + * @access protected  | 
                                                        |
| 35 | + * @type int $_template  | 
                                                        |
| 36 | + */  | 
                                                        |
| 37 | + protected $_order = 0;  | 
                                                        |
| 38 | +  | 
                                                        |
| 39 | + /**  | 
                                                        |
| 40 | + * $_slug - URL param for this step  | 
                                                        |
| 41 | + *  | 
                                                        |
| 42 | + * @access protected  | 
                                                        |
| 43 | + * @type string $_slug  | 
                                                        |
| 44 | + */  | 
                                                        |
| 45 | + protected $_slug;  | 
                                                        |
| 46 | +  | 
                                                        |
| 47 | + /**  | 
                                                        |
| 48 | + * $_name - Step Name - translatable string  | 
                                                        |
| 49 | + *  | 
                                                        |
| 50 | + * @access protected  | 
                                                        |
| 51 | + * @type string $_slug  | 
                                                        |
| 52 | + */  | 
                                                        |
| 53 | + protected $_name;  | 
                                                        |
| 54 | +  | 
                                                        |
| 55 | + /**  | 
                                                        |
| 56 | + * $_submit_button_text - translatable string that appears on this step's submit button  | 
                                                        |
| 57 | + *  | 
                                                        |
| 58 | + * @access protected  | 
                                                        |
| 59 | + * @type string $_slug  | 
                                                        |
| 60 | + */  | 
                                                        |
| 61 | + protected $_submit_button_text;  | 
                                                        |
| 62 | +  | 
                                                        |
| 63 | + /**  | 
                                                        |
| 64 | + * $_template - template name  | 
                                                        |
| 65 | + *  | 
                                                        |
| 66 | + * @access protected  | 
                                                        |
| 67 | + * @type string $_template  | 
                                                        |
| 68 | + */  | 
                                                        |
| 69 | + protected $_template;  | 
                                                        |
| 70 | +  | 
                                                        |
| 71 | + /**  | 
                                                        |
| 72 | + * $_reg_form_name - the form input name and id attribute  | 
                                                        |
| 73 | + *  | 
                                                        |
| 74 | + * @access protected  | 
                                                        |
| 75 | + * @var string $_reg_form_name  | 
                                                        |
| 76 | + */  | 
                                                        |
| 77 | + protected $_reg_form_name;  | 
                                                        |
| 78 | +  | 
                                                        |
| 79 | + /**  | 
                                                        |
| 80 | + * $_success_message - text to display upon successful form submission  | 
                                                        |
| 81 | + *  | 
                                                        |
| 82 | + * @access private  | 
                                                        |
| 83 | + * @var string $_success_message  | 
                                                        |
| 84 | + */  | 
                                                        |
| 85 | + protected $_success_message;  | 
                                                        |
| 86 | +  | 
                                                        |
| 87 | + /**  | 
                                                        |
| 88 | + * $_instructions - a brief description of how to complete the reg step.  | 
                                                        |
| 89 | + * Usually displayed in conjunction with the previous step's success message.  | 
                                                        |
| 90 | + *  | 
                                                        |
| 91 | + * @access private  | 
                                                        |
| 92 | + * @var string $_instructions  | 
                                                        |
| 93 | + */  | 
                                                        |
| 94 | + protected $_instructions;  | 
                                                        |
| 95 | +  | 
                                                        |
| 96 | + /**  | 
                                                        |
| 97 | + * $_valid_data - the normalized and validated data for this step  | 
                                                        |
| 98 | + *  | 
                                                        |
| 99 | + * @access public  | 
                                                        |
| 100 | + * @var array $_valid_data  | 
                                                        |
| 101 | + */  | 
                                                        |
| 102 | + protected $_valid_data = array();  | 
                                                        |
| 103 | +  | 
                                                        |
| 104 | + /**  | 
                                                        |
| 105 | + * $reg_form - the registration form for this step  | 
                                                        |
| 106 | + *  | 
                                                        |
| 107 | + * @access public  | 
                                                        |
| 108 | + * @var EE_Form_Section_Proper $reg_form  | 
                                                        |
| 109 | + */  | 
                                                        |
| 110 | + public $reg_form;  | 
                                                        |
| 111 | +  | 
                                                        |
| 112 | + /**  | 
                                                        |
| 113 | + * $checkout - EE_Checkout object for handling the properties of the current checkout process  | 
                                                        |
| 114 | + *  | 
                                                        |
| 115 | + * @access public  | 
                                                        |
| 116 | + * @var EE_Checkout $checkout  | 
                                                        |
| 117 | + */  | 
                                                        |
| 118 | + public $checkout;  | 
                                                        |
| 119 | +  | 
                                                        |
| 120 | +  | 
                                                        |
| 121 | + /**  | 
                                                        |
| 122 | + * @return void  | 
                                                        |
| 123 | + */  | 
                                                        |
| 124 | + abstract public function translate_js_strings();  | 
                                                        |
| 125 | +  | 
                                                        |
| 126 | +  | 
                                                        |
| 127 | + /**  | 
                                                        |
| 128 | + * @return void  | 
                                                        |
| 129 | + */  | 
                                                        |
| 130 | + abstract public function enqueue_styles_and_scripts();  | 
                                                        |
| 131 | +  | 
                                                        |
| 132 | +  | 
                                                        |
| 133 | + /**  | 
                                                        |
| 134 | + * @return boolean  | 
                                                        |
| 135 | + */  | 
                                                        |
| 136 | + abstract public function initialize_reg_step();  | 
                                                        |
| 137 | +  | 
                                                        |
| 138 | +  | 
                                                        |
| 139 | + /**  | 
                                                        |
| 140 | + * @return string  | 
                                                        |
| 141 | + */  | 
                                                        |
| 142 | + abstract public function generate_reg_form();  | 
                                                        |
| 143 | +  | 
                                                        |
| 144 | +  | 
                                                        |
| 145 | + /**  | 
                                                        |
| 146 | + * @return boolean  | 
                                                        |
| 147 | + */  | 
                                                        |
| 148 | + abstract public function process_reg_step();  | 
                                                        |
| 149 | +  | 
                                                        |
| 150 | +  | 
                                                        |
| 151 | + /**  | 
                                                        |
| 152 | + * @return boolean  | 
                                                        |
| 153 | + */  | 
                                                        |
| 154 | + abstract public function update_reg_step();  | 
                                                        |
| 155 | +  | 
                                                        |
| 156 | +  | 
                                                        |
| 157 | + /**  | 
                                                        |
| 158 | + * @return boolean  | 
                                                        |
| 159 | + */  | 
                                                        |
| 160 | + public function completed()  | 
                                                        |
| 161 | +	{ | 
                                                        |
| 162 | + return $this->_completed;  | 
                                                        |
| 163 | + }  | 
                                                        |
| 164 | +  | 
                                                        |
| 165 | +  | 
                                                        |
| 166 | + /**  | 
                                                        |
| 167 | + * set_completed - toggles $_completed to TRUE  | 
                                                        |
| 168 | + */  | 
                                                        |
| 169 | + public function set_completed()  | 
                                                        |
| 170 | +	{ | 
                                                        |
| 171 | + // DEBUG LOG  | 
                                                        |
| 172 | + // $this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 173 | +		$this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this); | 
                                                        |
| 174 | + }  | 
                                                        |
| 175 | +  | 
                                                        |
| 176 | +  | 
                                                        |
| 177 | + /**  | 
                                                        |
| 178 | + * set_completed - toggles $_completed to FALSE  | 
                                                        |
| 179 | + */  | 
                                                        |
| 180 | + public function set_not_completed()  | 
                                                        |
| 181 | +	{ | 
                                                        |
| 182 | + $this->_completed = false;  | 
                                                        |
| 183 | + }  | 
                                                        |
| 184 | +  | 
                                                        |
| 185 | +  | 
                                                        |
| 186 | + /**  | 
                                                        |
| 187 | + * @return string  | 
                                                        |
| 188 | + */  | 
                                                        |
| 189 | + public function name()  | 
                                                        |
| 190 | +	{ | 
                                                        |
| 191 | + return $this->_name;  | 
                                                        |
| 192 | + }  | 
                                                        |
| 193 | +  | 
                                                        |
| 194 | +  | 
                                                        |
| 195 | + /**  | 
                                                        |
| 196 | + * @return string  | 
                                                        |
| 197 | + */  | 
                                                        |
| 198 | + public function slug()  | 
                                                        |
| 199 | +	{ | 
                                                        |
| 200 | + return $this->_slug;  | 
                                                        |
| 201 | + }  | 
                                                        |
| 202 | +  | 
                                                        |
| 203 | +  | 
                                                        |
| 204 | + /**  | 
                                                        |
| 205 | + * submit_button_text  | 
                                                        |
| 206 | + * the text that appears on the reg step form submit button  | 
                                                        |
| 207 | + *  | 
                                                        |
| 208 | + * @return string  | 
                                                        |
| 209 | + */  | 
                                                        |
| 210 | + public function submit_button_text()  | 
                                                        |
| 211 | +	{ | 
                                                        |
| 212 | + return $this->_submit_button_text;  | 
                                                        |
| 213 | + }  | 
                                                        |
| 214 | +  | 
                                                        |
| 215 | +  | 
                                                        |
| 216 | + /**  | 
                                                        |
| 217 | + * set_submit_button_text  | 
                                                        |
| 218 | + * sets the text that appears on the reg step form submit button  | 
                                                        |
| 219 | + *  | 
                                                        |
| 220 | + * @param string $submit_button_text  | 
                                                        |
| 221 | + */  | 
                                                        |
| 222 | + public function set_submit_button_text($submit_button_text = '')  | 
                                                        |
| 223 | +	{ | 
                                                        |
| 224 | +		if (! empty($submit_button_text)) { | 
                                                        |
| 225 | + $this->_submit_button_text = $submit_button_text;  | 
                                                        |
| 226 | +		} elseif ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) { | 
                                                        |
| 227 | +			if ($this->checkout->revisit) { | 
                                                        |
| 228 | + $this->_submit_button_text = sprintf(  | 
                                                        |
| 229 | +					__('Update %s', 'event_espresso'), | 
                                                        |
| 230 | + $this->checkout->current_step->name()  | 
                                                        |
| 231 | + );  | 
                                                        |
| 232 | +			} else { | 
                                                        |
| 233 | + $this->_submit_button_text = sprintf(  | 
                                                        |
| 234 | +					__('Proceed to %s', 'event_espresso'), | 
                                                        |
| 235 | + $this->checkout->next_step->name()  | 
                                                        |
| 236 | + );  | 
                                                        |
| 237 | + }  | 
                                                        |
| 238 | + }  | 
                                                        |
| 239 | + // filters the submit button text  | 
                                                        |
| 240 | + $this->_submit_button_text = apply_filters(  | 
                                                        |
| 241 | + 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',  | 
                                                        |
| 242 | + $this->_submit_button_text,  | 
                                                        |
| 243 | + $this->checkout  | 
                                                        |
| 244 | + );  | 
                                                        |
| 245 | + }  | 
                                                        |
| 246 | +  | 
                                                        |
| 247 | +  | 
                                                        |
| 248 | + /**  | 
                                                        |
| 249 | + * @param boolean $is_current_step  | 
                                                        |
| 250 | + */  | 
                                                        |
| 251 | + public function set_is_current_step($is_current_step)  | 
                                                        |
| 252 | +	{ | 
                                                        |
| 253 | + $this->_is_current_step = $is_current_step;  | 
                                                        |
| 254 | + }  | 
                                                        |
| 255 | +  | 
                                                        |
| 256 | +  | 
                                                        |
| 257 | + /**  | 
                                                        |
| 258 | + * @return boolean  | 
                                                        |
| 259 | + */  | 
                                                        |
| 260 | + public function is_current_step()  | 
                                                        |
| 261 | +	{ | 
                                                        |
| 262 | + return $this->_is_current_step;  | 
                                                        |
| 263 | + }  | 
                                                        |
| 264 | +  | 
                                                        |
| 265 | +  | 
                                                        |
| 266 | + /**  | 
                                                        |
| 267 | + * @return boolean  | 
                                                        |
| 268 | + */  | 
                                                        |
| 269 | + public function is_final_step()  | 
                                                        |
| 270 | +	{ | 
                                                        |
| 271 | + return $this instanceof EE_SPCO_Reg_Step_Finalize_Registration ? true : false;  | 
                                                        |
| 272 | + }  | 
                                                        |
| 273 | +  | 
                                                        |
| 274 | +  | 
                                                        |
| 275 | + /**  | 
                                                        |
| 276 | + * @param int $order  | 
                                                        |
| 277 | + */  | 
                                                        |
| 278 | + public function set_order($order)  | 
                                                        |
| 279 | +	{ | 
                                                        |
| 280 | + $this->_order = $order;  | 
                                                        |
| 281 | + }  | 
                                                        |
| 282 | +  | 
                                                        |
| 283 | +  | 
                                                        |
| 284 | + /**  | 
                                                        |
| 285 | + * @return int  | 
                                                        |
| 286 | + */  | 
                                                        |
| 287 | + public function order()  | 
                                                        |
| 288 | +	{ | 
                                                        |
| 289 | + return $this->_order;  | 
                                                        |
| 290 | + }  | 
                                                        |
| 291 | +  | 
                                                        |
| 292 | +  | 
                                                        |
| 293 | + /**  | 
                                                        |
| 294 | + * @return string  | 
                                                        |
| 295 | + */  | 
                                                        |
| 296 | + public function template(): string  | 
                                                        |
| 297 | +	{ | 
                                                        |
| 298 | + return $this->_template;  | 
                                                        |
| 299 | + }  | 
                                                        |
| 300 | +  | 
                                                        |
| 301 | +  | 
                                                        |
| 302 | + /**  | 
                                                        |
| 303 | + * @param string $template  | 
                                                        |
| 304 | + */  | 
                                                        |
| 305 | + public function setTemplate(string $template): void  | 
                                                        |
| 306 | +	{ | 
                                                        |
| 307 | + $this->_template = $template;  | 
                                                        |
| 308 | + }  | 
                                                        |
| 309 | +  | 
                                                        |
| 310 | +  | 
                                                        |
| 311 | + /**  | 
                                                        |
| 312 | + * @return string  | 
                                                        |
| 313 | + */  | 
                                                        |
| 314 | + public function success_message()  | 
                                                        |
| 315 | +	{ | 
                                                        |
| 316 | + return $this->_success_message;  | 
                                                        |
| 317 | + }  | 
                                                        |
| 318 | +  | 
                                                        |
| 319 | +  | 
                                                        |
| 320 | + /**  | 
                                                        |
| 321 | + * _set_success_message  | 
                                                        |
| 322 | + *  | 
                                                        |
| 323 | + * @param string $success_message  | 
                                                        |
| 324 | + */  | 
                                                        |
| 325 | + protected function _set_success_message($success_message)  | 
                                                        |
| 326 | +	{ | 
                                                        |
| 327 | + $this->_success_message = $success_message;  | 
                                                        |
| 328 | + }  | 
                                                        |
| 329 | +  | 
                                                        |
| 330 | +  | 
                                                        |
| 331 | + /**  | 
                                                        |
| 332 | + * _reset_success_message  | 
                                                        |
| 333 | + *  | 
                                                        |
| 334 | + * @return void  | 
                                                        |
| 335 | + */  | 
                                                        |
| 336 | + protected function _reset_success_message()  | 
                                                        |
| 337 | +	{ | 
                                                        |
| 338 | + $this->_success_message = '';  | 
                                                        |
| 339 | + }  | 
                                                        |
| 340 | +  | 
                                                        |
| 341 | +  | 
                                                        |
| 342 | + /**  | 
                                                        |
| 343 | + * @return string  | 
                                                        |
| 344 | + */  | 
                                                        |
| 345 | + public function _instructions()  | 
                                                        |
| 346 | +	{ | 
                                                        |
| 347 | + return $this->_instructions;  | 
                                                        |
| 348 | + }  | 
                                                        |
| 349 | +  | 
                                                        |
| 350 | +  | 
                                                        |
| 351 | + /**  | 
                                                        |
| 352 | + * @param string $instructions  | 
                                                        |
| 353 | + */  | 
                                                        |
| 354 | + public function set_instructions($instructions)  | 
                                                        |
| 355 | +	{ | 
                                                        |
| 356 | + $this->_instructions = apply_filters(  | 
                                                        |
| 357 | + 'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions',  | 
                                                        |
| 358 | + $instructions,  | 
                                                        |
| 359 | + $this  | 
                                                        |
| 360 | + );  | 
                                                        |
| 361 | + }  | 
                                                        |
| 362 | +  | 
                                                        |
| 363 | +  | 
                                                        |
| 364 | + /**  | 
                                                        |
| 365 | + * @param array $valid_data  | 
                                                        |
| 366 | + */  | 
                                                        |
| 367 | + public function set_valid_data($valid_data)  | 
                                                        |
| 368 | +	{ | 
                                                        |
| 369 | + $this->_valid_data = $valid_data;  | 
                                                        |
| 370 | + }  | 
                                                        |
| 371 | +  | 
                                                        |
| 372 | +  | 
                                                        |
| 373 | + /**  | 
                                                        |
| 374 | + * @return array  | 
                                                        |
| 375 | + */  | 
                                                        |
| 376 | + public function valid_data()  | 
                                                        |
| 377 | +	{ | 
                                                        |
| 378 | +		if (empty($this->_valid_data)) { | 
                                                        |
| 379 | + $this->_valid_data = $this->reg_form->valid_data();  | 
                                                        |
| 380 | + }  | 
                                                        |
| 381 | + return $this->_valid_data;  | 
                                                        |
| 382 | + }  | 
                                                        |
| 383 | +  | 
                                                        |
| 384 | +  | 
                                                        |
| 385 | + /**  | 
                                                        |
| 386 | + * @return string  | 
                                                        |
| 387 | + */  | 
                                                        |
| 388 | + public function reg_form_name()  | 
                                                        |
| 389 | +	{ | 
                                                        |
| 390 | +		if (empty($this->_reg_form_name)) { | 
                                                        |
| 391 | +			$this->set_reg_form_name('ee-spco-' . $this->slug() . '-reg-step-form'); | 
                                                        |
| 392 | + }  | 
                                                        |
| 393 | + return $this->_reg_form_name;  | 
                                                        |
| 394 | + }  | 
                                                        |
| 395 | +  | 
                                                        |
| 396 | +  | 
                                                        |
| 397 | + /**  | 
                                                        |
| 398 | + * @param string $reg_form_name  | 
                                                        |
| 399 | + */  | 
                                                        |
| 400 | + protected function set_reg_form_name($reg_form_name)  | 
                                                        |
| 401 | +	{ | 
                                                        |
| 402 | + $this->_reg_form_name = $reg_form_name;  | 
                                                        |
| 403 | + }  | 
                                                        |
| 404 | +  | 
                                                        |
| 405 | +  | 
                                                        |
| 406 | + /**  | 
                                                        |
| 407 | + * reg_step_url  | 
                                                        |
| 408 | + *  | 
                                                        |
| 409 | + * @param string $action  | 
                                                        |
| 410 | + * @return string  | 
                                                        |
| 411 | + */  | 
                                                        |
| 412 | + public function reg_step_url($action = '')  | 
                                                        |
| 413 | +	{ | 
                                                        |
| 414 | +		$query_args = array('step' => $this->slug()); | 
                                                        |
| 415 | +		if (! empty($action)) { | 
                                                        |
| 416 | + $query_args['action'] = $action;  | 
                                                        |
| 417 | + }  | 
                                                        |
| 418 | + // final step has no display  | 
                                                        |
| 419 | +		if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action === 'display_spco_reg_step') { | 
                                                        |
| 420 | + $query_args['action'] = 'process_reg_step';  | 
                                                        |
| 421 | + }  | 
                                                        |
| 422 | +		if ($this->checkout->revisit) { | 
                                                        |
| 423 | + $query_args['revisit'] = true;  | 
                                                        |
| 424 | + }  | 
                                                        |
| 425 | +		if ($this->checkout->reg_url_link) { | 
                                                        |
| 426 | + $query_args['e_reg_url_link'] = $this->checkout->reg_url_link;  | 
                                                        |
| 427 | + }  | 
                                                        |
| 428 | + return add_query_arg($query_args, $this->checkout->reg_page_base_url);  | 
                                                        |
| 429 | + }  | 
                                                        |
| 430 | +  | 
                                                        |
| 431 | +  | 
                                                        |
| 432 | + /**  | 
                                                        |
| 433 | + * creates the default hidden inputs section  | 
                                                        |
| 434 | + *  | 
                                                        |
| 435 | + * @return EE_Form_Section_Proper  | 
                                                        |
| 436 | + * @throws \EE_Error  | 
                                                        |
| 437 | + */  | 
                                                        |
| 438 | + public function reg_step_hidden_inputs()  | 
                                                        |
| 439 | +	{ | 
                                                        |
| 440 | + // hidden inputs for admin registrations  | 
                                                        |
| 441 | +		if ($this->checkout->admin_request) { | 
                                                        |
| 442 | + return new EE_Form_Section_Proper(  | 
                                                        |
| 443 | + array(  | 
                                                        |
| 444 | + 'layout_strategy' => new EE_Div_Per_Section_Layout(),  | 
                                                        |
| 445 | + 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs',  | 
                                                        |
| 446 | + 'subsections' => array(  | 
                                                        |
| 447 | + 'next_step' => new EE_Fixed_Hidden_Input(  | 
                                                        |
| 448 | + array(  | 
                                                        |
| 449 | + 'html_name' => 'next_step',  | 
                                                        |
| 450 | + 'html_id' => 'spco-' . $this->slug() . '-next-step',  | 
                                                        |
| 451 | + 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step  | 
                                                        |
| 452 | + ? $this->checkout->next_step->slug()  | 
                                                        |
| 453 | + : '',  | 
                                                        |
| 454 | + )  | 
                                                        |
| 455 | + ),  | 
                                                        |
| 456 | + ),  | 
                                                        |
| 457 | + )  | 
                                                        |
| 458 | + );  | 
                                                        |
| 459 | + }  | 
                                                        |
| 460 | + // hidden inputs for frontend registrations  | 
                                                        |
| 461 | + return new EE_Form_Section_Proper(  | 
                                                        |
| 462 | + array(  | 
                                                        |
| 463 | + 'layout_strategy' => new EE_Div_Per_Section_Layout(),  | 
                                                        |
| 464 | + 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs',  | 
                                                        |
| 465 | + 'subsections' => array(  | 
                                                        |
| 466 | + 'action' => new EE_Fixed_Hidden_Input(  | 
                                                        |
| 467 | + array(  | 
                                                        |
| 468 | + 'html_name' => 'action',  | 
                                                        |
| 469 | + 'html_id' => 'spco-' . $this->slug() . '-action',  | 
                                                        |
| 470 | + 'default' => apply_filters(  | 
                                                        |
| 471 | + 'FHEE__EE_SPCO_Reg_Step__reg_step_hidden_inputs__default_form_action',  | 
                                                        |
| 472 | + empty($this->checkout->reg_url_link)  | 
                                                        |
| 473 | + ? 'process_reg_step'  | 
                                                        |
| 474 | + : 'update_reg_step',  | 
                                                        |
| 475 | + $this  | 
                                                        |
| 476 | + ),  | 
                                                        |
| 477 | + )  | 
                                                        |
| 478 | + ),  | 
                                                        |
| 479 | + 'next_step' => new EE_Fixed_Hidden_Input(  | 
                                                        |
| 480 | + array(  | 
                                                        |
| 481 | + 'html_name' => 'next_step',  | 
                                                        |
| 482 | + 'html_id' => 'spco-' . $this->slug() . '-next-step',  | 
                                                        |
| 483 | + 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step  | 
                                                        |
| 484 | + ? $this->checkout->next_step->slug()  | 
                                                        |
| 485 | + : '',  | 
                                                        |
| 486 | + )  | 
                                                        |
| 487 | + ),  | 
                                                        |
| 488 | + 'e_reg_url_link' => new EE_Fixed_Hidden_Input(  | 
                                                        |
| 489 | + array(  | 
                                                        |
| 490 | + 'html_name' => 'e_reg_url_link',  | 
                                                        |
| 491 | + 'html_id' => 'spco-reg_url_link',  | 
                                                        |
| 492 | + 'default' => $this->checkout->reg_url_link,  | 
                                                        |
| 493 | + )  | 
                                                        |
| 494 | + ),  | 
                                                        |
| 495 | + 'revisit' => new EE_Fixed_Hidden_Input(  | 
                                                        |
| 496 | + array(  | 
                                                        |
| 497 | + 'html_name' => 'revisit',  | 
                                                        |
| 498 | + 'html_id' => 'spco-revisit',  | 
                                                        |
| 499 | + 'default' => $this->checkout->revisit,  | 
                                                        |
| 500 | + )  | 
                                                        |
| 501 | + ),  | 
                                                        |
| 502 | + ),  | 
                                                        |
| 503 | + )  | 
                                                        |
| 504 | + );  | 
                                                        |
| 505 | + }  | 
                                                        |
| 506 | +  | 
                                                        |
| 507 | +  | 
                                                        |
| 508 | + /**  | 
                                                        |
| 509 | + * generate_reg_form_for_actions  | 
                                                        |
| 510 | + *  | 
                                                        |
| 511 | + * @param array $actions  | 
                                                        |
| 512 | + * @return void  | 
                                                        |
| 513 | + */  | 
                                                        |
| 514 | + public function generate_reg_form_for_actions($actions = array())  | 
                                                        |
| 515 | +	{ | 
                                                        |
| 516 | + $actions = array_merge(  | 
                                                        |
| 517 | + array(  | 
                                                        |
| 518 | + 'generate_reg_form',  | 
                                                        |
| 519 | + 'display_spco_reg_step',  | 
                                                        |
| 520 | + 'process_reg_step',  | 
                                                        |
| 521 | + 'update_reg_step',  | 
                                                        |
| 522 | + ),  | 
                                                        |
| 523 | + $actions  | 
                                                        |
| 524 | + );  | 
                                                        |
| 525 | + $this->checkout->generate_reg_form = in_array($this->checkout->action, $actions, true) ? true : false;  | 
                                                        |
| 526 | + }  | 
                                                        |
| 527 | +  | 
                                                        |
| 528 | +  | 
                                                        |
| 529 | + /**  | 
                                                        |
| 530 | + * @return string  | 
                                                        |
| 531 | + * @throws \EE_Error  | 
                                                        |
| 532 | + */  | 
                                                        |
| 533 | + public function display_reg_form()  | 
                                                        |
| 534 | +	{ | 
                                                        |
| 535 | + $html = '';  | 
                                                        |
| 536 | +		if ($this->reg_form instanceof EE_Form_Section_Proper) { | 
                                                        |
| 537 | +			do_action('AHEE__EE_SPCO_Reg_Step__display_reg_form__reg_form', $this->reg_form, $this); | 
                                                        |
| 538 | + $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : '';  | 
                                                        |
| 539 | +			if (EE_Registry::instance()->REQ->ajax) { | 
                                                        |
| 540 | + $this->reg_form->localize_validation_rules();  | 
                                                        |
| 541 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());  | 
                                                        |
| 542 | + }  | 
                                                        |
| 543 | + $html .= $this->reg_form->get_html();  | 
                                                        |
| 544 | + $html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : '';  | 
                                                        |
| 545 | + $html .= ! $this->checkout->admin_request ? $this->reg_form->form_close() : '';  | 
                                                        |
| 546 | + }  | 
                                                        |
| 547 | + return $html;  | 
                                                        |
| 548 | + }  | 
                                                        |
| 549 | +  | 
                                                        |
| 550 | +  | 
                                                        |
| 551 | + /**  | 
                                                        |
| 552 | + * div_class - returns nothing for current step, but a css class of "hidden" for others  | 
                                                        |
| 553 | + *  | 
                                                        |
| 554 | + * @return string  | 
                                                        |
| 555 | + * @throws \EE_Error  | 
                                                        |
| 556 | + */  | 
                                                        |
| 557 | + public function reg_step_submit_button()  | 
                                                        |
| 558 | +	{ | 
                                                        |
| 559 | +		if (! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { | 
                                                        |
| 560 | + return '';  | 
                                                        |
| 561 | + }  | 
                                                        |
| 562 | + ob_start();  | 
                                                        |
| 563 | + do_action(  | 
                                                        |
| 564 | + 'AHEE__before_spco_whats_next_buttons',  | 
                                                        |
| 565 | + $this->slug(),  | 
                                                        |
| 566 | + $this->checkout->next_step->slug(),  | 
                                                        |
| 567 | + $this->checkout  | 
                                                        |
| 568 | + );  | 
                                                        |
| 569 | + $html = ob_get_clean();  | 
                                                        |
| 570 | + // generate submit button  | 
                                                        |
| 571 | + $sbmt_btn = new EE_Submit_Input(  | 
                                                        |
| 572 | + array(  | 
                                                        |
| 573 | + 'html_name' => 'spco-go-to-step-' . $this->checkout->next_step->slug(),  | 
                                                        |
| 574 | + 'html_id' => 'spco-go-to-step-' . $this->checkout->next_step->slug(),  | 
                                                        |
| 575 | + 'html_class' => 'spco-next-step-btn',  | 
                                                        |
| 576 | + 'other_html_attributes' => ' rel="' . $this->slug() . '"',  | 
                                                        |
| 577 | + 'default' => $this->submit_button_text(),  | 
                                                        |
| 578 | + )  | 
                                                        |
| 579 | + );  | 
                                                        |
| 580 | + $sbmt_btn->set_button_css_attributes(true, 'large');  | 
                                                        |
| 581 | + $sbmt_btn_html = $sbmt_btn->get_html_for_input();  | 
                                                        |
| 582 | + $html .= EEH_HTML::div(  | 
                                                        |
| 583 | +			apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this), | 
                                                        |
| 584 | + 'spco-' . $this->slug() . '-whats-next-buttons-dv',  | 
                                                        |
| 585 | + 'spco-whats-next-buttons'  | 
                                                        |
| 586 | + );  | 
                                                        |
| 587 | + return $html;  | 
                                                        |
| 588 | + }  | 
                                                        |
| 589 | +  | 
                                                        |
| 590 | +  | 
                                                        |
| 591 | + /**  | 
                                                        |
| 592 | + * div_class - returns nothing for current step, but a css class of "hidden" for others  | 
                                                        |
| 593 | + *  | 
                                                        |
| 594 | + * @return string  | 
                                                        |
| 595 | + */  | 
                                                        |
| 596 | + public function div_class()  | 
                                                        |
| 597 | +	{ | 
                                                        |
| 598 | + return $this->is_current_step() ? '' : ' hidden';  | 
                                                        |
| 599 | + }  | 
                                                        |
| 600 | +  | 
                                                        |
| 601 | +  | 
                                                        |
| 602 | + /**  | 
                                                        |
| 603 | + * div_class - returns a css class of "hidden" for current step, but nothing for others  | 
                                                        |
| 604 | + *  | 
                                                        |
| 605 | + * @return string  | 
                                                        |
| 606 | + */  | 
                                                        |
| 607 | + public function edit_lnk_url()  | 
                                                        |
| 608 | +	{ | 
                                                        |
| 609 | +		return add_query_arg(array('step' => $this->slug()), $this->checkout->reg_page_base_url); | 
                                                        |
| 610 | + }  | 
                                                        |
| 611 | +  | 
                                                        |
| 612 | +  | 
                                                        |
| 613 | + /**  | 
                                                        |
| 614 | + * div_class - returns a css class of "hidden" for current step, but nothing for others  | 
                                                        |
| 615 | + *  | 
                                                        |
| 616 | + * @return string  | 
                                                        |
| 617 | + */  | 
                                                        |
| 618 | + public function edit_link_class()  | 
                                                        |
| 619 | +	{ | 
                                                        |
| 620 | + return $this->is_current_step() ? ' hidden' : '';  | 
                                                        |
| 621 | + }  | 
                                                        |
| 622 | +  | 
                                                        |
| 623 | +  | 
                                                        |
| 624 | + /**  | 
                                                        |
| 625 | + * update_checkout with changes that have been made to the cart  | 
                                                        |
| 626 | + *  | 
                                                        |
| 627 | + * @return void  | 
                                                        |
| 628 | + * @throws \EE_Error  | 
                                                        |
| 629 | + */  | 
                                                        |
| 630 | + public function update_checkout()  | 
                                                        |
| 631 | +	{ | 
                                                        |
| 632 | + // grab the cart grand total and reset TXN total  | 
                                                        |
| 633 | + $this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total());  | 
                                                        |
| 634 | + $this->checkout->stash_transaction_and_checkout();  | 
                                                        |
| 635 | + }  | 
                                                        |
| 636 | +  | 
                                                        |
| 637 | +  | 
                                                        |
| 638 | + /**  | 
                                                        |
| 639 | + * __sleep  | 
                                                        |
| 640 | + * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon  | 
                                                        |
| 641 | + * serialization EE_Checkout will handle the reimplementation of itself upon waking, but we won't bother with the  | 
                                                        |
| 642 | + * reg form, because if needed, it will be regenerated anyways  | 
                                                        |
| 643 | + *  | 
                                                        |
| 644 | + * @return array  | 
                                                        |
| 645 | + */  | 
                                                        |
| 646 | + public function __sleep()  | 
                                                        |
| 647 | +	{ | 
                                                        |
| 648 | + // remove the reg form and the checkout  | 
                                                        |
| 649 | +		return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout')); | 
                                                        |
| 650 | + }  | 
                                                        |
| 651 | 651 | }  | 
                                                        
@@ -21,938 +21,938 @@  | 
                                                    ||
| 21 | 21 | class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step  | 
                                                        
| 22 | 22 |  { | 
                                                        
| 23 | 23 | |
| 24 | - /**  | 
                                                        |
| 25 | - * @var bool  | 
                                                        |
| 26 | - */  | 
                                                        |
| 27 | - private $_print_copy_info = false;  | 
                                                        |
| 28 | -  | 
                                                        |
| 29 | - /**  | 
                                                        |
| 30 | - * @var array  | 
                                                        |
| 31 | - */  | 
                                                        |
| 32 | - private $_attendee_data = array();  | 
                                                        |
| 33 | -  | 
                                                        |
| 34 | - /**  | 
                                                        |
| 35 | - * @var array  | 
                                                        |
| 36 | - */  | 
                                                        |
| 37 | - private $_required_questions = array();  | 
                                                        |
| 38 | -  | 
                                                        |
| 39 | - /**  | 
                                                        |
| 40 | - * @var array  | 
                                                        |
| 41 | - */  | 
                                                        |
| 42 | - private $_registration_answers = array();  | 
                                                        |
| 43 | -  | 
                                                        |
| 44 | - /**  | 
                                                        |
| 45 | - * @var int  | 
                                                        |
| 46 | - */  | 
                                                        |
| 47 | - protected $reg_form_count = 0;  | 
                                                        |
| 48 | -  | 
                                                        |
| 49 | - /**  | 
                                                        |
| 50 | - * class constructor  | 
                                                        |
| 51 | - *  | 
                                                        |
| 52 | - * @access public  | 
                                                        |
| 53 | - * @param EE_Checkout $checkout  | 
                                                        |
| 54 | - */  | 
                                                        |
| 55 | - public function __construct(EE_Checkout $checkout)  | 
                                                        |
| 56 | -    { | 
                                                        |
| 57 | - $this->_slug = 'attendee_information';  | 
                                                        |
| 58 | -        $this->_name = esc_html__('Attendee Information', 'event_espresso'); | 
                                                        |
| 59 | - $this->checkout = $checkout;  | 
                                                        |
| 60 | - $this->_reset_success_message();  | 
                                                        |
| 61 | - $this->set_instructions(  | 
                                                        |
| 62 | -            esc_html__('Please answer the following registration questions before proceeding.', 'event_espresso') | 
                                                        |
| 63 | - );  | 
                                                        |
| 64 | - }  | 
                                                        |
| 65 | -  | 
                                                        |
| 66 | -  | 
                                                        |
| 67 | - public function translate_js_strings()  | 
                                                        |
| 68 | -    { | 
                                                        |
| 69 | - EE_Registry::$i18n_js_strings['required_field'] = esc_html__(  | 
                                                        |
| 70 | - ' is a required question.',  | 
                                                        |
| 71 | - 'event_espresso'  | 
                                                        |
| 72 | - );  | 
                                                        |
| 73 | - EE_Registry::$i18n_js_strings['required_multi_field'] = esc_html__(  | 
                                                        |
| 74 | - ' is a required question. Please enter a value for at least one of the options.',  | 
                                                        |
| 75 | - 'event_espresso'  | 
                                                        |
| 76 | - );  | 
                                                        |
| 77 | - EE_Registry::$i18n_js_strings['answer_required_questions'] = esc_html__(  | 
                                                        |
| 78 | - 'Please answer all required questions correctly before proceeding.',  | 
                                                        |
| 79 | - 'event_espresso'  | 
                                                        |
| 80 | - );  | 
                                                        |
| 81 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(  | 
                                                        |
| 82 | - esc_html_x(  | 
                                                        |
| 83 | - 'The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.',  | 
                                                        |
| 84 | - 'The attendee information was successfully copied.(line break)Please ensure the rest of the registration form is completed before proceeding.',  | 
                                                        |
| 85 | - 'event_espresso'  | 
                                                        |
| 86 | - ),  | 
                                                        |
| 87 | - '<br/>'  | 
                                                        |
| 88 | - );  | 
                                                        |
| 89 | - EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = esc_html__(  | 
                                                        |
| 90 | - 'An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.',  | 
                                                        |
| 91 | - 'event_espresso'  | 
                                                        |
| 92 | - );  | 
                                                        |
| 93 | - EE_Registry::$i18n_js_strings['enter_valid_email'] = esc_html__(  | 
                                                        |
| 94 | - 'You must enter a valid email address.',  | 
                                                        |
| 95 | - 'event_espresso'  | 
                                                        |
| 96 | - );  | 
                                                        |
| 97 | - EE_Registry::$i18n_js_strings['valid_email_and_questions'] = esc_html__(  | 
                                                        |
| 98 | - 'You must enter a valid email address and answer all other required questions before you can proceed.',  | 
                                                        |
| 99 | - 'event_espresso'  | 
                                                        |
| 100 | - );  | 
                                                        |
| 101 | - }  | 
                                                        |
| 102 | -  | 
                                                        |
| 103 | -  | 
                                                        |
| 104 | - public function enqueue_styles_and_scripts()  | 
                                                        |
| 105 | -    { | 
                                                        |
| 106 | - }  | 
                                                        |
| 107 | -  | 
                                                        |
| 108 | -  | 
                                                        |
| 109 | - /**  | 
                                                        |
| 110 | - * @return boolean  | 
                                                        |
| 111 | - */  | 
                                                        |
| 112 | - public function initialize_reg_step(): bool  | 
                                                        |
| 113 | -    { | 
                                                        |
| 114 | - return true;  | 
                                                        |
| 115 | - }  | 
                                                        |
| 116 | -  | 
                                                        |
| 117 | -  | 
                                                        |
| 118 | - /**  | 
                                                        |
| 119 | - * @return LegacyRegistrationForm  | 
                                                        |
| 120 | - * @throws DomainException  | 
                                                        |
| 121 | - * @throws InvalidArgumentException  | 
                                                        |
| 122 | - * @throws EntityNotFoundException  | 
                                                        |
| 123 | - * @throws InvalidDataTypeException  | 
                                                        |
| 124 | - * @throws InvalidInterfaceException  | 
                                                        |
| 125 | - */  | 
                                                        |
| 126 | - public function generate_reg_form(): LegacyRegistrationForm  | 
                                                        |
| 127 | -    { | 
                                                        |
| 128 | - // TODO detect if event has a reg form UUID and swap this out for new reg form builder generated form  | 
                                                        |
| 129 | - return LoaderFactory::getLoader()->getShared(LegacyRegistrationForm::class, [$this]);  | 
                                                        |
| 130 | - }  | 
                                                        |
| 131 | -  | 
                                                        |
| 132 | -  | 
                                                        |
| 133 | - /**  | 
                                                        |
| 134 | - * looking for hooks?  | 
                                                        |
| 135 | - * this method has been replaced by:  | 
                                                        |
| 136 | - * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::getRegForm()  | 
                                                        |
| 137 | - *  | 
                                                        |
| 138 | - * @deprecated $VID:$  | 
                                                        |
| 139 | - */  | 
                                                        |
| 140 | - private function _registrations_reg_form()  | 
                                                        |
| 141 | -    { | 
                                                        |
| 142 | - }  | 
                                                        |
| 143 | -  | 
                                                        |
| 144 | -  | 
                                                        |
| 145 | - /**  | 
                                                        |
| 146 | - * looking for hooks?  | 
                                                        |
| 147 | - * this method has been replaced by:  | 
                                                        |
| 148 | - * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::additionalAttendeeRegInfoInput()  | 
                                                        |
| 149 | - *  | 
                                                        |
| 150 | - * @deprecated $VID:$  | 
                                                        |
| 151 | - */  | 
                                                        |
| 152 | -    private function _additional_attendee_reg_info_input() { | 
                                                        |
| 153 | - }  | 
                                                        |
| 154 | -  | 
                                                        |
| 155 | -  | 
                                                        |
| 156 | - /**  | 
                                                        |
| 157 | - * looking for hooks?  | 
                                                        |
| 158 | - * this method has been replaced by:  | 
                                                        |
| 159 | - * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::questionGroupRegForm()  | 
                                                        |
| 160 | - *  | 
                                                        |
| 161 | - * @deprecated $VID:$  | 
                                                        |
| 162 | - */  | 
                                                        |
| 163 | - private function _question_group_reg_form()  | 
                                                        |
| 164 | -    { | 
                                                        |
| 165 | - }  | 
                                                        |
| 166 | -  | 
                                                        |
| 167 | -  | 
                                                        |
| 168 | - /**  | 
                                                        |
| 169 | - * looking for hooks?  | 
                                                        |
| 170 | - * this method has been replaced by:  | 
                                                        |
| 171 | - * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::questionGroupHeader()  | 
                                                        |
| 172 | - *  | 
                                                        |
| 173 | - * @deprecated $VID:$  | 
                                                        |
| 174 | - */  | 
                                                        |
| 175 | - private function _question_group_header()  | 
                                                        |
| 176 | -    { | 
                                                        |
| 177 | - }  | 
                                                        |
| 178 | -  | 
                                                        |
| 179 | -  | 
                                                        |
| 180 | - /**  | 
                                                        |
| 181 | - * looking for hooks?  | 
                                                        |
| 182 | - * this method has been replaced by:  | 
                                                        |
| 183 | - * EventEspresso\core\domain\services\registration\form\LegacyCopyAttendeeInfoForm  | 
                                                        |
| 184 | - *  | 
                                                        |
| 185 | - * @deprecated $VID:$  | 
                                                        |
| 186 | - */  | 
                                                        |
| 187 | - private function _copy_attendee_info_form()  | 
                                                        |
| 188 | -    { | 
                                                        |
| 189 | - }  | 
                                                        |
| 190 | -  | 
                                                        |
| 191 | -  | 
                                                        |
| 192 | - /**  | 
                                                        |
| 193 | - * looking for hooks?  | 
                                                        |
| 194 | - * this method has been replaced by:  | 
                                                        |
| 195 | - * EventEspresso\core\domain\services\registration\form\LegacyAutoCopyAttendeeInfoForm  | 
                                                        |
| 196 | - *  | 
                                                        |
| 197 | - * @deprecated $VID:$  | 
                                                        |
| 198 | - */  | 
                                                        |
| 199 | - private function _auto_copy_attendee_info()  | 
                                                        |
| 200 | -    { | 
                                                        |
| 201 | - }  | 
                                                        |
| 202 | -  | 
                                                        |
| 203 | -  | 
                                                        |
| 204 | - /**  | 
                                                        |
| 205 | - * looking for hooks?  | 
                                                        |
| 206 | - * this method has been replaced by:  | 
                                                        |
| 207 | - * EventEspresso\core\domain\services\registration\form\LegacyCopyAttendeeInfoForm  | 
                                                        |
| 208 | - *  | 
                                                        |
| 209 | - * @deprecated $VID:$  | 
                                                        |
| 210 | - */  | 
                                                        |
| 211 | - private function _copy_attendee_info_inputs()  | 
                                                        |
| 212 | -    { | 
                                                        |
| 213 | - }  | 
                                                        |
| 214 | -  | 
                                                        |
| 215 | -  | 
                                                        |
| 216 | - /**  | 
                                                        |
| 217 | - * looking for hooks?  | 
                                                        |
| 218 | - * this method has been replaced by:  | 
                                                        |
| 219 | - * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::additionalPrimaryRegistrantInputs()  | 
                                                        |
| 220 | - *  | 
                                                        |
| 221 | - * @deprecated $VID:$  | 
                                                        |
| 222 | - */  | 
                                                        |
| 223 | - private function _additional_primary_registrant_inputs()  | 
                                                        |
| 224 | -    { | 
                                                        |
| 225 | - }  | 
                                                        |
| 226 | -  | 
                                                        |
| 227 | -  | 
                                                        |
| 228 | - /**  | 
                                                        |
| 229 | - * looking for hooks?  | 
                                                        |
| 230 | - * this method has been replaced by:  | 
                                                        |
| 231 | - * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::regFormQuestion()  | 
                                                        |
| 232 | - *  | 
                                                        |
| 233 | - * @param EE_Registration $registration  | 
                                                        |
| 234 | - * @param EE_Question $question  | 
                                                        |
| 235 | - * @return EE_Form_Input_Base  | 
                                                        |
| 236 | - * @throws EE_Error  | 
                                                        |
| 237 | - * @throws InvalidArgumentException  | 
                                                        |
| 238 | - * @throws InvalidDataTypeException  | 
                                                        |
| 239 | - * @throws InvalidInterfaceException  | 
                                                        |
| 240 | - * @throws OutOfRangeException  | 
                                                        |
| 241 | - * @throws ReflectionException  | 
                                                        |
| 242 | - * @deprecated $VID:$  | 
                                                        |
| 243 | - */  | 
                                                        |
| 244 | - public function reg_form_question(EE_Registration $registration, EE_Question $question): EE_Form_Input_Base  | 
                                                        |
| 245 | -    { | 
                                                        |
| 246 | - $legacy_reg_form = $this->legacy_reg_forms[ $registration->reg_url_link() ] ?? null;  | 
                                                        |
| 247 | -        if ($legacy_reg_form instanceof LegacyRegistrationForm) { | 
                                                        |
| 248 | - return $legacy_reg_form->regFormQuestion($registration, $question);  | 
                                                        |
| 249 | - }  | 
                                                        |
| 250 | - throw new OutOfRangeException();  | 
                                                        |
| 251 | - }  | 
                                                        |
| 252 | -  | 
                                                        |
| 253 | -  | 
                                                        |
| 254 | - /**  | 
                                                        |
| 255 | - * looking for hooks?  | 
                                                        |
| 256 | - * this method has been replaced by:  | 
                                                        |
| 257 | - * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::generateQuestionInput()  | 
                                                        |
| 258 | - *  | 
                                                        |
| 259 | - * @deprecated $VID:$  | 
                                                        |
| 260 | - */  | 
                                                        |
| 261 | - private function _generate_question_input()  | 
                                                        |
| 262 | -    { | 
                                                        |
| 263 | - }  | 
                                                        |
| 264 | -  | 
                                                        |
| 265 | -  | 
                                                        |
| 266 | - /**  | 
                                                        |
| 267 | - * looking for hooks?  | 
                                                        |
| 268 | - * this method has been replaced by:  | 
                                                        |
| 269 | - * EventEspresso\core\domain\services\registration\form\CountryOptions::forLegacyFormInput()  | 
                                                        |
| 270 | - *  | 
                                                        |
| 271 | - * @param array|null $countries_list  | 
                                                        |
| 272 | - * @param EE_Question|null $question  | 
                                                        |
| 273 | - * @param EE_Registration|null $registration  | 
                                                        |
| 274 | - * @param EE_Answer|null $answer  | 
                                                        |
| 275 | - * @return array 2d keys are country IDs, values are their names  | 
                                                        |
| 276 | - * @throws EE_Error  | 
                                                        |
| 277 | - * @throws ReflectionException  | 
                                                        |
| 278 | - * @deprecated $VID:$  | 
                                                        |
| 279 | - */  | 
                                                        |
| 280 | - public function use_cached_countries_for_form_input(  | 
                                                        |
| 281 | - array $countries_list = null,  | 
                                                        |
| 282 | - EE_Question $question = null,  | 
                                                        |
| 283 | - EE_Registration $registration = null,  | 
                                                        |
| 284 | - EE_Answer $answer = null  | 
                                                        |
| 285 | -    ): array { | 
                                                        |
| 286 | - /** @var CountryOptions $country_options */  | 
                                                        |
| 287 | - $country_options = LoaderFactory::getLoader()->getShared(CountryOptions::class, [$this->checkout->action]);  | 
                                                        |
| 288 | - return $country_options->forLegacyFormInput($countries_list, $question, $registration, $answer);  | 
                                                        |
| 289 | - }  | 
                                                        |
| 290 | -  | 
                                                        |
| 291 | -  | 
                                                        |
| 292 | - /**  | 
                                                        |
| 293 | - * looking for hooks?  | 
                                                        |
| 294 | - * this method has been replaced by:  | 
                                                        |
| 295 | - * EventEspresso\core\domain\services\registration\form\StateOptions::forLegacyFormInput()  | 
                                                        |
| 296 | - *  | 
                                                        |
| 297 | - * @param array|null $states_list  | 
                                                        |
| 298 | - * @param EE_Question|null $question  | 
                                                        |
| 299 | - * @param EE_Registration|null $registration  | 
                                                        |
| 300 | - * @param EE_Answer|null $answer  | 
                                                        |
| 301 | - * @return array 2d keys are state IDs, values are their names  | 
                                                        |
| 302 | - * @throws EE_Error  | 
                                                        |
| 303 | - * @throws ReflectionException  | 
                                                        |
| 304 | - * @deprecated $VID:$  | 
                                                        |
| 305 | - */  | 
                                                        |
| 306 | - public function use_cached_states_for_form_input(  | 
                                                        |
| 307 | - array $states_list = null,  | 
                                                        |
| 308 | - EE_Question $question = null,  | 
                                                        |
| 309 | - EE_Registration $registration = null,  | 
                                                        |
| 310 | - EE_Answer $answer = null  | 
                                                        |
| 311 | -    ): array { | 
                                                        |
| 312 | - /** @var StateOptions $state_options */  | 
                                                        |
| 313 | - $state_options = LoaderFactory::getLoader()->getShared(StateOptions::class, [$this->checkout->action]);  | 
                                                        |
| 314 | - return $state_options->forLegacyFormInput($states_list, $question, $registration, $answer);  | 
                                                        |
| 315 | - }  | 
                                                        |
| 316 | -  | 
                                                        |
| 317 | -  | 
                                                        |
| 318 | - /********************************************************************************************************/  | 
                                                        |
| 319 | - /**************************************** PROCESS REG STEP ****************************************/  | 
                                                        |
| 320 | - /********************************************************************************************************/  | 
                                                        |
| 321 | -  | 
                                                        |
| 322 | -  | 
                                                        |
| 323 | - /**  | 
                                                        |
| 324 | - * @return bool  | 
                                                        |
| 325 | - * @throws EE_Error  | 
                                                        |
| 326 | - * @throws InvalidArgumentException  | 
                                                        |
| 327 | - * @throws ReflectionException  | 
                                                        |
| 328 | - * @throws RuntimeException  | 
                                                        |
| 329 | - * @throws InvalidDataTypeException  | 
                                                        |
| 330 | - * @throws InvalidInterfaceException  | 
                                                        |
| 331 | - */  | 
                                                        |
| 332 | - public function process_reg_step()  | 
                                                        |
| 333 | -    { | 
                                                        |
| 334 | -        do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 335 | - // grab validated data from form  | 
                                                        |
| 336 | - $valid_data = $this->checkout->current_step->valid_data();  | 
                                                        |
| 337 | - // EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );  | 
                                                        |
| 338 | - // EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );  | 
                                                        |
| 339 | - // if we don't have any $valid_data then something went TERRIBLY WRONG !!!  | 
                                                        |
| 340 | -        if (empty($valid_data)) { | 
                                                        |
| 341 | - EE_Error::add_error(  | 
                                                        |
| 342 | -                esc_html__('No valid question responses were received.', 'event_espresso'), | 
                                                        |
| 343 | - __FILE__,  | 
                                                        |
| 344 | - __FUNCTION__,  | 
                                                        |
| 345 | - __LINE__  | 
                                                        |
| 346 | - );  | 
                                                        |
| 347 | - return false;  | 
                                                        |
| 348 | - }  | 
                                                        |
| 349 | -        if (! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { | 
                                                        |
| 350 | - EE_Error::add_error(  | 
                                                        |
| 351 | - esc_html__(  | 
                                                        |
| 352 | - 'A valid transaction could not be initiated for processing your registrations.',  | 
                                                        |
| 353 | - 'event_espresso'  | 
                                                        |
| 354 | - ),  | 
                                                        |
| 355 | - __FILE__,  | 
                                                        |
| 356 | - __FUNCTION__,  | 
                                                        |
| 357 | - __LINE__  | 
                                                        |
| 358 | - );  | 
                                                        |
| 359 | - return false;  | 
                                                        |
| 360 | - }  | 
                                                        |
| 361 | - // get cached registrations  | 
                                                        |
| 362 | - $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);  | 
                                                        |
| 363 | - // verify we got the goods  | 
                                                        |
| 364 | -        if (empty($registrations)) { | 
                                                        |
| 365 | - // combine the old translated string with a new one, in order to not break translations  | 
                                                        |
| 366 | - $error_message = esc_html__(  | 
                                                        |
| 367 | - 'Your form data could not be applied to any valid registrations.',  | 
                                                        |
| 368 | - 'event_espresso'  | 
                                                        |
| 369 | - )  | 
                                                        |
| 370 | - . sprintf(  | 
                                                        |
| 371 | - esc_html_x(  | 
                                                        |
| 372 | - '%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.',  | 
                                                        |
| 373 | - '(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.',  | 
                                                        |
| 374 | - 'event_espresso'  | 
                                                        |
| 375 | - ),  | 
                                                        |
| 376 | -                '<a href="' . get_post_type_archive_link('espresso_events') . '" >', | 
                                                        |
| 377 | - '</a>',  | 
                                                        |
| 378 | - '<br />'  | 
                                                        |
| 379 | - );  | 
                                                        |
| 380 | - EE_Error::add_error(  | 
                                                        |
| 381 | - $error_message,  | 
                                                        |
| 382 | - __FILE__,  | 
                                                        |
| 383 | - __FUNCTION__,  | 
                                                        |
| 384 | - __LINE__  | 
                                                        |
| 385 | - );  | 
                                                        |
| 386 | - return false;  | 
                                                        |
| 387 | - }  | 
                                                        |
| 388 | - // extract attendee info from form data and save to model objects  | 
                                                        |
| 389 | - $registrations_processed = $this->_process_registrations($registrations, $valid_data);  | 
                                                        |
| 390 | - // if first pass thru SPCO,  | 
                                                        |
| 391 | - // then let's check processed registrations against the total number of tickets in the cart  | 
                                                        |
| 392 | -        if ($registrations_processed === false) { | 
                                                        |
| 393 | - // but return immediately if the previous step exited early due to errors  | 
                                                        |
| 394 | - return false;  | 
                                                        |
| 395 | - }  | 
                                                        |
| 396 | -        if (! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { | 
                                                        |
| 397 | - // generate a correctly translated string for all possible singular/plural combinations  | 
                                                        |
| 398 | -            if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { | 
                                                        |
| 399 | - $error_msg = sprintf(  | 
                                                        |
| 400 | - esc_html_x(  | 
                                                        |
| 401 | - 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed',  | 
                                                        |
| 402 | - 'There was 1 ticket in the Event Queue, but 2 registrations were processed',  | 
                                                        |
| 403 | - 'event_espresso'  | 
                                                        |
| 404 | - ),  | 
                                                        |
| 405 | - $this->checkout->total_ticket_count,  | 
                                                        |
| 406 | - $registrations_processed  | 
                                                        |
| 407 | - );  | 
                                                        |
| 408 | -            } elseif ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { | 
                                                        |
| 409 | - $error_msg = sprintf(  | 
                                                        |
| 410 | - esc_html_x(  | 
                                                        |
| 411 | - 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed',  | 
                                                        |
| 412 | - 'There was a total of 2 tickets in the Event Queue, but only 1 registration was processed',  | 
                                                        |
| 413 | - 'event_espresso'  | 
                                                        |
| 414 | - ),  | 
                                                        |
| 415 | - $this->checkout->total_ticket_count,  | 
                                                        |
| 416 | - $registrations_processed  | 
                                                        |
| 417 | - );  | 
                                                        |
| 418 | -            } else { | 
                                                        |
| 419 | - $error_msg = sprintf(  | 
                                                        |
| 420 | - esc_html__(  | 
                                                        |
| 421 | - 'There was a total of 2 tickets in the Event Queue, but 2 registrations were processed',  | 
                                                        |
| 422 | - 'event_espresso'  | 
                                                        |
| 423 | - ),  | 
                                                        |
| 424 | - $this->checkout->total_ticket_count,  | 
                                                        |
| 425 | - $registrations_processed  | 
                                                        |
| 426 | - );  | 
                                                        |
| 427 | - }  | 
                                                        |
| 428 | - EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 429 | - return false;  | 
                                                        |
| 430 | - }  | 
                                                        |
| 431 | - // mark this reg step as completed  | 
                                                        |
| 432 | - $this->set_completed();  | 
                                                        |
| 433 | - $this->_set_success_message(  | 
                                                        |
| 434 | -            esc_html__('The Attendee Information Step has been successfully completed.', 'event_espresso') | 
                                                        |
| 435 | - );  | 
                                                        |
| 436 | - // do action in case a plugin wants to do something with the data submitted in step 1.  | 
                                                        |
| 437 | - // passes EE_Single_Page_Checkout, and it's posted data  | 
                                                        |
| 438 | -        do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); | 
                                                        |
| 439 | - return true;  | 
                                                        |
| 440 | - }  | 
                                                        |
| 441 | -  | 
                                                        |
| 442 | -  | 
                                                        |
| 443 | - /**  | 
                                                        |
| 444 | - * _process_registrations  | 
                                                        |
| 445 | - *  | 
                                                        |
| 446 | - * @param EE_Registration[] $registrations  | 
                                                        |
| 447 | - * @param array[][] $valid_data  | 
                                                        |
| 448 | - * @return bool|int  | 
                                                        |
| 449 | - * @throws EntityNotFoundException  | 
                                                        |
| 450 | - * @throws EE_Error  | 
                                                        |
| 451 | - * @throws InvalidArgumentException  | 
                                                        |
| 452 | - * @throws ReflectionException  | 
                                                        |
| 453 | - * @throws RuntimeException  | 
                                                        |
| 454 | - * @throws InvalidDataTypeException  | 
                                                        |
| 455 | - * @throws InvalidInterfaceException  | 
                                                        |
| 456 | - */  | 
                                                        |
| 457 | - private function _process_registrations($registrations = array(), $valid_data = array())  | 
                                                        |
| 458 | -    { | 
                                                        |
| 459 | - // load resources and set some defaults  | 
                                                        |
| 460 | -        EE_Registry::instance()->load_model('Attendee'); | 
                                                        |
| 461 | - // holder for primary registrant attendee object  | 
                                                        |
| 462 | - $this->checkout->primary_attendee_obj = null;  | 
                                                        |
| 463 | - // array for tracking reg form data for the primary registrant  | 
                                                        |
| 464 | - $primary_registrant = array(  | 
                                                        |
| 465 | - 'line_item_id' => null,  | 
                                                        |
| 466 | - );  | 
                                                        |
| 467 | - $copy_primary = false;  | 
                                                        |
| 468 | - // reg form sections that do not contain inputs  | 
                                                        |
| 469 | - $non_input_form_sections = array(  | 
                                                        |
| 470 | - 'primary_registrant',  | 
                                                        |
| 471 | - 'additional_attendee_reg_info',  | 
                                                        |
| 472 | - 'spco_copy_attendee_chk',  | 
                                                        |
| 473 | - );  | 
                                                        |
| 474 | - // attendee counter  | 
                                                        |
| 475 | - $att_nmbr = 0;  | 
                                                        |
| 476 | - // grab the saved registrations from the transaction  | 
                                                        |
| 477 | -        foreach ($registrations as $registration) { | 
                                                        |
| 478 | - // verify EE_Registration object  | 
                                                        |
| 479 | -            if (! $registration instanceof EE_Registration) { | 
                                                        |
| 480 | - EE_Error::add_error(  | 
                                                        |
| 481 | - esc_html__(  | 
                                                        |
| 482 | - 'An invalid Registration object was discovered when attempting to process your registration information.',  | 
                                                        |
| 483 | - 'event_espresso'  | 
                                                        |
| 484 | - ),  | 
                                                        |
| 485 | - __FILE__,  | 
                                                        |
| 486 | - __FUNCTION__,  | 
                                                        |
| 487 | - __LINE__  | 
                                                        |
| 488 | - );  | 
                                                        |
| 489 | - return false;  | 
                                                        |
| 490 | - }  | 
                                                        |
| 491 | - /** @var string $reg_url_link */  | 
                                                        |
| 492 | - $reg_url_link = $registration->reg_url_link();  | 
                                                        |
| 493 | - // reg_url_link exists ?  | 
                                                        |
| 494 | -            if (! empty($reg_url_link)) { | 
                                                        |
| 495 | - // should this registration be processed during this visit ?  | 
                                                        |
| 496 | -                if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { | 
                                                        |
| 497 | - // if NOT revisiting, then let's save the registration now,  | 
                                                        |
| 498 | - // so that we have a REG_ID to use when generating other objects  | 
                                                        |
| 499 | -                    if (! $this->checkout->revisit) { | 
                                                        |
| 500 | - $registration->save();  | 
                                                        |
| 501 | - }  | 
                                                        |
| 502 | - /**  | 
                                                        |
| 503 | - * This allows plugins to trigger a fail on processing of a  | 
                                                        |
| 504 | - * registration for any conditions they may have for it to pass.  | 
                                                        |
| 505 | - *  | 
                                                        |
| 506 | - * @var bool if true is returned by the plugin then the  | 
                                                        |
| 507 | - * registration processing is halted.  | 
                                                        |
| 508 | - */  | 
                                                        |
| 509 | - if (  | 
                                                        |
| 510 | - apply_filters(  | 
                                                        |
| 511 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process',  | 
                                                        |
| 512 | - false,  | 
                                                        |
| 513 | - $att_nmbr,  | 
                                                        |
| 514 | - $registration,  | 
                                                        |
| 515 | - $registrations,  | 
                                                        |
| 516 | - $valid_data,  | 
                                                        |
| 517 | - $this  | 
                                                        |
| 518 | - )  | 
                                                        |
| 519 | -                    ) { | 
                                                        |
| 520 | - return false;  | 
                                                        |
| 521 | - }  | 
                                                        |
| 522 | -  | 
                                                        |
| 523 | - // Houston, we have a registration!  | 
                                                        |
| 524 | - $att_nmbr++;  | 
                                                        |
| 525 | - $this->_attendee_data[ $reg_url_link ] = array();  | 
                                                        |
| 526 | - // grab any existing related answer objects  | 
                                                        |
| 527 | - $this->_registration_answers = $registration->answers();  | 
                                                        |
| 528 | - // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );  | 
                                                        |
| 529 | -                    if (isset($valid_data[ $reg_url_link ])) { | 
                                                        |
| 530 | - // do we need to copy basic info from primary attendee ?  | 
                                                        |
| 531 | - $copy_primary = isset($valid_data[ $reg_url_link ]['additional_attendee_reg_info'])  | 
                                                        |
| 532 | - && absint($valid_data[ $reg_url_link ]['additional_attendee_reg_info']) === 0;  | 
                                                        |
| 533 | - // filter form input data for this registration  | 
                                                        |
| 534 | - $valid_data[ $reg_url_link ] = (array) apply_filters(  | 
                                                        |
| 535 | - 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',  | 
                                                        |
| 536 | - $valid_data[ $reg_url_link ]  | 
                                                        |
| 537 | - );  | 
                                                        |
| 538 | -                        if (isset($valid_data['primary_attendee'])) { | 
                                                        |
| 539 | - $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])  | 
                                                        |
| 540 | - ? $valid_data['primary_attendee']  | 
                                                        |
| 541 | - : false;  | 
                                                        |
| 542 | - unset($valid_data['primary_attendee']);  | 
                                                        |
| 543 | - }  | 
                                                        |
| 544 | - // now loop through our array of valid post data && process attendee reg forms  | 
                                                        |
| 545 | -                        foreach ($valid_data[ $reg_url_link ] as $form_section => $form_inputs) { | 
                                                        |
| 546 | -                            if (! in_array($form_section, $non_input_form_sections, true)) { | 
                                                        |
| 547 | -                                foreach ($form_inputs as $form_input => $input_value) { | 
                                                        |
| 548 | - // \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ );  | 
                                                        |
| 549 | - // check for critical inputs  | 
                                                        |
| 550 | - if (  | 
                                                        |
| 551 | - ! $this->_verify_critical_attendee_details_are_set_and_validate_email(  | 
                                                        |
| 552 | - $form_input,  | 
                                                        |
| 553 | - $input_value  | 
                                                        |
| 554 | - )  | 
                                                        |
| 555 | -                                    ) { | 
                                                        |
| 556 | - return false;  | 
                                                        |
| 557 | - }  | 
                                                        |
| 558 | - // store a bit of data about the primary attendee  | 
                                                        |
| 559 | - if (  | 
                                                        |
| 560 | - $att_nmbr === 1  | 
                                                        |
| 561 | - && ! empty($input_value)  | 
                                                        |
| 562 | - && $reg_url_link === $primary_registrant['line_item_id']  | 
                                                        |
| 563 | -                                    ) { | 
                                                        |
| 564 | - $primary_registrant[ $form_input ] = $input_value;  | 
                                                        |
| 565 | - } elseif (  | 
                                                        |
| 566 | - $copy_primary  | 
                                                        |
| 567 | - && $input_value === null  | 
                                                        |
| 568 | - && isset($primary_registrant[ $form_input ])  | 
                                                        |
| 569 | -                                    ) { | 
                                                        |
| 570 | - $input_value = $primary_registrant[ $form_input ];  | 
                                                        |
| 571 | - }  | 
                                                        |
| 572 | - // now attempt to save the input data  | 
                                                        |
| 573 | - if (  | 
                                                        |
| 574 | - ! $this->_save_registration_form_input(  | 
                                                        |
| 575 | - $registration,  | 
                                                        |
| 576 | - $form_input,  | 
                                                        |
| 577 | - $input_value  | 
                                                        |
| 578 | - )  | 
                                                        |
| 579 | -                                    ) { | 
                                                        |
| 580 | - EE_Error::add_error(  | 
                                                        |
| 581 | - sprintf(  | 
                                                        |
| 582 | - esc_html_x(  | 
                                                        |
| 583 | - 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"',  | 
                                                        |
| 584 | - 'Unable to save registration form data for the form input: "form input name" with the submitted value: "form input value"',  | 
                                                        |
| 585 | - 'event_espresso'  | 
                                                        |
| 586 | - ),  | 
                                                        |
| 587 | - $form_input,  | 
                                                        |
| 588 | - $input_value  | 
                                                        |
| 589 | - ),  | 
                                                        |
| 590 | - __FILE__,  | 
                                                        |
| 591 | - __FUNCTION__,  | 
                                                        |
| 592 | - __LINE__  | 
                                                        |
| 593 | - );  | 
                                                        |
| 594 | - return false;  | 
                                                        |
| 595 | - }  | 
                                                        |
| 596 | - }  | 
                                                        |
| 597 | - }  | 
                                                        |
| 598 | - } // end of foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs )  | 
                                                        |
| 599 | - }  | 
                                                        |
| 600 | - // EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ );  | 
                                                        |
| 601 | - // this registration does not require additional attendee information ?  | 
                                                        |
| 602 | - if (  | 
                                                        |
| 603 | - $copy_primary  | 
                                                        |
| 604 | - && $att_nmbr > 1  | 
                                                        |
| 605 | - && $this->checkout->primary_attendee_obj instanceof EE_Attendee  | 
                                                        |
| 606 | -                    ) { | 
                                                        |
| 607 | - // just copy the primary registrant  | 
                                                        |
| 608 | - $attendee = $this->checkout->primary_attendee_obj;  | 
                                                        |
| 609 | -                    } else { | 
                                                        |
| 610 | - // ensure critical details are set for additional attendees  | 
                                                        |
| 611 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1  | 
                                                        |
| 612 | - ? $this->_copy_critical_attendee_details_from_primary_registrant(  | 
                                                        |
| 613 | - $this->_attendee_data[ $reg_url_link ]  | 
                                                        |
| 614 | - )  | 
                                                        |
| 615 | - : $this->_attendee_data[ $reg_url_link ];  | 
                                                        |
| 616 | - // execute create attendee command (which may return an existing attendee)  | 
                                                        |
| 617 | - $attendee = EE_Registry::instance()->BUS->execute(  | 
                                                        |
| 618 | - new CreateAttendeeCommand(  | 
                                                        |
| 619 | - $this->_attendee_data[ $reg_url_link ],  | 
                                                        |
| 620 | - $registration  | 
                                                        |
| 621 | - )  | 
                                                        |
| 622 | - );  | 
                                                        |
| 623 | - // who's #1 ?  | 
                                                        |
| 624 | -                        if ($att_nmbr === 1) { | 
                                                        |
| 625 | - $this->checkout->primary_attendee_obj = $attendee;  | 
                                                        |
| 626 | - }  | 
                                                        |
| 627 | - }  | 
                                                        |
| 628 | - // EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );  | 
                                                        |
| 629 | - // add relation to registration, set attendee ID, and cache attendee  | 
                                                        |
| 630 | - $this->_associate_attendee_with_registration($registration, $attendee);  | 
                                                        |
| 631 | - // \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ );  | 
                                                        |
| 632 | -                    if (! $registration->attendee() instanceof EE_Attendee) { | 
                                                        |
| 633 | - EE_Error::add_error(  | 
                                                        |
| 634 | - sprintf(  | 
                                                        |
| 635 | - esc_html_x(  | 
                                                        |
| 636 | - 'Registration %s has an invalid or missing Attendee object.',  | 
                                                        |
| 637 | - 'Registration 123-456-789 has an invalid or missing Attendee object.',  | 
                                                        |
| 638 | - 'event_espresso'  | 
                                                        |
| 639 | - ),  | 
                                                        |
| 640 | - $reg_url_link  | 
                                                        |
| 641 | - ),  | 
                                                        |
| 642 | - __FILE__,  | 
                                                        |
| 643 | - __FUNCTION__,  | 
                                                        |
| 644 | - __LINE__  | 
                                                        |
| 645 | - );  | 
                                                        |
| 646 | - return false;  | 
                                                        |
| 647 | - }  | 
                                                        |
| 648 | - /** @type EE_Registration_Processor $registration_processor */  | 
                                                        |
| 649 | -                    $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); | 
                                                        |
| 650 | - // at this point, we should have enough details about the registrant to consider the registration  | 
                                                        |
| 651 | - // NOT incomplete  | 
                                                        |
| 652 | - $registration_processor->toggle_incomplete_registration_status_to_default(  | 
                                                        |
| 653 | - $registration,  | 
                                                        |
| 654 | - false,  | 
                                                        |
| 655 | - new Context(  | 
                                                        |
| 656 | - 'spco_reg_step_attendee_information_process_registrations',  | 
                                                        |
| 657 | - esc_html__(  | 
                                                        |
| 658 | - 'Finished populating registration with details from the registration form after submitting the Attendee Information Reg Step.',  | 
                                                        |
| 659 | - 'event_espresso'  | 
                                                        |
| 660 | - )  | 
                                                        |
| 661 | - )  | 
                                                        |
| 662 | - );  | 
                                                        |
| 663 | - // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to  | 
                                                        |
| 664 | - // abandoned  | 
                                                        |
| 665 | - $this->checkout->transaction->toggle_failed_transaction_status();  | 
                                                        |
| 666 | - // if we've gotten this far, then let's save what we have  | 
                                                        |
| 667 | - $registration->save();  | 
                                                        |
| 668 | - // add relation between TXN and registration  | 
                                                        |
| 669 | - $this->_associate_registration_with_transaction($registration);  | 
                                                        |
| 670 | - }  | 
                                                        |
| 671 | -            } else { | 
                                                        |
| 672 | - EE_Error::add_error(  | 
                                                        |
| 673 | - esc_html__(  | 
                                                        |
| 674 | - 'An invalid or missing line item ID was encountered while attempting to process the registration form.',  | 
                                                        |
| 675 | - 'event_espresso'  | 
                                                        |
| 676 | - ),  | 
                                                        |
| 677 | - __FILE__,  | 
                                                        |
| 678 | - __FUNCTION__,  | 
                                                        |
| 679 | - __LINE__  | 
                                                        |
| 680 | - );  | 
                                                        |
| 681 | - // remove malformed data  | 
                                                        |
| 682 | - unset($valid_data[ $reg_url_link ]);  | 
                                                        |
| 683 | - return false;  | 
                                                        |
| 684 | - }  | 
                                                        |
| 685 | - } // end of foreach ( $this->checkout->transaction->registrations() as $registration )  | 
                                                        |
| 686 | - return $att_nmbr;  | 
                                                        |
| 687 | - }  | 
                                                        |
| 688 | -  | 
                                                        |
| 689 | -  | 
                                                        |
| 690 | - /**  | 
                                                        |
| 691 | - * _save_registration_form_input  | 
                                                        |
| 692 | - *  | 
                                                        |
| 693 | - * @param EE_Registration $registration  | 
                                                        |
| 694 | - * @param string $form_input  | 
                                                        |
| 695 | - * @param string $input_value  | 
                                                        |
| 696 | - * @return bool  | 
                                                        |
| 697 | - * @throws EE_Error  | 
                                                        |
| 698 | - * @throws InvalidArgumentException  | 
                                                        |
| 699 | - * @throws InvalidDataTypeException  | 
                                                        |
| 700 | - * @throws InvalidInterfaceException  | 
                                                        |
| 701 | - * @throws ReflectionException  | 
                                                        |
| 702 | - */  | 
                                                        |
| 703 | - private function _save_registration_form_input(  | 
                                                        |
| 704 | - EE_Registration $registration,  | 
                                                        |
| 705 | - $form_input = '',  | 
                                                        |
| 706 | - $input_value = ''  | 
                                                        |
| 707 | -    ) { | 
                                                        |
| 708 | - // If email_confirm is sent it's not saved  | 
                                                        |
| 709 | -        if ((string) $form_input === 'email_confirm') { | 
                                                        |
| 710 | - return true;  | 
                                                        |
| 711 | - }  | 
                                                        |
| 712 | -  | 
                                                        |
| 713 | - // \EEH_Debug_Tools::printr( __FUNCTION__, __CLASS__, __FILE__, __LINE__, 2 );  | 
                                                        |
| 714 | - // \EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ );  | 
                                                        |
| 715 | - // \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );  | 
                                                        |
| 716 | - // allow for plugins to hook in and do their own processing of the form input.  | 
                                                        |
| 717 | - // For plugins to bypass normal processing here, they just need to return a boolean value.  | 
                                                        |
| 718 | - if (  | 
                                                        |
| 719 | - apply_filters(  | 
                                                        |
| 720 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input',  | 
                                                        |
| 721 | - false,  | 
                                                        |
| 722 | - $registration,  | 
                                                        |
| 723 | - $form_input,  | 
                                                        |
| 724 | - $input_value,  | 
                                                        |
| 725 | - $this  | 
                                                        |
| 726 | - )  | 
                                                        |
| 727 | -        ) { | 
                                                        |
| 728 | - return true;  | 
                                                        |
| 729 | - }  | 
                                                        |
| 730 | - /*  | 
                                                        |
| 24 | + /**  | 
                                                        |
| 25 | + * @var bool  | 
                                                        |
| 26 | + */  | 
                                                        |
| 27 | + private $_print_copy_info = false;  | 
                                                        |
| 28 | +  | 
                                                        |
| 29 | + /**  | 
                                                        |
| 30 | + * @var array  | 
                                                        |
| 31 | + */  | 
                                                        |
| 32 | + private $_attendee_data = array();  | 
                                                        |
| 33 | +  | 
                                                        |
| 34 | + /**  | 
                                                        |
| 35 | + * @var array  | 
                                                        |
| 36 | + */  | 
                                                        |
| 37 | + private $_required_questions = array();  | 
                                                        |
| 38 | +  | 
                                                        |
| 39 | + /**  | 
                                                        |
| 40 | + * @var array  | 
                                                        |
| 41 | + */  | 
                                                        |
| 42 | + private $_registration_answers = array();  | 
                                                        |
| 43 | +  | 
                                                        |
| 44 | + /**  | 
                                                        |
| 45 | + * @var int  | 
                                                        |
| 46 | + */  | 
                                                        |
| 47 | + protected $reg_form_count = 0;  | 
                                                        |
| 48 | +  | 
                                                        |
| 49 | + /**  | 
                                                        |
| 50 | + * class constructor  | 
                                                        |
| 51 | + *  | 
                                                        |
| 52 | + * @access public  | 
                                                        |
| 53 | + * @param EE_Checkout $checkout  | 
                                                        |
| 54 | + */  | 
                                                        |
| 55 | + public function __construct(EE_Checkout $checkout)  | 
                                                        |
| 56 | +	{ | 
                                                        |
| 57 | + $this->_slug = 'attendee_information';  | 
                                                        |
| 58 | +		$this->_name = esc_html__('Attendee Information', 'event_espresso'); | 
                                                        |
| 59 | + $this->checkout = $checkout;  | 
                                                        |
| 60 | + $this->_reset_success_message();  | 
                                                        |
| 61 | + $this->set_instructions(  | 
                                                        |
| 62 | +			esc_html__('Please answer the following registration questions before proceeding.', 'event_espresso') | 
                                                        |
| 63 | + );  | 
                                                        |
| 64 | + }  | 
                                                        |
| 65 | +  | 
                                                        |
| 66 | +  | 
                                                        |
| 67 | + public function translate_js_strings()  | 
                                                        |
| 68 | +	{ | 
                                                        |
| 69 | + EE_Registry::$i18n_js_strings['required_field'] = esc_html__(  | 
                                                        |
| 70 | + ' is a required question.',  | 
                                                        |
| 71 | + 'event_espresso'  | 
                                                        |
| 72 | + );  | 
                                                        |
| 73 | + EE_Registry::$i18n_js_strings['required_multi_field'] = esc_html__(  | 
                                                        |
| 74 | + ' is a required question. Please enter a value for at least one of the options.',  | 
                                                        |
| 75 | + 'event_espresso'  | 
                                                        |
| 76 | + );  | 
                                                        |
| 77 | + EE_Registry::$i18n_js_strings['answer_required_questions'] = esc_html__(  | 
                                                        |
| 78 | + 'Please answer all required questions correctly before proceeding.',  | 
                                                        |
| 79 | + 'event_espresso'  | 
                                                        |
| 80 | + );  | 
                                                        |
| 81 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(  | 
                                                        |
| 82 | + esc_html_x(  | 
                                                        |
| 83 | + 'The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.',  | 
                                                        |
| 84 | + 'The attendee information was successfully copied.(line break)Please ensure the rest of the registration form is completed before proceeding.',  | 
                                                        |
| 85 | + 'event_espresso'  | 
                                                        |
| 86 | + ),  | 
                                                        |
| 87 | + '<br/>'  | 
                                                        |
| 88 | + );  | 
                                                        |
| 89 | + EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = esc_html__(  | 
                                                        |
| 90 | + 'An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.',  | 
                                                        |
| 91 | + 'event_espresso'  | 
                                                        |
| 92 | + );  | 
                                                        |
| 93 | + EE_Registry::$i18n_js_strings['enter_valid_email'] = esc_html__(  | 
                                                        |
| 94 | + 'You must enter a valid email address.',  | 
                                                        |
| 95 | + 'event_espresso'  | 
                                                        |
| 96 | + );  | 
                                                        |
| 97 | + EE_Registry::$i18n_js_strings['valid_email_and_questions'] = esc_html__(  | 
                                                        |
| 98 | + 'You must enter a valid email address and answer all other required questions before you can proceed.',  | 
                                                        |
| 99 | + 'event_espresso'  | 
                                                        |
| 100 | + );  | 
                                                        |
| 101 | + }  | 
                                                        |
| 102 | +  | 
                                                        |
| 103 | +  | 
                                                        |
| 104 | + public function enqueue_styles_and_scripts()  | 
                                                        |
| 105 | +	{ | 
                                                        |
| 106 | + }  | 
                                                        |
| 107 | +  | 
                                                        |
| 108 | +  | 
                                                        |
| 109 | + /**  | 
                                                        |
| 110 | + * @return boolean  | 
                                                        |
| 111 | + */  | 
                                                        |
| 112 | + public function initialize_reg_step(): bool  | 
                                                        |
| 113 | +	{ | 
                                                        |
| 114 | + return true;  | 
                                                        |
| 115 | + }  | 
                                                        |
| 116 | +  | 
                                                        |
| 117 | +  | 
                                                        |
| 118 | + /**  | 
                                                        |
| 119 | + * @return LegacyRegistrationForm  | 
                                                        |
| 120 | + * @throws DomainException  | 
                                                        |
| 121 | + * @throws InvalidArgumentException  | 
                                                        |
| 122 | + * @throws EntityNotFoundException  | 
                                                        |
| 123 | + * @throws InvalidDataTypeException  | 
                                                        |
| 124 | + * @throws InvalidInterfaceException  | 
                                                        |
| 125 | + */  | 
                                                        |
| 126 | + public function generate_reg_form(): LegacyRegistrationForm  | 
                                                        |
| 127 | +	{ | 
                                                        |
| 128 | + // TODO detect if event has a reg form UUID and swap this out for new reg form builder generated form  | 
                                                        |
| 129 | + return LoaderFactory::getLoader()->getShared(LegacyRegistrationForm::class, [$this]);  | 
                                                        |
| 130 | + }  | 
                                                        |
| 131 | +  | 
                                                        |
| 132 | +  | 
                                                        |
| 133 | + /**  | 
                                                        |
| 134 | + * looking for hooks?  | 
                                                        |
| 135 | + * this method has been replaced by:  | 
                                                        |
| 136 | + * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::getRegForm()  | 
                                                        |
| 137 | + *  | 
                                                        |
| 138 | + * @deprecated $VID:$  | 
                                                        |
| 139 | + */  | 
                                                        |
| 140 | + private function _registrations_reg_form()  | 
                                                        |
| 141 | +	{ | 
                                                        |
| 142 | + }  | 
                                                        |
| 143 | +  | 
                                                        |
| 144 | +  | 
                                                        |
| 145 | + /**  | 
                                                        |
| 146 | + * looking for hooks?  | 
                                                        |
| 147 | + * this method has been replaced by:  | 
                                                        |
| 148 | + * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::additionalAttendeeRegInfoInput()  | 
                                                        |
| 149 | + *  | 
                                                        |
| 150 | + * @deprecated $VID:$  | 
                                                        |
| 151 | + */  | 
                                                        |
| 152 | +	private function _additional_attendee_reg_info_input() { | 
                                                        |
| 153 | + }  | 
                                                        |
| 154 | +  | 
                                                        |
| 155 | +  | 
                                                        |
| 156 | + /**  | 
                                                        |
| 157 | + * looking for hooks?  | 
                                                        |
| 158 | + * this method has been replaced by:  | 
                                                        |
| 159 | + * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::questionGroupRegForm()  | 
                                                        |
| 160 | + *  | 
                                                        |
| 161 | + * @deprecated $VID:$  | 
                                                        |
| 162 | + */  | 
                                                        |
| 163 | + private function _question_group_reg_form()  | 
                                                        |
| 164 | +	{ | 
                                                        |
| 165 | + }  | 
                                                        |
| 166 | +  | 
                                                        |
| 167 | +  | 
                                                        |
| 168 | + /**  | 
                                                        |
| 169 | + * looking for hooks?  | 
                                                        |
| 170 | + * this method has been replaced by:  | 
                                                        |
| 171 | + * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::questionGroupHeader()  | 
                                                        |
| 172 | + *  | 
                                                        |
| 173 | + * @deprecated $VID:$  | 
                                                        |
| 174 | + */  | 
                                                        |
| 175 | + private function _question_group_header()  | 
                                                        |
| 176 | +	{ | 
                                                        |
| 177 | + }  | 
                                                        |
| 178 | +  | 
                                                        |
| 179 | +  | 
                                                        |
| 180 | + /**  | 
                                                        |
| 181 | + * looking for hooks?  | 
                                                        |
| 182 | + * this method has been replaced by:  | 
                                                        |
| 183 | + * EventEspresso\core\domain\services\registration\form\LegacyCopyAttendeeInfoForm  | 
                                                        |
| 184 | + *  | 
                                                        |
| 185 | + * @deprecated $VID:$  | 
                                                        |
| 186 | + */  | 
                                                        |
| 187 | + private function _copy_attendee_info_form()  | 
                                                        |
| 188 | +	{ | 
                                                        |
| 189 | + }  | 
                                                        |
| 190 | +  | 
                                                        |
| 191 | +  | 
                                                        |
| 192 | + /**  | 
                                                        |
| 193 | + * looking for hooks?  | 
                                                        |
| 194 | + * this method has been replaced by:  | 
                                                        |
| 195 | + * EventEspresso\core\domain\services\registration\form\LegacyAutoCopyAttendeeInfoForm  | 
                                                        |
| 196 | + *  | 
                                                        |
| 197 | + * @deprecated $VID:$  | 
                                                        |
| 198 | + */  | 
                                                        |
| 199 | + private function _auto_copy_attendee_info()  | 
                                                        |
| 200 | +	{ | 
                                                        |
| 201 | + }  | 
                                                        |
| 202 | +  | 
                                                        |
| 203 | +  | 
                                                        |
| 204 | + /**  | 
                                                        |
| 205 | + * looking for hooks?  | 
                                                        |
| 206 | + * this method has been replaced by:  | 
                                                        |
| 207 | + * EventEspresso\core\domain\services\registration\form\LegacyCopyAttendeeInfoForm  | 
                                                        |
| 208 | + *  | 
                                                        |
| 209 | + * @deprecated $VID:$  | 
                                                        |
| 210 | + */  | 
                                                        |
| 211 | + private function _copy_attendee_info_inputs()  | 
                                                        |
| 212 | +	{ | 
                                                        |
| 213 | + }  | 
                                                        |
| 214 | +  | 
                                                        |
| 215 | +  | 
                                                        |
| 216 | + /**  | 
                                                        |
| 217 | + * looking for hooks?  | 
                                                        |
| 218 | + * this method has been replaced by:  | 
                                                        |
| 219 | + * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::additionalPrimaryRegistrantInputs()  | 
                                                        |
| 220 | + *  | 
                                                        |
| 221 | + * @deprecated $VID:$  | 
                                                        |
| 222 | + */  | 
                                                        |
| 223 | + private function _additional_primary_registrant_inputs()  | 
                                                        |
| 224 | +	{ | 
                                                        |
| 225 | + }  | 
                                                        |
| 226 | +  | 
                                                        |
| 227 | +  | 
                                                        |
| 228 | + /**  | 
                                                        |
| 229 | + * looking for hooks?  | 
                                                        |
| 230 | + * this method has been replaced by:  | 
                                                        |
| 231 | + * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::regFormQuestion()  | 
                                                        |
| 232 | + *  | 
                                                        |
| 233 | + * @param EE_Registration $registration  | 
                                                        |
| 234 | + * @param EE_Question $question  | 
                                                        |
| 235 | + * @return EE_Form_Input_Base  | 
                                                        |
| 236 | + * @throws EE_Error  | 
                                                        |
| 237 | + * @throws InvalidArgumentException  | 
                                                        |
| 238 | + * @throws InvalidDataTypeException  | 
                                                        |
| 239 | + * @throws InvalidInterfaceException  | 
                                                        |
| 240 | + * @throws OutOfRangeException  | 
                                                        |
| 241 | + * @throws ReflectionException  | 
                                                        |
| 242 | + * @deprecated $VID:$  | 
                                                        |
| 243 | + */  | 
                                                        |
| 244 | + public function reg_form_question(EE_Registration $registration, EE_Question $question): EE_Form_Input_Base  | 
                                                        |
| 245 | +	{ | 
                                                        |
| 246 | + $legacy_reg_form = $this->legacy_reg_forms[ $registration->reg_url_link() ] ?? null;  | 
                                                        |
| 247 | +		if ($legacy_reg_form instanceof LegacyRegistrationForm) { | 
                                                        |
| 248 | + return $legacy_reg_form->regFormQuestion($registration, $question);  | 
                                                        |
| 249 | + }  | 
                                                        |
| 250 | + throw new OutOfRangeException();  | 
                                                        |
| 251 | + }  | 
                                                        |
| 252 | +  | 
                                                        |
| 253 | +  | 
                                                        |
| 254 | + /**  | 
                                                        |
| 255 | + * looking for hooks?  | 
                                                        |
| 256 | + * this method has been replaced by:  | 
                                                        |
| 257 | + * EventEspresso\core\domain\services\registration\form\LegacyRegistrationForm::generateQuestionInput()  | 
                                                        |
| 258 | + *  | 
                                                        |
| 259 | + * @deprecated $VID:$  | 
                                                        |
| 260 | + */  | 
                                                        |
| 261 | + private function _generate_question_input()  | 
                                                        |
| 262 | +	{ | 
                                                        |
| 263 | + }  | 
                                                        |
| 264 | +  | 
                                                        |
| 265 | +  | 
                                                        |
| 266 | + /**  | 
                                                        |
| 267 | + * looking for hooks?  | 
                                                        |
| 268 | + * this method has been replaced by:  | 
                                                        |
| 269 | + * EventEspresso\core\domain\services\registration\form\CountryOptions::forLegacyFormInput()  | 
                                                        |
| 270 | + *  | 
                                                        |
| 271 | + * @param array|null $countries_list  | 
                                                        |
| 272 | + * @param EE_Question|null $question  | 
                                                        |
| 273 | + * @param EE_Registration|null $registration  | 
                                                        |
| 274 | + * @param EE_Answer|null $answer  | 
                                                        |
| 275 | + * @return array 2d keys are country IDs, values are their names  | 
                                                        |
| 276 | + * @throws EE_Error  | 
                                                        |
| 277 | + * @throws ReflectionException  | 
                                                        |
| 278 | + * @deprecated $VID:$  | 
                                                        |
| 279 | + */  | 
                                                        |
| 280 | + public function use_cached_countries_for_form_input(  | 
                                                        |
| 281 | + array $countries_list = null,  | 
                                                        |
| 282 | + EE_Question $question = null,  | 
                                                        |
| 283 | + EE_Registration $registration = null,  | 
                                                        |
| 284 | + EE_Answer $answer = null  | 
                                                        |
| 285 | +	): array { | 
                                                        |
| 286 | + /** @var CountryOptions $country_options */  | 
                                                        |
| 287 | + $country_options = LoaderFactory::getLoader()->getShared(CountryOptions::class, [$this->checkout->action]);  | 
                                                        |
| 288 | + return $country_options->forLegacyFormInput($countries_list, $question, $registration, $answer);  | 
                                                        |
| 289 | + }  | 
                                                        |
| 290 | +  | 
                                                        |
| 291 | +  | 
                                                        |
| 292 | + /**  | 
                                                        |
| 293 | + * looking for hooks?  | 
                                                        |
| 294 | + * this method has been replaced by:  | 
                                                        |
| 295 | + * EventEspresso\core\domain\services\registration\form\StateOptions::forLegacyFormInput()  | 
                                                        |
| 296 | + *  | 
                                                        |
| 297 | + * @param array|null $states_list  | 
                                                        |
| 298 | + * @param EE_Question|null $question  | 
                                                        |
| 299 | + * @param EE_Registration|null $registration  | 
                                                        |
| 300 | + * @param EE_Answer|null $answer  | 
                                                        |
| 301 | + * @return array 2d keys are state IDs, values are their names  | 
                                                        |
| 302 | + * @throws EE_Error  | 
                                                        |
| 303 | + * @throws ReflectionException  | 
                                                        |
| 304 | + * @deprecated $VID:$  | 
                                                        |
| 305 | + */  | 
                                                        |
| 306 | + public function use_cached_states_for_form_input(  | 
                                                        |
| 307 | + array $states_list = null,  | 
                                                        |
| 308 | + EE_Question $question = null,  | 
                                                        |
| 309 | + EE_Registration $registration = null,  | 
                                                        |
| 310 | + EE_Answer $answer = null  | 
                                                        |
| 311 | +	): array { | 
                                                        |
| 312 | + /** @var StateOptions $state_options */  | 
                                                        |
| 313 | + $state_options = LoaderFactory::getLoader()->getShared(StateOptions::class, [$this->checkout->action]);  | 
                                                        |
| 314 | + return $state_options->forLegacyFormInput($states_list, $question, $registration, $answer);  | 
                                                        |
| 315 | + }  | 
                                                        |
| 316 | +  | 
                                                        |
| 317 | +  | 
                                                        |
| 318 | + /********************************************************************************************************/  | 
                                                        |
| 319 | + /**************************************** PROCESS REG STEP ****************************************/  | 
                                                        |
| 320 | + /********************************************************************************************************/  | 
                                                        |
| 321 | +  | 
                                                        |
| 322 | +  | 
                                                        |
| 323 | + /**  | 
                                                        |
| 324 | + * @return bool  | 
                                                        |
| 325 | + * @throws EE_Error  | 
                                                        |
| 326 | + * @throws InvalidArgumentException  | 
                                                        |
| 327 | + * @throws ReflectionException  | 
                                                        |
| 328 | + * @throws RuntimeException  | 
                                                        |
| 329 | + * @throws InvalidDataTypeException  | 
                                                        |
| 330 | + * @throws InvalidInterfaceException  | 
                                                        |
| 331 | + */  | 
                                                        |
| 332 | + public function process_reg_step()  | 
                                                        |
| 333 | +	{ | 
                                                        |
| 334 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 335 | + // grab validated data from form  | 
                                                        |
| 336 | + $valid_data = $this->checkout->current_step->valid_data();  | 
                                                        |
| 337 | + // EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );  | 
                                                        |
| 338 | + // EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );  | 
                                                        |
| 339 | + // if we don't have any $valid_data then something went TERRIBLY WRONG !!!  | 
                                                        |
| 340 | +		if (empty($valid_data)) { | 
                                                        |
| 341 | + EE_Error::add_error(  | 
                                                        |
| 342 | +				esc_html__('No valid question responses were received.', 'event_espresso'), | 
                                                        |
| 343 | + __FILE__,  | 
                                                        |
| 344 | + __FUNCTION__,  | 
                                                        |
| 345 | + __LINE__  | 
                                                        |
| 346 | + );  | 
                                                        |
| 347 | + return false;  | 
                                                        |
| 348 | + }  | 
                                                        |
| 349 | +		if (! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { | 
                                                        |
| 350 | + EE_Error::add_error(  | 
                                                        |
| 351 | + esc_html__(  | 
                                                        |
| 352 | + 'A valid transaction could not be initiated for processing your registrations.',  | 
                                                        |
| 353 | + 'event_espresso'  | 
                                                        |
| 354 | + ),  | 
                                                        |
| 355 | + __FILE__,  | 
                                                        |
| 356 | + __FUNCTION__,  | 
                                                        |
| 357 | + __LINE__  | 
                                                        |
| 358 | + );  | 
                                                        |
| 359 | + return false;  | 
                                                        |
| 360 | + }  | 
                                                        |
| 361 | + // get cached registrations  | 
                                                        |
| 362 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);  | 
                                                        |
| 363 | + // verify we got the goods  | 
                                                        |
| 364 | +		if (empty($registrations)) { | 
                                                        |
| 365 | + // combine the old translated string with a new one, in order to not break translations  | 
                                                        |
| 366 | + $error_message = esc_html__(  | 
                                                        |
| 367 | + 'Your form data could not be applied to any valid registrations.',  | 
                                                        |
| 368 | + 'event_espresso'  | 
                                                        |
| 369 | + )  | 
                                                        |
| 370 | + . sprintf(  | 
                                                        |
| 371 | + esc_html_x(  | 
                                                        |
| 372 | + '%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.',  | 
                                                        |
| 373 | + '(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.',  | 
                                                        |
| 374 | + 'event_espresso'  | 
                                                        |
| 375 | + ),  | 
                                                        |
| 376 | +				'<a href="' . get_post_type_archive_link('espresso_events') . '" >', | 
                                                        |
| 377 | + '</a>',  | 
                                                        |
| 378 | + '<br />'  | 
                                                        |
| 379 | + );  | 
                                                        |
| 380 | + EE_Error::add_error(  | 
                                                        |
| 381 | + $error_message,  | 
                                                        |
| 382 | + __FILE__,  | 
                                                        |
| 383 | + __FUNCTION__,  | 
                                                        |
| 384 | + __LINE__  | 
                                                        |
| 385 | + );  | 
                                                        |
| 386 | + return false;  | 
                                                        |
| 387 | + }  | 
                                                        |
| 388 | + // extract attendee info from form data and save to model objects  | 
                                                        |
| 389 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data);  | 
                                                        |
| 390 | + // if first pass thru SPCO,  | 
                                                        |
| 391 | + // then let's check processed registrations against the total number of tickets in the cart  | 
                                                        |
| 392 | +		if ($registrations_processed === false) { | 
                                                        |
| 393 | + // but return immediately if the previous step exited early due to errors  | 
                                                        |
| 394 | + return false;  | 
                                                        |
| 395 | + }  | 
                                                        |
| 396 | +		if (! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { | 
                                                        |
| 397 | + // generate a correctly translated string for all possible singular/plural combinations  | 
                                                        |
| 398 | +			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { | 
                                                        |
| 399 | + $error_msg = sprintf(  | 
                                                        |
| 400 | + esc_html_x(  | 
                                                        |
| 401 | + 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed',  | 
                                                        |
| 402 | + 'There was 1 ticket in the Event Queue, but 2 registrations were processed',  | 
                                                        |
| 403 | + 'event_espresso'  | 
                                                        |
| 404 | + ),  | 
                                                        |
| 405 | + $this->checkout->total_ticket_count,  | 
                                                        |
| 406 | + $registrations_processed  | 
                                                        |
| 407 | + );  | 
                                                        |
| 408 | +			} elseif ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { | 
                                                        |
| 409 | + $error_msg = sprintf(  | 
                                                        |
| 410 | + esc_html_x(  | 
                                                        |
| 411 | + 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed',  | 
                                                        |
| 412 | + 'There was a total of 2 tickets in the Event Queue, but only 1 registration was processed',  | 
                                                        |
| 413 | + 'event_espresso'  | 
                                                        |
| 414 | + ),  | 
                                                        |
| 415 | + $this->checkout->total_ticket_count,  | 
                                                        |
| 416 | + $registrations_processed  | 
                                                        |
| 417 | + );  | 
                                                        |
| 418 | +			} else { | 
                                                        |
| 419 | + $error_msg = sprintf(  | 
                                                        |
| 420 | + esc_html__(  | 
                                                        |
| 421 | + 'There was a total of 2 tickets in the Event Queue, but 2 registrations were processed',  | 
                                                        |
| 422 | + 'event_espresso'  | 
                                                        |
| 423 | + ),  | 
                                                        |
| 424 | + $this->checkout->total_ticket_count,  | 
                                                        |
| 425 | + $registrations_processed  | 
                                                        |
| 426 | + );  | 
                                                        |
| 427 | + }  | 
                                                        |
| 428 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 429 | + return false;  | 
                                                        |
| 430 | + }  | 
                                                        |
| 431 | + // mark this reg step as completed  | 
                                                        |
| 432 | + $this->set_completed();  | 
                                                        |
| 433 | + $this->_set_success_message(  | 
                                                        |
| 434 | +			esc_html__('The Attendee Information Step has been successfully completed.', 'event_espresso') | 
                                                        |
| 435 | + );  | 
                                                        |
| 436 | + // do action in case a plugin wants to do something with the data submitted in step 1.  | 
                                                        |
| 437 | + // passes EE_Single_Page_Checkout, and it's posted data  | 
                                                        |
| 438 | +		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); | 
                                                        |
| 439 | + return true;  | 
                                                        |
| 440 | + }  | 
                                                        |
| 441 | +  | 
                                                        |
| 442 | +  | 
                                                        |
| 443 | + /**  | 
                                                        |
| 444 | + * _process_registrations  | 
                                                        |
| 445 | + *  | 
                                                        |
| 446 | + * @param EE_Registration[] $registrations  | 
                                                        |
| 447 | + * @param array[][] $valid_data  | 
                                                        |
| 448 | + * @return bool|int  | 
                                                        |
| 449 | + * @throws EntityNotFoundException  | 
                                                        |
| 450 | + * @throws EE_Error  | 
                                                        |
| 451 | + * @throws InvalidArgumentException  | 
                                                        |
| 452 | + * @throws ReflectionException  | 
                                                        |
| 453 | + * @throws RuntimeException  | 
                                                        |
| 454 | + * @throws InvalidDataTypeException  | 
                                                        |
| 455 | + * @throws InvalidInterfaceException  | 
                                                        |
| 456 | + */  | 
                                                        |
| 457 | + private function _process_registrations($registrations = array(), $valid_data = array())  | 
                                                        |
| 458 | +	{ | 
                                                        |
| 459 | + // load resources and set some defaults  | 
                                                        |
| 460 | +		EE_Registry::instance()->load_model('Attendee'); | 
                                                        |
| 461 | + // holder for primary registrant attendee object  | 
                                                        |
| 462 | + $this->checkout->primary_attendee_obj = null;  | 
                                                        |
| 463 | + // array for tracking reg form data for the primary registrant  | 
                                                        |
| 464 | + $primary_registrant = array(  | 
                                                        |
| 465 | + 'line_item_id' => null,  | 
                                                        |
| 466 | + );  | 
                                                        |
| 467 | + $copy_primary = false;  | 
                                                        |
| 468 | + // reg form sections that do not contain inputs  | 
                                                        |
| 469 | + $non_input_form_sections = array(  | 
                                                        |
| 470 | + 'primary_registrant',  | 
                                                        |
| 471 | + 'additional_attendee_reg_info',  | 
                                                        |
| 472 | + 'spco_copy_attendee_chk',  | 
                                                        |
| 473 | + );  | 
                                                        |
| 474 | + // attendee counter  | 
                                                        |
| 475 | + $att_nmbr = 0;  | 
                                                        |
| 476 | + // grab the saved registrations from the transaction  | 
                                                        |
| 477 | +		foreach ($registrations as $registration) { | 
                                                        |
| 478 | + // verify EE_Registration object  | 
                                                        |
| 479 | +			if (! $registration instanceof EE_Registration) { | 
                                                        |
| 480 | + EE_Error::add_error(  | 
                                                        |
| 481 | + esc_html__(  | 
                                                        |
| 482 | + 'An invalid Registration object was discovered when attempting to process your registration information.',  | 
                                                        |
| 483 | + 'event_espresso'  | 
                                                        |
| 484 | + ),  | 
                                                        |
| 485 | + __FILE__,  | 
                                                        |
| 486 | + __FUNCTION__,  | 
                                                        |
| 487 | + __LINE__  | 
                                                        |
| 488 | + );  | 
                                                        |
| 489 | + return false;  | 
                                                        |
| 490 | + }  | 
                                                        |
| 491 | + /** @var string $reg_url_link */  | 
                                                        |
| 492 | + $reg_url_link = $registration->reg_url_link();  | 
                                                        |
| 493 | + // reg_url_link exists ?  | 
                                                        |
| 494 | +			if (! empty($reg_url_link)) { | 
                                                        |
| 495 | + // should this registration be processed during this visit ?  | 
                                                        |
| 496 | +				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { | 
                                                        |
| 497 | + // if NOT revisiting, then let's save the registration now,  | 
                                                        |
| 498 | + // so that we have a REG_ID to use when generating other objects  | 
                                                        |
| 499 | +					if (! $this->checkout->revisit) { | 
                                                        |
| 500 | + $registration->save();  | 
                                                        |
| 501 | + }  | 
                                                        |
| 502 | + /**  | 
                                                        |
| 503 | + * This allows plugins to trigger a fail on processing of a  | 
                                                        |
| 504 | + * registration for any conditions they may have for it to pass.  | 
                                                        |
| 505 | + *  | 
                                                        |
| 506 | + * @var bool if true is returned by the plugin then the  | 
                                                        |
| 507 | + * registration processing is halted.  | 
                                                        |
| 508 | + */  | 
                                                        |
| 509 | + if (  | 
                                                        |
| 510 | + apply_filters(  | 
                                                        |
| 511 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process',  | 
                                                        |
| 512 | + false,  | 
                                                        |
| 513 | + $att_nmbr,  | 
                                                        |
| 514 | + $registration,  | 
                                                        |
| 515 | + $registrations,  | 
                                                        |
| 516 | + $valid_data,  | 
                                                        |
| 517 | + $this  | 
                                                        |
| 518 | + )  | 
                                                        |
| 519 | +					) { | 
                                                        |
| 520 | + return false;  | 
                                                        |
| 521 | + }  | 
                                                        |
| 522 | +  | 
                                                        |
| 523 | + // Houston, we have a registration!  | 
                                                        |
| 524 | + $att_nmbr++;  | 
                                                        |
| 525 | + $this->_attendee_data[ $reg_url_link ] = array();  | 
                                                        |
| 526 | + // grab any existing related answer objects  | 
                                                        |
| 527 | + $this->_registration_answers = $registration->answers();  | 
                                                        |
| 528 | + // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );  | 
                                                        |
| 529 | +					if (isset($valid_data[ $reg_url_link ])) { | 
                                                        |
| 530 | + // do we need to copy basic info from primary attendee ?  | 
                                                        |
| 531 | + $copy_primary = isset($valid_data[ $reg_url_link ]['additional_attendee_reg_info'])  | 
                                                        |
| 532 | + && absint($valid_data[ $reg_url_link ]['additional_attendee_reg_info']) === 0;  | 
                                                        |
| 533 | + // filter form input data for this registration  | 
                                                        |
| 534 | + $valid_data[ $reg_url_link ] = (array) apply_filters(  | 
                                                        |
| 535 | + 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',  | 
                                                        |
| 536 | + $valid_data[ $reg_url_link ]  | 
                                                        |
| 537 | + );  | 
                                                        |
| 538 | +						if (isset($valid_data['primary_attendee'])) { | 
                                                        |
| 539 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])  | 
                                                        |
| 540 | + ? $valid_data['primary_attendee']  | 
                                                        |
| 541 | + : false;  | 
                                                        |
| 542 | + unset($valid_data['primary_attendee']);  | 
                                                        |
| 543 | + }  | 
                                                        |
| 544 | + // now loop through our array of valid post data && process attendee reg forms  | 
                                                        |
| 545 | +						foreach ($valid_data[ $reg_url_link ] as $form_section => $form_inputs) { | 
                                                        |
| 546 | +							if (! in_array($form_section, $non_input_form_sections, true)) { | 
                                                        |
| 547 | +								foreach ($form_inputs as $form_input => $input_value) { | 
                                                        |
| 548 | + // \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ );  | 
                                                        |
| 549 | + // check for critical inputs  | 
                                                        |
| 550 | + if (  | 
                                                        |
| 551 | + ! $this->_verify_critical_attendee_details_are_set_and_validate_email(  | 
                                                        |
| 552 | + $form_input,  | 
                                                        |
| 553 | + $input_value  | 
                                                        |
| 554 | + )  | 
                                                        |
| 555 | +									) { | 
                                                        |
| 556 | + return false;  | 
                                                        |
| 557 | + }  | 
                                                        |
| 558 | + // store a bit of data about the primary attendee  | 
                                                        |
| 559 | + if (  | 
                                                        |
| 560 | + $att_nmbr === 1  | 
                                                        |
| 561 | + && ! empty($input_value)  | 
                                                        |
| 562 | + && $reg_url_link === $primary_registrant['line_item_id']  | 
                                                        |
| 563 | +									) { | 
                                                        |
| 564 | + $primary_registrant[ $form_input ] = $input_value;  | 
                                                        |
| 565 | + } elseif (  | 
                                                        |
| 566 | + $copy_primary  | 
                                                        |
| 567 | + && $input_value === null  | 
                                                        |
| 568 | + && isset($primary_registrant[ $form_input ])  | 
                                                        |
| 569 | +									) { | 
                                                        |
| 570 | + $input_value = $primary_registrant[ $form_input ];  | 
                                                        |
| 571 | + }  | 
                                                        |
| 572 | + // now attempt to save the input data  | 
                                                        |
| 573 | + if (  | 
                                                        |
| 574 | + ! $this->_save_registration_form_input(  | 
                                                        |
| 575 | + $registration,  | 
                                                        |
| 576 | + $form_input,  | 
                                                        |
| 577 | + $input_value  | 
                                                        |
| 578 | + )  | 
                                                        |
| 579 | +									) { | 
                                                        |
| 580 | + EE_Error::add_error(  | 
                                                        |
| 581 | + sprintf(  | 
                                                        |
| 582 | + esc_html_x(  | 
                                                        |
| 583 | + 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"',  | 
                                                        |
| 584 | + 'Unable to save registration form data for the form input: "form input name" with the submitted value: "form input value"',  | 
                                                        |
| 585 | + 'event_espresso'  | 
                                                        |
| 586 | + ),  | 
                                                        |
| 587 | + $form_input,  | 
                                                        |
| 588 | + $input_value  | 
                                                        |
| 589 | + ),  | 
                                                        |
| 590 | + __FILE__,  | 
                                                        |
| 591 | + __FUNCTION__,  | 
                                                        |
| 592 | + __LINE__  | 
                                                        |
| 593 | + );  | 
                                                        |
| 594 | + return false;  | 
                                                        |
| 595 | + }  | 
                                                        |
| 596 | + }  | 
                                                        |
| 597 | + }  | 
                                                        |
| 598 | + } // end of foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs )  | 
                                                        |
| 599 | + }  | 
                                                        |
| 600 | + // EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ );  | 
                                                        |
| 601 | + // this registration does not require additional attendee information ?  | 
                                                        |
| 602 | + if (  | 
                                                        |
| 603 | + $copy_primary  | 
                                                        |
| 604 | + && $att_nmbr > 1  | 
                                                        |
| 605 | + && $this->checkout->primary_attendee_obj instanceof EE_Attendee  | 
                                                        |
| 606 | +					) { | 
                                                        |
| 607 | + // just copy the primary registrant  | 
                                                        |
| 608 | + $attendee = $this->checkout->primary_attendee_obj;  | 
                                                        |
| 609 | +					} else { | 
                                                        |
| 610 | + // ensure critical details are set for additional attendees  | 
                                                        |
| 611 | + $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1  | 
                                                        |
| 612 | + ? $this->_copy_critical_attendee_details_from_primary_registrant(  | 
                                                        |
| 613 | + $this->_attendee_data[ $reg_url_link ]  | 
                                                        |
| 614 | + )  | 
                                                        |
| 615 | + : $this->_attendee_data[ $reg_url_link ];  | 
                                                        |
| 616 | + // execute create attendee command (which may return an existing attendee)  | 
                                                        |
| 617 | + $attendee = EE_Registry::instance()->BUS->execute(  | 
                                                        |
| 618 | + new CreateAttendeeCommand(  | 
                                                        |
| 619 | + $this->_attendee_data[ $reg_url_link ],  | 
                                                        |
| 620 | + $registration  | 
                                                        |
| 621 | + )  | 
                                                        |
| 622 | + );  | 
                                                        |
| 623 | + // who's #1 ?  | 
                                                        |
| 624 | +						if ($att_nmbr === 1) { | 
                                                        |
| 625 | + $this->checkout->primary_attendee_obj = $attendee;  | 
                                                        |
| 626 | + }  | 
                                                        |
| 627 | + }  | 
                                                        |
| 628 | + // EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );  | 
                                                        |
| 629 | + // add relation to registration, set attendee ID, and cache attendee  | 
                                                        |
| 630 | + $this->_associate_attendee_with_registration($registration, $attendee);  | 
                                                        |
| 631 | + // \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ );  | 
                                                        |
| 632 | +					if (! $registration->attendee() instanceof EE_Attendee) { | 
                                                        |
| 633 | + EE_Error::add_error(  | 
                                                        |
| 634 | + sprintf(  | 
                                                        |
| 635 | + esc_html_x(  | 
                                                        |
| 636 | + 'Registration %s has an invalid or missing Attendee object.',  | 
                                                        |
| 637 | + 'Registration 123-456-789 has an invalid or missing Attendee object.',  | 
                                                        |
| 638 | + 'event_espresso'  | 
                                                        |
| 639 | + ),  | 
                                                        |
| 640 | + $reg_url_link  | 
                                                        |
| 641 | + ),  | 
                                                        |
| 642 | + __FILE__,  | 
                                                        |
| 643 | + __FUNCTION__,  | 
                                                        |
| 644 | + __LINE__  | 
                                                        |
| 645 | + );  | 
                                                        |
| 646 | + return false;  | 
                                                        |
| 647 | + }  | 
                                                        |
| 648 | + /** @type EE_Registration_Processor $registration_processor */  | 
                                                        |
| 649 | +					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); | 
                                                        |
| 650 | + // at this point, we should have enough details about the registrant to consider the registration  | 
                                                        |
| 651 | + // NOT incomplete  | 
                                                        |
| 652 | + $registration_processor->toggle_incomplete_registration_status_to_default(  | 
                                                        |
| 653 | + $registration,  | 
                                                        |
| 654 | + false,  | 
                                                        |
| 655 | + new Context(  | 
                                                        |
| 656 | + 'spco_reg_step_attendee_information_process_registrations',  | 
                                                        |
| 657 | + esc_html__(  | 
                                                        |
| 658 | + 'Finished populating registration with details from the registration form after submitting the Attendee Information Reg Step.',  | 
                                                        |
| 659 | + 'event_espresso'  | 
                                                        |
| 660 | + )  | 
                                                        |
| 661 | + )  | 
                                                        |
| 662 | + );  | 
                                                        |
| 663 | + // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to  | 
                                                        |
| 664 | + // abandoned  | 
                                                        |
| 665 | + $this->checkout->transaction->toggle_failed_transaction_status();  | 
                                                        |
| 666 | + // if we've gotten this far, then let's save what we have  | 
                                                        |
| 667 | + $registration->save();  | 
                                                        |
| 668 | + // add relation between TXN and registration  | 
                                                        |
| 669 | + $this->_associate_registration_with_transaction($registration);  | 
                                                        |
| 670 | + }  | 
                                                        |
| 671 | +			} else { | 
                                                        |
| 672 | + EE_Error::add_error(  | 
                                                        |
| 673 | + esc_html__(  | 
                                                        |
| 674 | + 'An invalid or missing line item ID was encountered while attempting to process the registration form.',  | 
                                                        |
| 675 | + 'event_espresso'  | 
                                                        |
| 676 | + ),  | 
                                                        |
| 677 | + __FILE__,  | 
                                                        |
| 678 | + __FUNCTION__,  | 
                                                        |
| 679 | + __LINE__  | 
                                                        |
| 680 | + );  | 
                                                        |
| 681 | + // remove malformed data  | 
                                                        |
| 682 | + unset($valid_data[ $reg_url_link ]);  | 
                                                        |
| 683 | + return false;  | 
                                                        |
| 684 | + }  | 
                                                        |
| 685 | + } // end of foreach ( $this->checkout->transaction->registrations() as $registration )  | 
                                                        |
| 686 | + return $att_nmbr;  | 
                                                        |
| 687 | + }  | 
                                                        |
| 688 | +  | 
                                                        |
| 689 | +  | 
                                                        |
| 690 | + /**  | 
                                                        |
| 691 | + * _save_registration_form_input  | 
                                                        |
| 692 | + *  | 
                                                        |
| 693 | + * @param EE_Registration $registration  | 
                                                        |
| 694 | + * @param string $form_input  | 
                                                        |
| 695 | + * @param string $input_value  | 
                                                        |
| 696 | + * @return bool  | 
                                                        |
| 697 | + * @throws EE_Error  | 
                                                        |
| 698 | + * @throws InvalidArgumentException  | 
                                                        |
| 699 | + * @throws InvalidDataTypeException  | 
                                                        |
| 700 | + * @throws InvalidInterfaceException  | 
                                                        |
| 701 | + * @throws ReflectionException  | 
                                                        |
| 702 | + */  | 
                                                        |
| 703 | + private function _save_registration_form_input(  | 
                                                        |
| 704 | + EE_Registration $registration,  | 
                                                        |
| 705 | + $form_input = '',  | 
                                                        |
| 706 | + $input_value = ''  | 
                                                        |
| 707 | +	) { | 
                                                        |
| 708 | + // If email_confirm is sent it's not saved  | 
                                                        |
| 709 | +		if ((string) $form_input === 'email_confirm') { | 
                                                        |
| 710 | + return true;  | 
                                                        |
| 711 | + }  | 
                                                        |
| 712 | +  | 
                                                        |
| 713 | + // \EEH_Debug_Tools::printr( __FUNCTION__, __CLASS__, __FILE__, __LINE__, 2 );  | 
                                                        |
| 714 | + // \EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ );  | 
                                                        |
| 715 | + // \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );  | 
                                                        |
| 716 | + // allow for plugins to hook in and do their own processing of the form input.  | 
                                                        |
| 717 | + // For plugins to bypass normal processing here, they just need to return a boolean value.  | 
                                                        |
| 718 | + if (  | 
                                                        |
| 719 | + apply_filters(  | 
                                                        |
| 720 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input',  | 
                                                        |
| 721 | + false,  | 
                                                        |
| 722 | + $registration,  | 
                                                        |
| 723 | + $form_input,  | 
                                                        |
| 724 | + $input_value,  | 
                                                        |
| 725 | + $this  | 
                                                        |
| 726 | + )  | 
                                                        |
| 727 | +		) { | 
                                                        |
| 728 | + return true;  | 
                                                        |
| 729 | + }  | 
                                                        |
| 730 | + /*  | 
                                                        |
| 731 | 731 | * $answer_cache_id is the key used to find the EE_Answer we want  | 
                                                        
| 732 | 732 | * @see https://events.codebasehq.com/projects/event-espresso/tickets/10477  | 
                                                        
| 733 | 733 | */  | 
                                                        
| 734 | - $answer_cache_id = $this->checkout->reg_url_link  | 
                                                        |
| 735 | - ? $form_input . '-' . $registration->reg_url_link()  | 
                                                        |
| 736 | - : $form_input;  | 
                                                        |
| 737 | - $answer_is_obj = isset($this->_registration_answers[ $answer_cache_id ])  | 
                                                        |
| 738 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer;  | 
                                                        |
| 739 | - // rename form_inputs if they are EE_Attendee properties  | 
                                                        |
| 740 | -        switch ((string) $form_input) { | 
                                                        |
| 741 | - case 'state':  | 
                                                        |
| 742 | - case 'STA_ID':  | 
                                                        |
| 743 | - $attendee_property = true;  | 
                                                        |
| 744 | - $form_input = 'STA_ID';  | 
                                                        |
| 745 | - break;  | 
                                                        |
| 746 | -  | 
                                                        |
| 747 | - case 'country':  | 
                                                        |
| 748 | - case 'CNT_ISO':  | 
                                                        |
| 749 | - $attendee_property = true;  | 
                                                        |
| 750 | - $form_input = 'CNT_ISO';  | 
                                                        |
| 751 | - break;  | 
                                                        |
| 752 | -  | 
                                                        |
| 753 | - default:  | 
                                                        |
| 754 | - $ATT_input = 'ATT_' . $form_input;  | 
                                                        |
| 755 | - // EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );  | 
                                                        |
| 756 | - $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false;  | 
                                                        |
| 757 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;  | 
                                                        |
| 758 | - }  | 
                                                        |
| 759 | - // EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );  | 
                                                        |
| 760 | - // EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );  | 
                                                        |
| 761 | - // EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );  | 
                                                        |
| 762 | - // if this form input has a corresponding attendee property  | 
                                                        |
| 763 | -        if ($attendee_property) { | 
                                                        |
| 764 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;  | 
                                                        |
| 765 | -            if ($answer_is_obj) { | 
                                                        |
| 766 | - // and delete the corresponding answer since we won't be storing this data in that object  | 
                                                        |
| 767 | - $registration->_remove_relation_to($this->_registration_answers[ $answer_cache_id ], 'Answer');  | 
                                                        |
| 768 | - $this->_registration_answers[ $answer_cache_id ]->delete_permanently();  | 
                                                        |
| 769 | - }  | 
                                                        |
| 770 | - return true;  | 
                                                        |
| 771 | - }  | 
                                                        |
| 772 | -        if ($answer_is_obj) { | 
                                                        |
| 773 | - // save this data to the answer object  | 
                                                        |
| 774 | - $this->_registration_answers[ $answer_cache_id ]->set_value($input_value);  | 
                                                        |
| 775 | - $result = $this->_registration_answers[ $answer_cache_id ]->save();  | 
                                                        |
| 776 | - return $result !== false;  | 
                                                        |
| 777 | - }  | 
                                                        |
| 778 | -        foreach ($this->_registration_answers as $answer) { | 
                                                        |
| 779 | -            if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) { | 
                                                        |
| 780 | - $answer->set_value($input_value);  | 
                                                        |
| 781 | - $result = $answer->save();  | 
                                                        |
| 782 | - return $result !== false;  | 
                                                        |
| 783 | - }  | 
                                                        |
| 784 | - }  | 
                                                        |
| 785 | - return false;  | 
                                                        |
| 786 | - }  | 
                                                        |
| 787 | -  | 
                                                        |
| 788 | -  | 
                                                        |
| 789 | - /**  | 
                                                        |
| 790 | - * _verify_critical_attendee_details_are_set  | 
                                                        |
| 791 | - *  | 
                                                        |
| 792 | - * @param string $form_input  | 
                                                        |
| 793 | - * @param string $input_value  | 
                                                        |
| 794 | - * @return boolean  | 
                                                        |
| 795 | - */  | 
                                                        |
| 796 | - private function _verify_critical_attendee_details_are_set_and_validate_email(  | 
                                                        |
| 797 | - $form_input = '',  | 
                                                        |
| 798 | - $input_value = ''  | 
                                                        |
| 799 | -    ) { | 
                                                        |
| 800 | -        if (empty($input_value)) { | 
                                                        |
| 801 | - // if the form input isn't marked as being required, then just return  | 
                                                        |
| 802 | -            if (! isset($this->_required_questions[ $form_input ]) || ! $this->_required_questions[ $form_input ]) { | 
                                                        |
| 803 | - return true;  | 
                                                        |
| 804 | - }  | 
                                                        |
| 805 | -            switch ($form_input) { | 
                                                        |
| 806 | - case 'fname':  | 
                                                        |
| 807 | - EE_Error::add_error(  | 
                                                        |
| 808 | -                        esc_html__('First Name is a required value.', 'event_espresso'), | 
                                                        |
| 809 | - __FILE__,  | 
                                                        |
| 810 | - __FUNCTION__,  | 
                                                        |
| 811 | - __LINE__  | 
                                                        |
| 812 | - );  | 
                                                        |
| 813 | - return false;  | 
                                                        |
| 814 | - break;  | 
                                                        |
| 815 | - case 'lname':  | 
                                                        |
| 816 | - EE_Error::add_error(  | 
                                                        |
| 817 | -                        esc_html__('Last Name is a required value.', 'event_espresso'), | 
                                                        |
| 818 | - __FILE__,  | 
                                                        |
| 819 | - __FUNCTION__,  | 
                                                        |
| 820 | - __LINE__  | 
                                                        |
| 821 | - );  | 
                                                        |
| 822 | - return false;  | 
                                                        |
| 823 | - break;  | 
                                                        |
| 824 | - case 'email':  | 
                                                        |
| 825 | - EE_Error::add_error(  | 
                                                        |
| 826 | -                        esc_html__('Please enter a valid email address.', 'event_espresso'), | 
                                                        |
| 827 | - __FILE__,  | 
                                                        |
| 828 | - __FUNCTION__,  | 
                                                        |
| 829 | - __LINE__  | 
                                                        |
| 830 | - );  | 
                                                        |
| 831 | - return false;  | 
                                                        |
| 832 | - break;  | 
                                                        |
| 833 | - }  | 
                                                        |
| 834 | - }  | 
                                                        |
| 835 | - return true;  | 
                                                        |
| 836 | - }  | 
                                                        |
| 837 | -  | 
                                                        |
| 838 | -  | 
                                                        |
| 839 | - /**  | 
                                                        |
| 840 | - * _associate_attendee_with_registration  | 
                                                        |
| 841 | - *  | 
                                                        |
| 842 | - * @param EE_Registration $registration  | 
                                                        |
| 843 | - * @param EE_Attendee $attendee  | 
                                                        |
| 844 | - * @return void  | 
                                                        |
| 845 | - * @throws EE_Error  | 
                                                        |
| 846 | - * @throws InvalidArgumentException  | 
                                                        |
| 847 | - * @throws ReflectionException  | 
                                                        |
| 848 | - * @throws RuntimeException  | 
                                                        |
| 849 | - * @throws InvalidDataTypeException  | 
                                                        |
| 850 | - * @throws InvalidInterfaceException  | 
                                                        |
| 851 | - */  | 
                                                        |
| 852 | - private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee)  | 
                                                        |
| 853 | -    { | 
                                                        |
| 854 | - // add relation to attendee  | 
                                                        |
| 855 | - $registration->_add_relation_to($attendee, 'Attendee');  | 
                                                        |
| 856 | - $registration->set_attendee_id($attendee->ID());  | 
                                                        |
| 857 | -        $registration->update_cache_after_object_save('Attendee', $attendee); | 
                                                        |
| 858 | - }  | 
                                                        |
| 859 | -  | 
                                                        |
| 860 | -  | 
                                                        |
| 861 | - /**  | 
                                                        |
| 862 | - * _associate_registration_with_transaction  | 
                                                        |
| 863 | - *  | 
                                                        |
| 864 | - * @param EE_Registration $registration  | 
                                                        |
| 865 | - * @return void  | 
                                                        |
| 866 | - * @throws EE_Error  | 
                                                        |
| 867 | - * @throws InvalidArgumentException  | 
                                                        |
| 868 | - * @throws ReflectionException  | 
                                                        |
| 869 | - * @throws InvalidDataTypeException  | 
                                                        |
| 870 | - * @throws InvalidInterfaceException  | 
                                                        |
| 871 | - */  | 
                                                        |
| 872 | - private function _associate_registration_with_transaction(EE_Registration $registration)  | 
                                                        |
| 873 | -    { | 
                                                        |
| 874 | - // add relation to registration  | 
                                                        |
| 875 | - $this->checkout->transaction->_add_relation_to($registration, 'Registration');  | 
                                                        |
| 876 | -        $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); | 
                                                        |
| 877 | - }  | 
                                                        |
| 878 | -  | 
                                                        |
| 879 | -  | 
                                                        |
| 880 | - /**  | 
                                                        |
| 881 | - * _copy_critical_attendee_details_from_primary_registrant  | 
                                                        |
| 882 | - * ensures that all attendees at least have data for first name, last name, and email address  | 
                                                        |
| 883 | - *  | 
                                                        |
| 884 | - * @param array $attendee_data  | 
                                                        |
| 885 | - * @return array  | 
                                                        |
| 886 | - * @throws EE_Error  | 
                                                        |
| 887 | - * @throws InvalidArgumentException  | 
                                                        |
| 888 | - * @throws ReflectionException  | 
                                                        |
| 889 | - * @throws InvalidDataTypeException  | 
                                                        |
| 890 | - * @throws InvalidInterfaceException  | 
                                                        |
| 891 | - */  | 
                                                        |
| 892 | - private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array())  | 
                                                        |
| 893 | -    { | 
                                                        |
| 894 | - // bare minimum critical details include first name, last name, email address  | 
                                                        |
| 895 | -        $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); | 
                                                        |
| 896 | - // add address info to critical details?  | 
                                                        |
| 897 | - if (  | 
                                                        |
| 898 | - apply_filters(  | 
                                                        |
| 899 | - 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details',  | 
                                                        |
| 900 | - false  | 
                                                        |
| 901 | - )  | 
                                                        |
| 902 | -        ) { | 
                                                        |
| 903 | - $address_details = array(  | 
                                                        |
| 904 | - 'ATT_address',  | 
                                                        |
| 905 | - 'ATT_address2',  | 
                                                        |
| 906 | - 'ATT_city',  | 
                                                        |
| 907 | - 'STA_ID',  | 
                                                        |
| 908 | - 'CNT_ISO',  | 
                                                        |
| 909 | - 'ATT_zip',  | 
                                                        |
| 910 | - 'ATT_phone',  | 
                                                        |
| 911 | - );  | 
                                                        |
| 912 | - $critical_attendee_details = array_merge($critical_attendee_details, $address_details);  | 
                                                        |
| 913 | - }  | 
                                                        |
| 914 | -        foreach ($critical_attendee_details as $critical_attendee_detail) { | 
                                                        |
| 915 | - if (  | 
                                                        |
| 916 | - ! isset($attendee_data[ $critical_attendee_detail ])  | 
                                                        |
| 917 | - || empty($attendee_data[ $critical_attendee_detail ])  | 
                                                        |
| 918 | -            ) { | 
                                                        |
| 919 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(  | 
                                                        |
| 920 | - $critical_attendee_detail  | 
                                                        |
| 921 | - );  | 
                                                        |
| 922 | - }  | 
                                                        |
| 923 | - }  | 
                                                        |
| 924 | - return $attendee_data;  | 
                                                        |
| 925 | - }  | 
                                                        |
| 926 | -  | 
                                                        |
| 927 | -  | 
                                                        |
| 928 | - /**  | 
                                                        |
| 929 | - * update_reg_step  | 
                                                        |
| 930 | - * this is the final step after a user revisits the site to edit their attendee information  | 
                                                        |
| 931 | - * this gets called AFTER the process_reg_step() method above  | 
                                                        |
| 932 | - *  | 
                                                        |
| 933 | - * @return bool  | 
                                                        |
| 934 | - * @throws EE_Error  | 
                                                        |
| 935 | - * @throws InvalidArgumentException  | 
                                                        |
| 936 | - * @throws ReflectionException  | 
                                                        |
| 937 | - * @throws RuntimeException  | 
                                                        |
| 938 | - * @throws InvalidDataTypeException  | 
                                                        |
| 939 | - * @throws InvalidInterfaceException  | 
                                                        |
| 940 | - */  | 
                                                        |
| 941 | - public function update_reg_step()  | 
                                                        |
| 942 | -    { | 
                                                        |
| 943 | - // save everything  | 
                                                        |
| 944 | -        if ($this->process_reg_step()) { | 
                                                        |
| 945 | - $this->checkout->redirect = true;  | 
                                                        |
| 946 | - $this->checkout->redirect_url = add_query_arg(  | 
                                                        |
| 947 | - array(  | 
                                                        |
| 948 | - 'e_reg_url_link' => $this->checkout->reg_url_link,  | 
                                                        |
| 949 | - 'revisit' => true,  | 
                                                        |
| 950 | - ),  | 
                                                        |
| 951 | - $this->checkout->thank_you_page_url  | 
                                                        |
| 952 | - );  | 
                                                        |
| 953 | - $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);  | 
                                                        |
| 954 | - return true;  | 
                                                        |
| 955 | - }  | 
                                                        |
| 956 | - return false;  | 
                                                        |
| 957 | - }  | 
                                                        |
| 734 | + $answer_cache_id = $this->checkout->reg_url_link  | 
                                                        |
| 735 | + ? $form_input . '-' . $registration->reg_url_link()  | 
                                                        |
| 736 | + : $form_input;  | 
                                                        |
| 737 | + $answer_is_obj = isset($this->_registration_answers[ $answer_cache_id ])  | 
                                                        |
| 738 | + && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer;  | 
                                                        |
| 739 | + // rename form_inputs if they are EE_Attendee properties  | 
                                                        |
| 740 | +		switch ((string) $form_input) { | 
                                                        |
| 741 | + case 'state':  | 
                                                        |
| 742 | + case 'STA_ID':  | 
                                                        |
| 743 | + $attendee_property = true;  | 
                                                        |
| 744 | + $form_input = 'STA_ID';  | 
                                                        |
| 745 | + break;  | 
                                                        |
| 746 | +  | 
                                                        |
| 747 | + case 'country':  | 
                                                        |
| 748 | + case 'CNT_ISO':  | 
                                                        |
| 749 | + $attendee_property = true;  | 
                                                        |
| 750 | + $form_input = 'CNT_ISO';  | 
                                                        |
| 751 | + break;  | 
                                                        |
| 752 | +  | 
                                                        |
| 753 | + default:  | 
                                                        |
| 754 | + $ATT_input = 'ATT_' . $form_input;  | 
                                                        |
| 755 | + // EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );  | 
                                                        |
| 756 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false;  | 
                                                        |
| 757 | + $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;  | 
                                                        |
| 758 | + }  | 
                                                        |
| 759 | + // EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );  | 
                                                        |
| 760 | + // EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );  | 
                                                        |
| 761 | + // EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );  | 
                                                        |
| 762 | + // if this form input has a corresponding attendee property  | 
                                                        |
| 763 | +		if ($attendee_property) { | 
                                                        |
| 764 | + $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;  | 
                                                        |
| 765 | +			if ($answer_is_obj) { | 
                                                        |
| 766 | + // and delete the corresponding answer since we won't be storing this data in that object  | 
                                                        |
| 767 | + $registration->_remove_relation_to($this->_registration_answers[ $answer_cache_id ], 'Answer');  | 
                                                        |
| 768 | + $this->_registration_answers[ $answer_cache_id ]->delete_permanently();  | 
                                                        |
| 769 | + }  | 
                                                        |
| 770 | + return true;  | 
                                                        |
| 771 | + }  | 
                                                        |
| 772 | +		if ($answer_is_obj) { | 
                                                        |
| 773 | + // save this data to the answer object  | 
                                                        |
| 774 | + $this->_registration_answers[ $answer_cache_id ]->set_value($input_value);  | 
                                                        |
| 775 | + $result = $this->_registration_answers[ $answer_cache_id ]->save();  | 
                                                        |
| 776 | + return $result !== false;  | 
                                                        |
| 777 | + }  | 
                                                        |
| 778 | +		foreach ($this->_registration_answers as $answer) { | 
                                                        |
| 779 | +			if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) { | 
                                                        |
| 780 | + $answer->set_value($input_value);  | 
                                                        |
| 781 | + $result = $answer->save();  | 
                                                        |
| 782 | + return $result !== false;  | 
                                                        |
| 783 | + }  | 
                                                        |
| 784 | + }  | 
                                                        |
| 785 | + return false;  | 
                                                        |
| 786 | + }  | 
                                                        |
| 787 | +  | 
                                                        |
| 788 | +  | 
                                                        |
| 789 | + /**  | 
                                                        |
| 790 | + * _verify_critical_attendee_details_are_set  | 
                                                        |
| 791 | + *  | 
                                                        |
| 792 | + * @param string $form_input  | 
                                                        |
| 793 | + * @param string $input_value  | 
                                                        |
| 794 | + * @return boolean  | 
                                                        |
| 795 | + */  | 
                                                        |
| 796 | + private function _verify_critical_attendee_details_are_set_and_validate_email(  | 
                                                        |
| 797 | + $form_input = '',  | 
                                                        |
| 798 | + $input_value = ''  | 
                                                        |
| 799 | +	) { | 
                                                        |
| 800 | +		if (empty($input_value)) { | 
                                                        |
| 801 | + // if the form input isn't marked as being required, then just return  | 
                                                        |
| 802 | +			if (! isset($this->_required_questions[ $form_input ]) || ! $this->_required_questions[ $form_input ]) { | 
                                                        |
| 803 | + return true;  | 
                                                        |
| 804 | + }  | 
                                                        |
| 805 | +			switch ($form_input) { | 
                                                        |
| 806 | + case 'fname':  | 
                                                        |
| 807 | + EE_Error::add_error(  | 
                                                        |
| 808 | +						esc_html__('First Name is a required value.', 'event_espresso'), | 
                                                        |
| 809 | + __FILE__,  | 
                                                        |
| 810 | + __FUNCTION__,  | 
                                                        |
| 811 | + __LINE__  | 
                                                        |
| 812 | + );  | 
                                                        |
| 813 | + return false;  | 
                                                        |
| 814 | + break;  | 
                                                        |
| 815 | + case 'lname':  | 
                                                        |
| 816 | + EE_Error::add_error(  | 
                                                        |
| 817 | +						esc_html__('Last Name is a required value.', 'event_espresso'), | 
                                                        |
| 818 | + __FILE__,  | 
                                                        |
| 819 | + __FUNCTION__,  | 
                                                        |
| 820 | + __LINE__  | 
                                                        |
| 821 | + );  | 
                                                        |
| 822 | + return false;  | 
                                                        |
| 823 | + break;  | 
                                                        |
| 824 | + case 'email':  | 
                                                        |
| 825 | + EE_Error::add_error(  | 
                                                        |
| 826 | +						esc_html__('Please enter a valid email address.', 'event_espresso'), | 
                                                        |
| 827 | + __FILE__,  | 
                                                        |
| 828 | + __FUNCTION__,  | 
                                                        |
| 829 | + __LINE__  | 
                                                        |
| 830 | + );  | 
                                                        |
| 831 | + return false;  | 
                                                        |
| 832 | + break;  | 
                                                        |
| 833 | + }  | 
                                                        |
| 834 | + }  | 
                                                        |
| 835 | + return true;  | 
                                                        |
| 836 | + }  | 
                                                        |
| 837 | +  | 
                                                        |
| 838 | +  | 
                                                        |
| 839 | + /**  | 
                                                        |
| 840 | + * _associate_attendee_with_registration  | 
                                                        |
| 841 | + *  | 
                                                        |
| 842 | + * @param EE_Registration $registration  | 
                                                        |
| 843 | + * @param EE_Attendee $attendee  | 
                                                        |
| 844 | + * @return void  | 
                                                        |
| 845 | + * @throws EE_Error  | 
                                                        |
| 846 | + * @throws InvalidArgumentException  | 
                                                        |
| 847 | + * @throws ReflectionException  | 
                                                        |
| 848 | + * @throws RuntimeException  | 
                                                        |
| 849 | + * @throws InvalidDataTypeException  | 
                                                        |
| 850 | + * @throws InvalidInterfaceException  | 
                                                        |
| 851 | + */  | 
                                                        |
| 852 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee)  | 
                                                        |
| 853 | +	{ | 
                                                        |
| 854 | + // add relation to attendee  | 
                                                        |
| 855 | + $registration->_add_relation_to($attendee, 'Attendee');  | 
                                                        |
| 856 | + $registration->set_attendee_id($attendee->ID());  | 
                                                        |
| 857 | +		$registration->update_cache_after_object_save('Attendee', $attendee); | 
                                                        |
| 858 | + }  | 
                                                        |
| 859 | +  | 
                                                        |
| 860 | +  | 
                                                        |
| 861 | + /**  | 
                                                        |
| 862 | + * _associate_registration_with_transaction  | 
                                                        |
| 863 | + *  | 
                                                        |
| 864 | + * @param EE_Registration $registration  | 
                                                        |
| 865 | + * @return void  | 
                                                        |
| 866 | + * @throws EE_Error  | 
                                                        |
| 867 | + * @throws InvalidArgumentException  | 
                                                        |
| 868 | + * @throws ReflectionException  | 
                                                        |
| 869 | + * @throws InvalidDataTypeException  | 
                                                        |
| 870 | + * @throws InvalidInterfaceException  | 
                                                        |
| 871 | + */  | 
                                                        |
| 872 | + private function _associate_registration_with_transaction(EE_Registration $registration)  | 
                                                        |
| 873 | +	{ | 
                                                        |
| 874 | + // add relation to registration  | 
                                                        |
| 875 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration');  | 
                                                        |
| 876 | +		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration); | 
                                                        |
| 877 | + }  | 
                                                        |
| 878 | +  | 
                                                        |
| 879 | +  | 
                                                        |
| 880 | + /**  | 
                                                        |
| 881 | + * _copy_critical_attendee_details_from_primary_registrant  | 
                                                        |
| 882 | + * ensures that all attendees at least have data for first name, last name, and email address  | 
                                                        |
| 883 | + *  | 
                                                        |
| 884 | + * @param array $attendee_data  | 
                                                        |
| 885 | + * @return array  | 
                                                        |
| 886 | + * @throws EE_Error  | 
                                                        |
| 887 | + * @throws InvalidArgumentException  | 
                                                        |
| 888 | + * @throws ReflectionException  | 
                                                        |
| 889 | + * @throws InvalidDataTypeException  | 
                                                        |
| 890 | + * @throws InvalidInterfaceException  | 
                                                        |
| 891 | + */  | 
                                                        |
| 892 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array())  | 
                                                        |
| 893 | +	{ | 
                                                        |
| 894 | + // bare minimum critical details include first name, last name, email address  | 
                                                        |
| 895 | +		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); | 
                                                        |
| 896 | + // add address info to critical details?  | 
                                                        |
| 897 | + if (  | 
                                                        |
| 898 | + apply_filters(  | 
                                                        |
| 899 | + 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details',  | 
                                                        |
| 900 | + false  | 
                                                        |
| 901 | + )  | 
                                                        |
| 902 | +		) { | 
                                                        |
| 903 | + $address_details = array(  | 
                                                        |
| 904 | + 'ATT_address',  | 
                                                        |
| 905 | + 'ATT_address2',  | 
                                                        |
| 906 | + 'ATT_city',  | 
                                                        |
| 907 | + 'STA_ID',  | 
                                                        |
| 908 | + 'CNT_ISO',  | 
                                                        |
| 909 | + 'ATT_zip',  | 
                                                        |
| 910 | + 'ATT_phone',  | 
                                                        |
| 911 | + );  | 
                                                        |
| 912 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details);  | 
                                                        |
| 913 | + }  | 
                                                        |
| 914 | +		foreach ($critical_attendee_details as $critical_attendee_detail) { | 
                                                        |
| 915 | + if (  | 
                                                        |
| 916 | + ! isset($attendee_data[ $critical_attendee_detail ])  | 
                                                        |
| 917 | + || empty($attendee_data[ $critical_attendee_detail ])  | 
                                                        |
| 918 | +			) { | 
                                                        |
| 919 | + $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(  | 
                                                        |
| 920 | + $critical_attendee_detail  | 
                                                        |
| 921 | + );  | 
                                                        |
| 922 | + }  | 
                                                        |
| 923 | + }  | 
                                                        |
| 924 | + return $attendee_data;  | 
                                                        |
| 925 | + }  | 
                                                        |
| 926 | +  | 
                                                        |
| 927 | +  | 
                                                        |
| 928 | + /**  | 
                                                        |
| 929 | + * update_reg_step  | 
                                                        |
| 930 | + * this is the final step after a user revisits the site to edit their attendee information  | 
                                                        |
| 931 | + * this gets called AFTER the process_reg_step() method above  | 
                                                        |
| 932 | + *  | 
                                                        |
| 933 | + * @return bool  | 
                                                        |
| 934 | + * @throws EE_Error  | 
                                                        |
| 935 | + * @throws InvalidArgumentException  | 
                                                        |
| 936 | + * @throws ReflectionException  | 
                                                        |
| 937 | + * @throws RuntimeException  | 
                                                        |
| 938 | + * @throws InvalidDataTypeException  | 
                                                        |
| 939 | + * @throws InvalidInterfaceException  | 
                                                        |
| 940 | + */  | 
                                                        |
| 941 | + public function update_reg_step()  | 
                                                        |
| 942 | +	{ | 
                                                        |
| 943 | + // save everything  | 
                                                        |
| 944 | +		if ($this->process_reg_step()) { | 
                                                        |
| 945 | + $this->checkout->redirect = true;  | 
                                                        |
| 946 | + $this->checkout->redirect_url = add_query_arg(  | 
                                                        |
| 947 | + array(  | 
                                                        |
| 948 | + 'e_reg_url_link' => $this->checkout->reg_url_link,  | 
                                                        |
| 949 | + 'revisit' => true,  | 
                                                        |
| 950 | + ),  | 
                                                        |
| 951 | + $this->checkout->thank_you_page_url  | 
                                                        |
| 952 | + );  | 
                                                        |
| 953 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);  | 
                                                        |
| 954 | + return true;  | 
                                                        |
| 955 | + }  | 
                                                        |
| 956 | + return false;  | 
                                                        |
| 957 | + }  | 
                                                        |
| 958 | 958 | }  | 
                                                        
@@ -243,7 +243,7 @@ discard block  | 
                                                    ||
| 243 | 243 | */  | 
                                                        
| 244 | 244 | public function reg_form_question(EE_Registration $registration, EE_Question $question): EE_Form_Input_Base  | 
                                                        
| 245 | 245 |      { | 
                                                        
| 246 | - $legacy_reg_form = $this->legacy_reg_forms[ $registration->reg_url_link() ] ?? null;  | 
                                                        |
| 246 | + $legacy_reg_form = $this->legacy_reg_forms[$registration->reg_url_link()] ?? null;  | 
                                                        |
| 247 | 247 |          if ($legacy_reg_form instanceof LegacyRegistrationForm) { | 
                                                        
| 248 | 248 | return $legacy_reg_form->regFormQuestion($registration, $question);  | 
                                                        
| 249 | 249 | }  | 
                                                        
@@ -346,7 +346,7 @@ discard block  | 
                                                    ||
| 346 | 346 | );  | 
                                                        
| 347 | 347 | return false;  | 
                                                        
| 348 | 348 | }  | 
                                                        
| 349 | -        if (! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { | 
                                                        |
| 349 | +        if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { | 
                                                        |
| 350 | 350 | EE_Error::add_error(  | 
                                                        
| 351 | 351 | esc_html__(  | 
                                                        
| 352 | 352 | 'A valid transaction could not be initiated for processing your registrations.',  | 
                                                        
@@ -373,7 +373,7 @@ discard block  | 
                                                    ||
| 373 | 373 | '(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.',  | 
                                                        
| 374 | 374 | 'event_espresso'  | 
                                                        
| 375 | 375 | ),  | 
                                                        
| 376 | -                '<a href="' . get_post_type_archive_link('espresso_events') . '" >', | 
                                                        |
| 376 | +                '<a href="'.get_post_type_archive_link('espresso_events').'" >', | 
                                                        |
| 377 | 377 | '</a>',  | 
                                                        
| 378 | 378 | '<br />'  | 
                                                        
| 379 | 379 | );  | 
                                                        
@@ -393,7 +393,7 @@ discard block  | 
                                                    ||
| 393 | 393 | // but return immediately if the previous step exited early due to errors  | 
                                                        
| 394 | 394 | return false;  | 
                                                        
| 395 | 395 | }  | 
                                                        
| 396 | -        if (! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { | 
                                                        |
| 396 | +        if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { | 
                                                        |
| 397 | 397 | // generate a correctly translated string for all possible singular/plural combinations  | 
                                                        
| 398 | 398 |              if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { | 
                                                        
| 399 | 399 | $error_msg = sprintf(  | 
                                                        
@@ -476,7 +476,7 @@ discard block  | 
                                                    ||
| 476 | 476 | // grab the saved registrations from the transaction  | 
                                                        
| 477 | 477 |          foreach ($registrations as $registration) { | 
                                                        
| 478 | 478 | // verify EE_Registration object  | 
                                                        
| 479 | -            if (! $registration instanceof EE_Registration) { | 
                                                        |
| 479 | +            if ( ! $registration instanceof EE_Registration) { | 
                                                        |
| 480 | 480 | EE_Error::add_error(  | 
                                                        
| 481 | 481 | esc_html__(  | 
                                                        
| 482 | 482 | 'An invalid Registration object was discovered when attempting to process your registration information.',  | 
                                                        
@@ -491,12 +491,12 @@ discard block  | 
                                                    ||
| 491 | 491 | /** @var string $reg_url_link */  | 
                                                        
| 492 | 492 | $reg_url_link = $registration->reg_url_link();  | 
                                                        
| 493 | 493 | // reg_url_link exists ?  | 
                                                        
| 494 | -            if (! empty($reg_url_link)) { | 
                                                        |
| 494 | +            if ( ! empty($reg_url_link)) { | 
                                                        |
| 495 | 495 | // should this registration be processed during this visit ?  | 
                                                        
| 496 | 496 |                  if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { | 
                                                        
| 497 | 497 | // if NOT revisiting, then let's save the registration now,  | 
                                                        
| 498 | 498 | // so that we have a REG_ID to use when generating other objects  | 
                                                        
| 499 | -                    if (! $this->checkout->revisit) { | 
                                                        |
| 499 | +                    if ( ! $this->checkout->revisit) { | 
                                                        |
| 500 | 500 | $registration->save();  | 
                                                        
| 501 | 501 | }  | 
                                                        
| 502 | 502 | /**  | 
                                                        
@@ -522,18 +522,18 @@ discard block  | 
                                                    ||
| 522 | 522 | |
| 523 | 523 | // Houston, we have a registration!  | 
                                                        
| 524 | 524 | $att_nmbr++;  | 
                                                        
| 525 | - $this->_attendee_data[ $reg_url_link ] = array();  | 
                                                        |
| 525 | + $this->_attendee_data[$reg_url_link] = array();  | 
                                                        |
| 526 | 526 | // grab any existing related answer objects  | 
                                                        
| 527 | 527 | $this->_registration_answers = $registration->answers();  | 
                                                        
| 528 | 528 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );  | 
                                                        
| 529 | -                    if (isset($valid_data[ $reg_url_link ])) { | 
                                                        |
| 529 | +                    if (isset($valid_data[$reg_url_link])) { | 
                                                        |
| 530 | 530 | // do we need to copy basic info from primary attendee ?  | 
                                                        
| 531 | - $copy_primary = isset($valid_data[ $reg_url_link ]['additional_attendee_reg_info'])  | 
                                                        |
| 532 | - && absint($valid_data[ $reg_url_link ]['additional_attendee_reg_info']) === 0;  | 
                                                        |
| 531 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info'])  | 
                                                        |
| 532 | + && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0;  | 
                                                        |
| 533 | 533 | // filter form input data for this registration  | 
                                                        
| 534 | - $valid_data[ $reg_url_link ] = (array) apply_filters(  | 
                                                        |
| 534 | + $valid_data[$reg_url_link] = (array) apply_filters(  | 
                                                        |
| 535 | 535 | 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',  | 
                                                        
| 536 | - $valid_data[ $reg_url_link ]  | 
                                                        |
| 536 | + $valid_data[$reg_url_link]  | 
                                                        |
| 537 | 537 | );  | 
                                                        
| 538 | 538 |                          if (isset($valid_data['primary_attendee'])) { | 
                                                        
| 539 | 539 | $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])  | 
                                                        
@@ -542,8 +542,8 @@ discard block  | 
                                                    ||
| 542 | 542 | unset($valid_data['primary_attendee']);  | 
                                                        
| 543 | 543 | }  | 
                                                        
| 544 | 544 | // now loop through our array of valid post data && process attendee reg forms  | 
                                                        
| 545 | -                        foreach ($valid_data[ $reg_url_link ] as $form_section => $form_inputs) { | 
                                                        |
| 546 | -                            if (! in_array($form_section, $non_input_form_sections, true)) { | 
                                                        |
| 545 | +                        foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { | 
                                                        |
| 546 | +                            if ( ! in_array($form_section, $non_input_form_sections, true)) { | 
                                                        |
| 547 | 547 |                                  foreach ($form_inputs as $form_input => $input_value) { | 
                                                        
| 548 | 548 | // \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ );  | 
                                                        
| 549 | 549 | // check for critical inputs  | 
                                                        
@@ -561,13 +561,13 @@ discard block  | 
                                                    ||
| 561 | 561 | && ! empty($input_value)  | 
                                                        
| 562 | 562 | && $reg_url_link === $primary_registrant['line_item_id']  | 
                                                        
| 563 | 563 |                                      ) { | 
                                                        
| 564 | - $primary_registrant[ $form_input ] = $input_value;  | 
                                                        |
| 564 | + $primary_registrant[$form_input] = $input_value;  | 
                                                        |
| 565 | 565 | } elseif (  | 
                                                        
| 566 | 566 | $copy_primary  | 
                                                        
| 567 | 567 | && $input_value === null  | 
                                                        
| 568 | - && isset($primary_registrant[ $form_input ])  | 
                                                        |
| 568 | + && isset($primary_registrant[$form_input])  | 
                                                        |
| 569 | 569 |                                      ) { | 
                                                        
| 570 | - $input_value = $primary_registrant[ $form_input ];  | 
                                                        |
| 570 | + $input_value = $primary_registrant[$form_input];  | 
                                                        |
| 571 | 571 | }  | 
                                                        
| 572 | 572 | // now attempt to save the input data  | 
                                                        
| 573 | 573 | if (  | 
                                                        
@@ -608,15 +608,15 @@ discard block  | 
                                                    ||
| 608 | 608 | $attendee = $this->checkout->primary_attendee_obj;  | 
                                                        
| 609 | 609 |                      } else { | 
                                                        
| 610 | 610 | // ensure critical details are set for additional attendees  | 
                                                        
| 611 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1  | 
                                                        |
| 611 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1  | 
                                                        |
| 612 | 612 | ? $this->_copy_critical_attendee_details_from_primary_registrant(  | 
                                                        
| 613 | - $this->_attendee_data[ $reg_url_link ]  | 
                                                        |
| 613 | + $this->_attendee_data[$reg_url_link]  | 
                                                        |
| 614 | 614 | )  | 
                                                        
| 615 | - : $this->_attendee_data[ $reg_url_link ];  | 
                                                        |
| 615 | + : $this->_attendee_data[$reg_url_link];  | 
                                                        |
| 616 | 616 | // execute create attendee command (which may return an existing attendee)  | 
                                                        
| 617 | 617 | $attendee = EE_Registry::instance()->BUS->execute(  | 
                                                        
| 618 | 618 | new CreateAttendeeCommand(  | 
                                                        
| 619 | - $this->_attendee_data[ $reg_url_link ],  | 
                                                        |
| 619 | + $this->_attendee_data[$reg_url_link],  | 
                                                        |
| 620 | 620 | $registration  | 
                                                        
| 621 | 621 | )  | 
                                                        
| 622 | 622 | );  | 
                                                        
@@ -629,7 +629,7 @@ discard block  | 
                                                    ||
| 629 | 629 | // add relation to registration, set attendee ID, and cache attendee  | 
                                                        
| 630 | 630 | $this->_associate_attendee_with_registration($registration, $attendee);  | 
                                                        
| 631 | 631 | // \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ );  | 
                                                        
| 632 | -                    if (! $registration->attendee() instanceof EE_Attendee) { | 
                                                        |
| 632 | +                    if ( ! $registration->attendee() instanceof EE_Attendee) { | 
                                                        |
| 633 | 633 | EE_Error::add_error(  | 
                                                        
| 634 | 634 | sprintf(  | 
                                                        
| 635 | 635 | esc_html_x(  | 
                                                        
@@ -679,7 +679,7 @@ discard block  | 
                                                    ||
| 679 | 679 | __LINE__  | 
                                                        
| 680 | 680 | );  | 
                                                        
| 681 | 681 | // remove malformed data  | 
                                                        
| 682 | - unset($valid_data[ $reg_url_link ]);  | 
                                                        |
| 682 | + unset($valid_data[$reg_url_link]);  | 
                                                        |
| 683 | 683 | return false;  | 
                                                        
| 684 | 684 | }  | 
                                                        
| 685 | 685 | } // end of foreach ( $this->checkout->transaction->registrations() as $registration )  | 
                                                        
@@ -732,10 +732,10 @@ discard block  | 
                                                    ||
| 732 | 732 | * @see https://events.codebasehq.com/projects/event-espresso/tickets/10477  | 
                                                        
| 733 | 733 | */  | 
                                                        
| 734 | 734 | $answer_cache_id = $this->checkout->reg_url_link  | 
                                                        
| 735 | - ? $form_input . '-' . $registration->reg_url_link()  | 
                                                        |
| 735 | + ? $form_input.'-'.$registration->reg_url_link()  | 
                                                        |
| 736 | 736 | : $form_input;  | 
                                                        
| 737 | - $answer_is_obj = isset($this->_registration_answers[ $answer_cache_id ])  | 
                                                        |
| 738 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer;  | 
                                                        |
| 737 | + $answer_is_obj = isset($this->_registration_answers[$answer_cache_id])  | 
                                                        |
| 738 | + && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer;  | 
                                                        |
| 739 | 739 | // rename form_inputs if they are EE_Attendee properties  | 
                                                        
| 740 | 740 |          switch ((string) $form_input) { | 
                                                        
| 741 | 741 | case 'state':  | 
                                                        
@@ -751,28 +751,28 @@ discard block  | 
                                                    ||
| 751 | 751 | break;  | 
                                                        
| 752 | 752 | |
| 753 | 753 | default:  | 
                                                        
| 754 | - $ATT_input = 'ATT_' . $form_input;  | 
                                                        |
| 754 | + $ATT_input = 'ATT_'.$form_input;  | 
                                                        |
| 755 | 755 | // EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );  | 
                                                        
| 756 | 756 | $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false;  | 
                                                        
| 757 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;  | 
                                                        |
| 757 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;  | 
                                                        |
| 758 | 758 | }  | 
                                                        
| 759 | 759 | // EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );  | 
                                                        
| 760 | 760 | // EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );  | 
                                                        
| 761 | 761 | // EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );  | 
                                                        
| 762 | 762 | // if this form input has a corresponding attendee property  | 
                                                        
| 763 | 763 |          if ($attendee_property) { | 
                                                        
| 764 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;  | 
                                                        |
| 764 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;  | 
                                                        |
| 765 | 765 |              if ($answer_is_obj) { | 
                                                        
| 766 | 766 | // and delete the corresponding answer since we won't be storing this data in that object  | 
                                                        
| 767 | - $registration->_remove_relation_to($this->_registration_answers[ $answer_cache_id ], 'Answer');  | 
                                                        |
| 768 | - $this->_registration_answers[ $answer_cache_id ]->delete_permanently();  | 
                                                        |
| 767 | + $registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer');  | 
                                                        |
| 768 | + $this->_registration_answers[$answer_cache_id]->delete_permanently();  | 
                                                        |
| 769 | 769 | }  | 
                                                        
| 770 | 770 | return true;  | 
                                                        
| 771 | 771 | }  | 
                                                        
| 772 | 772 |          if ($answer_is_obj) { | 
                                                        
| 773 | 773 | // save this data to the answer object  | 
                                                        
| 774 | - $this->_registration_answers[ $answer_cache_id ]->set_value($input_value);  | 
                                                        |
| 775 | - $result = $this->_registration_answers[ $answer_cache_id ]->save();  | 
                                                        |
| 774 | + $this->_registration_answers[$answer_cache_id]->set_value($input_value);  | 
                                                        |
| 775 | + $result = $this->_registration_answers[$answer_cache_id]->save();  | 
                                                        |
| 776 | 776 | return $result !== false;  | 
                                                        
| 777 | 777 | }  | 
                                                        
| 778 | 778 |          foreach ($this->_registration_answers as $answer) { | 
                                                        
@@ -799,7 +799,7 @@ discard block  | 
                                                    ||
| 799 | 799 |      ) { | 
                                                        
| 800 | 800 |          if (empty($input_value)) { | 
                                                        
| 801 | 801 | // if the form input isn't marked as being required, then just return  | 
                                                        
| 802 | -            if (! isset($this->_required_questions[ $form_input ]) || ! $this->_required_questions[ $form_input ]) { | 
                                                        |
| 802 | +            if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { | 
                                                        |
| 803 | 803 | return true;  | 
                                                        
| 804 | 804 | }  | 
                                                        
| 805 | 805 |              switch ($form_input) { | 
                                                        
@@ -913,10 +913,10 @@ discard block  | 
                                                    ||
| 913 | 913 | }  | 
                                                        
| 914 | 914 |          foreach ($critical_attendee_details as $critical_attendee_detail) { | 
                                                        
| 915 | 915 | if (  | 
                                                        
| 916 | - ! isset($attendee_data[ $critical_attendee_detail ])  | 
                                                        |
| 917 | - || empty($attendee_data[ $critical_attendee_detail ])  | 
                                                        |
| 916 | + ! isset($attendee_data[$critical_attendee_detail])  | 
                                                        |
| 917 | + || empty($attendee_data[$critical_attendee_detail])  | 
                                                        |
| 918 | 918 |              ) { | 
                                                        
| 919 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(  | 
                                                        |
| 919 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get(  | 
                                                        |
| 920 | 920 | $critical_attendee_detail  | 
                                                        
| 921 | 921 | );  | 
                                                        
| 922 | 922 | }  |