Completed
Branch FET-9046-messages-queue (bdca24)
by
unknown
547:25 queued 529:16
created
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 4 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_SPCO_Reg_Step_Attendee_Information
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_SPCO_Reg_Step_Attendee_Information
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage 	core
10
+  * @author 				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step {
15 15
 
16 16
 	/**
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 			case EEM_Question::QST_type_text :
508 508
 				if( $identifier == 'email' ){
509 509
 					return new EE_Email_Input( $input_constructor_args );
510
-				}else{
510
+				} else{
511 511
 					return new EE_Text_Input( $input_constructor_args );
512 512
 				}
513 513
 				break;
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 
793 793
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
794 794
 
795
-			}  else {
795
+			} else {
796 796
 				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
797 797
 				// remove malformed data
798 798
 				unset( $valid_data[ $reg_url_link ] );
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	 * _auto_copy_attendee_info
349 349
 	 *
350 350
 	 * @access public
351
-	 * @return 	EE_Form_Section_Proper
351
+	 * @return 	EE_Form_Section_HTML
352 352
 	 */
353 353
 	private function _auto_copy_attendee_info() {
354 354
 		return new EE_Form_Section_HTML(
@@ -462,6 +462,7 @@  discard block
 block discarded – undo
462 462
 	 * @param EE_Registration $registration
463 463
 	 * @param EE_Question     $question
464 464
 	 * @param mixed EE_Answer|NULL      $answer
465
+	 * @param EE_Answer $answer
465 466
 	 * @return EE_Form_Input_Base
466 467
 	 */
467 468
 	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
Please login to merge, or discard this patch.
Spacing   +261 added lines, -262 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	 * @param    EE_Checkout $checkout
38 38
 	 * @return    \EE_SPCO_Reg_Step_Attendee_Information
39 39
 	 */
40
-	public function __construct( EE_Checkout $checkout ) {
40
+	public function __construct(EE_Checkout $checkout) {
41 41
 		$this->_slug = 'attendee_information';
42 42
 		$this->_name = __('Attendee Information', 'event_espresso');
43
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
43
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
44 44
 		$this->checkout = $checkout;
45 45
 		$this->_reset_success_message();
46
-		$this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso'));
46
+		$this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso'));
47 47
 	}
48 48
 
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
53 53
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso');
54 54
 		EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso');
55
-		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' );
55
+		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>');
56 56
 		EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso');
57 57
 		EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso');
58 58
 		EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso');
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		EEH_Autoloader::register_line_item_display_autoloaders();
86 86
 		$Line_Item_Display = new EE_Line_Item_Display();
87 87
 		// calculate taxes
88
-		$Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) );
88
+		$Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true));
89 89
 		EE_Registry::instance()->load_helper('Line_Item');
90 90
 		/** @var $subsections EE_Form_Section_Proper[] */
91 91
 		$subsections = array(
@@ -97,33 +97,33 @@  discard block
 block discarded – undo
97 97
 			'ticket_count' 	=> array()
98 98
 		);
99 99
 		// grab the saved registrations from the transaction
100
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
101
-		if ( $registrations ) {
102
-			foreach ( $registrations as $registration ) {
103
-				if ( $registration instanceof EE_Registration ) {
100
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
101
+		if ($registrations) {
102
+			foreach ($registrations as $registration) {
103
+				if ($registration instanceof EE_Registration) {
104 104
 					// can this registration be processed during this visit ?
105
-					if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
106
-						$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
107
-						if ( ! $this->checkout->admin_request ) {
108
-							$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
109
-							$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1;
110
-							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) );
111
-							$ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item;
112
-							$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item );
105
+					if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
106
+						$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
107
+						if ( ! $this->checkout->admin_request) {
108
+							$template_args['registrations'][$registration->reg_url_link()] = $registration;
109
+							$template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1;
110
+							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID()));
111
+							$ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item;
112
+							$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item);
113 113
 						}
114
-						if ( $registration->is_primary_registrant() ) {
114
+						if ($registration->is_primary_registrant()) {
115 115
 							$primary_registrant = $registration->reg_url_link();
116 116
 						}
117 117
 					}
118 118
 				}
119 119
 			}
120 120
 			// print_copy_info ?
121
-			if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) {
121
+			if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) {
122 122
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
123 123
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info();
124 124
 				// generate hidden input
125
-				if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) {
126
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
125
+				if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) {
126
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
127 127
 				}
128 128
 			}
129 129
 
@@ -135,8 +135,7 @@  discard block
 block discarded – undo
135 135
 				'html_id' 					=> $this->reg_form_name(),
136 136
 				'subsections' 			=> $subsections,
137 137
 				'layout_strategy'		=> $this->checkout->admin_request ?
138
-					new EE_Div_Per_Section_Layout() :
139
-					new EE_Template_Layout(
138
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
140 139
 						array(
141 140
 							'layout_template_file' 	=> $this->_template, // layout_template
142 141
 							'template_args' 				=> $template_args
@@ -153,61 +152,61 @@  discard block
 block discarded – undo
153 152
 	 * @param EE_Registration $registration
154 153
 	 * @return EE_Form_Section_Proper
155 154
 	 */
156
-	private function _registrations_reg_form( EE_Registration $registration ) {
157
-		EE_Registry::instance()->load_helper( 'Template' );
155
+	private function _registrations_reg_form(EE_Registration $registration) {
156
+		EE_Registry::instance()->load_helper('Template');
158 157
 		static $attendee_nmbr = 1;
159 158
 		// array of params to pass to parent constructor
160 159
 		$form_args = array(
161
-			'html_id' 				=> 'ee-registration-' . $registration->reg_url_link(),
160
+			'html_id' 				=> 'ee-registration-'.$registration->reg_url_link(),
162 161
 			'html_class' 		=> 'ee-reg-form-attendee-dv',
163 162
 			'html_style' 		=> $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '',
164 163
 			'subsections' 		=> array(),
165 164
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
166 165
 				array(
167 166
 					'legend_class' 	=> 'spco-attendee-lgnd smaller-text lt-grey-text',
168
-					'legend_text' 	=> sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
167
+					'legend_text' 	=> sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
169 168
 				)
170 169
 			)
171 170
 		);
172 171
 		// verify that registration has valid event
173
-		if ( $registration->event() instanceof EE_Event ) {
172
+		if ($registration->event() instanceof EE_Event) {
174 173
 			$query_params = array(
175 174
 				array(
176 175
 					'Event.EVT_ID' => $registration->event()->ID(),
177 176
 					'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE
178 177
 				),
179
-				'order_by'=>array( 'QSG_order'=>'ASC' )
178
+				'order_by'=>array('QSG_order'=>'ASC')
180 179
 			);
181
-			$question_groups = $registration->event()->question_groups( $query_params );
182
-			if ( $question_groups ) {
183
-				foreach ( $question_groups as $question_group ) {
184
-					if ( $question_group instanceof EE_Question_Group ) {
185
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group );
180
+			$question_groups = $registration->event()->question_groups($query_params);
181
+			if ($question_groups) {
182
+				foreach ($question_groups as $question_group) {
183
+					if ($question_group instanceof EE_Question_Group) {
184
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group);
186 185
 						// add hidden input
187
-						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration );
186
+						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration);
188 187
 					}
189 188
 				}
190 189
 				// if we have question groups for additional attendees, then display the copy options
191 190
 				$this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info;
192 191
 			} else {
193
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML(
192
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML(
194 193
 					EEH_Template::locate_template(
195
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
196
-						apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
194
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
195
+						apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
197 196
 						TRUE,
198 197
 						TRUE
199 198
 					)
200 199
 				);
201 200
 				// add hidden input
202
-				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE );
201
+				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE);
203 202
 			}
204 203
 		}
205
-		if ( $registration->is_primary_registrant() ) {
204
+		if ($registration->is_primary_registrant()) {
206 205
 			// generate hidden input
207
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
206
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
208 207
 		}
209 208
 		$attendee_nmbr++;
210
-		return new EE_Form_Section_Proper( $form_args );
209
+		return new EE_Form_Section_Proper($form_args);
211 210
 	}
212 211
 
213 212
 
@@ -220,11 +219,11 @@  discard block
 block discarded – undo
220 219
 	 * @param bool  $additional_attendee_reg_info
221 220
 	 * @return    EE_Form_Input_Base
222 221
 	 */
223
-	private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){
222
+	private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) {
224 223
 		// generate hidden input
225 224
 		return new EE_Hidden_Input(
226 225
 			array(
227
-				'html_id' 				=> 'additional-attendee-reg-info-' . $registration->reg_url_link(),
226
+				'html_id' 				=> 'additional-attendee-reg-info-'.$registration->reg_url_link(),
228 227
 				'default'				=> $additional_attendee_reg_info
229 228
 			)
230 229
 		);
@@ -237,22 +236,22 @@  discard block
 block discarded – undo
237 236
 	 * @param EE_Question_Group $question_group
238 237
 	 * @return EE_Form_Section_Proper
239 238
 	 */
240
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
239
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
241 240
 		// array of params to pass to parent constructor
242 241
 		$form_args = array(
243
-			'html_id' 					=> 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
242
+			'html_id' 					=> 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
244 243
 			'html_class' 			=> $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv',
245
-			'html_label_id' 		=> 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
244
+			'html_label_id' 		=> 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
246 245
 			'subsections' 			=> array(
247
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
246
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
248 247
 			),
249 248
 			'layout_strategy' 	=> $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout()
250 249
 		);
251 250
 		// where params
252
-		$query_params = array( 'QST_deleted' => 0 );
251
+		$query_params = array('QST_deleted' => 0);
253 252
 		// don't load admin only questions on the frontend
254
-		if ( ! $this->checkout->admin_request ) {
255
-			$query_params['QST_admin_only'] = array( '!=', TRUE );
253
+		if ( ! $this->checkout->admin_request) {
254
+			$query_params['QST_admin_only'] = array('!=', TRUE);
256 255
 		}
257 256
 		$questions = $question_group->get_many_related(
258 257
 			'Question',
@@ -264,21 +263,21 @@  discard block
 block discarded – undo
264 263
 			)
265 264
 		);
266 265
 		// filter for additional content before questions
267
-		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this ));
266
+		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this));
268 267
 		// loop thru questions
269
-		foreach ( $questions as $question ) {
270
-			if( $question instanceof EE_Question ){
268
+		foreach ($questions as $question) {
269
+			if ($question instanceof EE_Question) {
271 270
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
272
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
271
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
273 272
 			}
274 273
 		}
275
-		$form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this );
274
+		$form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this);
276 275
 
277 276
 		// filter for additional content after questions
278
-		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this ));
277
+		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this));
279 278
 //		d( $form_args );
280
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
281
-		return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this );
279
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
280
+		return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this);
282 281
 	}
283 282
 
284 283
 
@@ -288,12 +287,12 @@  discard block
 block discarded – undo
288 287
 	 * @param EE_Question_Group $question_group
289 288
 	 * @return 	EE_Form_Section_HTML
290 289
 	 */
291
-	private function _question_group_header( EE_Question_Group $question_group ){
290
+	private function _question_group_header(EE_Question_Group $question_group) {
292 291
 		$html = '';
293 292
 		// group_name
294
-		if ( $question_group->show_group_name() && $question_group->name() != '' ) {
293
+		if ($question_group->show_group_name() && $question_group->name() != '') {
295 294
 			EE_Registry::instance()->load_helper('HTML');
296
-			if ( $this->checkout->admin_request ) {
295
+			if ($this->checkout->admin_request) {
297 296
 				$html .= EEH_HTML::br();
298 297
 				$html .= EEH_HTML::h3(
299 298
 					$question_group->name(),
@@ -307,7 +306,7 @@  discard block
 block discarded – undo
307 306
 			}
308 307
 		}
309 308
 		// group_desc
310
-		if ( $question_group->show_group_desc() && $question_group->desc() != '' ) {
309
+		if ($question_group->show_group_desc() && $question_group->desc() != '') {
311 310
 			$html .= EEH_HTML::p(
312 311
 				$question_group->desc(),
313 312
 				'',
@@ -315,7 +314,7 @@  discard block
 block discarded – undo
315 314
 			);
316 315
 
317 316
 		}
318
-		return new EE_Form_Section_HTML( $html );
317
+		return new EE_Form_Section_HTML($html);
319 318
 	}
320 319
 
321 320
 
@@ -324,14 +323,14 @@  discard block
 block discarded – undo
324 323
 	 * @access public
325 324
 	 * @return 	EE_Form_Section_Proper
326 325
 	 */
327
-	private function _copy_attendee_info_form(){
326
+	private function _copy_attendee_info_form() {
328 327
 		// array of params to pass to parent constructor
329 328
 		return new EE_Form_Section_Proper(
330 329
 			array(
331 330
 				'subsections' 			=> $this->_copy_attendee_info_inputs(),
332 331
 				'layout_strategy' 	=> new EE_Template_Layout(
333 332
 					array(
334
-						'layout_template_file' 			=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template
333
+						'layout_template_file' 			=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template
335 334
 						'begin_template_file' 			=> NULL,
336 335
 						'input_template_file' 				=> NULL,
337 336
 						'subsection_template_file' 	=> NULL,
@@ -353,8 +352,8 @@  discard block
 block discarded – undo
353 352
 	private function _auto_copy_attendee_info() {
354 353
 		return new EE_Form_Section_HTML(
355 354
 			EEH_Template::locate_template(
356
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
357
-				apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
355
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
356
+				apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
358 357
 				TRUE,
359 358
 				TRUE
360 359
 			)
@@ -373,25 +372,25 @@  discard block
 block discarded – undo
373 372
 		$copy_attendee_info_inputs = array();
374 373
 		$prev_ticket = NULL;
375 374
 		// grab the saved registrations from the transaction
376
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
377
-		foreach ( $registrations as $registration ) {
375
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
376
+		foreach ($registrations as $registration) {
378 377
 			// for all  attendees other than the primary attendee
379
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
378
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
380 379
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
381
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
380
+				if ($registration->ticket()->ID() !== $prev_ticket) {
382 381
 					$item_name = $registration->ticket()->name();
383
-					$item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : '';
384
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
385
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
382
+					$item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : '';
383
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
384
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
386 385
 					);
387 386
 					$prev_ticket = $registration->ticket()->ID();
388 387
 				}
389 388
 
390
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
389
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
391 390
 				EE_Checkbox_Multi_Input(
392
-					array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )),
391
+					array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())),
393 392
 					array(
394
-						'html_id' 								=> 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
393
+						'html_id' 								=> 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
395 394
 						'html_class' 						=> 'spco-copy-attendee-chk ee-do-not-validate',
396 395
 						'display_html_label_text' 	=> FALSE
397 396
 					)
@@ -410,7 +409,7 @@  discard block
 block discarded – undo
410 409
 	 * @param EE_Registration $registration
411 410
 	 * @return    EE_Form_Input_Base
412 411
 	 */
413
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
412
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
414 413
 		// generate hidden input
415 414
 		return new EE_Hidden_Input(
416 415
 			array(
@@ -428,31 +427,31 @@  discard block
 block discarded – undo
428 427
 	 * @param EE_Question     $question
429 428
 	 * @return 	EE_Form_Input_Base
430 429
 	 */
431
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
430
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
432 431
 
433 432
 		// if this question was for an attendee detail, then check for that answer
434
-		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() );
433
+		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID());
435 434
 		$answer = $answer_value === null
436
-				? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() )	) )
435
+				? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())))
437 436
 				: null;
438 437
 		// if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object
439
-		if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) {
438
+		if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) {
440 439
 			// create an EE_Answer object for storing everything in
441
-			$answer = EE_Answer::new_instance ( array(
440
+			$answer = EE_Answer::new_instance(array(
442 441
 				'QST_ID'=> $question->ID(),
443 442
 				'REG_ID'=> $registration->ID()
444 443
 			));
445 444
 		}
446 445
 		// verify instance
447
-		if( $answer instanceof EE_Answer ){
448
-			if ( ! empty( $answer_value )) {
449
-				$answer->set( 'ANS_value', $answer_value );
446
+		if ($answer instanceof EE_Answer) {
447
+			if ( ! empty($answer_value)) {
448
+				$answer->set('ANS_value', $answer_value);
450 449
 			}
451
-			$answer->cache( 'Question', $question );
452
-			$answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link();
453
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
450
+			$answer->cache('Question', $question);
451
+			$answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link();
452
+			$registration->cache('Answer', $answer, $answer_cache_id);
454 453
 		}
455
-		return $this->_generate_question_input( $registration, $question, $answer );
454
+		return $this->_generate_question_input($registration, $question, $answer);
456 455
 
457 456
 	}
458 457
 
@@ -464,7 +463,7 @@  discard block
 block discarded – undo
464 463
 	 * @param mixed EE_Answer|NULL      $answer
465 464
 	 * @return EE_Form_Input_Base
466 465
 	 */
467
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
466
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
468 467
 		//		d( $registration );
469 468
 		//		d( $question );
470 469
 		//		d( $answer );
@@ -487,29 +486,29 @@  discard block
 block discarded – undo
487 486
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
488 487
 
489 488
 		$input_constructor_args = array(
490
-			'html_name' 			=> 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
491
-			'html_id' 					=> 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
492
-			'html_class' 			=> 'ee-reg-qstn ee-reg-qstn-' . $identifier,
489
+			'html_name' 			=> 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
490
+			'html_id' 					=> 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
491
+			'html_class' 			=> 'ee-reg-qstn ee-reg-qstn-'.$identifier,
493 492
 			'required' 				=> $question->required() ? TRUE : FALSE,
494
-			'html_label_id'		=> 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
493
+			'html_label_id'		=> 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
495 494
 			'html_label_class'	=> 'ee-reg-qstn',
496 495
 			'html_label_text'		=> $question->display_text(),
497 496
 			'required_validation_error_message' => $question->required_text()
498 497
 		);
499 498
 		// has this question been answered ?
500
-		if ( $answer instanceof EE_Answer ) {
501
-			if ( $answer->ID() ) {
502
-				$input_constructor_args['html_name'] 		.= '[' . $answer->ID() . ']';
503
-				$input_constructor_args['html_id'] 				.= '-' . $answer->ID();
504
-				$input_constructor_args['html_label_id'] 	.= '-' . $answer->ID();
499
+		if ($answer instanceof EE_Answer) {
500
+			if ($answer->ID()) {
501
+				$input_constructor_args['html_name'] 		.= '['.$answer->ID().']';
502
+				$input_constructor_args['html_id'] 				.= '-'.$answer->ID();
503
+				$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
505 504
 			}
506 505
 			$input_constructor_args['default'] = $answer->value();
507 506
 		}
508 507
 		//add "-lbl" to the end of the label id
509
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
510
-		$max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() );
511
-		if( EEM_Question::instance()->question_type_is_in_category(  $question->type(), 'text' ) ) {
512
-			$input_constructor_args[ 'validation_strategies' ][] = new EE_Max_Length_Validation_Strategy( 
508
+		$input_constructor_args['html_label_id'] .= '-lbl';
509
+		$max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID());
510
+		if (EEM_Question::instance()->question_type_is_in_category($question->type(), 'text')) {
511
+			$input_constructor_args['validation_strategies'][] = new EE_Max_Length_Validation_Strategy( 
513 512
 				null, 
514 513
 				min( 
515 514
 					$max_max_for_question, 
@@ -517,83 +516,83 @@  discard block
 block discarded – undo
517 516
 				) 
518 517
 			);
519 518
 		}
520
-		$input_constructor_args = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args',
519
+		$input_constructor_args = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args',
521 520
 				$input_constructor_args,
522 521
 				$registration,
523 522
 				$question,
524 523
 				$answer
525 524
 				);
526 525
 
527
-		$this->_required_questions[ $identifier ] = $question->required() ? true : false;
526
+		$this->_required_questions[$identifier] = $question->required() ? true : false;
528 527
 
529
-		switch ( $question->type() ) {
528
+		switch ($question->type()) {
530 529
 			// Text
531 530
 			case EEM_Question::QST_type_text :
532
-				if( $identifier == 'email' ){
533
-					return new EE_Email_Input( $input_constructor_args );
534
-				}else{
535
-					return new EE_Text_Input( $input_constructor_args );
531
+				if ($identifier == 'email') {
532
+					return new EE_Email_Input($input_constructor_args);
533
+				} else {
534
+					return new EE_Text_Input($input_constructor_args);
536 535
 				}
537 536
 				break;
538 537
 			// Textarea
539 538
 			case EEM_Question::QST_type_textarea :
540
-				return new EE_Text_Area_Input( $input_constructor_args );
539
+				return new EE_Text_Area_Input($input_constructor_args);
541 540
 				break;
542 541
 			// Radio Buttons
543 542
 			case EEM_Question::QST_type_radio :
544
-				return new EE_Radio_Button_Input( $question->options(), $input_constructor_args );
543
+				return new EE_Radio_Button_Input($question->options(), $input_constructor_args);
545 544
 				break;
546 545
 			// Dropdown
547 546
 			case EEM_Question::QST_type_dropdown :
548
-				return new EE_Select_Input( $question->options(), $input_constructor_args );
547
+				return new EE_Select_Input($question->options(), $input_constructor_args);
549 548
 				break;
550 549
 			// State Dropdown
551 550
 			case EEM_Question::QST_type_state :
552
-				$state_options = array( '' => array( '' => ''));
551
+				$state_options = array('' => array('' => ''));
553 552
 				$states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states();
554
-				if ( ! empty( $states )) {
555
-					foreach( $states as $state ){
556
-						if ( $state instanceof EE_State ) {
557
-							$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
553
+				if ( ! empty($states)) {
554
+					foreach ($states as $state) {
555
+						if ($state instanceof EE_State) {
556
+							$state_options[$state->country()->name()][$state->ID()] = $state->name();
558 557
 						}
559 558
 					}
560 559
 				}
561
-				$state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer );
562
-				return new EE_State_Select_Input( $state_options, $input_constructor_args );
560
+				$state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer);
561
+				return new EE_State_Select_Input($state_options, $input_constructor_args);
563 562
 				break;
564 563
 			// Country Dropdown
565 564
 			case EEM_Question::QST_type_country :
566
-				$country_options = array( '' => '' );
565
+				$country_options = array('' => '');
567 566
 				// get possibly cached list of countries
568 567
 				$countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
569
-				if ( ! empty( $countries )) {
570
-					foreach( $countries as $country ){
571
-						if ( $country instanceof EE_Country ) {
572
-							$country_options[ $country->ID() ] = $country->name();
568
+				if ( ! empty($countries)) {
569
+					foreach ($countries as $country) {
570
+						if ($country instanceof EE_Country) {
571
+							$country_options[$country->ID()] = $country->name();
573 572
 						}
574 573
 					}
575 574
 				}
576
-				$country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer );
577
-				return new EE_Country_Select_Input( $country_options, $input_constructor_args );
575
+				$country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer);
576
+				return new EE_Country_Select_Input($country_options, $input_constructor_args);
578 577
 				break;
579 578
 			// Checkboxes
580 579
 			case EEM_Question::QST_type_checkbox :
581
-				return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args );
580
+				return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args);
582 581
 				break;
583 582
 			// Date
584 583
 			case EEM_Question::QST_type_date :
585
-				return new EE_Datepicker_Input( $input_constructor_args );
584
+				return new EE_Datepicker_Input($input_constructor_args);
586 585
 				break;
587 586
 			case EEM_Question::QST_type_html_textarea :
588
-				$input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy();
589
-				$input =  new EE_Text_Area_Input( $input_constructor_args );
590
-				$input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' );
587
+				$input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy();
588
+				$input = new EE_Text_Area_Input($input_constructor_args);
589
+				$input->remove_validation_strategy('EE_Plaintext_Validation_Strategy');
591 590
 				return $input;
592 591
 			// fallback
593 592
 			default :
594
-				$default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args );
595
-				if( ! $default_input ){
596
-					$default_input = new EE_Text_Input( $input_constructor_args );
593
+				$default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args);
594
+				if ( ! $default_input) {
595
+					$default_input = new EE_Text_Input($input_constructor_args);
597 596
 				}
598 597
 				return $default_input;
599 598
 		}
@@ -618,65 +617,65 @@  discard block
 block discarded – undo
618 617
 	 */
619 618
 	public function process_reg_step() {
620 619
 
621
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
620
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
622 621
 		// grab validated data from form
623 622
 		$valid_data = $this->checkout->current_step->valid_data();
624 623
 		//EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
625 624
 		//EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
626 625
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
627
-		if ( empty( $valid_data ))  {
628
-			EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
626
+		if (empty($valid_data)) {
627
+			EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
629 628
 			return FALSE;
630 629
 		}
631 630
 		//EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ );
632
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
633
-			EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
631
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
632
+			EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
634 633
 			return FALSE;
635 634
 		}
636 635
 		// get cached registrations
637
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
636
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
638 637
 		// verify we got the goods
639
-		if ( empty( $registrations )) {
640
-			EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
638
+		if (empty($registrations)) {
639
+			EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
641 640
 			return FALSE;
642 641
 		}
643 642
 		// extract attendee info from form data and save to model objects
644
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
643
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
645 644
 		// if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart
646
-		if ( $registrations_processed === FALSE ) {
645
+		if ($registrations_processed === FALSE) {
647 646
 			// but return immediately if the previous step exited early due to errors
648 647
 			return FALSE;
649
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
648
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
650 649
 			// generate a correctly translated string for all possible singular/plural combinations
651
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
650
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
652 651
 				$error_msg = sprintf(
653
-					__( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
652
+					__('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
654 653
 					$this->checkout->total_ticket_count,
655 654
 					$registrations_processed
656 655
 				);
657
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
656
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
658 657
 				$error_msg = sprintf(
659
-					__( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ),
658
+					__('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'),
660 659
 					$this->checkout->total_ticket_count,
661 660
 					$registrations_processed
662 661
 				);
663 662
 			} else {
664 663
 				$error_msg = sprintf(
665
-					__( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
664
+					__('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
666 665
 					$this->checkout->total_ticket_count,
667 666
 					$registrations_processed
668 667
 				);
669 668
 
670 669
 			}
671
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
670
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
672 671
 			return FALSE;
673 672
 		}
674 673
 		// mark this reg step as completed
675 674
 		$this->set_completed();
676
-		$this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' ));
675
+		$this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso'));
677 676
 		//do action in case a plugin wants to do something with the data submitted in step 1.
678 677
 		//passes EE_Single_Page_Checkout, and it's posted data
679
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
678
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
680 679
 		return TRUE;
681 680
 
682 681
 	}
@@ -690,9 +689,9 @@  discard block
 block discarded – undo
690 689
 	 * @param array             $valid_data
691 690
 	 * @return boolean | int
692 691
 	 */
693
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
692
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
694 693
 		// load resources and set some defaults
695
-		EE_Registry::instance()->load_model( 'Attendee' );
694
+		EE_Registry::instance()->load_model('Attendee');
696 695
 		// holder for primary registrant attendee object
697 696
 		$this->checkout->primary_attendee_obj = NULL;
698 697
 		// array for tracking reg form data for the primary registrant
@@ -709,19 +708,19 @@  discard block
 block discarded – undo
709 708
 		// attendee counter
710 709
 		$att_nmbr = 0;
711 710
 		// grab the saved registrations from the transaction
712
-		foreach ( $registrations  as $registration ) {
711
+		foreach ($registrations  as $registration) {
713 712
 			// verify EE_Registration object
714
-			if ( ! $registration instanceof EE_Registration ) {
715
-				EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
713
+			if ( ! $registration instanceof EE_Registration) {
714
+				EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
716 715
 				return FALSE;
717 716
 			}
718 717
 			$reg_url_link = $registration->reg_url_link();
719 718
 			// reg_url_link exists ?
720
-			if ( $reg_url_link ) {
719
+			if ($reg_url_link) {
721 720
 				// should this registration be processed during this visit ?
722
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
721
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
723 722
 					// if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects
724
-					if ( ! $this->checkout->revisit ) {
723
+					if ( ! $this->checkout->revisit) {
725 724
 						$registration->save();
726 725
 					}
727 726
 
@@ -732,41 +731,41 @@  discard block
 block discarded – undo
732 731
 					 * @var bool   if TRUE is returned by the plugin then the
733 732
 					 *      		registration processing is halted.
734 733
 					 */
735
-					if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) {
734
+					if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) {
736 735
 						return FALSE;
737 736
 					}
738 737
 
739 738
 					// Houston, we have a registration!
740 739
 					$att_nmbr++;
741
-					$this->_attendee_data[ $reg_url_link ] = array();
740
+					$this->_attendee_data[$reg_url_link] = array();
742 741
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
743
-					if ( isset( $valid_data[ $reg_url_link ] )) {
742
+					if (isset($valid_data[$reg_url_link])) {
744 743
 						// do we need to copy basic info from primary attendee ?
745
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE;
744
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE;
746 745
 						// filter form input data for this registration
747
-						$valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] );
746
+						$valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]);
748 747
 						//EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
749
-						if ( isset( $valid_data['primary_attendee'] )) {
750
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE;
751
-							unset( $valid_data['primary_attendee'] );
748
+						if (isset($valid_data['primary_attendee'])) {
749
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE;
750
+							unset($valid_data['primary_attendee']);
752 751
 						}
753 752
 						// now loop through our array of valid post data && process attendee reg forms
754
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
755
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
756
-								foreach ( $form_inputs as $form_input => $input_value ) {
753
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
754
+							if ( ! in_array($form_section, $non_input_form_sections)) {
755
+								foreach ($form_inputs as $form_input => $input_value) {
757 756
 									// check for critical inputs
758
-									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) {
757
+									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) {
759 758
 										return FALSE;
760 759
 									}
761 760
 									// store a bit of data about the primary attendee
762
-									if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) {
763
-										$primary_registrant[ $form_input ] = $input_value;
764
-									} else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) {
765
-										$input_value = $primary_registrant[ $form_input ];
761
+									if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) {
762
+										$primary_registrant[$form_input] = $input_value;
763
+									} else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) {
764
+										$input_value = $primary_registrant[$form_input];
766 765
 									}
767 766
 									// now attempt to save the input data
768
-									if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value ))  {
769
-										EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ );
767
+									if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) {
768
+										EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__);
770 769
 										return FALSE;
771 770
 									}
772 771
 								}
@@ -775,51 +774,51 @@  discard block
 block discarded – undo
775 774
 					}
776 775
 					//EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ );
777 776
 					// this registration does not require additional attendee information ?
778
-					if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
777
+					if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
779 778
 						// just copy the primary registrant
780 779
 						$attendee = $this->checkout->primary_attendee_obj;
781 780
 					} else {
782 781
 						// have we met before?
783
-						$attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
782
+						$attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]);
784 783
 						// did we find an already existing record for this attendee ?
785
-						if ( $attendee instanceof EE_Attendee ) {
786
-							$attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] );
784
+						if ($attendee instanceof EE_Attendee) {
785
+							$attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]);
787 786
 						} else {
788 787
 							// ensure critical details are set for additional attendees
789
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ];
790
-							$attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
788
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link];
789
+							$attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]);
791 790
 						}
792 791
 						// who's #1 ?
793
-						if ( $att_nmbr == 1 ) {
792
+						if ($att_nmbr == 1) {
794 793
 							$this->checkout->primary_attendee_obj = $attendee;
795 794
 						}
796 795
 					}
797 796
 					//EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
798 797
 					// add relation to registration, set attendee ID, and cache attendee
799
-					$this->_associate_attendee_with_registration( $registration, $attendee );
800
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
801
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
798
+					$this->_associate_attendee_with_registration($registration, $attendee);
799
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
800
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
802 801
 						return FALSE;
803 802
 					}
804 803
 					/** @type EE_Registration_Processor $registration_processor */
805
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
804
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
806 805
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
807
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE );
806
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE);
808 807
 					/** @type EE_Transaction_Processor $transaction_processor */
809
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
808
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
810 809
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
811
-					$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
810
+					$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
812 811
 					// if we've gotten this far, then let's save what we have
813 812
 					$registration->save();
814 813
 					// add relation between TXN and registration
815
-					$this->_associate_registration_with_transaction( $registration );
814
+					$this->_associate_registration_with_transaction($registration);
816 815
 
817 816
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
818 817
 
819
-			}  else {
820
-				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
818
+			} else {
819
+				EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
821 820
 				// remove malformed data
822
-				unset( $valid_data[ $reg_url_link ] );
821
+				unset($valid_data[$reg_url_link]);
823 822
 				return FALSE;
824 823
 			}
825 824
 
@@ -837,22 +836,22 @@  discard block
 block discarded – undo
837 836
 	 * @param string           	$input_value
838 837
 	 * @return boolean
839 838
 	 */
840
-	private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) {
839
+	private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') {
841 840
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
842 841
 		//EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ );
843 842
 		// allow for plugins to hook in and do their own processing of the form input.
844 843
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
845
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) {
844
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) {
846 845
 			return TRUE;
847 846
 		}
848 847
 
849 848
 		// grab related answer objects
850 849
 		$answers = $registration->answers();
851 850
 		// $answer_cache_id is the key used to find the EE_Answer we want
852
-		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link();
853
-		$answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE;
851
+		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link();
852
+		$answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE;
854 853
 		//rename form_inputs if they are EE_Attendee properties
855
-		switch( (string)$form_input ) {
854
+		switch ((string) $form_input) {
856 855
 
857 856
 			case 'state' :
858 857
 			case 'STA_ID' :
@@ -867,33 +866,33 @@  discard block
 block discarded – undo
867 866
 				break;
868 867
 
869 868
 			default :
870
-				$ATT_input = 'ATT_' . $form_input;
869
+				$ATT_input = 'ATT_'.$form_input;
871 870
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
872
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE;
873
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
871
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE;
872
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
874 873
 		}
875 874
 		//EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
876 875
 		//EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
877 876
 		//EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
878 877
 		//EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
879 878
 		// if this form input has a corresponding attendee property
880
-		if ( $attendee_property ) {
881
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
882
-			if (  $answer_is_obj ) {
879
+		if ($attendee_property) {
880
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
881
+			if ($answer_is_obj) {
883 882
 				// and delete the corresponding answer since we won't be storing this data in that object
884
-				$registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' );
885
-				$answers[ $answer_cache_id ]->delete_permanently();
883
+				$registration->_remove_relation_to($answers[$answer_cache_id], 'Answer');
884
+				$answers[$answer_cache_id]->delete_permanently();
886 885
 			}
887 886
 			return TRUE;
888
-		} elseif ( $answer_is_obj ) {
887
+		} elseif ($answer_is_obj) {
889 888
 			// save this data to the answer object
890
-			$answers[ $answer_cache_id ]->set_value( $input_value );
891
-			$result = $answers[ $answer_cache_id ]->save();
889
+			$answers[$answer_cache_id]->set_value($input_value);
890
+			$result = $answers[$answer_cache_id]->save();
892 891
 			return $result !== false ? true : false;
893 892
 		} else {
894
-			foreach ( $answers as $answer ) {
895
-				if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) {
896
-					$answer->set_value( $input_value );
893
+			foreach ($answers as $answer) {
894
+				if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) {
895
+					$answer->set_value($input_value);
897 896
 					$result = $answer->save();
898 897
 					return $result !== false ? true : false;
899 898
 				}
@@ -911,33 +910,33 @@  discard block
 block discarded – undo
911 910
 	 * @param string $input_value
912 911
 	 * @return boolean
913 912
 	 */
914
-	private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) {
915
-		if ( empty( $input_value )) {
913
+	private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') {
914
+		if (empty($input_value)) {
916 915
 			// if the form input isn't marked as being required, then just return
917
-			if ( ! isset( $this->_required_questions[ $form_input ]  ) || ! $this->_required_questions[ $form_input ] ) {
916
+			if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
918 917
 				return true;
919 918
 			}
920
-			switch( $form_input ) {
919
+			switch ($form_input) {
921 920
 				case 'fname' :
922
-					EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
921
+					EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
923 922
 					return FALSE;
924 923
 					break;
925 924
 				case 'lname' :
926
-					EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
925
+					EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
927 926
 					return FALSE;
928 927
 					break;
929 928
 				case 'email' :
930
-					EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
929
+					EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
931 930
 					return FALSE;
932 931
 					break;
933 932
 			}
934
-		} else if ( $form_input === 'email' ) {
933
+		} else if ($form_input === 'email') {
935 934
 			// clean the email address
936
-			$valid_email = sanitize_email( $input_value );
935
+			$valid_email = sanitize_email($input_value);
937 936
 			// check if it matches
938
-			if ( $input_value != $valid_email ) {
937
+			if ($input_value != $valid_email) {
939 938
 				// whoops!!!
940
-				EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
939
+				EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
941 940
 				return FALSE;
942 941
 			}
943 942
 		}
@@ -965,14 +964,14 @@  discard block
 block discarded – undo
965 964
 	 * @param array           $attendee_data
966 965
 	 * @return boolean
967 966
 	 */
968
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
967
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
969 968
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
970
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : '';
971
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : '';
972
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : '';
969
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : '';
970
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : '';
971
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : '';
973 972
 		// but only if those have values
974
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
975
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
973
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
974
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
976 975
 				'ATT_fname' => $ATT_fname,
977 976
 				'ATT_lname' => $ATT_lname,
978 977
 				'ATT_email' => $ATT_email
@@ -980,7 +979,7 @@  discard block
 block discarded – undo
980 979
 		} else {
981 980
 			$existing_attendee = NULL;
982 981
 		}
983
-		return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data );
982
+		return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data);
984 983
 	}
985 984
 
986 985
 
@@ -992,13 +991,13 @@  discard block
 block discarded – undo
992 991
 	 * @param array           $attendee_data
993 992
 	 * @return \EE_Attendee
994 993
 	 */
995
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
994
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
996 995
 		// first remove fname, lname, and email from attendee data
997
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
996
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
998 997
 		// now loop thru what's left and add to attendee CPT
999
-		foreach ( $attendee_data as $property_name => $property_value ) {
1000
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
1001
-				$existing_attendee->set( $property_name, $property_value );
998
+		foreach ($attendee_data as $property_name => $property_value) {
999
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
1000
+				$existing_attendee->set($property_name, $property_value);
1002 1001
 			}
1003 1002
 		}
1004 1003
 		// better save that now
@@ -1015,11 +1014,11 @@  discard block
 block discarded – undo
1015 1014
 	 * @param EE_Attendee     $attendee
1016 1015
 	 * @return void
1017 1016
 	 */
1018
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
1017
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
1019 1018
 		// add relation to attendee
1020
-		$registration->_add_relation_to( $attendee, 'Attendee' );
1021
-		$registration->set_attendee_id( $attendee->ID() );
1022
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
1019
+		$registration->_add_relation_to($attendee, 'Attendee');
1020
+		$registration->set_attendee_id($attendee->ID());
1021
+		$registration->update_cache_after_object_save('Attendee', $attendee);
1023 1022
 	}
1024 1023
 
1025 1024
 
@@ -1030,10 +1029,10 @@  discard block
 block discarded – undo
1030 1029
 	 * @param EE_Registration $registration
1031 1030
 	 * @return void
1032 1031
 	 */
1033
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
1032
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
1034 1033
 		// add relation to attendee
1035
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
1036
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
1034
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1035
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1037 1036
 	}
1038 1037
 
1039 1038
 
@@ -1045,17 +1044,17 @@  discard block
 block discarded – undo
1045 1044
 	 * @param array $attendee_data
1046 1045
 	 * @return array
1047 1046
 	 */
1048
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1047
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1049 1048
 		// bare minimum critical details include first name, last name, email address
1050
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1049
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1051 1050
 		// add address info to critical details?
1052
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) {
1053
-			$address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' );
1054
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1051
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) {
1052
+			$address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone');
1053
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1055 1054
 		}
1056
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1057
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) {
1058
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail );
1055
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1056
+			if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) {
1057
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail);
1059 1058
 			}
1060 1059
 		}
1061 1060
 		return $attendee_data;
@@ -1070,11 +1069,11 @@  discard block
 block discarded – undo
1070 1069
 	 * @param array           $attendee_data
1071 1070
 	 * @return \EE_Attendee
1072 1071
 	 */
1073
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1072
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1074 1073
 		// create new attendee object
1075
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1074
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1076 1075
 		// set author to event creator
1077
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1076
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1078 1077
 		$new_attendee->save();
1079 1078
 		return $new_attendee;
1080 1079
 	}
@@ -1090,7 +1089,7 @@  discard block
 block discarded – undo
1090 1089
 	 */
1091 1090
 	public function update_reg_step() {
1092 1091
 		// save everything
1093
-		if ( $this->process_reg_step() ) {
1092
+		if ($this->process_reg_step()) {
1094 1093
 			$this->checkout->redirect = TRUE;
1095 1094
 			$this->checkout->redirect_url = add_query_arg(
1096 1095
 				array(
@@ -1099,7 +1098,7 @@  discard block
 block discarded – undo
1099 1098
 				),
1100 1099
 				$this->checkout->thank_you_page_url
1101 1100
 			);
1102
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1101
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1103 1102
 			return TRUE;
1104 1103
 		}
1105 1104
 		return FALSE;
Please login to merge, or discard this patch.
reg_steps/attendee_information/attendee_info_not_required.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1 1
 	<p class="spco-attendee-info-not-required-pg smaller-text lt-grey-text">
2
-		<?php echo apply_filters( 'FHEE__registration_page_attendee_information__attendee_info_not_required_pg', __( 'This ticket type does not require any information for additional attendees, so attendee #1\'s information will be used for its registration purposes.', 'event_espresso' ));?>
2
+		<?php echo apply_filters('FHEE__registration_page_attendee_information__attendee_info_not_required_pg', __('This ticket type does not require any information for additional attendees, so attendee #1\'s information will be used for its registration purposes.', 'event_espresso')); ?>
3 3
 	</p>
Please login to merge, or discard this patch.
reg_steps/attendee_information/auto_copy_attendee_info.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1 1
 	<p id="spco-auto-copy-attendee-pg" class="smaller-text lt-grey-text">
2
-		<?php echo apply_filters( 'FHEE__registration_page_attendee_information__auto_copy_attendee_pg', __('The above information will be used for any additional tickets/attendees.', 'event_espresso' ));?>
2
+		<?php echo apply_filters('FHEE__registration_page_attendee_information__auto_copy_attendee_pg', __('The above information will be used for any additional tickets/attendees.', 'event_espresso')); ?>
3 3
 	</p>
4 4
\ No newline at end of file
Please login to merge, or discard this patch.
reg_steps/attendee_information/copy_attendee_info.template.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <div id="spco-copy-attendee-dv" class="hide-if-no-js">
2 2
 
3 3
 	<p class="spco-copy-all-attendee-pg">
4
-		<label class="ee-checkbox-label-before ee-checkbox-label-wide"><?php  _e('Use Attendee #1\'s information for ALL attendees', 'event_espresso');?>
4
+		<label class="ee-checkbox-label-before ee-checkbox-label-wide"><?php  _e('Use Attendee #1\'s information for ALL attendees', 'event_espresso'); ?>
5 5
 			<input id="spco-copy-all-attendee-chk" class="spco-copy-all-attendee-chk ee-do-not-validate" type="checkbox" value="copy-all">
6 6
 		</label>
7 7
 	</p>
8 8
 
9
-	<p class="spco-copy-attendee-pg"><?php echo apply_filters(  'FHEE__registration_page_attendee_information__copy_attendee_pg', sprintf( __('This option allows you to use the above information for all additional attendee question fields. %sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.', 'event_espresso'), '<strong>', '</strong>' )); ?></p>
9
+	<p class="spco-copy-attendee-pg"><?php echo apply_filters('FHEE__registration_page_attendee_information__copy_attendee_pg', sprintf(__('This option allows you to use the above information for all additional attendee question fields. %sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.', 'event_espresso'), '<strong>', '</strong>')); ?></p>
10 10
 
11
-	<a id="display-more-attendee-copy-options" class="display-the-hidden smaller-text float-right" rel="more-attendee-copy-options" ><span class="dashicons dashicons-arrow-right"></span><?php  _e('advanced copy options', 'event_espresso');?></a>
12
-	<a id="hide-more-attendee-copy-options" class="hide-the-displayed smaller-text float-right" rel="more-attendee-copy-options" style="display: none;"><span class="dashicons dashicons-arrow-down"></span><?php  _e('basic copy options', 'event_espresso');?></a>
11
+	<a id="display-more-attendee-copy-options" class="display-the-hidden smaller-text float-right" rel="more-attendee-copy-options" ><span class="dashicons dashicons-arrow-right"></span><?php  _e('advanced copy options', 'event_espresso'); ?></a>
12
+	<a id="hide-more-attendee-copy-options" class="hide-the-displayed smaller-text float-right" rel="more-attendee-copy-options" style="display: none;"><span class="dashicons dashicons-arrow-down"></span><?php  _e('basic copy options', 'event_espresso'); ?></a>
13 13
 
14 14
 	<div id="more-attendee-copy-options-dv" class="" style="display: none;">
15 15
 
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 			<?php _e('Only copy the above information to the following selected additional attendees.', 'event_espresso'); ?>
18 18
 		</p>
19 19
 
20
-		<?php foreach ( $spco_copy_attendee_chk as $spco_copy_chk ) { echo $spco_copy_chk; } ?>
20
+		<?php foreach ($spco_copy_attendee_chk as $spco_copy_chk) { echo $spco_copy_chk; } ?>
21 21
 
22 22
 	</div>
23 23
 	<div class="clear-float"></div>
Please login to merge, or discard this patch.
finalize_registration/EE_SPCO_Reg_Step_Finalize_Registration.class.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_SPCO_Reg_Step_Finalize_Registration
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_SPCO_Reg_Step_Finalize_Registration
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage 	core
10
+  * @author 				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_SPCO_Reg_Step_Finalize_Registration extends EE_SPCO_Reg_Step {
15 15
 
16 16
 	/**
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param    EE_Checkout $checkout
21 21
 	 * @return 	\EE_SPCO_Reg_Step_Finalize_Registration
22 22
 	 */
23
-	public function __construct( EE_Checkout $checkout ) {
23
+	public function __construct(EE_Checkout $checkout) {
24 24
 		$this->_slug = 'finalize_registration';
25 25
 		$this->_name = __('Finalize Registration', 'event_espresso');
26 26
 		$this->_submit_button_text = $this->_name;
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 	public function initialize_reg_step() {
48 48
 
49 49
 		// there's actually no reg form to process if this is the final step
50
-		if ( $this->is_current_step() ) {
50
+		if ($this->is_current_step()) {
51 51
 			$this->checkout->step = $_REQUEST['step'] = $this->slug();
52
-			$this->checkout->action = $_REQUEST[ 'action' ] = 'process_reg_step';
52
+			$this->checkout->action = $_REQUEST['action'] = 'process_reg_step';
53 53
 			$this->checkout->generate_reg_form = false;
54 54
 		}
55 55
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function process_reg_step() {
74 74
 		// ensure all data gets refreshed from the db
75
-		$this->checkout->refresh_all_entities( true );
75
+		$this->checkout->refresh_all_entities(true);
76 76
 		// ensures that all details and statuses for transaction, registration, and payments are updated
77 77
 		$txn_update_params = $this->_finalize_transaction();
78 78
 		// DEBUG LOG
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 		//	)
87 87
 		//);
88 88
 		// set a hook point
89
-		do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params );
89
+		do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params);
90 90
 		// check if transaction has a primary registrant and that it has a related Attendee object
91
-		if ( $this->checkout->transaction_has_primary_registrant() ) {
91
+		if ($this->checkout->transaction_has_primary_registrant()) {
92 92
 			// setup URL for redirect
93 93
 			$this->checkout->redirect_url = add_query_arg(
94
-				array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ),
94
+				array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()),
95 95
 				$this->checkout->thank_you_page_url
96 96
 			);
97 97
 		} else {
98
-			EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
98
+			EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
99 99
 			$this->checkout->redirect = false;
100 100
 			$this->checkout->continue_reg = false;
101 101
 			return false;
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 		// you don't have to go home but you can't stay here !
104 104
 		$this->checkout->redirect = true;
105 105
 		$this->checkout->continue_reg = true;
106
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
107
-		if ( ! ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) ) {
106
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
107
+		if ( ! ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site())) {
108 108
 			// mark this reg step as completed
109 109
 			$this->checkout->current_step->set_completed();
110 110
 		}
@@ -121,43 +121,43 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function _finalize_transaction() {
123 123
 		/** @type EE_Transaction_Processor $transaction_processor */
124
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
124
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
125 125
 		//set revisit flag in txn processor
126
-		$transaction_processor->set_revisit( $this->checkout->revisit );
126
+		$transaction_processor->set_revisit($this->checkout->revisit);
127 127
 		// at this point we'll consider a TXN to not have been abandoned
128
-		$transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction );
129
-		if ( $this->checkout->cart instanceof EE_Cart ) {
128
+		$transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction);
129
+		if ($this->checkout->cart instanceof EE_Cart) {
130 130
 			// save TXN data to the cart
131
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
131
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
132 132
 		}
133 133
 		/** @type EE_Transaction_Payments $transaction_payments */
134
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
134
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
135 135
 		// maybe update status, but don't save transaction just yet
136
-		$transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false );
136
+		$transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false);
137 137
 		// If the selected method of payment used an off-site gateway...
138
-		if ( $this->checkout->payment_method instanceof EE_Payment_Method ) {
139
-			$is_revisit = filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN );
140
-			if ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) {
141
-				$gateway= $this->checkout->payment_method->type_obj()->get_gateway();
142
-				if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
138
+		if ($this->checkout->payment_method instanceof EE_Payment_Method) {
139
+			$is_revisit = filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN);
140
+			if ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site()) {
141
+				$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
142
+				if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
143 143
 					// do NOT trigger notifications because it was already done during the IPN
144
-					remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' );
145
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
146
-				} else if ( ! $is_revisit ) {
147
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
144
+					remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications');
145
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
146
+				} else if ( ! $is_revisit) {
147
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
148 148
 				}
149 149
 			} else if (
150 150
 				// if SPCO revisit and TXN status has changed due to a payment
151
-				$is_revisit && ( $this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated() )
151
+				$is_revisit && ($this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated())
152 152
 			) {
153 153
 				// send out notifications
154
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
155
-			} else if ( ! $is_revisit ) {
156
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
154
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
155
+			} else if ( ! $is_revisit) {
156
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
157 157
 			}
158 158
 		}
159 159
 		// this will result in the base session properties getting saved to the TXN_Session_data field
160
-		$this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true ));
160
+		$this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true));
161 161
 
162 162
 		// update the TXN if payment conditions have changed
163 163
 		return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment(
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @return boolean
175 175
 	 */
176 176
 	public function update_reg_step() {
177
-		EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' );
177
+		EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0');
178 178
 	 }
179 179
 
180 180
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 	/**
28 28
 	 * Applies all teh individual item validation strategies on each item in the array
29 29
 	 * @param array $normalized_value
30
-	 * @return boolean
30
+	 * @return boolean|null
31 31
 	 */
32 32
 	function validate($normalized_value) {
33 33
 		if( is_array($normalized_value)){
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 4 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_SPCO_Reg_Step_Payment_Options
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_SPCO_Reg_Step_Payment_Options
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage 	core
10
+  * @author 				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_SPCO_Reg_Step_Payment_Options extends EE_SPCO_Reg_Step {
15 15
 
16 16
 	/**
@@ -740,13 +740,13 @@  discard block
 block discarded – undo
740 740
 			return FALSE;
741 741
 		}
742 742
 		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
743
-            EE_Error::add_success(
744
-                apply_filters(
745
-                    'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
746
-                    sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
747
-                )
748
-            );
749
-        }
743
+			EE_Error::add_success(
744
+				apply_filters(
745
+					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
746
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
747
+				)
748
+			);
749
+		}
750 750
 		// now generate billing form for selected method of payment
751 751
 		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method, FALSE );
752 752
 		// fill form with attendee info if applicable
@@ -778,14 +778,14 @@  discard block
 block discarded – undo
778 778
 		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
779 779
 		if ( $billing_form instanceof EE_Billing_Info_Form ) {
780 780
 			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
781
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
782
-                    EE_Error::add_success(
783
-                        apply_filters(
784
-                            'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
785
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
786
-                        )
787
-                    );
788
-                }
781
+				if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
782
+					EE_Error::add_success(
783
+						apply_filters(
784
+							'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
785
+							sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
786
+						)
787
+					);
788
+				}
789 789
 			}
790 790
 			return apply_filters(
791 791
 				'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form',
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1214,9 +1214,9 @@
 block discarded – undo
1214 1214
 						$form_section = $validation_error->get_form_section();
1215 1215
 						if( $form_section instanceof EE_Form_Input_Base ){
1216 1216
 							$label = $form_section->html_label_text();
1217
-						}elseif( $form_section instanceof EE_Form_Section_Base ){
1217
+						} elseif( $form_section instanceof EE_Form_Section_Base ){
1218 1218
 							$label = $form_section->name();
1219
-						}else{
1219
+						} else{
1220 1220
 							$label = __( 'Validation Error', 'event_espresso' );
1221 1221
 						}
1222 1222
 						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() );
Please login to merge, or discard this patch.
Doc Comments   +12 added lines, -10 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 
114 114
 	/**
115
-	 * @param null $line_item_display
115
+	 * @param EE_Line_Item_Display $line_item_display
116 116
 	 */
117 117
 	public function set_line_item_display( $line_item_display ) {
118 118
 		$this->line_item_display = $line_item_display;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
 
182 182
 	/**
183
-	 * @return bool
183
+	 * @return EE_Form_Section_Proper
184 184
 	 */
185 185
 	public function generate_reg_form() {
186 186
 		EE_Registry::instance()->load_helper( 'HTML' );
@@ -537,6 +537,7 @@  discard block
 block discarded – undo
537 537
 	 *    _apply_registration_payments_to_amount_owing
538 538
 	 *
539 539
 	 * @access    protected
540
+	 * @param EE_Base_Class[] $registrations
540 541
 	 * @return    void
541 542
 	 */
542 543
 	protected function _apply_registration_payments_to_amount_owing( $registrations ) {
@@ -754,7 +755,7 @@  discard block
 block discarded – undo
754 755
 	 * get_billing_form_html_for_payment_method
755 756
 	 *
756 757
 	 * @access public
757
-	 * @return string
758
+	 * @return boolean
758 759
 	 */
759 760
 	public function get_billing_form_html_for_payment_method() {
760 761
 		// how have they chosen to pay?
@@ -874,7 +875,7 @@  discard block
 block discarded – undo
874 875
 	 * switch_payment_method
875 876
 	 *
876 877
 	 * @access public
877
-	 * @return string
878
+	 * @return boolean
878 879
 	 */
879 880
 	public function switch_payment_method() {
880 881
 		if ( ! $this->_verify_payment_method_is_set() ) {
@@ -1041,7 +1042,7 @@  discard block
 block discarded – undo
1041 1042
 
1042 1043
 	/**
1043 1044
 	 * process_reg_step
1044
-	 * @return boolean
1045
+	 * @return null|boolean
1045 1046
 	 */
1046 1047
 	public function process_reg_step() {
1047 1048
 		// how have they chosen to pay?
@@ -1117,7 +1118,7 @@  discard block
 block discarded – undo
1117 1118
 	 *    update_reg_step
1118 1119
 	 *    this is the final step after a user  revisits the site to retry a payment
1119 1120
 	 *
1120
-	 * @return boolean
1121
+	 * @return null|boolean
1121 1122
 	 */
1122 1123
 	public function update_reg_step() {
1123 1124
 		$success = TRUE;
@@ -1399,7 +1400,7 @@  discard block
 block discarded – undo
1399 1400
 	 *
1400 1401
 	 * 	@access 	private
1401 1402
 	 * 	@type 	EE_Payment_Method $payment_method
1402
-	 * 	@return 	mixed	EE_Payment | boolean
1403
+	 * 	@return 	EE_Payment|null	EE_Payment | boolean
1403 1404
 	 */
1404 1405
 	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1405 1406
 		$payment =NULL;
@@ -1601,6 +1602,7 @@  discard block
 block discarded – undo
1601 1602
 	 * @access private
1602 1603
 	 * @type    EE_Payment $payment
1603 1604
 	 * @param string $payment_occurs
1605
+	 * @param EE_Payment|null $payment
1604 1606
 	 * @return bool
1605 1607
 	 * @throws \EE_Error
1606 1608
 	 */
@@ -1707,7 +1709,7 @@  discard block
 block discarded – undo
1707 1709
 	 * 		or present the payment options again
1708 1710
 	 *
1709 1711
 	 * @access private
1710
-	 * @return EE_Payment | FALSE
1712
+	 * @return boolean | FALSE
1711 1713
 	 */
1712 1714
 	public function process_gateway_response() {
1713 1715
 		$payment = null;
@@ -1768,7 +1770,7 @@  discard block
 block discarded – undo
1768 1770
 	 * _validate_return
1769 1771
 	 *
1770 1772
 	 * @access private
1771
-	 * @return bool
1773
+	 * @return boolean|null
1772 1774
 	 */
1773 1775
 	private function _validate_offsite_return() {
1774 1776
 		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
@@ -1835,7 +1837,7 @@  discard block
 block discarded – undo
1835 1837
 	 *
1836 1838
 	 * @access private
1837 1839
 	 * @param \EE_Registration $primary_registrant
1838
-	 * @return bool
1840
+	 * @return false|null
1839 1841
 	 */
1840 1842
 	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1841 1843
 		if ( ! $primary_registrant instanceof EE_Registration ) {
Please login to merge, or discard this patch.
Spacing   +370 added lines, -370 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 *  @return 	void
29 29
 	 */
30 30
 	public static function set_hooks() {
31
-		add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) );
32
-		add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
33
-		add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
34
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
35
-		add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
36
-		add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) );
37
-		add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
31
+		add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters'));
32
+		add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
33
+		add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
34
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
35
+		add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
36
+		add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details'));
37
+		add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
38 38
 		);
39
-		add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 );
39
+		add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1);
40 40
 	}
41 41
 
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * 	ajax switch_spco_billing_form
46 46
 	 */
47 47
 	public static function switch_spco_billing_form() {
48
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
48
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
49 49
 	}
50 50
 
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * 	ajax save_payer_details
55 55
 	 */
56 56
 	public static function save_payer_details() {
57
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
57
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
58 58
 	}
59 59
 
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * 	ajax get_transaction_details
64 64
 	 */
65 65
 	public static function get_transaction_details() {
66
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
66
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
67 67
 	}
68 68
 
69 69
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	 * @param    EE_Checkout $checkout
92 92
 	 * @return    \EE_SPCO_Reg_Step_Payment_Options
93 93
 	 */
94
-	public function __construct( EE_Checkout $checkout ) {
94
+	public function __construct(EE_Checkout $checkout) {
95 95
 		$this->_slug = 'payment_options';
96 96
 		$this->_name = __('Payment Options', 'event_espresso');
97
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
97
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
98 98
 		$this->checkout = $checkout;
99 99
 		$this->_reset_success_message();
100
-		$this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
100
+		$this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
101 101
 	}
102 102
 
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * @param null $line_item_display
116 116
 	 */
117
-	public function set_line_item_display( $line_item_display ) {
117
+	public function set_line_item_display($line_item_display) {
118 118
 		$this->line_item_display = $line_item_display;
119 119
 	}
120 120
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @return void
126 126
 	 */
127 127
 	public function translate_js_strings() {
128
-		EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' );
129
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' );
130
-		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' );
128
+		EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso');
129
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso');
130
+		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso');
131 131
 	}
132 132
 
133 133
 
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 			// 	$ 0.00 transactions (no payment required)
157 157
 			! $this->checkout->payment_required()
158 158
 			// but do NOT remove if current action being called belongs to this reg step
159
-			&& ! is_callable( array( $this, $this->checkout->action ) )
159
+			&& ! is_callable(array($this, $this->checkout->action))
160 160
 			&& ! $this->completed()
161 161
 		) {
162 162
 			// and if so, then we no longer need the Payment Options step
163
-			if ( $this->is_current_step() ) {
163
+			if ($this->is_current_step()) {
164 164
 				$this->checkout->generate_reg_form = false;
165 165
 			}
166
-			$this->checkout->remove_reg_step( $this->_slug );
166
+			$this->checkout->remove_reg_step($this->_slug);
167 167
 			// DEBUG LOG
168 168
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
169 169
 			return false;
170 170
 		}
171 171
 		// load EEM_Payment_Method
172
-		EE_Registry::instance()->load_model( 'Payment_Method' );
172
+		EE_Registry::instance()->load_model('Payment_Method');
173 173
 		// get all active payment methods
174 174
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
175 175
 			$this->checkout->transaction, EEM_Payment_Method::scope_cart
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return bool
184 184
 	 */
185 185
 	public function generate_reg_form() {
186
-		EE_Registry::instance()->load_helper( 'HTML' );
186
+		EE_Registry::instance()->load_helper('HTML');
187 187
 		// reset in case someone changes their mind
188 188
 		$this->_reset_selected_method_of_payment();
189 189
 		// set some defaults
@@ -194,15 +194,15 @@  discard block
 block discarded – undo
194 194
 		$sold_out_events = array();
195 195
 		$reg_count = 0;
196 196
 		// loop thru registrations to gather info
197
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
198
-		foreach ( $registrations as $registration ) {
197
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
198
+		foreach ($registrations as $registration) {
199 199
 			/** @var $registration EE_Registration */
200 200
 			$reg_count++;
201 201
 			// if returning registrant is Approved then do NOT do this
202
-			if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) {
203
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) {
202
+			if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) {
203
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
204 204
 					// add event to list of events that are sold out
205
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
205
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
206 206
 					do_action(
207 207
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
208 208
 						$registration->event(),
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 					);
211 211
 				}
212 212
 				// event requires admin approval
213
-				if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) {
213
+				if ($registration->status_ID() == EEM_Registration::status_id_not_approved) {
214 214
 					// add event to list of events with pre-approval reg status
215
-					$registrations_requiring_pre_approval[ $registration->ID() ] = $registration;
215
+					$registrations_requiring_pre_approval[$registration->ID()] = $registration;
216 216
 					do_action(
217 217
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
218 218
 						$registration->event(),
@@ -221,29 +221,29 @@  discard block
 block discarded – undo
221 221
 				}
222 222
 			}
223 223
 			// are they allowed to pay now and is there monies owing?
224
-			if ( $registration->owes_monies_and_can_pay() ) {
225
-				$registrations_requiring_payment[ $registration->ID() ] = $registration;
224
+			if ($registration->owes_monies_and_can_pay()) {
225
+				$registrations_requiring_payment[$registration->ID()] = $registration;
226 226
 				do_action(
227 227
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
228 228
 					$registration->event(),
229 229
 					$this
230 230
 				);
231
-			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()  ) {
232
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
231
+			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) {
232
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
233 233
 			}
234 234
 		}
235 235
 		$subsections = array();
236 236
 		// now decide which template to load
237
-		if ( ! empty( $sold_out_events )) {
238
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
237
+		if ( ! empty($sold_out_events)) {
238
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
239 239
 		}
240
-		if ( ! empty( $registrations_requiring_pre_approval )) {
241
-			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval );
240
+		if ( ! empty($registrations_requiring_pre_approval)) {
241
+			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval);
242 242
 		}
243
-		if ( ! empty( $registrations_for_free_events ) ) {
244
-			$subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events );
243
+		if ( ! empty($registrations_for_free_events)) {
244
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
245 245
 		}
246
-		if ( ! empty( $registrations_requiring_payment ) ) {
246
+		if ( ! empty($registrations_requiring_payment)) {
247 247
 			// autoload Line_Item_Display classes
248 248
 			EEH_Autoloader::register_line_item_filter_autoloaders();
249 249
 			$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 				$this->checkout->cart->get_grand_total()
255 255
 			);
256 256
 			$filtered_line_item_tree = $line_item_filter_processor->process();
257
-			if ( $this->checkout->amount_owing > 0 ) {
257
+			if ($this->checkout->amount_owing > 0) {
258 258
 				EEH_Autoloader::register_line_item_display_autoloaders();
259
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
260
-				$subsections[ 'payment_options' ] = $this->_display_payment_options(
259
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
260
+				$subsections['payment_options'] = $this->_display_payment_options(
261 261
 					$this->line_item_display->display_line_item(
262 262
 						$filtered_line_item_tree,
263
-						array( 'registrations' => $registrations )
263
+						array('registrations' => $registrations)
264 264
 					)
265 265
 				);
266 266
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
267
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
267
+				$this->_apply_registration_payments_to_amount_owing($registrations);
268 268
 			}
269 269
 		} else {
270 270
 			$this->_hide_reg_step_submit_button_if_revisit();
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection
298 298
 	 * @return \EE_Line_Item_Filter_Collection
299 299
 	 */
300
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
300
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
301 301
 		$line_item_filter_collection->add(
302 302
 			new EE_Billable_Line_Item_Filter(
303 303
 				EE_Registry::instance()->SSN->checkout()->transaction->registrations(
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 				)
306 306
 			)
307 307
 		);
308
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
308
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
309 309
 		return $line_item_filter_collection;
310 310
 	}
311 311
 
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 	 * @return void
320 320
 	 */
321 321
 	protected function _hide_reg_step_submit_button_if_revisit() {
322
-		if ( $this->checkout->revisit ) {
323
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
322
+		if ($this->checkout->revisit) {
323
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
324 324
 		}
325 325
 	}
326 326
 
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 	 * @param \EE_Event[] $sold_out_events_array
332 332
 	 * @return \EE_Form_Section_Proper
333 333
 	 */
334
-	private function _sold_out_events( $sold_out_events_array = array() ) {
334
+	private function _sold_out_events($sold_out_events_array = array()) {
335 335
 		// set some defaults
336 336
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
337 337
 		$sold_out_events = '';
338
-		foreach ( $sold_out_events_array as $sold_out_event ) {
339
-			$sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ));
338
+		foreach ($sold_out_events_array as $sold_out_event) {
339
+			$sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text'));
340 340
 		}
341 341
 		return new EE_Form_Section_Proper(
342 342
 			array(
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 				),
349 349
 				'layout_strategy'		=> new EE_Template_Layout(
350 350
 					array(
351
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template
351
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template
352 352
 						'template_args'  				=> apply_filters(
353 353
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
354 354
 							array(
355 355
 								'sold_out_events' 			=> $sold_out_events,
356 356
 								'sold_out_events_msg' 	=> apply_filters(
357 357
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg',
358
-									__( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' )
358
+									__('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso')
359 359
 								)
360 360
 							)
361 361
 						)
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 	 * @param array $registrations_requiring_pre_approval
373 373
 	 * @return \EE_Form_Section_Proper
374 374
 	 */
375
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) {
375
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
376 376
 		$events_requiring_pre_approval = '';
377
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
378
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
379
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
380
-					EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
377
+		foreach ($registrations_requiring_pre_approval as $registration) {
378
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
379
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
380
+					EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
381 381
 					)
382
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
382
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
383 383
 				);
384 384
 			}
385 385
 		}
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
 				),
392 392
 				'layout_strategy'		=> new EE_Template_Layout(
393 393
 					array(
394
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template
394
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template
395 395
 						'template_args'  				=> apply_filters(
396 396
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
397 397
 							array(
398
-								'events_requiring_pre_approval' 			=> implode( '', $events_requiring_pre_approval ),
398
+								'events_requiring_pre_approval' 			=> implode('', $events_requiring_pre_approval),
399 399
 								'events_requiring_pre_approval_msg' 	=> apply_filters(
400 400
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
401
-									__( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' )
401
+									__('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso')
402 402
 								)
403 403
 							)
404 404
 						),
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 * @param \EE_Event[] $registrations_for_free_events
417 417
 	 * @return \EE_Form_Section_Proper
418 418
 	 */
419
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
419
+	private function _no_payment_required($registrations_for_free_events = array()) {
420 420
 		// set some defaults
421 421
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
422 422
 		// generate no_payment_required form
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 				),
429 429
 				'layout_strategy' 	=> new EE_Template_Layout(
430 430
 					array(
431
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template
431
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template
432 432
 						'template_args'  				=> apply_filters(
433 433
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
434 434
 							array(
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 								'registrations' => array(),
437 437
 								'ticket_count' 	=> array(),
438 438
 								'registrations_for_free_events' 	=> $registrations_for_free_events,
439
-								'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' ))
439
+								'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso'))
440 440
 							)
441 441
 						),
442 442
 					)
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 * @param string $transaction_details
454 454
 	 * @return \EE_Form_Section_Proper
455 455
 	 */
456
-	private function _display_payment_options( $transaction_details = '' ) {
456
+	private function _display_payment_options($transaction_details = '') {
457 457
 		// has method_of_payment been set by no-js user?
458 458
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
459 459
 		// build payment options form
@@ -465,20 +465,20 @@  discard block
 block discarded – undo
465 465
 						'before_payment_options' => apply_filters(
466 466
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
467 467
 							new EE_Form_Section_Proper(
468
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
468
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
469 469
 							)
470 470
 						),
471 471
 						'payment_options' => $this->_setup_payment_options(),
472 472
 						'after_payment_options' => apply_filters(
473 473
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
474 474
 							new EE_Form_Section_Proper(
475
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
475
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
476 476
 							)
477 477
 						),
478 478
 						'default_hidden_inputs' => $this->reg_step_hidden_inputs(),
479
-						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs( FALSE )
479
+						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs(FALSE)
480 480
 					),
481
-					'layout_strategy'	=> new EE_Template_Layout( array(
481
+					'layout_strategy'	=> new EE_Template_Layout(array(
482 482
 							'layout_template_file' 	=> $this->_template,
483 483
 							'template_args'  				=> apply_filters(
484 484
 								'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args',
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 	 * @param bool $no_payment_required
503 503
 	 * @return \EE_Form_Section_Proper
504 504
 	 */
505
-	private function _extra_hidden_inputs( $no_payment_required = TRUE ) {
505
+	private function _extra_hidden_inputs($no_payment_required = TRUE) {
506 506
 
507 507
 		return new EE_Form_Section_Proper(
508 508
 			array(
509
-				'html_id' 				=> 'ee-' . $this->slug() . '-extra-hidden-inputs',
509
+				'html_id' 				=> 'ee-'.$this->slug().'-extra-hidden-inputs',
510 510
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
511 511
 				'subsections' 		=> array(
512 512
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -539,16 +539,16 @@  discard block
 block discarded – undo
539 539
 	 * @access    protected
540 540
 	 * @return    void
541 541
 	 */
542
-	protected function _apply_registration_payments_to_amount_owing( $registrations ) {
542
+	protected function _apply_registration_payments_to_amount_owing($registrations) {
543 543
 		$payments = array();
544
-		foreach ( $registrations as $registration ) {
545
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
544
+		foreach ($registrations as $registration) {
545
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
546 546
 				$payments = $payments + $registration->registration_payments();
547 547
 			}
548 548
 		}
549
-		if ( ! empty( $payments ) ) {
550
-			foreach ( $payments as $payment ) {
551
-				if ( $payment instanceof EE_Registration_Payment ) {
549
+		if ( ! empty($payments)) {
550
+			foreach ($payments as $payment) {
551
+				if ($payment instanceof EE_Registration_Payment) {
552 552
 					$this->checkout->amount_owing -= $payment->amount();
553 553
 				}
554 554
 			}
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 	 * @param 	bool $force_reset
564 564
 	 * @return 	void
565 565
 	 */
566
-	private function _reset_selected_method_of_payment( $force_reset = FALSE ) {
567
-		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE ));
568
-		if ( $reset_payment_method ) {
566
+	private function _reset_selected_method_of_payment($force_reset = FALSE) {
567
+		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE));
568
+		if ($reset_payment_method) {
569 569
 			$this->checkout->selected_method_of_payment = NULL;
570 570
 			$this->checkout->payment_method = NULL;
571 571
 			$this->checkout->billing_form = NULL;
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 	 * @param string $selected_method_of_payment
585 585
 	 * 	@return 		EE_Billing_Info_Form
586 586
 	 */
587
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
588
-		$selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
589
-		EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment ));
587
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
588
+		$selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
589
+		EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment));
590 590
 	}
591 591
 
592 592
 
@@ -599,40 +599,40 @@  discard block
 block discarded – undo
599 599
 		// load payment method classes
600 600
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
601 601
 		// switch up header depending on number of available payment methods
602
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
603
-			? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' ))
604
-			: apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' ));
602
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
603
+			? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso'))
604
+			: apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso'));
605 605
 		$available_payment_methods = array(
606 606
 			// display the "Payment Method" header
607 607
 			'payment_method_header' => new EE_Form_Section_HTML(
608
-				EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' )
608
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
609 609
 			)
610 610
 		);
611 611
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
612 612
 		$available_payment_method_options = array();
613 613
 		$default_payment_method_option = array();
614 614
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
615
-		$payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' )));
615
+		$payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;')));
616 616
 		// loop through payment methods
617
-		foreach( $this->checkout->available_payment_methods as $payment_method ) {
618
-			if ( $payment_method instanceof EE_Payment_Method ) {
619
-				$payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' );
617
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
618
+			if ($payment_method instanceof EE_Payment_Method) {
619
+				$payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img');
620 620
 				// check if any payment methods are set as default
621 621
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
622
-				if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) {
622
+				if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) {
623 623
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
624 624
 					$this->_save_selected_method_of_payment();
625
-					$default_payment_method_option[ $payment_method->slug() ] =  $payment_method_button;
625
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
626 626
 				} else {
627
-					$available_payment_method_options[ $payment_method->slug() ] =  $payment_method_button;
627
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
628 628
 				}
629
-				$payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method );
629
+				$payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method);
630 630
 			}
631 631
 		}
632 632
 		// prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs
633 633
 		$available_payment_method_options = $default_payment_method_option + $available_payment_method_options;
634 634
 		// now generate the actual form  inputs
635
-		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options );
635
+		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options);
636 636
 		$available_payment_methods = $available_payment_methods + $payment_methods_billing_info;
637 637
 
638 638
 		// build the available payment methods form
@@ -652,19 +652,19 @@  discard block
 block discarded – undo
652 652
 	 * @return EE_Payment_Method[]
653 653
 	 */
654 654
 	protected function _get_available_payment_methods() {
655
-		if ( ! empty( $this->checkout->available_payment_methods )) {
655
+		if ( ! empty($this->checkout->available_payment_methods)) {
656 656
 			return $this->checkout->available_payment_methods;
657 657
 		}
658 658
 		$available_payment_methods = array();
659 659
 		// load EEM_Payment_Method
660
-		EE_Registry::instance()->load_model( 'Payment_Method' );
660
+		EE_Registry::instance()->load_model('Payment_Method');
661 661
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
662 662
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
663 663
 		// get all active payment methods
664
-		$payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart );
665
-		foreach ( $payment_methods as $payment_method ) {
666
-			if ( $payment_method instanceof EE_Payment_Method ) {
667
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
664
+		$payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart);
665
+		foreach ($payment_methods as $payment_method) {
666
+			if ($payment_method instanceof EE_Payment_Method) {
667
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
668 668
 			}
669 669
 		}
670 670
 		return $available_payment_methods;
@@ -680,14 +680,14 @@  discard block
 block discarded – undo
680 680
 	 * @param 	array $available_payment_method_options
681 681
 	 * @return 	\EE_Form_Section_Proper
682 682
 	 */
683
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
683
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
684 684
 		// generate inputs
685 685
 		return new EE_Form_Section_Proper(
686 686
 			array(
687 687
 				'html_id' 				=> 'ee-available-payment-method-inputs',
688 688
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
689 689
 				'subsections' 		=> array(
690
-					'' => new EE_Radio_Button_Input (
690
+					'' => new EE_Radio_Button_Input(
691 691
 						$available_payment_method_options,
692 692
 						array(
693 693
 							'html_name' 				=> 'selected_method_of_payment',
@@ -711,36 +711,36 @@  discard block
 block discarded – undo
711 711
 	 * @param 	EE_Payment_Method $payment_method
712 712
 	 * @return 	\EE_Form_Section_Proper
713 713
 	 */
714
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
714
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
715 715
 		$currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE;
716 716
 		// generate the billing form for payment method
717
-		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML();
717
+		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML();
718 718
 		$this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form;
719 719
 		// it's all in the details
720
-		$info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' );
720
+		$info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr');
721 721
 		// add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not
722
-		if ( $payment_method->description() ) {
722
+		if ($payment_method->description()) {
723 723
 			$payment_method_info = $payment_method->description();
724
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
725
-			$payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
724
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
725
+			$payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
726 726
 		} else {
727
-			$payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
727
+			$payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
728 728
 		}
729
-		$info_html .= EEH_HTML::p (
730
-			apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ),
729
+		$info_html .= EEH_HTML::p(
730
+			apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info),
731 731
 			'',
732 732
 			'spco-payment-method-desc ee-attention'
733 733
 		);
734 734
 
735 735
 		return new EE_Form_Section_Proper(
736 736
 			array(
737
-				'html_id' 					=> 'spco-payment-method-info-' . $payment_method->slug(),
737
+				'html_id' 					=> 'spco-payment-method-info-'.$payment_method->slug(),
738 738
 				'html_class' 			=> 'spco-payment-method-info-dv',
739 739
 				// only display the selected or default PM
740 740
 				'html_style' 			=> $currently_selected ? '' : 'display:none;',
741 741
 				'layout_strategy'		=> new EE_Div_Per_Section_Layout(),
742 742
 				'subsections' 			=> array(
743
-					'info' 					=> new EE_Form_Section_HTML( $info_html ),
743
+					'info' 					=> new EE_Form_Section_HTML($info_html),
744 744
 					'billing_form' 		=> $currently_selected ? $billing_form : new EE_Form_Section_HTML()
745 745
 				)
746 746
 			)
@@ -758,12 +758,12 @@  discard block
 block discarded – undo
758 758
 	 */
759 759
 	public function get_billing_form_html_for_payment_method() {
760 760
 		// how have they chosen to pay?
761
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
761
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
762 762
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
763
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
763
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
764 764
 			return FALSE;
765 765
 		}
766
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
766
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
767 767
             EE_Error::add_success(
768 768
                 apply_filters(
769 769
                     'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -772,20 +772,20 @@  discard block
 block discarded – undo
772 772
             );
773 773
         }
774 774
 		// now generate billing form for selected method of payment
775
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
775
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
776 776
 		// fill form with attendee info if applicable
777
-		if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
778
-			$payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
777
+		if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
778
+			$payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
779 779
 		}
780 780
 		// and debug content
781
-		if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
782
-			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form );
781
+		if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
782
+			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form);
783 783
 		}
784 784
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : '';
785
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ));
785
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
786 786
 		// localize validation rules for main form
787 787
 		$this->checkout->current_step->reg_form->localize_validation_rules();
788
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
788
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
789 789
 		return TRUE;
790 790
 	}
791 791
 
@@ -798,15 +798,15 @@  discard block
 block discarded – undo
798 798
 	 * @param EE_Payment_Method $payment_method
799 799
 	 * @return \EE_Billing_Info_Form
800 800
 	 */
801
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
802
-		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
803
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
804
-			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
805
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
801
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
802
+		$billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing));
803
+		if ($billing_form instanceof EE_Billing_Info_Form) {
804
+			if (EE_Registry::instance()->REQ->is_set('payment_method')) {
805
+                if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
806 806
                     EE_Error::add_success(
807 807
                         apply_filters(
808 808
                             'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
809
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
809
+                            sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name())
810 810
                         )
811 811
                     );
812 812
                 }
@@ -831,27 +831,27 @@  discard block
 block discarded – undo
831 831
 	 * @param string 		$request_param
832 832
 	 * @return NULL|string
833 833
 	 */
834
-	private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) {
834
+	private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') {
835 835
 		// is selected_method_of_payment set in the request ?
836
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE );
837
-		if ( $selected_method_of_payment ) {
836
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE);
837
+		if ($selected_method_of_payment) {
838 838
 			// sanitize it
839
-			$selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment;
840
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
839
+			$selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment;
840
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
841 841
 			// store it in the session so that it's available for all subsequent requests including AJAX
842
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
842
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
843 843
 		} else {
844 844
 			// or is is set in the session ?
845
-			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' );
845
+			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment');
846 846
 		}
847 847
 		// do ya really really gotta have it?
848
-		if ( empty( $selected_method_of_payment ) && $required ) {
848
+		if (empty($selected_method_of_payment) && $required) {
849 849
 			EE_Error::add_error(
850 850
 				sprintf(
851
-					__( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ),
851
+					__('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'),
852 852
 					'<br/>',
853 853
 					'<br/>',
854
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
854
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
855 855
 				),
856 856
 				__FILE__, __FUNCTION__, __LINE__
857 857
 			);
@@ -877,37 +877,37 @@  discard block
 block discarded – undo
877 877
 	 * @return string
878 878
 	 */
879 879
 	public function switch_payment_method() {
880
-		if ( ! $this->_verify_payment_method_is_set() ) {
880
+		if ( ! $this->_verify_payment_method_is_set()) {
881 881
 			return FALSE;
882 882
 		}
883
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
883
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
884 884
 			EE_Error::add_success(
885 885
 				apply_filters(
886 886
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
887
-					sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() )
887
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
888 888
 				)
889 889
 			);
890 890
 		}
891 891
 		// generate billing form for selected method of payment if it hasn't been done already
892
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
893
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
892
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
893
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
894 894
 		}
895 895
 		// fill form with attendee info if applicable
896
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
897
-			$this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
896
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
897
+			$this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
898 898
 		}
899 899
 		// and debug content
900
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
901
-			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form );
900
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
901
+			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form);
902 902
 		}
903 903
 		// get html and validation rules for form
904
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
905
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() ));
904
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
905
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html()));
906 906
 			// localize validation rules for main form
907
-			$this->checkout->billing_form->localize_validation_rules( TRUE );
908
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
907
+			$this->checkout->billing_form->localize_validation_rules(TRUE);
908
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
909 909
 		} else {
910
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ));
910
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
911 911
 		}
912 912
 		//prevents advancement to next step
913 913
 		$this->checkout->continue_reg = FALSE;
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
 	 */
923 923
 	protected function _verify_payment_method_is_set() {
924 924
 		// generate billing form for selected method of payment if it hasn't been done already
925
-		if ( empty( $this->checkout->selected_method_of_payment )) {
925
+		if (empty($this->checkout->selected_method_of_payment)) {
926 926
 			// how have they chosen to pay?
927
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
927
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
928 928
 		}
929 929
 		// verify payment method
930
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
930
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
931 931
 			// get payment method for selected method of payment
932 932
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
933 933
 		}
@@ -947,23 +947,23 @@  discard block
 block discarded – undo
947 947
 	 * @return void
948 948
 	 */
949 949
 	public function save_payer_details_via_ajax() {
950
-		if ( ! $this->_verify_payment_method_is_set() ) {
950
+		if ( ! $this->_verify_payment_method_is_set()) {
951 951
 			return;
952 952
 		}
953 953
 		// generate billing form for selected method of payment if it hasn't been done already
954
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
955
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
954
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
955
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
956 956
 		}
957 957
 		// generate primary attendee from payer info if applicable
958 958
 		if ( ! $this->checkout->transaction_has_primary_registrant()) {
959 959
 			$attendee = $this->_create_attendee_from_request_data();
960
-			if ( $attendee instanceof EE_Attendee ) {
961
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
962
-					if ( $registration->is_primary_registrant() ) {
960
+			if ($attendee instanceof EE_Attendee) {
961
+				foreach ($this->checkout->transaction->registrations() as $registration) {
962
+					if ($registration->is_primary_registrant()) {
963 963
 						$this->checkout->primary_attendee_obj = $attendee;
964
-						$registration->_add_relation_to( $attendee, 'Attendee' );
965
-						$registration->set_attendee_id( $attendee->ID() );
966
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
964
+						$registration->_add_relation_to($attendee, 'Attendee');
965
+						$registration->set_attendee_id($attendee->ID());
966
+						$registration->update_cache_after_object_save('Attendee', $attendee);
967 967
 					}
968 968
 				}
969 969
 			}
@@ -976,56 +976,56 @@  discard block
 block discarded – undo
976 976
 	 * uses info from alternate GET or POST data (such as AJAX) to create a new attendee
977 977
 	 * @return \EE_Attendee
978 978
 	 */
979
-	protected function _create_attendee_from_request_data(){
979
+	protected function _create_attendee_from_request_data() {
980 980
 		// get State ID
981
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
982
-		if ( ! empty( $STA_ID )) {
981
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
982
+		if ( ! empty($STA_ID)) {
983 983
 			// can we get state object from name ?
984
-			EE_Registry::instance()->load_model( 'State' );
985
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' );
986
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
984
+			EE_Registry::instance()->load_model('State');
985
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
986
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
987 987
 		}
988 988
 		// get Country ISO
989
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
990
-		if ( ! empty( $CNT_ISO )) {
989
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
990
+		if ( ! empty($CNT_ISO)) {
991 991
 			// can we get country object from name ?
992
-			EE_Registry::instance()->load_model( 'Country' );
993
-			$country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' );
994
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
992
+			EE_Registry::instance()->load_model('Country');
993
+			$country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO');
994
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
995 995
 		}
996 996
 		// grab attendee data
997 997
 		$attendee_data = array(
998
-			'ATT_fname' 		=> ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
999
-			'ATT_lname' 		=> ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1000
-			'ATT_email' 		=> ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1001
-			'ATT_address' 		=> ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1002
-			'ATT_address2' 	=> ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1003
-			'ATT_city' 			=> ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
998
+			'ATT_fname' 		=> ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
999
+			'ATT_lname' 		=> ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1000
+			'ATT_email' 		=> ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1001
+			'ATT_address' 		=> ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1002
+			'ATT_address2' 	=> ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1003
+			'ATT_city' 			=> ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1004 1004
 			'STA_ID' 				=> $STA_ID,
1005 1005
 			'CNT_ISO' 			=> $CNT_ISO,
1006
-			'ATT_zip' 				=> ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1007
-			'ATT_phone' 		=> ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1006
+			'ATT_zip' 				=> ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1007
+			'ATT_phone' 		=> ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1008 1008
 		);
1009 1009
 		// validate the email address since it is the most important piece of info
1010
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) {
1011
-			EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1010
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) {
1011
+			EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1012 1012
 		}
1013 1013
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1014
-		if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) {
1015
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1014
+		if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) {
1015
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1016 1016
 				'ATT_fname' => $attendee_data['ATT_fname'],
1017 1017
 				'ATT_lname' => $attendee_data['ATT_lname'],
1018 1018
 				'ATT_email' => $attendee_data['ATT_email']
1019 1019
 			));
1020
-			if ( $existing_attendee instanceof EE_Attendee ) {
1020
+			if ($existing_attendee instanceof EE_Attendee) {
1021 1021
 				return $existing_attendee;
1022 1022
 			}
1023 1023
 		}
1024 1024
 		// no existing attendee? kk let's create a new one
1025 1025
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1026
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1027
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1028
-		return EE_Attendee::new_instance( $attendee_data );
1026
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1027
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1028
+		return EE_Attendee::new_instance($attendee_data);
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1045,22 +1045,22 @@  discard block
 block discarded – undo
1045 1045
 	 */
1046 1046
 	public function process_reg_step() {
1047 1047
 		// how have they chosen to pay?
1048
-		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE );
1048
+		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE);
1049 1049
 		// choose your own adventure based on method_of_payment
1050
-		switch(  $this->checkout->selected_method_of_payment ) {
1050
+		switch ($this->checkout->selected_method_of_payment) {
1051 1051
 
1052 1052
 			case 'events_sold_out' :
1053 1053
 				$this->checkout->redirect = TRUE;
1054 1054
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1055
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1055
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1056 1056
 				// mark this reg step as completed
1057 1057
 				$this->set_completed();
1058 1058
 				return FALSE;
1059 1059
 				break;
1060 1060
 
1061 1061
 			case 'payments_closed' :
1062
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) {
1063
-					EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1062
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) {
1063
+					EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1064 1064
 				}
1065 1065
 				// mark this reg step as completed
1066 1066
 				$this->set_completed();
@@ -1068,8 +1068,8 @@  discard block
 block discarded – undo
1068 1068
 				break;
1069 1069
 
1070 1070
 			case 'no_payment_required' :
1071
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) {
1072
-					EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1071
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) {
1072
+					EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1073 1073
 				}
1074 1074
 				// mark this reg step as completed
1075 1075
 				$this->set_completed();
@@ -1078,9 +1078,9 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
 			default:
1080 1080
 				$payment_successful = $this->_process_payment();
1081
-				if ( $payment_successful ) {
1081
+				if ($payment_successful) {
1082 1082
 					$this->checkout->continue_reg = true;
1083
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1083
+					$this->_maybe_set_completed($this->checkout->payment_method);
1084 1084
 				} else {
1085 1085
 					$this->checkout->continue_reg = false;
1086 1086
 				}
@@ -1098,8 +1098,8 @@  discard block
 block discarded – undo
1098 1098
 	 * @param \EE_Payment_Method $payment_method
1099 1099
 	 * @return void
1100 1100
 	 */
1101
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1102
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1101
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1102
+		switch ($payment_method->type_obj()->payment_occurs()) {
1103 1103
 			case EE_PMT_Base::offsite :
1104 1104
 				break;
1105 1105
 			case EE_PMT_Base::onsite :
@@ -1122,15 +1122,15 @@  discard block
 block discarded – undo
1122 1122
 	public function update_reg_step() {
1123 1123
 		$success = TRUE;
1124 1124
 		// if payment required
1125
-		if ( $this->checkout->transaction->total() > 0 ) {
1126
-			do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction );
1125
+		if ($this->checkout->transaction->total() > 0) {
1126
+			do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction);
1127 1127
 			// attempt payment via payment method
1128 1128
 			$success = $this->process_reg_step();
1129 1129
 		}
1130
-		if ( $success && ! $this->checkout->redirect ) {
1131
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
1130
+		if ($success && ! $this->checkout->redirect) {
1131
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
1132 1132
 			 // set return URL
1133
-			$this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url );
1133
+			$this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url);
1134 1134
 		}
1135 1135
 		return $success;
1136 1136
 	}
@@ -1150,24 +1150,24 @@  discard block
 block discarded – undo
1150 1150
 		// clear any previous errors related to not selecting a payment method
1151 1151
 //		EE_Error::overwrite_errors();
1152 1152
 		// ya gotta make a choice man
1153
-		if ( empty( $this->checkout->selected_method_of_payment )) {
1154
-			$this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' ));
1153
+		if (empty($this->checkout->selected_method_of_payment)) {
1154
+			$this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso'));
1155 1155
 			return FALSE;
1156 1156
 		}
1157 1157
 		// get EE_Payment_Method object
1158
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1158
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1159 1159
 			return FALSE;
1160 1160
 		}
1161 1161
 		// setup billing form
1162
-		if ( $this->checkout->payment_method->is_on_site() ) {
1163
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1162
+		if ($this->checkout->payment_method->is_on_site()) {
1163
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1164 1164
 			// bad billing form ?
1165
-			if ( ! $this->_billing_form_is_valid() ) {
1165
+			if ( ! $this->_billing_form_is_valid()) {
1166 1166
 				return FALSE;
1167 1167
 			}
1168 1168
 		}
1169 1169
 		// ensure primary registrant has been fully processed
1170
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1170
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1171 1171
 			return FALSE;
1172 1172
 		}
1173 1173
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1175,24 +1175,24 @@  discard block
 block discarded – undo
1175 1175
 		// in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved
1176 1176
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1177 1177
 		// attempt payment
1178
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1178
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1179 1179
 		// process results
1180
-		$payment = $this->_validate_payment( $payment );
1181
-		$payment = $this->_post_payment_processing( $payment );
1180
+		$payment = $this->_validate_payment($payment);
1181
+		$payment = $this->_post_payment_processing($payment);
1182 1182
 		// verify payment
1183
-		if ( $payment instanceof EE_Payment ) {
1183
+		if ($payment instanceof EE_Payment) {
1184 1184
 			// store that for later
1185 1185
 			$this->checkout->payment = $payment;
1186 1186
 			/** @type EE_Transaction_Processor $transaction_processor */
1187
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1187
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1188 1188
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1189
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1190
-			if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) {
1189
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1190
+			if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) {
1191 1191
 				return true;
1192 1192
 			} else {
1193 1193
 				return false;
1194 1194
 			}
1195
-		} else if ( $payment === true ) {
1195
+		} else if ($payment === true) {
1196 1196
 			// please note that offline payment methods will NOT make a payment,
1197 1197
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1198 1198
 			$this->checkout->payment = $payment;
@@ -1211,10 +1211,10 @@  discard block
 block discarded – undo
1211 1211
 	 * @return bool
1212 1212
 	 */
1213 1213
 	public function redirect_form() {
1214
-		$payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() );
1214
+		$payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment());
1215 1215
 		$html = $payment_method_billing_info->get_html_and_js();
1216 1216
 		$html .= $this->checkout->redirect_form;
1217
-		EE_Registry::instance()->REQ->add_output( $html );
1217
+		EE_Registry::instance()->REQ->add_output($html);
1218 1218
 		return TRUE;
1219 1219
 	}
1220 1220
 
@@ -1227,36 +1227,36 @@  discard block
 block discarded – undo
1227 1227
 	 * @return bool
1228 1228
 	 */
1229 1229
 	private function _billing_form_is_valid() {
1230
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1230
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1231 1231
 			return TRUE;
1232 1232
 		}
1233
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1234
-			if ( $this->checkout->billing_form->was_submitted() ) {
1233
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1234
+			if ($this->checkout->billing_form->was_submitted()) {
1235 1235
 				$this->checkout->billing_form->receive_form_submission();
1236
-				if ( $this->checkout->billing_form->is_valid() ) {
1236
+				if ($this->checkout->billing_form->is_valid()) {
1237 1237
 					return TRUE;
1238 1238
 				}
1239 1239
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1240 1240
 				$error_strings = array();
1241
-				foreach( $validation_errors as $validation_error ){
1242
-					if( $validation_error instanceof EE_Validation_Error ){
1241
+				foreach ($validation_errors as $validation_error) {
1242
+					if ($validation_error instanceof EE_Validation_Error) {
1243 1243
 						$form_section = $validation_error->get_form_section();
1244
-						if( $form_section instanceof EE_Form_Input_Base ){
1244
+						if ($form_section instanceof EE_Form_Input_Base) {
1245 1245
 							$label = $form_section->html_label_text();
1246
-						}elseif( $form_section instanceof EE_Form_Section_Base ){
1246
+						}elseif ($form_section instanceof EE_Form_Section_Base) {
1247 1247
 							$label = $form_section->name();
1248
-						}else{
1249
-							$label = __( 'Validation Error', 'event_espresso' );
1248
+						} else {
1249
+							$label = __('Validation Error', 'event_espresso');
1250 1250
 						}
1251
-						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() );
1251
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1252 1252
 					}
1253 1253
 				}
1254
-				EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings )  ), __FILE__, __FUNCTION__, __LINE__ );
1254
+				EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__);
1255 1255
 			} else {
1256
-				EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1256
+				EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1257 1257
 			}
1258 1258
 		} else {
1259
-			EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1259
+			EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1260 1260
 		}
1261 1261
 		return FALSE;
1262 1262
 	}
@@ -1274,9 +1274,9 @@  discard block
 block discarded – undo
1274 1274
 	 */
1275 1275
 		private function _setup_primary_registrant_prior_to_payment() {
1276 1276
 			// check if transaction has a primary registrant and that it has a related Attendee object
1277
-			if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1277
+			if ( ! $this->checkout->transaction_has_primary_registrant()) {
1278 1278
 				// need to at least gather some primary registrant data before attempting payment
1279
-				if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) {
1279
+				if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) {
1280 1280
 					return FALSE;
1281 1281
 				}
1282 1282
 			}
@@ -1284,13 +1284,13 @@  discard block
 block discarded – undo
1284 1284
 			// grab the primary_registration object
1285 1285
 			$primary_registration = $this->checkout->transaction->primary_registration();
1286 1286
 			/** @type EE_Transaction_Processor $transaction_processor */
1287
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1287
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1288 1288
 			// at this point we'll consider a TXN to not have been failed
1289
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1289
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1290 1290
 			// save the TXN ( which clears cached copy of primary_registration)
1291 1291
 			$this->checkout->transaction->save();
1292 1292
 			// grab TXN ID and save it to the primary_registration
1293
-			$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1293
+			$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1294 1294
 			// save what we have so far
1295 1295
 			$primary_registration->save();
1296 1296
 			return TRUE;
@@ -1307,41 +1307,41 @@  discard block
 block discarded – undo
1307 1307
 		private function _capture_primary_registration_data_from_billing_form() {
1308 1308
 			// convert billing form data into an attendee
1309 1309
 			$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1310
-			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1310
+			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1311 1311
 				EE_Error::add_error(
1312 1312
 					sprintf(
1313
-						__( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1313
+						__('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1314 1314
 						'<br/>',
1315
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1315
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1316 1316
 					), __FILE__, __FUNCTION__, __LINE__
1317 1317
 				);
1318 1318
 				return FALSE;
1319 1319
 			}
1320 1320
 			$primary_registration = $this->checkout->transaction->primary_registration();
1321
-			if ( ! $primary_registration instanceof EE_Registration ) {
1321
+			if ( ! $primary_registration instanceof EE_Registration) {
1322 1322
 				EE_Error::add_error(
1323 1323
 					sprintf(
1324
-						__( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1324
+						__('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1325 1325
 						'<br/>',
1326
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1326
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1327 1327
 					), __FILE__, __FUNCTION__, __LINE__
1328 1328
 				);
1329 1329
 				return FALSE;
1330 1330
 			}
1331
-			if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) {
1331
+			if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) {
1332 1332
 				EE_Error::add_error(
1333 1333
 					sprintf(
1334
-						__( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1334
+						__('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1335 1335
 						'<br/>',
1336
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1336
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1337 1337
 					), __FILE__, __FUNCTION__, __LINE__
1338 1338
 				);
1339 1339
 				return FALSE;
1340 1340
 			}
1341 1341
 			/** @type EE_Registration_Processor $registration_processor */
1342
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1342
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1343 1343
 			// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1344
-			$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1344
+			$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1345 1345
 
1346 1346
 			return TRUE;
1347 1347
 		}
@@ -1357,35 +1357,35 @@  discard block
 block discarded – undo
1357 1357
 	 */
1358 1358
 		private function _get_payment_method_for_selected_method_of_payment() {
1359 1359
 			// get EE_Payment_Method object
1360
-			if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) {
1361
-				$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1360
+			if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1361
+				$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1362 1362
 			} else {
1363 1363
 				// load EEM_Payment_Method
1364
-				EE_Registry::instance()->load_model( 'Payment_Method' );
1364
+				EE_Registry::instance()->load_model('Payment_Method');
1365 1365
 				/** @type EEM_Payment_Method $EEM_Payment_Method */
1366 1366
 				$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1367
-				$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1367
+				$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1368 1368
 			}
1369 1369
 			// verify $payment_method
1370
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
1370
+			if ( ! $payment_method instanceof EE_Payment_Method) {
1371 1371
 				// not a payment
1372 1372
 				EE_Error::add_error(
1373 1373
 					sprintf(
1374
-						__( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1374
+						__('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1375 1375
 						'<br/>',
1376
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1376
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1377 1377
 					), __FILE__, __FUNCTION__, __LINE__
1378 1378
 				);
1379 1379
 				return NULL;
1380 1380
 			}
1381 1381
 			// and verify it has a valid Payment_Method Type object
1382
-			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1382
+			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1383 1383
 				// not a payment
1384 1384
 				EE_Error::add_error(
1385 1385
 					sprintf(
1386
-						__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1386
+						__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1387 1387
 						'<br/>',
1388
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1388
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1389 1389
 					), __FILE__, __FUNCTION__, __LINE__
1390 1390
 				);
1391 1391
 				return NULL;
@@ -1404,30 +1404,30 @@  discard block
 block discarded – undo
1404 1404
 	 * 	@type 	EE_Payment_Method $payment_method
1405 1405
 	 * 	@return 	mixed	EE_Payment | boolean
1406 1406
 	 */
1407
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1408
-		$payment =NULL;
1407
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1408
+		$payment = NULL;
1409 1409
 		$this->checkout->transaction->save();
1410
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1411
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1410
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1411
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1412 1412
 			return FALSE;
1413 1413
 		}
1414 1414
 		try {
1415
-			$payment_processor->set_revisit( $this->checkout->revisit );
1415
+			$payment_processor->set_revisit($this->checkout->revisit);
1416 1416
 			// generate payment object
1417 1417
 			$payment = $payment_processor->process_payment(
1418 1418
 				$payment_method,
1419 1419
 				$this->checkout->transaction,
1420 1420
 				$this->checkout->amount_owing,
1421 1421
 				$this->checkout->billing_form,
1422
-				$this->_get_return_url( $payment_method ),
1422
+				$this->_get_return_url($payment_method),
1423 1423
 				'CART',
1424 1424
 				$this->checkout->admin_request,
1425 1425
 				TRUE,
1426 1426
 				$this->reg_step_url()
1427 1427
 			);
1428 1428
 
1429
-		} catch( Exception $e ) {
1430
-			$this->_handle_payment_processor_exception( $e );
1429
+		} catch (Exception $e) {
1430
+			$this->_handle_payment_processor_exception($e);
1431 1431
 		}
1432 1432
 		return $payment;
1433 1433
 	}
@@ -1441,12 +1441,12 @@  discard block
 block discarded – undo
1441 1441
 	 * @param \Exception $e
1442 1442
 	 * @return void
1443 1443
 	 */
1444
-	protected function _handle_payment_processor_exception( Exception $e ) {
1444
+	protected function _handle_payment_processor_exception(Exception $e) {
1445 1445
 		EE_Error::add_error(
1446 1446
 			sprintf(
1447
-				__( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ),
1447
+				__('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'),
1448 1448
 				'<br/>',
1449
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
1449
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
1450 1450
 				$e->getMessage(),
1451 1451
 				$e->getFile(),
1452 1452
 				$e->getLine()
@@ -1463,9 +1463,9 @@  discard block
 block discarded – undo
1463 1463
 	 * @param \EE_Payment_Method $payment_method
1464 1464
 	 * @return string
1465 1465
 	 */
1466
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
1466
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
1467 1467
 		$return_url = '';
1468
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1468
+		switch ($payment_method->type_obj()->payment_occurs()) {
1469 1469
 
1470 1470
 			case EE_PMT_Base::offsite :
1471 1471
 				$return_url = add_query_arg(
@@ -1496,27 +1496,27 @@  discard block
 block discarded – undo
1496 1496
 	 * @param EE_Payment $payment
1497 1497
 	 * @return EE_Payment | FALSE
1498 1498
 	 */
1499
-	private function _validate_payment( $payment = NULL ) {
1500
-		if (  $this->checkout->payment_method->is_off_line() ) {
1499
+	private function _validate_payment($payment = NULL) {
1500
+		if ($this->checkout->payment_method->is_off_line()) {
1501 1501
 			return TRUE;
1502 1502
 		}
1503 1503
 		// verify payment object
1504
-		if ( $payment instanceof EE_Payment ) {
1504
+		if ($payment instanceof EE_Payment) {
1505 1505
 			if (
1506 1506
 				$payment->status() != EEM_Payment::status_id_approved
1507 1507
 				&& $payment->status() != EEM_Payment::status_id_pending
1508 1508
 				&& $payment->status() != EEM_Payment::status_id_cancelled
1509 1509
 				&& $payment->gateway_response() != ''
1510 1510
 			) {
1511
-				EE_Error::add_error( $payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__ );
1511
+				EE_Error::add_error($payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__);
1512 1512
 			}
1513 1513
 		} else {
1514 1514
 			// not a payment
1515 1515
 			EE_Error::add_error(
1516 1516
 				sprintf(
1517
-					__( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1517
+					__('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1518 1518
 					'<br/>',
1519
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1519
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1520 1520
 				), __FILE__, __FUNCTION__, __LINE__
1521 1521
 			);
1522 1522
 			return FALSE;
@@ -1533,23 +1533,23 @@  discard block
 block discarded – undo
1533 1533
 	 * @param EE_Payment $payment
1534 1534
 	 * @return bool
1535 1535
 	 */
1536
-	private function _post_payment_processing( $payment = NULL ) {
1536
+	private function _post_payment_processing($payment = NULL) {
1537 1537
 		// On-Site payment?
1538
-		if ( $this->checkout->payment_method->is_on_site() ) {
1539
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) {
1538
+		if ($this->checkout->payment_method->is_on_site()) {
1539
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
1540 1540
 				//$this->_setup_redirect_for_next_step();
1541 1541
 				$this->checkout->continue_reg = false;
1542 1542
 			}
1543 1543
 			// Off-Site payment?
1544
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
1544
+		} else if ($this->checkout->payment_method->is_off_site()) {
1545 1545
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
1546
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ){
1547
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
1546
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
1547
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
1548 1548
 				$this->checkout->redirect = TRUE;
1549 1549
 				$this->checkout->redirect_form = $payment->redirect_form();
1550
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
1550
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
1551 1551
 				// set JSON response
1552
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
1552
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
1553 1553
 				// set cron job for finalizing the TXN
1554 1554
 				// in case the user does not return from the off-site gateway
1555 1555
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -1557,21 +1557,21 @@  discard block
 block discarded – undo
1557 1557
 					$this->checkout->transaction->ID()
1558 1558
 				);
1559 1559
 				// and lastly, let's bump the payment status to pending
1560
-				$payment->set_status( EEM_Payment::status_id_pending );
1560
+				$payment->set_status(EEM_Payment::status_id_pending);
1561 1561
 				$payment->save();
1562 1562
 			} else {
1563 1563
 				// not a payment
1564 1564
 				$this->checkout->continue_reg = false;
1565 1565
 				EE_Error::add_error(
1566 1566
 					sprintf(
1567
-						__( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1567
+						__('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1568 1568
 						'<br/>',
1569
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1569
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1570 1570
 					), __FILE__, __FUNCTION__, __LINE__
1571 1571
 				);
1572 1572
 			}
1573 1573
 			// Off-Line payment?
1574
-		} else if ( $payment === TRUE ) {
1574
+		} else if ($payment === TRUE) {
1575 1575
 			//$this->_setup_redirect_for_next_step();
1576 1576
 			return TRUE;
1577 1577
 		} else {
@@ -1607,65 +1607,65 @@  discard block
 block discarded – undo
1607 1607
 	 * @return bool
1608 1608
 	 * @throws \EE_Error
1609 1609
 	 */
1610
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
1610
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
1611 1611
 		// off-line payment? carry on
1612
-		if ( $payment_occurs == EE_PMT_Base::offline ) {
1612
+		if ($payment_occurs == EE_PMT_Base::offline) {
1613 1613
 			return true;
1614 1614
 		}
1615 1615
 		// verify payment validity
1616
-		if ( $payment instanceof EE_Payment ) {
1617
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
1616
+		if ($payment instanceof EE_Payment) {
1617
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
1618 1618
 			$msg = $payment->gateway_response();
1619 1619
 			// check results
1620
-			switch ( $payment->status() ) {
1620
+			switch ($payment->status()) {
1621 1621
 
1622 1622
 				// good payment
1623 1623
 				case EEM_Payment::status_id_approved :
1624
-					EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1624
+					EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1625 1625
 					return TRUE;
1626 1626
 					break;
1627 1627
 
1628 1628
 				// slow payment
1629 1629
 				case EEM_Payment::status_id_pending :
1630
-					if ( empty( $msg )) {
1631
-						$msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' );
1630
+					if (empty($msg)) {
1631
+						$msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso');
1632 1632
 					}
1633
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
1633
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
1634 1634
 					return TRUE;
1635 1635
 					break;
1636 1636
 
1637 1637
 				// don't wanna payment
1638 1638
 				case EEM_Payment::status_id_cancelled :
1639
-					if ( empty( $msg )) {
1639
+					if (empty($msg)) {
1640 1640
 						$msg = _n(
1641 1641
 							'Payment cancelled. Please try again.',
1642 1642
 							'Payment cancelled. Please try again or select another method of payment.',
1643
-							count( $this->checkout->available_payment_methods ),
1643
+							count($this->checkout->available_payment_methods),
1644 1644
 							'event_espresso'
1645 1645
 						);
1646 1646
 					}
1647
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1647
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1648 1648
 					return FALSE;
1649 1649
 					break;
1650 1650
 
1651 1651
 				// not enough payment
1652 1652
 				case EEM_Payment::status_id_declined :
1653
-					if ( empty( $msg )) {
1653
+					if (empty($msg)) {
1654 1654
 						$msg = _n(
1655 1655
 							'We\'re sorry but your payment was declined. Please try again.',
1656 1656
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
1657
-							count( $this->checkout->available_payment_methods ),
1657
+							count($this->checkout->available_payment_methods),
1658 1658
 							'event_espresso'
1659 1659
 						);
1660 1660
 					}
1661
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1661
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1662 1662
 					return FALSE;
1663 1663
 					break;
1664 1664
 
1665 1665
 				// bad payment
1666 1666
 				case EEM_Payment::status_id_failed :
1667
-					if ( ! empty( $msg ) ) {
1668
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1667
+					if ( ! empty($msg)) {
1668
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1669 1669
 						return false;
1670 1670
 					}
1671 1671
 					// default to error below
@@ -1675,14 +1675,14 @@  discard block
 block discarded – undo
1675 1675
 		}
1676 1676
 		// off-site payment gateway responses are too unreliable, so let's just assume that
1677 1677
 		// the payment processing is just running slower than the registrant's request
1678
-		if ( $payment_occurs == EE_PMT_Base::offsite ) {
1678
+		if ($payment_occurs == EE_PMT_Base::offsite) {
1679 1679
 			return true;
1680 1680
 		}
1681 1681
 		EE_Error::add_error(
1682 1682
 				sprintf(
1683
-					__( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1683
+					__('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1684 1684
 					'<br/>',
1685
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1685
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1686 1686
 				),
1687 1687
 				__FILE__, __FUNCTION__, __LINE__
1688 1688
 			);
@@ -1715,13 +1715,13 @@  discard block
 block discarded – undo
1715 1715
 	public function process_gateway_response() {
1716 1716
 		$payment = null;
1717 1717
 		// how have they chosen to pay?
1718
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1718
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1719 1719
 		// get EE_Payment_Method object
1720
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1720
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1721 1721
 			$this->checkout->continue_reg = false;
1722 1722
 			return false;
1723 1723
 		}
1724
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
1724
+		if ( ! $this->checkout->payment_method->is_off_site()) {
1725 1725
 			return false;
1726 1726
 		}
1727 1727
 		$this->_validate_offsite_return();
@@ -1735,23 +1735,23 @@  discard block
 block discarded – undo
1735 1735
 		//	true
1736 1736
 		//);
1737 1737
 		// verify TXN
1738
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1738
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1739 1739
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
1740
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
1740
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
1741 1741
 				$this->checkout->continue_reg = false;
1742 1742
 				return false;
1743 1743
 			}
1744
-			$payment = $this->_process_off_site_payment( $gateway );
1745
-			$payment = $this->_process_cancelled_payments( $payment );
1746
-			$payment = $this->_validate_payment( $payment );
1744
+			$payment = $this->_process_off_site_payment($gateway);
1745
+			$payment = $this->_process_cancelled_payments($payment);
1746
+			$payment = $this->_validate_payment($payment);
1747 1747
 			// if payment was not declined by the payment gateway or cancelled by the registrant
1748
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
1748
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
1749 1749
 				//$this->_setup_redirect_for_next_step();
1750 1750
 				// store that for later
1751 1751
 				$this->checkout->payment = $payment;
1752 1752
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
1753 1753
 				// because we will complete this step during the IPN processing then
1754
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) {
1754
+				if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) {
1755 1755
 					$this->set_completed();
1756 1756
 				}
1757 1757
 				return true;
@@ -1774,19 +1774,19 @@  discard block
 block discarded – undo
1774 1774
 	 * @return bool
1775 1775
 	 */
1776 1776
 	private function _validate_offsite_return() {
1777
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
1778
-		if ( $TXN_ID != $this->checkout->transaction->ID() ) {
1777
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
1778
+		if ($TXN_ID != $this->checkout->transaction->ID()) {
1779 1779
 			// Houston... we might have a problem
1780 1780
 			$invalid_TXN = false;
1781 1781
 			// first gather some info
1782
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1782
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1783 1783
 			$primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null;
1784 1784
 			// let's start by retrieving the cart for this TXN
1785
-			$cart = $this->checkout->get_cart_for_transaction( $this->checkout->transaction );
1786
-			if ( $cart instanceof EE_Cart ) {
1785
+			$cart = $this->checkout->get_cart_for_transaction($this->checkout->transaction);
1786
+			if ($cart instanceof EE_Cart) {
1787 1787
 				// verify that the current cart has tickets
1788 1788
 				$tickets = $cart->get_tickets();
1789
-				if ( empty( $tickets ) ) {
1789
+				if (empty($tickets)) {
1790 1790
 					$invalid_TXN = true;
1791 1791
 				}
1792 1792
 			} else {
@@ -1794,39 +1794,39 @@  discard block
 block discarded – undo
1794 1794
 			}
1795 1795
 			$valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null;
1796 1796
 			// validate current Session ID and compare against valid TXN session ID
1797
-			if ( EE_Session::instance()->id() === null ) {
1797
+			if (EE_Session::instance()->id() === null) {
1798 1798
 				$invalid_TXN = true;
1799
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
1799
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
1800 1800
 				// WARNING !!!
1801 1801
 				// this could be PayPal sending back duplicate requests (ya they do that)
1802 1802
 				// or it **could** mean someone is simply registering AGAIN after having just done so
1803 1803
 				// so now we need to determine if this current TXN looks valid or not
1804 1804
 				/** @type EE_Transaction_Processor $transaction_processor */
1805
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1805
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1806 1806
 				// has this step even been started ?
1807
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
1807
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
1808 1808
 				) {
1809 1809
 					// really? you're half way through this reg step, but you never started it ?
1810 1810
 					$invalid_TXN = true;
1811 1811
 				}
1812 1812
 			}
1813
-			if ( $invalid_TXN ) {
1813
+			if ($invalid_TXN) {
1814 1814
 				// is the valid TXN completed ?
1815
-				if ( $valid_TXN instanceof EE_Transaction ) {
1815
+				if ($valid_TXN instanceof EE_Transaction) {
1816 1816
 					/** @type EE_Transaction_Processor $transaction_processor */
1817
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1817
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1818 1818
 					// has this step even been started ?
1819
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
1820
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
1819
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
1820
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
1821 1821
 						// so it **looks** like this is a double request from PayPal
1822 1822
 						// so let's try to pick up where we left off
1823 1823
 						$this->checkout->transaction = $valid_TXN;
1824
-						$this->checkout->refresh_all_entities( true );
1824
+						$this->checkout->refresh_all_entities(true);
1825 1825
 						return;
1826 1826
 					}
1827 1827
 				}
1828 1828
 				// you appear to be lost?
1829
-				$this->_redirect_wayward_request( $primary_registrant );
1829
+				$this->_redirect_wayward_request($primary_registrant);
1830 1830
 			}
1831 1831
 		}
1832 1832
 	}
@@ -1840,16 +1840,16 @@  discard block
 block discarded – undo
1840 1840
 	 * @param \EE_Registration $primary_registrant
1841 1841
 	 * @return bool
1842 1842
 	 */
1843
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1844
-		if ( ! $primary_registrant instanceof EE_Registration ) {
1843
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
1844
+		if ( ! $primary_registrant instanceof EE_Registration) {
1845 1845
 			// try redirecting based on the current TXN
1846 1846
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null;
1847
-			if ( ! $primary_registrant instanceof EE_Registration ) {
1847
+			if ( ! $primary_registrant instanceof EE_Registration) {
1848 1848
 				EE_Error::add_error(
1849 1849
 					sprintf(
1850
-						__( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1850
+						__('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1851 1851
 						'<br/>',
1852
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1852
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1853 1853
 					),
1854 1854
 					__FILE__, __FUNCTION__, __LINE__
1855 1855
 				);
@@ -1877,16 +1877,16 @@  discard block
 block discarded – undo
1877 1877
 	 * @param \EE_Offsite_Gateway $gateway
1878 1878
 	 * @return \EE_Payment
1879 1879
 	 */
1880
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
1880
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
1881 1881
 		try {
1882 1882
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
1883
-			if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
1883
+			if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
1884 1884
 				$payment = $this->checkout->transaction->last_payment();
1885 1885
 				//$payment_source = 'last_payment';
1886 1886
 			} else {
1887 1887
 				// get payment details and process results
1888 1888
 				/** @type EE_Payment_Processor $payment_processor */
1889
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1889
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1890 1890
 				$payment = $payment_processor->process_ipn(
1891 1891
 					$_REQUEST,
1892 1892
 					$this->checkout->transaction,
@@ -1896,14 +1896,14 @@  discard block
 block discarded – undo
1896 1896
 				);
1897 1897
 				//$payment_source = 'process_ipn';
1898 1898
 			}
1899
-		} catch ( Exception $e ) {
1899
+		} catch (Exception $e) {
1900 1900
 			// let's just eat the exception and try to move on using any previously set payment info
1901 1901
 			$payment = $this->checkout->transaction->last_payment();
1902 1902
 			//$payment_source = 'last_payment after Exception';
1903 1903
 			// but if we STILL don't have a payment object
1904
-			if ( ! $payment instanceof EE_Payment ) {
1904
+			if ( ! $payment instanceof EE_Payment) {
1905 1905
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
1906
-				$this->_handle_payment_processor_exception( $e );
1906
+				$this->_handle_payment_processor_exception($e);
1907 1907
 			}
1908 1908
 		}
1909 1909
 		// DEBUG LOG
@@ -1927,13 +1927,13 @@  discard block
 block discarded – undo
1927 1927
 	 * @param EE_Payment $payment
1928 1928
 	 * @return EE_Payment | FALSE
1929 1929
 	 */
1930
-	private function _process_cancelled_payments( $payment = NULL ) {
1930
+	private function _process_cancelled_payments($payment = NULL) {
1931 1931
 		if (
1932
-			isset( $_REQUEST[ 'ee_cancel_payment' ] )
1932
+			isset($_REQUEST['ee_cancel_payment'])
1933 1933
 			&& $payment instanceof EE_Payment
1934 1934
 			&& $payment->status() == EEM_Payment::status_id_failed
1935 1935
 		) {
1936
-			$payment->set_status( EEM_Payment::status_id_cancelled );
1936
+			$payment->set_status(EEM_Payment::status_id_cancelled);
1937 1937
 		}
1938 1938
 		return $payment;
1939 1939
 	}
@@ -1950,23 +1950,23 @@  discard block
 block discarded – undo
1950 1950
 	public function get_transaction_details_for_gateways() {
1951 1951
 		$txn_details = array();
1952 1952
 		// ya gotta make a choice man
1953
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1953
+		if (empty($this->checkout->selected_method_of_payment)) {
1954 1954
 			$txn_details = array(
1955
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
1955
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
1956 1956
 			);
1957 1957
 		}
1958 1958
 		// get EE_Payment_Method object
1959 1959
 		if (
1960
-			empty( $txn_details ) &&
1960
+			empty($txn_details) &&
1961 1961
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
1962 1962
 		) {
1963 1963
 			$txn_details = array(
1964 1964
 				'selected_method_of_payment' => $this->checkout->selected_method_of_payment,
1965
-				'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' )
1965
+				'error' => __('A valid Payment Method could not be determined.', 'event_espresso')
1966 1966
 			);
1967 1967
 		}
1968
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
1969
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
1968
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
1969
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
1970 1970
 			$txn_details = array(
1971 1971
 				'TXN_ID'        			=> $this->checkout->transaction->ID(),
1972 1972
 				'TXN_timestamp' 	=> $this->checkout->transaction->datetime(),
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 				'PMD_ID'        			=> $this->checkout->transaction->payment_method_ID(),
1978 1978
 				'payment_amount' => $this->checkout->amount_owing,
1979 1979
 				'return_url' 				=> $return_url,
1980
-				'cancel_url' 				=> add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
1980
+				'cancel_url' 				=> add_query_arg(array('ee_cancel_payment' => true), $return_url),
1981 1981
 				'notify_url' 				=> EE_Config::instance()->core->txn_page_url(
1982 1982
 					array(
1983 1983
 						'e_reg_url_link'    			=> $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
 				)
1987 1987
 			);
1988 1988
 		}
1989
-		echo json_encode( $txn_details );
1989
+		echo json_encode($txn_details);
1990 1990
 		exit();
1991 1991
 	}
1992 1992
 
Please login to merge, or discard this patch.
reg_steps/payment_options/events_requiring_pre_approval.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 
2
-	<h4><span class="orange-text"><?php _e('Important Notice: Events Requiring Pre-Approval', 'event_espresso');?></span></h4>
2
+	<h4><span class="orange-text"><?php _e('Important Notice: Events Requiring Pre-Approval', 'event_espresso'); ?></span></h4>
3 3
 	<p id="events-requiring-pre-approval-pg" class="small-text drk-grey-text">
4 4
 		<?php echo $events_requiring_pre_approval_msg; ?>
5 5
 	</p>
6 6
 	<ul id="spco-pre-approval-events-ul"><?php echo $events_requiring_pre_approval; ?></ul>
7 7
 
8
-	<?php echo $default_hidden_inputs;  ?>
9
-	<?php echo $extra_hidden_inputs;  ?>
8
+	<?php echo $default_hidden_inputs; ?>
9
+	<?php echo $extra_hidden_inputs; ?>
10 10
 
11 11
 	<!--	<input id="reg-page-selected-method-of-payment" type="hidden" value="payments_closed" name="selected_method_of_payment">-->
12 12
 <!--	<input type="hidden" id="reg-page-no-payment-required-payment_options" name="_reg-page-no-payment-required" value="1" />-->
Please login to merge, or discard this patch.
reg_steps/payment_options/no_payment_required.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
1 1
 <?php
2
-if( is_array( $registrations_for_free_events ) && ! empty( $registrations_for_free_events ) ) {
2
+if (is_array($registrations_for_free_events) && ! empty($registrations_for_free_events)) {
3 3
 	echo apply_filters(
4 4
 		'FHEE__registration_page_payment_options__no_payment_required_hdr',
5 5
 		sprintf(
6
-			__( '%1$sNo Payment Required%2$s', 'event_espresso' ),
6
+			__('%1$sNo Payment Required%2$s', 'event_espresso'),
7 7
 			'<h6>',
8 8
 			'</h6>'
9 9
 		)
10 10
 	);
11
-	foreach ( $registrations_for_free_events as $registration_for_free_event ) {
12
-		if ( $registration_for_free_event instanceof EE_Registration && $registration_for_free_event->ticket()->is_free() ) {
13
-			if ( $registration_for_free_event->event() instanceof EE_Event ) {
11
+	foreach ($registrations_for_free_events as $registration_for_free_event) {
12
+		if ($registration_for_free_event instanceof EE_Registration && $registration_for_free_event->ticket()->is_free()) {
13
+			if ($registration_for_free_event->event() instanceof EE_Event) {
14 14
 				?>
15 15
 				<p>
16 16
 					<?php echo apply_filters(
17 17
 						'FHEE__registration_page_payment_options__no_payment_required_pg',
18 18
 						sprintf(
19
-							__( '"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.', 'event_espresso' ),
19
+							__('"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.', 'event_espresso'),
20 20
 							$registration_for_free_event->ticket()->name(),
21 21
 							$registration_for_free_event->event()->name()
22 22
 						)
Please login to merge, or discard this patch.
single_page_checkout/reg_steps/payment_options/sold_out_events.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 
2
-	<h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso');?></b></h4>
2
+	<h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso'); ?></b></h4>
3 3
 	<ul id="spco-sold-out-events-ul"><?php echo $sold_out_events; ?></ul>
4
-	<h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso');?></h6>
4
+	<h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso'); ?></h6>
5 5
 	<p id="events-requiring-pre-approval-pg" class="small-text drk-grey-text">
6 6
 		<?php echo $sold_out_events_msg; ?>
7 7
 	</p>
8 8
 
9
-	<?php echo $default_hidden_inputs;  ?>
10
-	<?php echo $extra_hidden_inputs;  ?>
9
+	<?php echo $default_hidden_inputs; ?>
10
+	<?php echo $extra_hidden_inputs; ?>
Please login to merge, or discard this patch.