Completed
Branch FET-9576-iframes (685a28)
by
unknown
196:05 queued 174:48
created
caffeinated/EE_Caf_Messages.class.php 1 patch
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @since            4.3.2
16 16
  * @author          Darren Ethier
17 17
  */
18
-class EE_Caf_Messages  {
18
+class EE_Caf_Messages {
19 19
 
20 20
 
21 21
 	/**
@@ -34,36 +34,36 @@  discard block
 block discarded – undo
34 34
 	 * @return void
35 35
 	 */
36 36
 	private function _caf_hooks() {
37
-		add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array( $this, 'messages_autoload_paths'), 5 );
38
-		add_filter('FHEE__EE_Email_messenger__get_validator_config', array( $this, 'email_messenger_validator_config'), 5, 2 );
39
-		add_filter('FHEE__EE_Email_messenger__get_template_fields', array( $this, 'email_messenger_template_fields'), 5, 2 );
40
-		add_filter( 'FHEE__EE_Html_messenger__get_template_fields', array( $this, 'html_messenger_template_fields' ), 5, 2 );
41
-		add_filter( 'FHEE__EE_Html_messenger__get_validator_config', array( $this, 'html_messenger_validator_config' ), 5, 2 );
42
-		add_filter( 'FHEE__EE_Pdf_messenger__get_template_fields', array( $this, 'pdf_messenger_template_fields' ), 5, 2 );
43
-		add_filter( 'FHEE__EE_Pdf_messenger__get_validator_config', array( $this, 'pdf_messenger_validator_config' ), 5, 2 );
44
-		add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array( $this, 'new_default_templates'), 5, 7 );
45
-		add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array( $this, 'message_types_valid_shortcodes'), 5, 2 );
37
+		add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5);
38
+		add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), 5, 2);
39
+		add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, 2);
40
+		add_filter('FHEE__EE_Html_messenger__get_template_fields', array($this, 'html_messenger_template_fields'), 5, 2);
41
+		add_filter('FHEE__EE_Html_messenger__get_validator_config', array($this, 'html_messenger_validator_config'), 5, 2);
42
+		add_filter('FHEE__EE_Pdf_messenger__get_template_fields', array($this, 'pdf_messenger_template_fields'), 5, 2);
43
+		add_filter('FHEE__EE_Pdf_messenger__get_validator_config', array($this, 'pdf_messenger_validator_config'), 5, 2);
44
+		add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array($this, 'new_default_templates'), 5, 7);
45
+		add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, 2);
46 46
 
47 47
 		//shortcode parsers
48
-		add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array( $this, 'additional_attendee_shortcodes'), 5, 2 );
49
-		add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array( $this, 'additional_attendee_parser'), 5, 5 );
50
-		add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array( $this, 'additional_recipient_details_shortcodes'), 5, 2 );
51
-		add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array( $this, 'additional_recipient_details_parser'), 5, 5 );
52
-		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array( $this, 'additional_primary_registration_details_shortcodes'), 5, 2 );
53
-		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array( $this, 'additional_primary_registration_details_parser'), 5, 5 );
48
+		add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2);
49
+		add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5);
50
+		add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array($this, 'additional_recipient_details_shortcodes'), 5, 2);
51
+		add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array($this, 'additional_recipient_details_parser'), 5, 5);
52
+		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array($this, 'additional_primary_registration_details_shortcodes'), 5, 2);
53
+		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array($this, 'additional_primary_registration_details_parser'), 5, 5);
54 54
 
55 55
 		/**
56 56
 		 * @since 4.2.0
57 57
 		 */
58
-		add_filter( 'FHEE__EE_Datetime_Shortcodes__shortcodes', array( $this, 'additional_datetime_shortcodes'), 10, 2 );
59
-		add_filter( 'FHEE__EE_Datetime_Shortcodes__parser_after', array( $this, 'additional_datetime_parser'), 10, 5 );
58
+		add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2);
59
+		add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5);
60 60
 
61 61
 		/**
62 62
 		 * @since 4.3.0
63 63
 		 */
64 64
 		//eat our own dog food!
65
-		add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_message_types' ) );
66
-		add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_shortcodes' ) );
65
+		add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types'));
66
+		add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes'));
67 67
 		do_action('EE_Brewing_Regular___messages_caf');
68 68
 	}
69 69
 
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 * @param  array  $dir_ref original array of paths
75 75
 	 * @return array           appended paths
76 76
 	 */
77
-	public function messages_autoload_paths( $dir_ref ) {
78
-		$dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/';
77
+	public function messages_autoload_paths($dir_ref) {
78
+		$dir_ref[] = EE_CAF_LIBRARIES.'shortcodes/';
79 79
 		return $dir_ref;
80 80
 	}
81 81
 
82 82
 
83 83
 
84
-	public function email_messenger_validator_config( $validator_config, EE_Email_messenger $messenger ) {
84
+	public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) {
85 85
 		$validator_config['attendee_list'] = array(
86 86
 				'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'),
87 87
 				'required' => array('[ATTENDEE_LIST]')
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
 
97 97
 
98
-	public function html_messenger_validator_config( $validator_config, EE_Html_messenger $messenger ) {
98
+	public function html_messenger_validator_config($validator_config, EE_Html_messenger $messenger) {
99 99
 		$validator_config['attendee_list'] = array(
100 100
 			'shortcodes' => array('attendee', 'question_list'),
101 101
 			'required' => array('[ATTENDEE_LIST]')
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 
111 111
 
112
-	public function pdf_messenger_validator_config( $validator_config, EE_Pdf_messenger $messenger ) {
112
+	public function pdf_messenger_validator_config($validator_config, EE_Pdf_messenger $messenger) {
113 113
 		$validator_config['attendee_list'] = array(
114 114
 			'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'),
115 115
 			'required' => array('[ATTENDEE_LIST]')
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 
126 126
 
127
-	public function email_messenger_template_fields( $template_fields, EE_Email_messenger $messenger ) {
127
+	public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) {
128 128
 		$template_fields['extra']['content']['question_list'] = array(
129 129
 						'input' => 'textarea',
130 130
 						'label' => '[QUESTION_LIST]',
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	}
141 141
 
142 142
 
143
-	public function html_messenger_template_fields( $template_fields, EE_Html_messenger $messenger ) {
143
+	public function html_messenger_template_fields($template_fields, EE_Html_messenger $messenger) {
144 144
 		$template_fields['extra']['content']['question_list'] = array(
145 145
 			'input' => 'textarea',
146 146
 			'label' => '[QUESTION_LIST]',
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
 
159 159
 
160
-	public function pdf_messenger_template_fields( $template_fields, EE_Pdf_messenger $messenger ) {
160
+	public function pdf_messenger_template_fields($template_fields, EE_Pdf_messenger $messenger) {
161 161
 		$template_fields['extra']['content']['question_list'] = array(
162 162
 			'input' => 'textarea',
163 163
 			'label' => '[QUESTION_LIST]',
@@ -174,39 +174,39 @@  discard block
 block discarded – undo
174 174
 
175 175
 
176 176
 
177
-	public function new_default_templates( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack  ) {
177
+	public function new_default_templates($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) {
178 178
 
179 179
 		//we're only modifying templates for the default template pack
180
-		if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default ) {
180
+		if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) {
181 181
 			return $contents;
182 182
 		}
183 183
 
184 184
 		//the template file name we're replacing contents for.
185
-		$template_file_prefix = $field . '_' . $context;
186
-		$msg_prefix = $messenger->name . '_' . $message_type->name . '_' ;
185
+		$template_file_prefix = $field.'_'.$context;
186
+		$msg_prefix = $messenger->name.'_'.$message_type->name.'_';
187 187
 
188
-		$base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/';
188
+		$base_path = EE_CAF_LIBRARIES.'messages/defaults/default/';
189 189
 
190
-		if ( $messenger->name == 'email' && $message_type->name == 'registration' ) {
190
+		if ($messenger->name == 'email' && $message_type->name == 'registration') {
191 191
 
192
-			switch ( $template_file_prefix ) {
192
+			switch ($template_file_prefix) {
193 193
 
194 194
 				case 'question_list_admin' :
195 195
 				case 'question_list_attendee' :
196 196
 				case 'question_list_primary_attendee' :
197
-					$path = $base_path . $msg_prefix . 'question_list.template.php';
198
-					$contents = EEH_Template::display_template( $path, array(), true );
197
+					$path = $base_path.$msg_prefix.'question_list.template.php';
198
+					$contents = EEH_Template::display_template($path, array(), true);
199 199
 					break;
200 200
 
201 201
 				case 'attendee_list_primary_attendee' :
202
-					$path = $base_path . $msg_prefix . 'attendee_list.template.php';
203
-					$contents = EEH_Template::display_template( $path, array(), true );
202
+					$path = $base_path.$msg_prefix.'attendee_list.template.php';
203
+					$contents = EEH_Template::display_template($path, array(), true);
204 204
 					break;
205 205
 
206 206
 				case 'attendee_list_admin' :
207
-					$path = $base_path . $msg_prefix . 'attendee_list_admin.template.php';
208
-					$contents = EEH_Template::display_template( $path,
209
-						array(), true );
207
+					$path = $base_path.$msg_prefix.'attendee_list_admin.template.php';
208
+					$contents = EEH_Template::display_template($path,
209
+						array(), true);
210 210
 					break;
211 211
 
212 212
 				case 'attendee_list_attendee' :
@@ -214,33 +214,33 @@  discard block
 block discarded – undo
214 214
 					break;
215 215
 
216 216
 				case 'event_list_attendee' :
217
-					$path = $base_path . $msg_prefix . 'event_list_attendee.template.php';
218
-					$contents = EEH_Template::display_template( $path, array(), true );
217
+					$path = $base_path.$msg_prefix.'event_list_attendee.template.php';
218
+					$contents = EEH_Template::display_template($path, array(), true);
219 219
 					break;
220 220
 			}
221
-		} elseif ( $messenger->name == 'email' && $message_type->name == 'newsletter' ) {
222
-			switch( $template_file_prefix ) {
221
+		} elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') {
222
+			switch ($template_file_prefix) {
223 223
 
224 224
 				case 'content_attendee' :
225
-					$path = $base_path . $msg_prefix . 'content.template.php';
226
-					$contents = EEH_Template::display_template( $path, array(), true );
225
+					$path = $base_path.$msg_prefix.'content.template.php';
226
+					$contents = EEH_Template::display_template($path, array(), true);
227 227
 					break;
228 228
 
229 229
 				case 'newsletter_content_attendee' :
230
-					$path = $base_path . $msg_prefix . 'newsletter_content.template.php';
231
-					$contents = EEH_Template::display_template( $path, array(), true );
230
+					$path = $base_path.$msg_prefix.'newsletter_content.template.php';
231
+					$contents = EEH_Template::display_template($path, array(), true);
232 232
 					break;
233 233
 
234 234
 				case 'newsletter_subject_attendee' :
235
-					$path = $base_path . $msg_prefix . 'subject.template.php';
236
-					$contents = EEH_Template::display_template( $path, array(), true );
235
+					$path = $base_path.$msg_prefix.'subject.template.php';
236
+					$contents = EEH_Template::display_template($path, array(), true);
237 237
 					break;
238 238
 			}
239
-		} elseif ( $messenger->name == 'html' && $message_type->name == 'receipt' ) {
240
-			switch  ( $template_file_prefix ) {
239
+		} elseif ($messenger->name == 'html' && $message_type->name == 'receipt') {
240
+			switch ($template_file_prefix) {
241 241
 				case 'attendee_list_purchaser' :
242
-					$path = $base_path . $msg_prefix . 'attendee_list.template.php';
243
-					$contents = EEH_Template::display_template( $path, array(), true );
242
+					$path = $base_path.$msg_prefix.'attendee_list.template.php';
243
+					$contents = EEH_Template::display_template($path, array(), true);
244 244
 					break;
245 245
 			}
246 246
 		}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
 
253 253
 
254
-	public function message_types_valid_shortcodes( $valid_shortcodes, EE_Messages_Base $msg ) {
254
+	public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) {
255 255
 		//make sure question_list and question are ONLY added for the core message types.  Any other message types will have to explicitly set question_list as a valid shortcode.
256 256
 		$include_with = array(
257 257
 			'registration',
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 			'invoice',
269 269
 			'receipt'
270 270
 			);
271
-		if ( $msg instanceof EE_message_type && in_array( $msg->name, $include_with )) {
271
+		if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) {
272 272
 			$contexts = array_keys($msg->get_contexts());
273
-				foreach ( $contexts as $context ) {
273
+				foreach ($contexts as $context) {
274 274
 					$valid_shortcodes[$context][] = 'question_list';
275 275
 					$valid_shortcodes[$context][] = 'question';
276 276
 				}
@@ -282,40 +282,40 @@  discard block
 block discarded – undo
282 282
 
283 283
 
284 284
 
285
-	public function additional_attendee_shortcodes( $shortcodes, $shortcode_parser ) {
285
+	public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) {
286 286
 		$shortcodes['[ANSWER_*]'] = __('This is a special dynamic shortcode. Right after the "*", add the exact text of a existing question, and if there is an answer for that question for this registrant, that will take the place of this shortcode.', 'event_espresso');
287 287
 		return $shortcodes;
288 288
 	}
289 289
 
290 290
 
291 291
 
292
-	public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
292
+	public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
293 293
 
294
-		if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) )
294
+		if (strpos($shortcode, '[ANSWER_*') === FALSE || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations))
295 295
 			return $parsed;
296 296
 
297 297
 		//let's get the question from the code.
298 298
 		$shortcode = str_replace('[ANSWER_*', '', $shortcode);
299
-		$shortcode = trim( str_replace(']', '', $shortcode) );
299
+		$shortcode = trim(str_replace(']', '', $shortcode));
300 300
 
301 301
 		$registration = $data instanceof EE_Registration ? $data : null;
302
-		$registration = ! $registration instanceof EE_Registration && is_array( $extra_data ) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration;
302
+		$registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration;
303 303
 
304 304
 		$aee = $data instanceof EE_Messages_Addressee ? $data : null;
305
-		$aee = ! $aee instanceof EE_Messages_Addressee && is_array( $extra_data ) && isset( $extra_data['data'] ) ? $extra_data['data'] : $aee;
305
+		$aee = ! $aee instanceof EE_Messages_Addressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee;
306 306
 
307
-		if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee ) {
307
+		if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) {
308 308
 			return $parsed;
309 309
 		}
310 310
 
311 311
 		//now let's figure out which question has this text.
312
-		foreach ( $aee->questions as $ansid => $question ) {
312
+		foreach ($aee->questions as $ansid => $question) {
313 313
 			if (
314 314
 				$question instanceof EE_Question
315
-				&& trim( $question->display_text() ) == trim( $shortcode )
316
-				&& isset( $aee->registrations[ $registration->ID() ]['ans_objs'][ $ansid ] )
315
+				&& trim($question->display_text()) == trim($shortcode)
316
+				&& isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid])
317 317
 			) {
318
-				return $aee->registrations[ $registration->ID() ]['ans_objs'][ $ansid ]->get_pretty('ANS_value', 'no_wpautop');
318
+				return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop');
319 319
 			}
320 320
 		}
321 321
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	 * @return array                   						array of shortcodes and
337 337
 	 *                                             			descriptions
338 338
 	 */
339
-	public function additional_datetime_shortcodes( $shortcodes, $shortcode_parser ) {
339
+	public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) {
340 340
 		$shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', 'event_espresso');
341 341
 		$shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', 'event_espresso');
342 342
 		$shortcodes['[DTT_NAME_OR_DATES]'] = __('When parsed, if the Datetime has a name, it is used, otherwise a formatted string including the start date and end date will be used.', 'event_espresso');
@@ -358,13 +358,13 @@  discard block
 block discarded – undo
358 358
 	 * @param  EE_Datetime_Shortcodes $shortcode_parser
359 359
 	 * @return string                   The new parsed string.
360 360
 	 */
361
-	public function additional_datetime_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
361
+	public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
362 362
 
363
-		if ( ! $data instanceof EE_Datetime ) {
363
+		if ( ! $data instanceof EE_Datetime) {
364 364
 			return ''; //get out because we can only parse with the datetime object.
365 365
 		}
366 366
 
367
-		switch ( $shortcode ) {
367
+		switch ($shortcode) {
368 368
 			case '[DTT_NAME]' :
369 369
 				return $data->name();
370 370
 				break;
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 				return $data->description();
373 373
 				break;
374 374
 			case '[DTT_NAME_OR_DATES]' :
375
-				return $data->get_dtt_display_name( TRUE );
375
+				return $data->get_dtt_display_name(TRUE);
376 376
 				break;
377 377
 			default :
378 378
 				return $parsed;
@@ -384,40 +384,40 @@  discard block
 block discarded – undo
384 384
 
385 385
 
386 386
 
387
-	public function additional_recipient_details_shortcodes( $shortcodes, $shortcode_parser ) {
387
+	public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) {
388 388
 		$shortcodes['[RECIPIENT_QUESTION_LIST]'] = __('This is used to indicate where you want the list of questions and answers to show for the person receiving the message.', 'event_espresso');
389 389
 		return $shortcodes;
390 390
 	}
391 391
 
392 392
 
393
-	public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
393
+	public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
394 394
 
395
-		if ( array($data) && ! isset( $data['data'] ) )
395
+		if (array($data) && ! isset($data['data']))
396 396
 			return $parsed;
397 397
 
398 398
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
399
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
399
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
400 400
 
401
-		if ( ! $recipient instanceof EE_Messages_Addressee )
401
+		if ( ! $recipient instanceof EE_Messages_Addressee)
402 402
 			return $parsed;
403 403
 
404
-		switch ( $shortcode ) {
404
+		switch ($shortcode) {
405 405
 			case '[RECIPIENT_QUESTION_LIST]' :
406 406
 				$att = $recipient->att_obj;
407 407
 				$registrations_on_attendee = $att instanceof EE_Attendee ? $recipient->attendees[$att->ID()]['reg_objs'] : array();
408
-				$registrations_on_attendee = empty( $registrations_on_attendee ) && $recipient->reg_obj instanceof EE_Registration ? array( $recipient->reg_obj ) : $registrations_on_attendee;
408
+				$registrations_on_attendee = empty($registrations_on_attendee) && $recipient->reg_obj instanceof EE_Registration ? array($recipient->reg_obj) : $registrations_on_attendee;
409 409
 				$answers = array();
410 410
 
411
-				$template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
411
+				$template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
412 412
 				$valid_shortcodes = array('question');
413 413
 
414 414
 				//if the context is main_content then get all answers for all registrations on this attendee
415
-				if ( $data['data'] instanceof EE_Messages_Addressee ) {
416
-					foreach ( $registrations_on_attendee as $reg ) {
417
-						if ( $reg instanceof EE_Registration ) {
418
-							$anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
419
-							foreach( $anss as $ans ) {
420
-								if ( $ans instanceof EE_Answer ) {
415
+				if ($data['data'] instanceof EE_Messages_Addressee) {
416
+					foreach ($registrations_on_attendee as $reg) {
417
+						if ($reg instanceof EE_Registration) {
418
+							$anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
419
+							foreach ($anss as $ans) {
420
+								if ($ans instanceof EE_Answer) {
421 421
 									$answers[$ans->ID()] = $ans;
422 422
 								}
423 423
 							}
@@ -426,13 +426,13 @@  discard block
 block discarded – undo
426 426
 				}
427 427
 
428 428
 				//if the context is the event list parser, then let's return just the answers for all registrations attached to the recipient for that event.
429
-				if ( $data['data'] instanceof EE_Event ) {
429
+				if ($data['data'] instanceof EE_Event) {
430 430
 					$event = $data['data'];
431
-					foreach( $registrations_on_attendee as $reg ) {
432
-						if ( $reg instanceof EE_Registration && $reg->event_ID() == $event->ID() ) {
433
-							$anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
434
-							foreach( $anss as $ans ) {
435
-								if ( $ans instanceof EE_Answer ) {
431
+					foreach ($registrations_on_attendee as $reg) {
432
+						if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) {
433
+							$anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
434
+							foreach ($anss as $ans) {
435
+								if ($ans instanceof EE_Answer) {
436 436
 									$answers[$ans->ID()] = $ans;
437 437
 								}
438 438
 							}
@@ -442,13 +442,13 @@  discard block
 block discarded – undo
442 442
 
443 443
 				$question_list = '';
444 444
 				$shortcode_helper = $shortcode_parser->get_shortcode_helper();
445
-				foreach ( $answers as $answer ) {
446
-					if ( $answer instanceof EE_Answer ) {
445
+				foreach ($answers as $answer) {
446
+					if ($answer instanceof EE_Answer) {
447 447
 						$question = $answer->question();
448
-						if ( ! $question instanceof EE_Question || ( $question instanceof EE_Question && $question->admin_only() ) ) {
448
+						if ( ! $question instanceof EE_Question || ($question instanceof EE_Question && $question->admin_only())) {
449 449
 							continue;
450 450
 						}
451
-						$question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $extra_data);
451
+						$question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $extra_data);
452 452
 					}
453 453
 				}
454 454
 				return $question_list;
@@ -461,41 +461,41 @@  discard block
 block discarded – undo
461 461
 	}
462 462
 
463 463
 
464
-	public function additional_primary_registration_details_shortcodes( $shortcodes, $shortcode_parser ) {
464
+	public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) {
465 465
 		$shortcodes['[PRIMARY_REGISTRANT_QUESTION_LIST]'] = __('This is used to indicate the questions and answers for the primary_registrant. It should be placed in the "[attendee_list]" field', 'event_espresso');
466 466
 		return $shortcodes;
467 467
 	}
468 468
 
469 469
 
470
-	public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
471
-		if ( array($data) && ! isset( $data['data'] ) )
470
+	public function additional_primary_registration_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
471
+		if (array($data) && ! isset($data['data']))
472 472
 			return $parsed;
473 473
 
474 474
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
475
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
475
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
476 476
 
477
-		if ( ! $recipient instanceof EE_Messages_Addressee )
477
+		if ( ! $recipient instanceof EE_Messages_Addressee)
478 478
 			return $parsed;
479 479
 
480 480
 		$send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data;
481 481
 
482
-		switch ( $shortcode ) {
482
+		switch ($shortcode) {
483 483
 			case '[RECIPIENT_QUESTION_LIST]' :
484
-				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration )
484
+				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration)
485 485
 					return '';
486 486
 				$registration = $recipient->primary_reg_obj;
487
-				$template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
487
+				$template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
488 488
 				$valid_shortcodes = array('question');
489 489
 				$shortcode_helper = $shortcode_parser->get_shortcode_helper();
490 490
 				$answers = $recipient->registrations[$registration->ID()]['ans_objs'];
491 491
 				$question_list = '';
492
-				foreach ( $answers as $answer ) {
493
-					if ( $answer instanceof EE_Answer ) {
492
+				foreach ($answers as $answer) {
493
+					if ($answer instanceof EE_Answer) {
494 494
 						$question = $answer->question();
495
-						if ( $question instanceof EE_Question and $question->admin_only() ) {
495
+						if ($question instanceof EE_Question and $question->admin_only()) {
496 496
 							continue;
497 497
 						}
498
-						$question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $send_data);
498
+						$question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $send_data);
499 499
 					}
500 500
 				}
501 501
 				return $question_list;
@@ -521,67 +521,67 @@  discard block
 block discarded – undo
521 521
 		$setup_args = array(
522 522
 			'mtfilename' => 'EE_Newsletter_message_type.class.php',
523 523
 			'autoloadpaths' => array(
524
-				EE_CAF_LIBRARIES . 'messages/message_type/newsletter/'
524
+				EE_CAF_LIBRARIES.'messages/message_type/newsletter/'
525 525
 				),
526
-			'messengers_to_activate_with' => array( 'email' ),
527
-			'messengers_to_validate_with' => array( 'email' )
526
+			'messengers_to_activate_with' => array('email'),
527
+			'messengers_to_validate_with' => array('email')
528 528
 			);
529
-		EE_Register_Message_Type::register( 'newsletter', $setup_args );
529
+		EE_Register_Message_Type::register('newsletter', $setup_args);
530 530
 
531 531
 		//register payment reminder message type
532 532
 		$setup_args = array(
533 533
 			'mtfilename' => 'EE_Payment_Reminder_message_type.class.php',
534
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/' ),
535
-			'messengers_to_activate_with' => array( 'email' ),
536
-			'messengers_to_validate_with' => array( 'email' )
534
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_reminder/'),
535
+			'messengers_to_activate_with' => array('email'),
536
+			'messengers_to_validate_with' => array('email')
537 537
 			);
538
-		EE_Register_Message_Type::register( 'payment_reminder', $setup_args );
538
+		EE_Register_Message_Type::register('payment_reminder', $setup_args);
539 539
 
540 540
 		//register payment declined message type
541 541
 		$setup_args = array(
542 542
 			'mtfilename' => 'EE_Payment_Declined_message_type.class.php',
543
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/' ),
544
-			'messengers_to_activate_with' => array( 'email' ),
545
-			'messengers_to_validate_with' => array( 'email' )
543
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_declined/'),
544
+			'messengers_to_activate_with' => array('email'),
545
+			'messengers_to_validate_with' => array('email')
546 546
 			);
547
-		EE_Register_Message_Type::register( 'payment_declined', $setup_args );
547
+		EE_Register_Message_Type::register('payment_declined', $setup_args);
548 548
 
549 549
 		//register registration declined message type
550 550
 		$setup_args = array(
551 551
 			'mtfilename' => 'EE_Declined_Registration_message_type.class.php',
552
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/' ),
553
-			'messengers_to_activate_with' => array( 'email' ),
554
-			'messengers_to_validate_with' => array( 'email' )
552
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/declined_registration/'),
553
+			'messengers_to_activate_with' => array('email'),
554
+			'messengers_to_validate_with' => array('email')
555 555
 			);
556
-		EE_Register_Message_Type::register( 'declined_registration', $setup_args );
556
+		EE_Register_Message_Type::register('declined_registration', $setup_args);
557 557
 
558 558
 		//register registration cancelled message type
559 559
 		$setup_args = array(
560 560
 			'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php',
561
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/' ),
562
-			'messengers_to_activate_with' => array( 'email' ),
563
-			'messengers_to_validate_with' => array( 'email' )
561
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/cancelled_registration/'),
562
+			'messengers_to_activate_with' => array('email'),
563
+			'messengers_to_validate_with' => array('email')
564 564
 			);
565
-		EE_Register_Message_Type::register( 'cancelled_registration', $setup_args );
565
+		EE_Register_Message_Type::register('cancelled_registration', $setup_args);
566 566
 
567 567
 
568 568
 		//register payment failed message type
569 569
 		$setup_args = array(
570 570
 			'mtfilename' => 'EE_Payment_Failed_message_type.class.php',
571
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/' ),
572
-			'messengers_to_activate_with' => array( 'email' ),
573
-			'messengers_to_validate_with' => array( 'email' )
571
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_failed/'),
572
+			'messengers_to_activate_with' => array('email'),
573
+			'messengers_to_validate_with' => array('email')
574 574
 			);
575
-		EE_Register_Message_Type::register( 'payment_failed', $setup_args );
575
+		EE_Register_Message_Type::register('payment_failed', $setup_args);
576 576
 
577 577
 		//register payment declined message type
578 578
 		$setup_args = array(
579 579
 			'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php',
580
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/' ),
581
-			'messengers_to_activate_with' => array( 'email' ),
582
-			'messengers_to_validate_with' => array( 'email' )
580
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_cancelled/'),
581
+			'messengers_to_activate_with' => array('email'),
582
+			'messengers_to_validate_with' => array('email')
583 583
 			);
584
-		EE_Register_Message_Type::register( 'payment_cancelled', $setup_args );
584
+		EE_Register_Message_Type::register('payment_cancelled', $setup_args);
585 585
 	}
586 586
 
587 587
 
@@ -597,12 +597,12 @@  discard block
 block discarded – undo
597 597
 	public function register_caf_shortcodes() {
598 598
 		$setup_args = array(
599 599
 			'autoloadpaths' => array(
600
-				EE_CAF_LIBRARIES . 'shortcodes/'
600
+				EE_CAF_LIBRARIES.'shortcodes/'
601 601
 				),
602
-			'msgr_validator_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_validator_config' ),
603
-			'msgr_template_fields_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_template_fields' ),
604
-			'list_type_shortcodes' => array( '[NEWSLETTER_CONTENT]' )
602
+			'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'),
603
+			'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'),
604
+			'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]')
605 605
 			);
606
-		EE_Register_Messages_Shortcode_Library::register( 'newsletter', $setup_args );
606
+		EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args);
607 607
 	}
608 608
 }
Please login to merge, or discard this patch.
libraries/shortcodes/EE_Primary_Registration_Details_Shortcodes.lib.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -45,32 +45,32 @@  discard block
 block discarded – undo
45 45
 			'[PRIMARY_REGISTRANT_ADDRESS2]' => __('Whatever was in the address 2 field for the primary registrant for the transaction.', 'event_espresso'),
46 46
 			'[PRIMARY_REGISTRANT_CITY]' => __('The city for the primary registrant for the transaction.', 'event_espresso'),
47 47
 			'[PRIMARY_REGISTRANT_ZIP_PC]' => __('The ZIP (or Postal) Code for the primary registrant for the transaction.', 'event_espresso'),
48
-			'[PRIMARY_REGISTRANT_ADDRESS_STATE]' => __('The state/province for the primary registrant for the transaction.', 'event_espresso' ),
48
+			'[PRIMARY_REGISTRANT_ADDRESS_STATE]' => __('The state/province for the primary registrant for the transaction.', 'event_espresso'),
49 49
 			'[PRIMARY_REGISTRANT_COUNTRY]' => __('The country for the primary registrant for the transaction.', 'event_espresso'),
50 50
 			'[PRIMARY_REGISTRANT_REGISTRATION_DATE]' => __('The date the registration occured for the primary registration.', 'event_espresso'),
51 51
 			'[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]' => __('Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso'),
52
-			'[PRIMARY_REGISTRANT_ANSWER_*]' => __('This is a special dynamic shortcode.  After the "*", add the exact text of an existing question, and if there is an answer for that question for this primary registrant, then it will be output in place of this shortcode.', 'event_espresso' )
52
+			'[PRIMARY_REGISTRANT_ANSWER_*]' => __('This is a special dynamic shortcode.  After the "*", add the exact text of an existing question, and if there is an answer for that question for this primary registrant, then it will be output in place of this shortcode.', 'event_espresso')
53 53
 			);
54 54
 	}
55 55
 
56 56
 
57 57
 
58
-	protected function _parser( $shortcode ) {
58
+	protected function _parser($shortcode) {
59 59
 		//make sure we end up with a copy of the EE_Messages_Addressee object
60 60
 		$primary_registration = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
61
-		$primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $primary_registration;
62
-		$primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $primary_registration;
61
+		$primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $primary_registration;
62
+		$primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $primary_registration;
63 63
 
64
-		if ( ! $primary_registration instanceof EE_Messages_Addressee )
64
+		if ( ! $primary_registration instanceof EE_Messages_Addressee)
65 65
 			return '';
66 66
 
67 67
 		$attendee = $primary_registration->primary_att_obj;
68 68
 		$primary_reg = $primary_registration->primary_reg_obj;
69 69
 
70
-		if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration )
70
+		if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration)
71 71
 			return '';
72 72
 
73
-		switch ( $shortcode ) {
73
+		switch ($shortcode) {
74 74
 			case '[PRIMARY_REGISTRANT_FNAME]' :
75 75
 				return $attendee->fname();
76 76
 				break;
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 				break;
119 119
 
120 120
 			case '[PRIMARY_REGISTRANT_REGISTRATION_DATE]' :
121
-				if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration )
121
+				if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration)
122 122
 					return '';
123
-				return $primary_registration->primary_reg_obj->get_i18n_datetime( 'REG_date', get_option( 'date_format' ) );
123
+				return $primary_registration->primary_reg_obj->get_i18n_datetime('REG_date', get_option('date_format'));
124 124
 				break;
125 125
 
126 126
 			case '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]' :
@@ -128,22 +128,22 @@  discard block
 block discarded – undo
128 128
 				break;
129 129
 		}
130 130
 
131
-		if ( strpos( $shortcode, '[PRIMARY_REGISTRANT_ANSWER_*' ) !== false ) {
132
-			$shortcode = str_replace( '[PRIMARY_REGISTRANT_ANSWER_*', '', $shortcode );
133
-			$shortcode = trim( str_replace( ']', '', $shortcode ) );
131
+		if (strpos($shortcode, '[PRIMARY_REGISTRANT_ANSWER_*') !== false) {
132
+			$shortcode = str_replace('[PRIMARY_REGISTRANT_ANSWER_*', '', $shortcode);
133
+			$shortcode = trim(str_replace(']', '', $shortcode));
134 134
 
135 135
 
136 136
 			//now let's figure out what question has this text
137
-			if ( empty( $primary_registration->questions ) ) {
137
+			if (empty($primary_registration->questions)) {
138 138
 				return '';
139 139
 			}
140 140
 
141
-			foreach ( $primary_registration->questions as $ansid => $question ) {
141
+			foreach ($primary_registration->questions as $ansid => $question) {
142 142
 				if (
143
-					trim( $question->get( 'QST_display_text' ) ) == trim( $shortcode )
144
-					&& isset( $primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ] )
143
+					trim($question->get('QST_display_text')) == trim($shortcode)
144
+					&& isset($primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid])
145 145
 				) {
146
-					return $primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ]->get_pretty( 'ANS_value', 'no_wpautop' );
146
+					return $primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop');
147 147
 				}
148 148
 			}
149 149
 		}
Please login to merge, or discard this patch.
admin_pages/support/Support_Admin_Page.core.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 class Support_Admin_Page extends EE_Admin_Page {
31 31
 
32 32
 
33
-	public function __construct( $routing = TRUE ) {
34
-		parent::__construct( $routing );
33
+	public function __construct($routing = TRUE) {
34
+		parent::__construct($routing);
35 35
 	}
36 36
 
37 37
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 				'nav' => array(
85 85
 					'label' => __('Support', 'event_espresso'),
86 86
 					'order' => 30),
87
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_support_boxes' ) ),
87
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')),
88 88
 				'require_nonce' => FALSE
89 89
 				),
90 90
 			'developers' => array(
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 				'nav' => array(
99 99
 					'label' => __('Shortcodes', 'event_espresso'),
100 100
 					'order' => 60),
101
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_shortcodes_boxes' ) ),
101
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')),
102 102
 				'require_nonce' => FALSE
103 103
 				),
104 104
 			);
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 
120 120
 
121 121
 	protected function _installation() {
122
-		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php';
123
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE);
122
+		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php';
123
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE);
124 124
 		$this->display_admin_page_with_sidebar();
125 125
 	}
126 126
 
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 			'other_resources' => __('Other Resources', 'event_espresso')
146 146
 			);
147 147
 
148
-		foreach ( $boxes as $box => $label ) {
149
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
148
+		foreach ($boxes as $box => $label) {
149
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
150 150
 			$callback_args = array('template_path' => $template_path);
151
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
151
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
152 152
 		}
153 153
 	}
154 154
 
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 			'shortcodes_event_listings' => __('Event Listings', 'event_espresso'),
170 170
 			'shortcodes_ticket_selector' => __('Event Ticket Selector', 'event_espresso'),
171 171
 			'shortcodes_category' => __('Event Categories', 'event_espresso'),
172
-			'shortcodes_attendee' => __( 'Event Attendees', 'event_espresso' )
172
+			'shortcodes_attendee' => __('Event Attendees', 'event_espresso')
173 173
 			/*'shortcodes_single_events' => __('Single Events', 'event_espresso'),*/
174 174
 			/*'shortcodes_attendee_listings' => __('Attendee Listings', 'event_espresso'),*/
175 175
 			);
176 176
 
177
-		foreach ( $boxes as $box => $label ) {
178
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
177
+		foreach ($boxes as $box => $label) {
178
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
179 179
 			$callback_args = array('template_path' => $template_path);
180
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
180
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
181 181
 		}
182 182
 	}
183 183
 
@@ -196,17 +196,17 @@  discard block
 block discarded – undo
196 196
 			'important_information' => __('Important Information', 'event_espresso')
197 197
 			);
198 198
 
199
-		foreach ( $boxes as $box => $label ) {
200
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
199
+		foreach ($boxes as $box => $label) {
200
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
201 201
 			$callback_args = array('template_path' => $template_path, 'template_args' => $this->_template_args);
202
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
202
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
203 203
 		}
204 204
 	}
205 205
 
206 206
 
207 207
 	protected function _developers() {
208
-		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php';
209
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true );
208
+		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'developers_admin_details.template.php';
209
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true);
210 210
 		$this->display_admin_page_with_sidebar();
211 211
 	}
212 212
 } //end Support_Admin_Page class
Please login to merge, or discard this patch.
payment_methods/Paypal_Standard/EEG_Paypal_Standard.gateway.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -274,26 +274,26 @@  discard block
 block discarded – undo
274 274
 		if ( ! $this->validate_ipn( $update_info, $payment ) ) {
275 275
 			return $payment;
276 276
 		}
277
-        // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction,
278
-        // registrations, ticket counts, etc)
279
-        if (
280
-            (
281
-                $update_info[ 'payment_status' ] === 'Refunded'
282
-                || $update_info[ 'payment_status' ] === 'Partially_Refunded'
283
-            )
284
-            && apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true )
285
-        ) {
286
-            throw new EventEspresso\core\exceptions\IpnException(
287
-                sprintf(
288
-                    esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
289
-                    $update_info['payment_status']
290
-                ),
291
-                EventEspresso\core\exceptions\IpnException::UNSUPPORTED,
292
-                null,
293
-                $payment,
294
-                $update_info
295
-            );
296
-        }
277
+		// kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction,
278
+		// registrations, ticket counts, etc)
279
+		if (
280
+			(
281
+				$update_info[ 'payment_status' ] === 'Refunded'
282
+				|| $update_info[ 'payment_status' ] === 'Partially_Refunded'
283
+			)
284
+			&& apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true )
285
+		) {
286
+			throw new EventEspresso\core\exceptions\IpnException(
287
+				sprintf(
288
+					esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
289
+					$update_info['payment_status']
290
+				),
291
+				EventEspresso\core\exceptions\IpnException::UNSUPPORTED,
292
+				null,
293
+				$payment,
294
+				$update_info
295
+			);
296
+		}
297 297
 		//ok, well let's process this payment then!
298 298
 		switch ( $update_info[ 'payment_status' ] ) {
299 299
 
@@ -541,17 +541,17 @@  discard block
 block discarded – undo
541 541
 
542 542
 		//might paypal have changed the taxes?
543 543
 		if( $this->_paypal_taxes && $payment_was_itemized ) {
544
-            // note that we're doing this BEFORE adding shipping;
544
+			// note that we're doing this BEFORE adding shipping;
545 545
 			// we actually want PayPal's shipping to remain non-taxable
546
-            $this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' );
547
-            $this->_line_item->set_total_tax_to(
548
-	            $transaction_total_line_item,
549
-                (float)$update_info['tax'],
550
-                esc_html__( 'Taxes', 'event_espresso' ),
551
-                esc_html__( 'Calculated by Paypal', 'event_espresso' ),
552
-                'paypal_tax'
553
-            );
554
-            $grand_total_needs_resaving = TRUE;
546
+			$this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' );
547
+			$this->_line_item->set_total_tax_to(
548
+				$transaction_total_line_item,
549
+				(float)$update_info['tax'],
550
+				esc_html__( 'Taxes', 'event_espresso' ),
551
+				esc_html__( 'Calculated by Paypal', 'event_espresso' ),
552
+				'paypal_tax'
553
+			);
554
+			$grand_total_needs_resaving = TRUE;
555 555
 		}
556 556
 
557 557
 		$shipping_amount = (float)$update_info[ 'mc_shipping' ];
Please login to merge, or discard this patch.
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @return EEG_Paypal_Standard
71 71
 	 */
72 72
 	public function __construct() {
73
-		$this->set_uses_separate_IPN_request( true ) ;
73
+		$this->set_uses_separate_IPN_request(true);
74 74
 		parent::__construct();
75 75
 	}
76 76
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * Also sets the gateway url class variable based on whether debug mode is enabled or not
81 81
 	 * @param array $settings_array
82 82
 	 */
83
-	public function set_settings($settings_array){
83
+	public function set_settings($settings_array) {
84 84
 		parent::set_settings($settings_array);
85 85
 		$this->_gateway_url = $this->_debug_mode
86 86
 			? 'https://www.sandbox.paypal.com/cgi-bin/webscr'
@@ -114,42 +114,42 @@  discard block
 block discarded – undo
114 114
 
115 115
 		$total_discounts_to_cart_total = $transaction->paid();
116 116
 		//only itemize the order if we're paying for the rest of the order's amount
117
-		if( EEH_Money::compare_floats( $payment->amount(), $transaction->total(), '==' ) ) {
118
-			$payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true );
117
+		if (EEH_Money::compare_floats($payment->amount(), $transaction->total(), '==')) {
118
+			$payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true);
119 119
 			//this payment is for the remaining transaction amount,
120 120
 			//keep track of exactly how much the itemized order amount equals
121 121
 			$itemized_sum = 0;
122 122
 			$shipping_previously_added = 0;
123 123
 			//so let's show all the line items
124
-			foreach($total_line_item->get_items() as $line_item){
125
-				if ( $line_item instanceof EE_Line_Item ) {
124
+			foreach ($total_line_item->get_items() as $line_item) {
125
+				if ($line_item instanceof EE_Line_Item) {
126 126
 					//it's some kind of discount
127
-					if( $line_item->total() < 0 ) {
128
-						$total_discounts_to_cart_total += abs( $line_item->total() );
127
+					if ($line_item->total() < 0) {
128
+						$total_discounts_to_cart_total += abs($line_item->total());
129 129
 						$itemized_sum += $line_item->total();
130 130
 						continue;
131 131
 					}
132 132
 					//dont include shipping again.
133
-					if( strpos( $line_item->code(), 'paypal_shipping_') === 0 ) {
133
+					if (strpos($line_item->code(), 'paypal_shipping_') === 0) {
134 134
 						$shipping_previously_added = $line_item->total();
135 135
 						continue;
136 136
 					}
137
-					$redirect_args[ 'item_name_' . $item_num ] = substr(
138
-						$this->_format_line_item_name( $line_item, $payment ),
137
+					$redirect_args['item_name_'.$item_num] = substr(
138
+						$this->_format_line_item_name($line_item, $payment),
139 139
 						0, 127
140 140
 					);
141
-					$redirect_args[ 'amount_' . $item_num ] = $line_item->unit_price();
142
-					$redirect_args[ 'quantity_' . $item_num ] = $line_item->quantity();
141
+					$redirect_args['amount_'.$item_num] = $line_item->unit_price();
142
+					$redirect_args['quantity_'.$item_num] = $line_item->quantity();
143 143
 					//if we're not letting PayPal calculate shipping, tell them its 0
144
-					if ( ! $this->_paypal_shipping ) {
145
-						$redirect_args[ 'shipping_' . $item_num ] = '0';
146
-						$redirect_args[ 'shipping2_' . $item_num ] = '0';
144
+					if ( ! $this->_paypal_shipping) {
145
+						$redirect_args['shipping_'.$item_num] = '0';
146
+						$redirect_args['shipping2_'.$item_num] = '0';
147 147
 					}
148 148
 					$item_num++;
149 149
 					$itemized_sum += $line_item->total();
150 150
 				}
151 151
 			}
152
-			$taxes_li = $this->_line_item->get_taxes_subtotal( $total_line_item );
152
+			$taxes_li = $this->_line_item->get_taxes_subtotal($total_line_item);
153 153
 			//ideally itemized sum equals the transaction total. but if not (which is weird)
154 154
 			//and the itemized sum is LESS than the transaction total
155 155
 			//add another line item
@@ -159,47 +159,47 @@  discard block
 block discarded – undo
159 159
 				$transaction->total() - $itemized_sum - $taxes_li->total() - $shipping_previously_added,
160 160
 				2
161 161
 			);
162
-			if( $itemized_sum_diff_from_txn_total < 0 ) {
162
+			if ($itemized_sum_diff_from_txn_total < 0) {
163 163
 				//itemized sum is too big
164
-				$total_discounts_to_cart_total += abs( $itemized_sum_diff_from_txn_total );
165
-			} elseif( $itemized_sum_diff_from_txn_total > 0 ) {
166
-				$redirect_args[ 'item_name_' . $item_num ] = substr(
167
-						__( 'Other charges', 'event_espresso' ), 0, 127 );
168
-				$redirect_args[ 'amount_' . $item_num ] = $this->format_currency( $itemized_sum_diff_from_txn_total );
169
-				$redirect_args[ 'quantity_' . $item_num ] = 1;
164
+				$total_discounts_to_cart_total += abs($itemized_sum_diff_from_txn_total);
165
+			} elseif ($itemized_sum_diff_from_txn_total > 0) {
166
+				$redirect_args['item_name_'.$item_num] = substr(
167
+						__('Other charges', 'event_espresso'), 0, 127 );
168
+				$redirect_args['amount_'.$item_num] = $this->format_currency($itemized_sum_diff_from_txn_total);
169
+				$redirect_args['quantity_'.$item_num] = 1;
170 170
 				$item_num++;
171 171
 			}
172
-			if( $total_discounts_to_cart_total > 0 ) {
173
-				$redirect_args[ 'discount_amount_cart' ] = $this->format_currency( $total_discounts_to_cart_total );
172
+			if ($total_discounts_to_cart_total > 0) {
173
+				$redirect_args['discount_amount_cart'] = $this->format_currency($total_discounts_to_cart_total);
174 174
 			}
175 175
 			//add our taxes to the order if we're NOT using PayPal's
176
-			if( ! $this->_paypal_taxes ){
176
+			if ( ! $this->_paypal_taxes) {
177 177
 				$redirect_args['tax_cart'] = $total_line_item->get_total_tax();
178 178
 			}
179 179
 		} else {
180
-			$payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, false );
180
+			$payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, false);
181 181
 			//partial payment that's not for the remaining amount, so we can't send an itemized list
182
-			$redirect_args['item_name_' . $item_num] = substr(
183
-				$this->_format_partial_payment_line_item_name( $payment ),
182
+			$redirect_args['item_name_'.$item_num] = substr(
183
+				$this->_format_partial_payment_line_item_name($payment),
184 184
 				0, 127
185 185
 			);
186
-			$redirect_args['amount_' . $item_num] = $payment->amount();
187
-			$redirect_args['shipping_' . $item_num ] = '0';
188
-			$redirect_args['shipping2_' . $item_num ] = '0';
186
+			$redirect_args['amount_'.$item_num] = $payment->amount();
187
+			$redirect_args['shipping_'.$item_num] = '0';
188
+			$redirect_args['shipping2_'.$item_num] = '0';
189 189
 			$redirect_args['tax_cart'] = '0';
190 190
 			$item_num++;
191 191
 		}
192 192
 
193
-		if($this->_debug_mode){
194
-			$redirect_args['item_name_' . $item_num] = 'DEBUG INFO (this item only added in sandbox mode';
195
-			$redirect_args['amount_' . $item_num] = 0;
193
+		if ($this->_debug_mode) {
194
+			$redirect_args['item_name_'.$item_num] = 'DEBUG INFO (this item only added in sandbox mode';
195
+			$redirect_args['amount_'.$item_num] = 0;
196 196
 			$redirect_args['on0_'.$item_num] = 'NOTIFY URL';
197
-			$redirect_args['os0_' . $item_num] = $notify_url;
197
+			$redirect_args['os0_'.$item_num] = $notify_url;
198 198
 			$redirect_args['on1_'.$item_num] = 'RETURN URL';
199
-			$redirect_args['os1_' . $item_num] = $return_url;
199
+			$redirect_args['os1_'.$item_num] = $return_url;
200 200
 //			$redirect_args['option_index_' . $item_num] = 1; // <-- dunno if this is needed ?
201
-			$redirect_args['shipping_' . $item_num ] = '0';
202
-			$redirect_args['shipping2_' . $item_num ] = '0';
201
+			$redirect_args['shipping_'.$item_num] = '0';
202
+			$redirect_args['shipping2_'.$item_num] = '0';
203 203
 		}
204 204
 
205 205
 		$redirect_args['business'] = $this->_paypal_id;
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 		$redirect_args['cmd'] = '_cart';
210 210
 		$redirect_args['upload'] = 1;
211 211
 		$redirect_args['currency_code'] = $payment->currency_code();
212
-		$redirect_args['rm'] = 2;//makes the user return with method=POST
213
-		if($this->_image_url){
212
+		$redirect_args['rm'] = 2; //makes the user return with method=POST
213
+		if ($this->_image_url) {
214 214
 			$redirect_args['image_url'] = $this->_image_url;
215 215
 		}
216 216
 		$redirect_args['no_shipping'] = $this->_shipping_details;
217
-		$redirect_args['bn'] = 'EventEspresso_SP';//EE will blow up if you change this
217
+		$redirect_args['bn'] = 'EventEspresso_SP'; //EE will blow up if you change this
218 218
 
219
-		$redirect_args = apply_filters( "FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this );
219
+		$redirect_args = apply_filters("FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this);
220 220
 
221 221
 		$payment->set_redirect_url($this->_gateway_url);
222 222
 		$payment->set_redirect_args($redirect_args);
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		$this->log(
225 225
 			array(
226 226
 				'message'     => sprintf(
227
-					__( 'PayPal payment request initiated.', 'event_espresso' )
227
+					__('PayPal payment request initiated.', 'event_espresso')
228 228
 				),
229 229
 				'transaction' => $transaction->model_field_array(),
230 230
 			),
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 	 * @return \EEI_Payment updated
245 245
 	 * @throws \EE_Error, IpnException
246 246
 	 */
247
-	public function handle_payment_update( $update_info, $transaction ){
247
+	public function handle_payment_update($update_info, $transaction) {
248 248
 		// verify there's payment data that's been sent
249
-		if ( empty( $update_info[ 'payment_status' ] ) || empty( $update_info[ 'txn_id' ] ) ) {
249
+		if (empty($update_info['payment_status']) || empty($update_info['txn_id'])) {
250 250
 			// log the results
251 251
 			$this->log(
252 252
 				array(
253 253
 					'message' => sprintf(
254
-						__( 'PayPal IPN response is missing critical payment data. This may indicate a PDT request and require your PayPal account settings to be corrected.', 'event_espresso' )
254
+						__('PayPal IPN response is missing critical payment data. This may indicate a PDT request and require your PayPal account settings to be corrected.', 'event_espresso')
255 255
 					),
256 256
 					'update_info' => $update_info,
257 257
 				),
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
 			);
260 260
 			// waaaait... is this a PDT request? (see https://developer.paypal.com/docs/classic/products/payment-data-transfer/)
261 261
 			// indicated by the "tx" argument? If so, we don't need it. We'll just use the IPN data when it comes
262
-			if ( isset( $update_info[ 'tx' ] ) ) {
262
+			if (isset($update_info['tx'])) {
263 263
 				return $transaction->last_payment();
264 264
 			} else {
265 265
 				return null;
266 266
 			}
267 267
 		}
268
-		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
269
-		if ( ! $payment instanceof EEI_Payment ) {
268
+		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['txn_id']);
269
+		if ( ! $payment instanceof EEI_Payment) {
270 270
 			$payment = $transaction->last_payment();
271 271
 		}
272 272
 		// ok, then validate the IPN. Even if we've already processed this payment,
273 273
 		// let PayPal know we don't want to hear from them anymore!
274
-		if ( ! $this->validate_ipn( $update_info, $payment ) ) {
274
+		if ( ! $this->validate_ipn($update_info, $payment)) {
275 275
 			return $payment;
276 276
 		}
277 277
         // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction,
278 278
         // registrations, ticket counts, etc)
279 279
         if (
280 280
             (
281
-                $update_info[ 'payment_status' ] === 'Refunded'
282
-                || $update_info[ 'payment_status' ] === 'Partially_Refunded'
281
+                $update_info['payment_status'] === 'Refunded'
282
+                || $update_info['payment_status'] === 'Partially_Refunded'
283 283
             )
284
-            && apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true )
284
+            && apply_filters('FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true)
285 285
         ) {
286 286
             throw new EventEspresso\core\exceptions\IpnException(
287 287
                 sprintf(
288
-                    esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
288
+                    esc_html__('Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
289 289
                     $update_info['payment_status']
290 290
                 ),
291 291
                 EventEspresso\core\exceptions\IpnException::UNSUPPORTED,
@@ -295,34 +295,34 @@  discard block
 block discarded – undo
295 295
             );
296 296
         }
297 297
 		//ok, well let's process this payment then!
298
-		switch ( $update_info[ 'payment_status' ] ) {
298
+		switch ($update_info['payment_status']) {
299 299
 
300 300
 			case 'Completed' :
301 301
 				$status = $this->_pay_model->approved_status();
302
-				$gateway_response = esc_html__( 'The payment is approved.', 'event_espresso' );
302
+				$gateway_response = esc_html__('The payment is approved.', 'event_espresso');
303 303
 				break;
304 304
 
305 305
 			case 'Pending' :
306 306
 				$status = $this->_pay_model->pending_status();
307
-				$gateway_response = esc_html__( 'The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso' );
307
+				$gateway_response = esc_html__('The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso');
308 308
 				break;
309 309
 
310 310
 			case 'Denied' :
311 311
 				$status = $this->_pay_model->declined_status();
312
-				$gateway_response = esc_html__( 'The payment has been declined.', 'event_espresso' );
312
+				$gateway_response = esc_html__('The payment has been declined.', 'event_espresso');
313 313
 				break;
314 314
 
315 315
 			case 'Expired' :
316 316
 			case 'Failed' :
317 317
 				$status = $this->_pay_model->failed_status();
318
-				$gateway_response = esc_html__( 'The payment failed for technical reasons or expired.', 'event_espresso' );
318
+				$gateway_response = esc_html__('The payment failed for technical reasons or expired.', 'event_espresso');
319 319
 				break;
320 320
 
321 321
 			case 'Refunded' :
322 322
 			case 'Partially_Refunded' :
323 323
 				// even though it's a refund, we consider the payment as approved, it just has a negative value
324 324
 				$status = $this->_pay_model->approved_status();
325
-				$gateway_response = esc_html__( 'The payment has been refunded. Please update registrations accordingly.', 'event_espresso' );
325
+				$gateway_response = esc_html__('The payment has been refunded. Please update registrations accordingly.', 'event_espresso');
326 326
 				break;
327 327
 
328 328
 			case 'Voided' :
@@ -330,19 +330,19 @@  discard block
 block discarded – undo
330 330
 			case 'Canceled_Reversal' :
331 331
 			default :
332 332
 				$status = $this->_pay_model->cancelled_status();
333
-				$gateway_response = esc_html__( 'The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso' );
333
+				$gateway_response = esc_html__('The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso');
334 334
 				break;
335 335
 
336 336
 		}
337 337
 
338 338
 		//check if we've already processed this payment
339
-		if ( $payment instanceof EEI_Payment ) {
339
+		if ($payment instanceof EEI_Payment) {
340 340
 			//payment exists. if this has the exact same status and amount, don't bother updating. just return
341
-			if ( $payment->status() === $status && (float)$payment->amount() === (float)$update_info[ 'mc_gross' ] ) {
341
+			if ($payment->status() === $status && (float) $payment->amount() === (float) $update_info['mc_gross']) {
342 342
 				// DUPLICATED IPN! don't bother updating transaction
343 343
 				throw new IpnException(
344 344
 					sprintf(
345
-						esc_html__( 'It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso' ),
345
+						esc_html__('It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso'),
346 346
 						$payment->ID()
347 347
 					),
348 348
 					IpnException::DUPLICATE,
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
 				);
353 353
 			} else {
354 354
 				// new payment yippee !!!
355
-				$payment->set_status( $status );
356
-				$payment->set_amount( (float)$update_info[ 'mc_gross' ] );
357
-				$payment->set_gateway_response( $gateway_response );
358
-				$payment->set_details( $update_info );
359
-				$payment->set_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
355
+				$payment->set_status($status);
356
+				$payment->set_amount((float) $update_info['mc_gross']);
357
+				$payment->set_gateway_response($gateway_response);
358
+				$payment->set_details($update_info);
359
+				$payment->set_txn_id_chq_nmbr($update_info['txn_id']);
360 360
 				$this->log(
361 361
 					array(
362
-						'message'  => esc_html__( 'Updated payment either from IPN or as part of POST from PayPal', 'event_espresso' ),
362
+						'message'  => esc_html__('Updated payment either from IPN or as part of POST from PayPal', 'event_espresso'),
363 363
 						'url'      => $this->_process_response_url(),
364 364
 						'payment'  => $payment->model_field_array(),
365 365
 						'IPN_data' => $update_info
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 			}
370 370
 
371 371
 		}
372
-		do_action( 'FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this );
372
+		do_action('FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this);
373 373
 		return $payment;
374 374
 	}
375 375
 
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
 	 * @return boolean
385 385
 	 * @throws \EE_Error
386 386
 	 */
387
-	public function validate_ipn( $update_info, $payment ) {
387
+	public function validate_ipn($update_info, $payment) {
388 388
 		//allow us to skip validating IPNs with PayPal (useful for testing)
389
-		if ( apply_filters( 'FHEE__EEG_Paypal_Standard__validate_ipn__skip', false ) ) {
389
+		if (apply_filters('FHEE__EEG_Paypal_Standard__validate_ipn__skip', false)) {
390 390
 			return true;
391 391
 		}
392 392
 		//...otherwise, we actually don't care what the $update_info is, we need to look
@@ -394,22 +394,22 @@  discard block
 block discarded – undo
394 394
 		// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
395 395
 		// Instead, read raw POST data from the input stream.
396 396
 		// @see https://gist.github.com/xcommerce-gists/3440401
397
-		$raw_post_data = file_get_contents( 'php://input' );
398
-		$raw_post_array = explode( '&', $raw_post_data );
397
+		$raw_post_data = file_get_contents('php://input');
398
+		$raw_post_array = explode('&', $raw_post_data);
399 399
 		$update_info = array();
400
-		foreach ( $raw_post_array as $keyval ) {
401
-			$keyval = explode( '=', $keyval );
402
-			if ( count( $keyval ) === 2 ) {
403
-				$update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] );
400
+		foreach ($raw_post_array as $keyval) {
401
+			$keyval = explode('=', $keyval);
402
+			if (count($keyval) === 2) {
403
+				$update_info[$keyval[0]] = urldecode($keyval[1]);
404 404
 			}
405 405
 		}
406 406
 		// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
407 407
 		$req = 'cmd=_notify-validate';
408
-		$uses_get_magic_quotes = function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() === 1
408
+		$uses_get_magic_quotes = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() === 1
409 409
 			? true
410 410
 			: false;
411
-		foreach ( $update_info as $key => $value ) {
412
-			$value = $uses_get_magic_quotes ? urlencode( stripslashes( $value ) ) : urlencode( $value );
411
+		foreach ($update_info as $key => $value) {
412
+			$value = $uses_get_magic_quotes ? urlencode(stripslashes($value)) : urlencode($value);
413 413
 			$req .= "&$key=$value";
414 414
 		}
415 415
 		// HTTP POST the complete, unaltered IPN back to PayPal
@@ -418,38 +418,38 @@  discard block
 block discarded – undo
418 418
 			array(
419 419
 				'body' 				=> $req,
420 420
 				'sslverify' 		=> false,
421
-				'timeout' 		=> 60 ,
421
+				'timeout' 		=> 60,
422 422
 				// make sure to set a site specific unique "user-agent" string since the WordPres default gets declined by PayPal
423 423
 				// plz see: https://github.com/websharks/s2member/issues/610
424
-				'user-agent' 	=> 'Event Espresso v' . EVENT_ESPRESSO_VERSION . '; ' . home_url(),
424
+				'user-agent' 	=> 'Event Espresso v'.EVENT_ESPRESSO_VERSION.'; '.home_url(),
425 425
 				'httpversion' => '1.1'
426 426
 			)
427 427
 		);
428 428
 		// then check the response
429 429
 		if (
430
-			array_key_exists( 'body', $response )
431
-			&& ! is_wp_error( $response )
432
-			&& strcmp( $response[ 'body' ], "VERIFIED" ) === 0
430
+			array_key_exists('body', $response)
431
+			&& ! is_wp_error($response)
432
+			&& strcmp($response['body'], "VERIFIED") === 0
433 433
 		) {
434 434
 			return true;
435 435
 		}
436 436
 		// huh, something's wack... the IPN didn't validate. We must have replied to the IPN incorrectly,
437 437
 		// or their API must have changed: http://www.paypalobjects.com/en_US/ebook/PP_OrderManagement_IntegrationGuide/ipn.html
438
-		if( $response instanceof WP_Error ) {
438
+		if ($response instanceof WP_Error) {
439 439
 			$error_msg = sprintf(
440
-				esc_html__( 'WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso' ),
440
+				esc_html__('WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso'),
441 441
 				$response->get_error_code(),
442 442
 				$response->get_error_message(),
443
-				print_r( $response->get_error_data(), true )
443
+				print_r($response->get_error_data(), true)
444 444
 			);
445
-		} elseif( is_array( $response ) && isset( $response[ 'body' ] ) ) {
446
-			$error_msg = $response[ 'body' ];
445
+		} elseif (is_array($response) && isset($response['body'])) {
446
+			$error_msg = $response['body'];
447 447
 		} else {
448
-			$error_msg = print_r( $response, true );
448
+			$error_msg = print_r($response, true);
449 449
 		}
450
-		$payment->set_gateway_response( sprintf( esc_html__( "IPN Validation failed! Paypal responded with '%s'", "event_espresso" ), $error_msg ) );
451
-		$payment->set_details( array( 'REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response ) );
452
-		$payment->set_status( EEM_Payment::status_id_failed );
450
+		$payment->set_gateway_response(sprintf(esc_html__("IPN Validation failed! Paypal responded with '%s'", "event_espresso"), $error_msg));
451
+		$payment->set_details(array('REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response));
452
+		$payment->set_status(EEM_Payment::status_id_failed);
453 453
 		// log the results
454 454
 		$this->log(
455 455
 			array(
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
 	 * @return string
470 470
 	 */
471 471
 	protected function _process_response_url() {
472
-		if ( isset( $_SERVER[ 'HTTP_HOST' ], $_SERVER[ 'REQUEST_URI' ] ) ) {
472
+		if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) {
473 473
 			$url = is_ssl() ? 'https://' : 'http://';
474
-			$url .= EEH_URL::filter_input_server_url( 'HTTP_HOST' );
474
+			$url .= EEH_URL::filter_input_server_url('HTTP_HOST');
475 475
 			$url .= EEH_URL::filter_input_server_url();
476 476
 		} else {
477 477
 			$url = 'unknown';
@@ -488,12 +488,12 @@  discard block
 block discarded – undo
488 488
 	 * @param EEI_Payment $payment
489 489
 	 * @throws \EE_Error
490 490
 	 */
491
-	public function update_txn_based_on_payment( $payment ) {
491
+	public function update_txn_based_on_payment($payment) {
492 492
 		$update_info = $payment->details();
493 493
 		/** @var EE_Transaction $transaction */
494 494
 		$transaction = $payment->transaction();
495
-		$payment_was_itemized = $payment->get_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true, false );
496
-		if( ! $transaction ){
495
+		$payment_was_itemized = $payment->get_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true, false);
496
+		if ( ! $transaction) {
497 497
 			$this->log(
498 498
 				esc_html__(
499 499
 					'Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly',
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
 			);
504 504
 			return;
505 505
 		}
506
-		if(
507
-			! is_array( $update_info )
508
-			|| ! isset( $update_info[ 'mc_shipping' ] )
509
-			|| ! isset( $update_info[ 'tax' ] )
506
+		if (
507
+			! is_array($update_info)
508
+			|| ! isset($update_info['mc_shipping'])
509
+			|| ! isset($update_info['tax'])
510 510
 		) {
511 511
 			$this->log(
512 512
 				array(
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 			);
522 522
 			return;
523 523
 		}
524
-		if( $payment->status() !== $this->_pay_model->approved_status() ) {
524
+		if ($payment->status() !== $this->_pay_model->approved_status()) {
525 525
 			$this->log(
526 526
 				array(
527 527
 					'message' => esc_html__(
@@ -540,44 +540,44 @@  discard block
 block discarded – undo
540 540
 		$transaction_total_line_item = $transaction->total_line_item();
541 541
 
542 542
 		//might paypal have changed the taxes?
543
-		if( $this->_paypal_taxes && $payment_was_itemized ) {
543
+		if ($this->_paypal_taxes && $payment_was_itemized) {
544 544
             // note that we're doing this BEFORE adding shipping;
545 545
 			// we actually want PayPal's shipping to remain non-taxable
546
-            $this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' );
546
+            $this->_line_item->set_line_items_taxable($transaction_total_line_item, true, 'paypal_shipping');
547 547
             $this->_line_item->set_total_tax_to(
548 548
 	            $transaction_total_line_item,
549
-                (float)$update_info['tax'],
550
-                esc_html__( 'Taxes', 'event_espresso' ),
551
-                esc_html__( 'Calculated by Paypal', 'event_espresso' ),
549
+                (float) $update_info['tax'],
550
+                esc_html__('Taxes', 'event_espresso'),
551
+                esc_html__('Calculated by Paypal', 'event_espresso'),
552 552
                 'paypal_tax'
553 553
             );
554 554
             $grand_total_needs_resaving = TRUE;
555 555
 		}
556 556
 
557
-		$shipping_amount = (float)$update_info[ 'mc_shipping' ];
557
+		$shipping_amount = (float) $update_info['mc_shipping'];
558 558
 		//might paypal have added shipping?
559
-		if( $this->_paypal_shipping && $shipping_amount && $payment_was_itemized ){
559
+		if ($this->_paypal_shipping && $shipping_amount && $payment_was_itemized) {
560 560
 			$this->_line_item->add_unrelated_item(
561 561
 				$transaction_total_line_item,
562
-				sprintf( esc_html__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID() ),
562
+				sprintf(esc_html__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID()),
563 563
 				$shipping_amount,
564 564
 				esc_html__('Shipping charges calculated by Paypal', 'event_espresso'),
565 565
 				1,
566 566
 				false,
567
-				'paypal_shipping_' . $transaction->ID()
567
+				'paypal_shipping_'.$transaction->ID()
568 568
 			);
569 569
 			$grand_total_needs_resaving = true;
570 570
 		}
571 571
 
572
-		if( $grand_total_needs_resaving ){
573
-			$transaction_total_line_item->save_this_and_descendants_to_txn( $transaction->ID() );
572
+		if ($grand_total_needs_resaving) {
573
+			$transaction_total_line_item->save_this_and_descendants_to_txn($transaction->ID());
574 574
 			/** @var EE_Registration_Processor $registration_processor */
575
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
576
-			$registration_processor->update_registration_final_prices( $transaction );
575
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
576
+			$registration_processor->update_registration_final_prices($transaction);
577 577
 		}
578 578
 		$this->log(
579 579
 			array(
580
-				'message'                     => esc_html__( 'Updated transaction related to payment', 'event_espresso' ),
580
+				'message'                     => esc_html__('Updated transaction related to payment', 'event_espresso'),
581 581
 				'url'                         => $this->_process_response_url(),
582 582
 				'transaction (updated)'       => $transaction->model_field_array(),
583 583
 				'payment (updated)'           => $payment->model_field_array(),
Please login to merge, or discard this patch.
core/EE_Payment_Processor.core.php 2 patches
Indentation   +35 added lines, -37 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
  */
14 14
 class EE_Payment_Processor extends EE_Processor_Base {
15 15
 	/**
16
-     * 	@var EE_Payment_Processor $_instance
16
+	 * 	@var EE_Payment_Processor $_instance
17 17
 	 * 	@access 	private
18
-     */
18
+	 */
19 19
 	private static $_instance;
20 20
 
21 21
 
@@ -50,7 +50,6 @@  discard block
 block discarded – undo
50 50
 	/**
51 51
 	 * Using the selected gateway, processes the payment for that transaction, and updates the transaction appropriately.
52 52
 	 * Saves the payment that is generated
53
-
54 53
 	 *
55 54
 *@param EE_Payment_Method    $payment_method
56 55
 	 * @param EE_Transaction       $transaction
@@ -130,7 +129,6 @@  discard block
 block discarded – undo
130 129
 
131 130
 
132 131
 	/**
133
-
134 132
 	 * @param EE_Transaction|int $transaction
135 133
 	 * @param EE_Payment_Method $payment_method
136 134
 	 * @throws EE_Error
@@ -221,22 +219,22 @@  discard block
 block discarded – undo
221 219
 				/** @type EE_Payment_Method $payment_method */
222 220
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
223 221
 				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
224
-				    try {
225
-                        $payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
226
-                        $log->set_object($payment);
227
-                    } catch( EventEspresso\core\exceptions\IpnException $e ) {
228
-                        EEM_Change_Log::instance()->log(
229
-                            EEM_Change_Log::type_gateway,
230
-                            array(
231
-                                'message' => 'IPN Exception: ' . $e->getMessage(),
232
-                                'current_url' => EEH_URL::current_url(),
233
-                                'payment' => $e->getPaymentProperties(),
234
-                                'IPN_data' => $e->getIpnData()
235
-                            ),
236
-                            $obj_for_log
237
-                        );
238
-                        return $e->getPayment();
239
-                    }
222
+					try {
223
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
224
+						$log->set_object($payment);
225
+					} catch( EventEspresso\core\exceptions\IpnException $e ) {
226
+						EEM_Change_Log::instance()->log(
227
+							EEM_Change_Log::type_gateway,
228
+							array(
229
+								'message' => 'IPN Exception: ' . $e->getMessage(),
230
+								'current_url' => EEH_URL::current_url(),
231
+								'payment' => $e->getPaymentProperties(),
232
+								'IPN_data' => $e->getIpnData()
233
+							),
234
+							$obj_for_log
235
+						);
236
+						return $e->getPayment();
237
+					}
240 238
 				} else {
241 239
 					// not a payment
242 240
 					EE_Error::add_error(
@@ -262,18 +260,18 @@  discard block
 block discarded – undo
262 260
 						);
263 261
 						break;
264 262
 					} catch( EventEspresso\core\exceptions\IpnException $e ) {
265
-                        EEM_Change_Log::instance()->log(
266
-                            EEM_Change_Log::type_gateway,
267
-                            array(
268
-                                'message' => 'IPN Exception: ' . $e->getMessage(),
269
-                                'current_url' => EEH_URL::current_url(),
270
-                                'payment' => $e->getPaymentProperties(),
271
-                                'IPN_data' => $e->getIpnData()
272
-                            ),
273
-                            $obj_for_log
274
-                        );
275
-                        return $e->getPayment();
276
-                    } catch( EE_Error $e ) {
263
+						EEM_Change_Log::instance()->log(
264
+							EEM_Change_Log::type_gateway,
265
+							array(
266
+								'message' => 'IPN Exception: ' . $e->getMessage(),
267
+								'current_url' => EEH_URL::current_url(),
268
+								'payment' => $e->getPaymentProperties(),
269
+								'IPN_data' => $e->getIpnData()
270
+							),
271
+							$obj_for_log
272
+						);
273
+						return $e->getPayment();
274
+					} catch( EE_Error $e ) {
277 275
 						//that's fine- it apparently couldn't handle the IPN
278 276
 					}
279 277
 				}
@@ -709,12 +707,12 @@  discard block
 block discarded – undo
709 707
 	}
710 708
 	
711 709
 	/**
712
- 	 * Force posts to PayPal to use TLS v1.2. See:
713
- 	 * https://core.trac.wordpress.org/ticket/36320
714
- 	 * https://core.trac.wordpress.org/ticket/34924#comment:15
715
- 	 * https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1914&viewlocale=en_US
710
+	 * Force posts to PayPal to use TLS v1.2. See:
711
+	 * https://core.trac.wordpress.org/ticket/36320
712
+	 * https://core.trac.wordpress.org/ticket/34924#comment:15
713
+	 * https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1914&viewlocale=en_US
716 714
 	 * This will affect paypal standard, pro, express, and payflow.
717
- 	 */
715
+	 */
718 716
  	public static function _curl_requests_to_paypal_use_tls( $handle, $r, $url ) {
719 717
  		if ( strstr( $url, 'https://' ) && strstr( $url, '.paypal.com' ) ) {
720 718
 			//Use the value of the constant CURL_SSLVERSION_TLSv1 = 1
Please login to merge, or discard this patch.
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 /**
4 4
  *
5 5
  * EE_Payment_Processor
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function instance() {
29 29
 		// check if class object is instantiated
30
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
30
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
31 31
 			self::$_instance = new self();
32 32
 		}
33 33
 		return self::$_instance;
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 *@access private
42 42
 	 */
43 43
 	private function __construct() {
44
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
45
-		add_action( 'http_api_curl', array( $this, '_curl_requests_to_paypal_use_tls' ), 10, 3 );
44
+		do_action('AHEE__EE_Payment_Processor__construct');
45
+		add_action('http_api_curl', array($this, '_curl_requests_to_paypal_use_tls'), 10, 3);
46 46
 	}
47 47
 
48 48
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		$update_txn = true,
82 82
 		$cancel_url = ''
83 83
 	) {
84
-		if( (float)$amount < 0 ) {
84
+		if ((float) $amount < 0) {
85 85
 			throw new EE_Error(
86 86
 				sprintf(
87 87
 					__(
@@ -94,33 +94,33 @@  discard block
 block discarded – undo
94 94
 			);
95 95
 		}
96 96
 		// verify payment method
97
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
97
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
98 98
 		// verify transaction
99
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
100
-		$transaction->set_payment_method_ID( $payment_method->ID() );
99
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
100
+		$transaction->set_payment_method_ID($payment_method->ID());
101 101
 		// verify payment method type
102
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
102
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
103 103
 			$payment = $payment_method->type_obj()->process_payment(
104 104
 				$transaction,
105
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
105
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
106 106
 				$billing_form,
107 107
 				$return_url,
108
-				add_query_arg( array( 'ee_cancel_payment' => true ), $cancel_url ),
108
+				add_query_arg(array('ee_cancel_payment' => true), $cancel_url),
109 109
 				$method,
110 110
 				$by_admin
111 111
 			);
112 112
 			// check if payment method uses an off-site gateway
113
-			if ( $payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite ) {
113
+			if ($payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite) {
114 114
 				// don't process payments for off-site gateways yet because no payment has occurred yet
115
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
115
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
116 116
 			}
117 117
 			return $payment;
118 118
 		} else {
119 119
 			EE_Error::add_error(
120 120
 				sprintf(
121
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
121
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
122 122
 					'<br/>',
123
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
123
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
124 124
 				), __FILE__, __FUNCTION__, __LINE__
125 125
 			);
126 126
 			return NULL;
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 	 * @throws EE_Error
137 137
 	 * @return string
138 138
 	 */
139
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
139
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
140 140
 		/** @type \EE_Transaction $transaction */
141
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
141
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
142 142
 		$primary_reg = $transaction->primary_registration();
143
-		if( ! $primary_reg instanceof EE_Registration ){
143
+		if ( ! $primary_reg instanceof EE_Registration) {
144 144
 			throw new EE_Error(
145 145
 				sprintf(
146 146
 					__(
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 				)
152 152
 			);
153 153
 		}
154
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
154
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
155 155
 		$url = add_query_arg(
156 156
 			array(
157 157
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -188,47 +188,47 @@  discard block
 block discarded – undo
188 188
 		$update_txn = true,
189 189
 		$separate_IPN_request = true
190 190
 	) {
191
-		EE_Registry::instance()->load_model( 'Change_Log' );
192
-		$_req_data = $this->_remove_unusable_characters_from_array( (array)$_req_data );
193
-		EE_Processor_Base::set_IPN( $separate_IPN_request );
191
+		EE_Registry::instance()->load_model('Change_Log');
192
+		$_req_data = $this->_remove_unusable_characters_from_array((array) $_req_data);
193
+		EE_Processor_Base::set_IPN($separate_IPN_request);
194 194
 		$obj_for_log = null;
195
-		if( $transaction instanceof EE_Transaction ){
195
+		if ($transaction instanceof EE_Transaction) {
196 196
 			$obj_for_log = $transaction;
197
-			if( $payment_method instanceof EE_Payment_Method ) {
197
+			if ($payment_method instanceof EE_Payment_Method) {
198 198
 				$obj_for_log = EEM_Payment::instance()->get_one(
199 199
 					array(
200
-						array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ),
201
-						'order_by' => array( 'PAY_timestamp' => 'desc' )
200
+						array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()),
201
+						'order_by' => array('PAY_timestamp' => 'desc')
202 202
 					)
203 203
 				);
204 204
 			}
205
-		} else if( $payment_method instanceof EE_Payment ) {
205
+		} else if ($payment_method instanceof EE_Payment) {
206 206
 			$obj_for_log = $payment_method;
207 207
 		}
208 208
 		$log = EEM_Change_Log::instance()->log(
209 209
 			EEM_Change_Log::type_gateway,
210
-			array( 'IPN data received' => $_req_data ),
210
+			array('IPN data received' => $_req_data),
211 211
 			$obj_for_log
212 212
 		);
213
-		try{
213
+		try {
214 214
 			/**
215 215
 			 * @var EE_Payment $payment
216 216
 			 */
217 217
 			$payment = NULL;
218
-			if($transaction && $payment_method){
218
+			if ($transaction && $payment_method) {
219 219
 				/** @type EE_Transaction $transaction */
220 220
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
221 221
 				/** @type EE_Payment_Method $payment_method */
222 222
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
223
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
223
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
224 224
 				    try {
225 225
                         $payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
226 226
                         $log->set_object($payment);
227
-                    } catch( EventEspresso\core\exceptions\IpnException $e ) {
227
+                    } catch (EventEspresso\core\exceptions\IpnException $e) {
228 228
                         EEM_Change_Log::instance()->log(
229 229
                             EEM_Change_Log::type_gateway,
230 230
                             array(
231
-                                'message' => 'IPN Exception: ' . $e->getMessage(),
231
+                                'message' => 'IPN Exception: '.$e->getMessage(),
232 232
                                 'current_url' => EEH_URL::current_url(),
233 233
                                 'payment' => $e->getPaymentProperties(),
234 234
                                 'IPN_data' => $e->getIpnData()
@@ -241,31 +241,31 @@  discard block
 block discarded – undo
241 241
 					// not a payment
242 242
 					EE_Error::add_error(
243 243
 						sprintf(
244
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
244
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
245 245
 							'<br/>',
246
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
246
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
247 247
 						),
248 248
 						__FILE__, __FUNCTION__, __LINE__
249 249
 					);
250 250
 				}
251
-			}else{
251
+			} else {
252 252
 				//that's actually pretty ok. The IPN just wasn't able
253 253
 				//to identify which transaction or payment method this was for
254 254
 				// give all active payment methods a chance to claim it
255 255
 				$active_payment_methods = EEM_Payment_Method::instance()->get_all_active();
256
-				foreach( $active_payment_methods as $active_payment_method ){
257
-					try{
258
-						$payment = $active_payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
256
+				foreach ($active_payment_methods as $active_payment_method) {
257
+					try {
258
+						$payment = $active_payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
259 259
 						$payment_method = $active_payment_method;
260 260
 						EEM_Change_Log::instance()->log(
261 261
 							EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment
262 262
 						);
263 263
 						break;
264
-					} catch( EventEspresso\core\exceptions\IpnException $e ) {
264
+					} catch (EventEspresso\core\exceptions\IpnException $e) {
265 265
                         EEM_Change_Log::instance()->log(
266 266
                             EEM_Change_Log::type_gateway,
267 267
                             array(
268
-                                'message' => 'IPN Exception: ' . $e->getMessage(),
268
+                                'message' => 'IPN Exception: '.$e->getMessage(),
269 269
                                 'current_url' => EEH_URL::current_url(),
270 270
                                 'payment' => $e->getPaymentProperties(),
271 271
                                 'IPN_data' => $e->getIpnData()
@@ -273,33 +273,33 @@  discard block
 block discarded – undo
273 273
                             $obj_for_log
274 274
                         );
275 275
                         return $e->getPayment();
276
-                    } catch( EE_Error $e ) {
276
+                    } catch (EE_Error $e) {
277 277
 						//that's fine- it apparently couldn't handle the IPN
278 278
 					}
279 279
 				}
280 280
 
281 281
 			}
282 282
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
283
-			if( $payment instanceof EE_Payment){
283
+			if ($payment instanceof EE_Payment) {
284 284
 				$payment->save();
285 285
 				//  update the TXN
286
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
287
-			}else{
286
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request);
287
+			} else {
288 288
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
289
-				if($payment_method){
289
+				if ($payment_method) {
290 290
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
291
-				}elseif($transaction){
291
+				}elseif ($transaction) {
292 292
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
293 293
 				}
294 294
 			}
295 295
 			return $payment;
296 296
 
297
-		} catch( EE_Error $e ) {
297
+		} catch (EE_Error $e) {
298 298
 			do_action(
299 299
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
300
-					__( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ),
301
-					print_r( $transaction, TRUE ),
302
-					print_r( $_req_data, TRUE ),
300
+					__('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'),
301
+					print_r($transaction, TRUE),
302
+					print_r($_req_data, TRUE),
303 303
 					$e->getMessage()
304 304
 				)
305 305
 			);
@@ -314,10 +314,10 @@  discard block
 block discarded – undo
314 314
 	 * @param  array $request_data
315 315
 	 * @return array
316 316
 	 */
317
-	protected function _remove_unusable_characters_from_array( array $request_data ) {
317
+	protected function _remove_unusable_characters_from_array(array $request_data) {
318 318
 		$return_data = array();
319
-		foreach( $request_data as $key => $value ) {
320
-			$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
319
+		foreach ($request_data as $key => $value) {
320
+			$return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value);
321 321
 		}
322 322
 		return $return_data;
323 323
 	}
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
 	 * @param string $request_data
330 330
 	 * @return string
331 331
 	 */
332
-	protected function _remove_unusable_characters( $request_data ) {
333
-		return preg_replace( '/[^[:print:]]/', '', $request_data );
332
+	protected function _remove_unusable_characters($request_data) {
333
+		return preg_replace('/[^[:print:]]/', '', $request_data);
334 334
 	}
335 335
 
336 336
 
@@ -352,13 +352,13 @@  discard block
 block discarded – undo
352 352
 	 * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO,
353 353
 	 *                                      to call handle_ipn() for offsite gateways that don't receive separate IPNs
354 354
 	 */
355
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
355
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
356 356
 		/** @var $transaction EE_Transaction */
357
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
357
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
358 358
 		$last_payment_method = $transaction->payment_method();
359
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
360
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
361
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
359
+		if ($last_payment_method instanceof EE_Payment_Method) {
360
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
361
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
362 362
 			return $payment;
363 363
 		} else {
364 364
 			return NULL;
@@ -381,9 +381,9 @@  discard block
 block discarded – undo
381 381
 		EE_Payment $payment_to_refund,
382 382
 		$refund_info = array()
383 383
 	) {
384
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) {
385
-			$payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info );
386
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
384
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) {
385
+			$payment_method->type_obj()->process_refund($payment_to_refund, $refund_info);
386
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
387 387
 		}
388 388
 		return $payment_to_refund;
389 389
 	}
@@ -424,12 +424,12 @@  discard block
 block discarded – undo
424 424
 	 *                        TXN is locked before updating
425 425
 	 * @throws \EE_Error
426 426
 	 */
427
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
427
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
428 428
 		$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful';
429 429
 		/** @type EE_Transaction $transaction */
430
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
430
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
431 431
 		// can we freely update the TXN at this moment?
432
-		if ( $IPN && $transaction->is_locked() ) {
432
+		if ($IPN && $transaction->is_locked()) {
433 433
 			// don't update the transaction at this exact moment
434 434
 			// because the TXN is active in another request
435 435
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -439,38 +439,38 @@  discard block
 block discarded – undo
439 439
 			);
440 440
 		} else {
441 441
 			// verify payment and that it has been saved
442
-			if ( $payment instanceof EE_Payment && $payment->ID() ) {
443
-				if(
442
+			if ($payment instanceof EE_Payment && $payment->ID()) {
443
+				if (
444 444
 					$payment->payment_method() instanceof EE_Payment_Method
445 445
 					&& $payment->payment_method()->type_obj() instanceof EE_PMT_Base
446
-				){
447
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
446
+				) {
447
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
448 448
 					// update TXN registrations with payment info
449
-					$this->process_registration_payments( $transaction, $payment );
449
+					$this->process_registration_payments($transaction, $payment);
450 450
 				}
451 451
 				$do_action = $payment->just_approved()
452 452
 					? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful'
453 453
 					: $do_action;
454 454
 			} else {
455 455
 				// send out notifications
456
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
456
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
457 457
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
458 458
 			}
459
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
459
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
460 460
 				/** @type EE_Transaction_Payments $transaction_payments */
461
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
461
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
462 462
 				// set new value for total paid
463
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
463
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
464 464
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
465
-				if ( $update_txn ) {
466
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
465
+				if ($update_txn) {
466
+					$this->_post_payment_processing($transaction, $payment, $IPN);
467 467
 				}
468 468
 			}
469 469
 			// granular hook for others to use.
470
-			do_action( $do_action, $transaction, $payment );
471
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' );
470
+			do_action($do_action, $transaction, $payment);
471
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action');
472 472
 			//global hook for others to use.
473
-			do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment );
473
+			do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment);
474 474
 		}
475 475
 	}
476 476
 
@@ -490,25 +490,25 @@  discard block
 block discarded – undo
490 490
 		$registrations = array()
491 491
 	) {
492 492
 		// only process if payment was successful
493
-		if ( $payment->status() !== EEM_Payment::status_id_approved ) {
493
+		if ($payment->status() !== EEM_Payment::status_id_approved) {
494 494
 			return;
495 495
 		}
496 496
 		//EEM_Registration::instance()->show_next_x_db_queries();
497
-		if ( empty( $registrations )) {
497
+		if (empty($registrations)) {
498 498
 			// find registrations with monies owing that can receive a payment
499 499
 			$registrations = $transaction->registrations(
500 500
 				array(
501 501
 					array(
502 502
 						// only these reg statuses can receive payments
503
-						'STS_ID'           => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ),
504
-						'REG_final_price'  => array( '!=', 0 ),
505
-						'REG_final_price*' => array( '!=', 'REG_paid', true ),
503
+						'STS_ID'           => array('IN', EEM_Registration::reg_statuses_that_allow_payment()),
504
+						'REG_final_price'  => array('!=', 0),
505
+						'REG_final_price*' => array('!=', 'REG_paid', true),
506 506
 					)
507 507
 				)
508 508
 			);
509 509
 		}
510 510
 		// still nothing ??!??
511
-		if ( empty( $registrations )) {
511
+		if (empty($registrations)) {
512 512
 			return;
513 513
 		}
514 514
 		// todo: break out the following logic into a separate strategy class
@@ -520,28 +520,28 @@  discard block
 block discarded – undo
520 520
 
521 521
 		$refund = $payment->is_a_refund();
522 522
 		// how much is available to apply to registrations?
523
-		$available_payment_amount = abs( $payment->amount() );
524
-		foreach ( $registrations as $registration ) {
525
-			if ( $registration instanceof EE_Registration ) {
523
+		$available_payment_amount = abs($payment->amount());
524
+		foreach ($registrations as $registration) {
525
+			if ($registration instanceof EE_Registration) {
526 526
 				// nothing left?
527
-				if ( $available_payment_amount <= 0 ) {
527
+				if ($available_payment_amount <= 0) {
528 528
 					break;
529 529
 				}
530
-				if ( $refund ) {
531
-					$available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount );
530
+				if ($refund) {
531
+					$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
532 532
 				} else {
533
-					$available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount );
533
+					$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
534 534
 				}
535 535
 			}
536 536
 		}
537
-		if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) {
537
+		if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) {
538 538
 			EE_Error::add_attention(
539 539
 				sprintf(
540
-					__( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ),
541
-					EEH_Template::format_currency( $available_payment_amount ),
542
-					implode( ', ',  array_keys( $registrations ) ),
540
+					__('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'),
541
+					EEH_Template::format_currency($available_payment_amount),
542
+					implode(', ', array_keys($registrations)),
543 543
 					'<br/>',
544
-					EEH_Template::format_currency( $payment->amount() )
544
+					EEH_Template::format_currency($payment->amount())
545 545
 				),
546 546
 				__FILE__, __FUNCTION__, __LINE__
547 547
 			);
@@ -559,17 +559,17 @@  discard block
 block discarded – undo
559 559
 	 * @return float
560 560
 	 * @throws \EE_Error
561 561
 	 */
562
-	public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) {
562
+	public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) {
563 563
 		$owing = $registration->final_price() - $registration->paid();
564
-		if ( $owing > 0 ) {
564
+		if ($owing > 0) {
565 565
 			// don't allow payment amount to exceed the available payment amount, OR the amount owing
566
-			$payment_amount = min( $available_payment_amount, $owing );
566
+			$payment_amount = min($available_payment_amount, $owing);
567 567
 			// update $available_payment_amount
568 568
 			$available_payment_amount -= $payment_amount;
569 569
 			//calculate and set new REG_paid
570
-			$registration->set_paid( $registration->paid() + $payment_amount );
570
+			$registration->set_paid($registration->paid() + $payment_amount);
571 571
 			// now save it
572
-			$this->_apply_registration_payment( $registration, $payment, $payment_amount );
572
+			$this->_apply_registration_payment($registration, $payment, $payment_amount);
573 573
 		}
574 574
 		return $available_payment_amount;
575 575
 	}
@@ -585,19 +585,19 @@  discard block
 block discarded – undo
585 585
 	 * @return void
586 586
 	 * @throws \EE_Error
587 587
 	 */
588
-	protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) {
588
+	protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) {
589 589
 		// find any existing reg payment records for this registration and payment
590 590
 		$existing_reg_payment = EEM_Registration_Payment::instance()->get_one(
591
-			array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) )
591
+			array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID()))
592 592
 		);
593 593
 		// if existing registration payment exists
594
-		if ( $existing_reg_payment instanceof EE_Registration_Payment ) {
594
+		if ($existing_reg_payment instanceof EE_Registration_Payment) {
595 595
 			// then update that record
596
-			$existing_reg_payment->set_amount( $payment_amount );
596
+			$existing_reg_payment->set_amount($payment_amount);
597 597
 			$existing_reg_payment->save();
598 598
 		} else {
599 599
 			// or add new relation between registration and payment and set amount
600
-			$registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) );
600
+			$registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount));
601 601
 			// make it stick
602 602
 			$registration->save();
603 603
 		}
@@ -614,21 +614,21 @@  discard block
 block discarded – undo
614 614
 	 * @return float
615 615
 	 * @throws \EE_Error
616 616
 	 */
617
-	public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) {
617
+	public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) {
618 618
 		//EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ );
619
-		if ( $registration->paid() > 0 ) {
619
+		if ($registration->paid() > 0) {
620 620
 			// ensure $available_refund_amount is NOT negative
621
-			$available_refund_amount = (float)abs( $available_refund_amount );
621
+			$available_refund_amount = (float) abs($available_refund_amount);
622 622
 			// don't allow refund amount to exceed the available payment amount, OR the amount paid
623
-			$refund_amount = min( $available_refund_amount, (float)$registration->paid() );
623
+			$refund_amount = min($available_refund_amount, (float) $registration->paid());
624 624
 			// update $available_payment_amount
625 625
 			$available_refund_amount -= $refund_amount;
626 626
 			//calculate and set new REG_paid
627
-			$registration->set_paid( $registration->paid() - $refund_amount );
627
+			$registration->set_paid($registration->paid() - $refund_amount);
628 628
 			// convert payment amount back to a negative value for storage in the db
629
-			$refund_amount = (float)abs( $refund_amount ) * -1;
629
+			$refund_amount = (float) abs($refund_amount) * -1;
630 630
 			// now save it
631
-			$this->_apply_registration_payment( $registration, $payment, $refund_amount );
631
+			$this->_apply_registration_payment($registration, $payment, $refund_amount);
632 632
 		}
633 633
 		return $available_refund_amount;
634 634
 	}
@@ -647,53 +647,53 @@  discard block
 block discarded – undo
647 647
 	 * @param bool           $IPN
648 648
 	 * @throws \EE_Error
649 649
 	 */
650
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
650
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
651 651
 
652 652
 		/** @type EE_Transaction_Processor $transaction_processor */
653
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
653
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
654 654
 		// is the Payment Options Reg Step completed ?
655
-		$payment_options_step_completed = $transaction->reg_step_completed( 'payment_options' );
655
+		$payment_options_step_completed = $transaction->reg_step_completed('payment_options');
656 656
 		// if the Payment Options Reg Step is completed...
657 657
 		$revisit = $payment_options_step_completed === true ? true : false;
658 658
 		// then this is kinda sorta a revisit with regards to payments at least
659
-		$transaction_processor->set_revisit( $revisit );
659
+		$transaction_processor->set_revisit($revisit);
660 660
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
661 661
 		if (
662 662
 			$IPN &&
663 663
 			$payment_options_step_completed !== true &&
664
-			( $payment->is_approved() || $payment->is_pending() )
664
+			($payment->is_approved() || $payment->is_pending())
665 665
 		) {
666 666
 			$payment_options_step_completed = $transaction->set_reg_step_completed(
667 667
 				'payment_options'
668 668
 			);
669 669
 		}
670 670
 		// maybe update status, but don't save transaction just yet
671
-		$transaction->update_status_based_on_total_paid( false );
671
+		$transaction->update_status_based_on_total_paid(false);
672 672
 		// check if 'finalize_registration' step has been completed...
673
-		$finalized = $transaction->reg_step_completed( 'finalize_registration' );
673
+		$finalized = $transaction->reg_step_completed('finalize_registration');
674 674
 		//  if this is an IPN and the final step has not been initiated
675
-		if ( $IPN && $payment_options_step_completed && $finalized === false ) {
675
+		if ($IPN && $payment_options_step_completed && $finalized === false) {
676 676
 			// and if it hasn't already been set as being started...
677
-			$finalized = $transaction->set_reg_step_initiated( 'finalize_registration' );
677
+			$finalized = $transaction->set_reg_step_initiated('finalize_registration');
678 678
 		}
679 679
 		$transaction->save();
680 680
 		// because the above will return false if the final step was not fully completed, we need to check again...
681
-		if ( $IPN && $finalized !== false ) {
681
+		if ($IPN && $finalized !== false) {
682 682
 			// and if we are all good to go, then send out notifications
683
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
683
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
684 684
 			//ok, now process the transaction according to the payment
685
-			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
685
+			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
686 686
 		}
687 687
 		// DEBUG LOG
688 688
 		$payment_method = $payment->payment_method();
689
-		if ( $payment_method instanceof EE_Payment_Method ) {
689
+		if ($payment_method instanceof EE_Payment_Method) {
690 690
 			$payment_method_type_obj = $payment_method->type_obj();
691
-			if ( $payment_method_type_obj instanceof EE_PMT_Base ) {
691
+			if ($payment_method_type_obj instanceof EE_PMT_Base) {
692 692
 				$gateway = $payment_method_type_obj->get_gateway();
693
-				if ( $gateway instanceof EE_Gateway ){
693
+				if ($gateway instanceof EE_Gateway) {
694 694
 					$gateway->log(
695 695
 						array(
696
-							'message'               => __( 'Post Payment Transaction Details', 'event_espresso' ),
696
+							'message'               => __('Post Payment Transaction Details', 'event_espresso'),
697 697
 							'transaction'           => $transaction->model_field_array(),
698 698
 							'finalized'             => $finalized,
699 699
 							'IPN'                   => $IPN,
@@ -715,11 +715,11 @@  discard block
 block discarded – undo
715 715
  	 * https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1914&viewlocale=en_US
716 716
 	 * This will affect paypal standard, pro, express, and payflow.
717 717
  	 */
718
- 	public static function _curl_requests_to_paypal_use_tls( $handle, $r, $url ) {
719
- 		if ( strstr( $url, 'https://' ) && strstr( $url, '.paypal.com' ) ) {
718
+ 	public static function _curl_requests_to_paypal_use_tls($handle, $r, $url) {
719
+ 		if (strstr($url, 'https://') && strstr($url, '.paypal.com')) {
720 720
 			//Use the value of the constant CURL_SSLVERSION_TLSv1 = 1
721 721
 			//instead of the constant because it might not be defined
722
- 			curl_setopt( $handle, CURLOPT_SSLVERSION, 1 );
722
+ 			curl_setopt($handle, CURLOPT_SSLVERSION, 1);
723 723
  		}
724 724
  	}
725 725
  }
Please login to merge, or discard this patch.
core/exceptions/IpnException.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\exceptions;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -21,71 +21,71 @@  discard block
 block discarded – undo
21 21
 class IpnException extends \LogicException
22 22
 {
23 23
 
24
-    const DUPLICATE          = 1;
24
+	const DUPLICATE          = 1;
25 25
 
26
-    const UNABLE_TO_VALIDATE = 2;
26
+	const UNABLE_TO_VALIDATE = 2;
27 27
 
28
-    const UNSUPPORTED        = 3;
28
+	const UNSUPPORTED        = 3;
29 29
 
30
-    /**
31
-     * @var \EE_Payment
32
-     */
33
-    protected $payment;
30
+	/**
31
+	 * @var \EE_Payment
32
+	 */
33
+	protected $payment;
34 34
 
35
-    /**
36
-     * @var mixed IPN data, usually an array or object
37
-     */
38
-    protected $ipn_data;
35
+	/**
36
+	 * @var mixed IPN data, usually an array or object
37
+	 */
38
+	protected $ipn_data;
39 39
 
40 40
 
41 41
 
42
-    public function __construct(
43
-        $message,
44
-        $code = 0,
45
-        \Exception $previous = null,
46
-        \EE_Payment $payment = null,
47
-        $ipn_data = array()
48
-    ) {
49
-        parent::__construct($message, $code, $previous);
50
-        $this->payment = $payment;
51
-        $this->ipn_data = $ipn_data;
52
-    }
42
+	public function __construct(
43
+		$message,
44
+		$code = 0,
45
+		\Exception $previous = null,
46
+		\EE_Payment $payment = null,
47
+		$ipn_data = array()
48
+	) {
49
+		parent::__construct($message, $code, $previous);
50
+		$this->payment = $payment;
51
+		$this->ipn_data = $ipn_data;
52
+	}
53 53
 
54 54
 
55 55
 
56
-    /**
57
-     * Gets the payment associated with this IPN, if known
58
-     *
59
-     * @return \EE_Payment
60
-     */
61
-    public function getPayment()
62
-    {
63
-        return $this->payment;
64
-    }
56
+	/**
57
+	 * Gets the payment associated with this IPN, if known
58
+	 *
59
+	 * @return \EE_Payment
60
+	 */
61
+	public function getPayment()
62
+	{
63
+		return $this->payment;
64
+	}
65 65
 
66 66
 
67 67
 
68
-    /**
69
-     * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array)
70
-     *
71
-     * @return array
72
-     * @throws \EE_Error
73
-     */
74
-    public function getPaymentProperties()
75
-    {
76
-        return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array();
77
-    }
68
+	/**
69
+	 * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array)
70
+	 *
71
+	 * @return array
72
+	 * @throws \EE_Error
73
+	 */
74
+	public function getPaymentProperties()
75
+	{
76
+		return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array();
77
+	}
78 78
 
79 79
 
80 80
 
81
-    /**
82
-     * Returns an array, object, or string, however, the IPN data was received
83
-     *
84
-     * @return mixed
85
-     */
86
-    public function getIpnData()
87
-    {
88
-        return $this->ipn_data;
89
-    }
81
+	/**
82
+	 * Returns an array, object, or string, however, the IPN data was received
83
+	 *
84
+	 * @return mixed
85
+	 */
86
+	public function getIpnData()
87
+	{
88
+		return $this->ipn_data;
89
+	}
90 90
 
91 91
 }
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
core/helpers/EEH_URL.helper.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * ------------------------------------------------------------------------
11 11
  */
12
-class EEH_URL{
12
+class EEH_URL {
13 13
 
14 14
 	/**
15 15
 	 * _add_query_arg
@@ -21,30 +21,30 @@  discard block
 block discarded – undo
21 21
 	 * @param bool  $exclude_nonce  If true then the nonce will be excluded from the generated url.
22 22
 	 * @return string
23 23
 	 */
24
-	public static function add_query_args_and_nonce( $args = array(), $url = '', $exclude_nonce = false ) {
25
-		if ( empty( $url ) ) {
26
-			$user_msg = __('An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.', 'event_espresso' );
27
-			$dev_msg = $user_msg . "\n" . sprintf(
28
-					__('In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s::add_query_args_and_nonce method.', 'event_espresso' ),
24
+	public static function add_query_args_and_nonce($args = array(), $url = '', $exclude_nonce = false) {
25
+		if (empty($url)) {
26
+			$user_msg = __('An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.', 'event_espresso');
27
+			$dev_msg = $user_msg."\n".sprintf(
28
+					__('In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s::add_query_args_and_nonce method.', 'event_espresso'),
29 29
 					__CLASS__
30 30
 				);
31
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
31
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
32 32
 		}
33 33
 		// check that an action exists and add nonce
34
-		if ( ! $exclude_nonce ) {
35
-			if ( isset( $args['action'] ) && ! empty( $args['action'] ) ) {
36
-				$args = array_merge( $args, array( $args['action'] . '_nonce' => wp_create_nonce( $args['action'] . '_nonce' ) ) );
34
+		if ( ! $exclude_nonce) {
35
+			if (isset($args['action']) && ! empty($args['action'])) {
36
+				$args = array_merge($args, array($args['action'].'_nonce' => wp_create_nonce($args['action'].'_nonce')));
37 37
 			} else {
38
-				$args = array_merge( $args, array( 'action' => 'default', 'default_nonce' => wp_create_nonce( 'default_nonce' ) ) );
38
+				$args = array_merge($args, array('action' => 'default', 'default_nonce' => wp_create_nonce('default_nonce')));
39 39
 			}
40 40
 		}
41 41
 
42 42
 		//finally, let's always add a return address (if present) :)
43
-		$args = ! empty( $_REQUEST['action'] ) && ! isset( $_REQUEST[ 'return' ] )
44
-			? array_merge( $args, array( 'return' => $_REQUEST['action'] ) )
43
+		$args = ! empty($_REQUEST['action']) && ! isset($_REQUEST['return'])
44
+			? array_merge($args, array('return' => $_REQUEST['action']))
45 45
 			: $args;
46 46
 
47
-		return add_query_arg( $args, $url );
47
+		return add_query_arg($args, $url);
48 48
 
49 49
 	}
50 50
 
@@ -57,17 +57,17 @@  discard block
 block discarded – undo
57 57
 	 * @param boolean $sslverify whether we care if the SSL certificate for the requested site is setup properly
58 58
 	 * @return boolean
59 59
 	 */
60
-	public static function remote_file_exists( $url, $args = array() ){
61
-		$results = wp_remote_request($url,array_merge( array(
60
+	public static function remote_file_exists($url, $args = array()) {
61
+		$results = wp_remote_request($url, array_merge(array(
62 62
 			'method'=>'GET',
63 63
 			'redirection'=>1
64
-		), $args ) );
65
-		if( ! $results instanceof WP_Error &&
64
+		), $args));
65
+		if ( ! $results instanceof WP_Error &&
66 66
 				isset($results['response']) &&
67 67
 				isset($results['response']['code']) &&
68
-				$results['response']['code'] == '200'){
68
+				$results['response']['code'] == '200') {
69 69
 			return true;
70
-		}else{
70
+		} else {
71 71
 			return false;
72 72
 		}
73 73
 	}
@@ -83,29 +83,29 @@  discard block
 block discarded – undo
83 83
 	 * @param bool   $base_url_only - TRUE will only return the scheme and host with no other parameters
84 84
 	 * @return string
85 85
 	 */
86
-	public static function refactor_url( $url = '', $remove_query = TRUE, $base_url_only = FALSE ) {
86
+	public static function refactor_url($url = '', $remove_query = TRUE, $base_url_only = FALSE) {
87 87
 		// break apart incoming URL
88
-		$url_bits = parse_url( $url );
88
+		$url_bits = parse_url($url);
89 89
 		// HTTP or HTTPS ?
90
-		$scheme = isset( $url_bits[ 'scheme' ] ) ? $url_bits[ 'scheme' ] . '://' : 'http://';
90
+		$scheme = isset($url_bits['scheme']) ? $url_bits['scheme'].'://' : 'http://';
91 91
 		// domain
92
-		$host = isset( $url_bits[ 'host' ] ) ? $url_bits[ 'host' ] : '';
92
+		$host = isset($url_bits['host']) ? $url_bits['host'] : '';
93 93
 		// if only the base URL is requested, then return that now
94
-		if ( $base_url_only ) {
95
-			return $scheme . $host;
94
+		if ($base_url_only) {
95
+			return $scheme.$host;
96 96
 		}
97
-		$port = isset( $url_bits[ 'port' ] ) ? ':' . $url_bits[ 'port' ] : '';
98
-		$user = isset( $url_bits[ 'user' ] ) ? $url_bits[ 'user' ] : '';
99
-		$pass = isset( $url_bits[ 'pass' ] ) ? ':' . $url_bits[ 'pass' ] : '';
100
-		$pass = ( $user || $pass ) ? $pass . '@' : '';
101
-		$path = isset( $url_bits[ 'path' ] ) ? $url_bits[ 'path' ] : '';
97
+		$port = isset($url_bits['port']) ? ':'.$url_bits['port'] : '';
98
+		$user = isset($url_bits['user']) ? $url_bits['user'] : '';
99
+		$pass = isset($url_bits['pass']) ? ':'.$url_bits['pass'] : '';
100
+		$pass = ($user || $pass) ? $pass.'@' : '';
101
+		$path = isset($url_bits['path']) ? $url_bits['path'] : '';
102 102
 		// if the query string is not required, then return what we have so far
103
-		if ( $remove_query ) {
104
-			return $scheme . $user . $pass . $host . $port . $path;
103
+		if ($remove_query) {
104
+			return $scheme.$user.$pass.$host.$port.$path;
105 105
 		}
106
-		$query = isset( $url_bits[ 'query' ] ) ? '?' . $url_bits[ 'query' ] : '';
107
-		$fragment = isset( $url_bits[ 'fragment' ] ) ? '#' . $url_bits[ 'fragment' ] : '';
108
-		return $scheme . $user . $pass . $host . $port . $path . $query . $fragment;
106
+		$query = isset($url_bits['query']) ? '?'.$url_bits['query'] : '';
107
+		$fragment = isset($url_bits['fragment']) ? '#'.$url_bits['fragment'] : '';
108
+		return $scheme.$user.$pass.$host.$port.$path.$query.$fragment;
109 109
 	}
110 110
 
111 111
 
@@ -118,29 +118,29 @@  discard block
 block discarded – undo
118 118
 	 * @param bool   $as_array TRUE (default) will return query params as an array of key value pairs, FALSE will simply return the query string
119 119
 	 * @return string|array
120 120
 	 */
121
-	public static function get_query_string( $url = '', $as_array = TRUE ) {
121
+	public static function get_query_string($url = '', $as_array = TRUE) {
122 122
 		// break apart incoming URL
123
-		$url_bits = parse_url( $url );
123
+		$url_bits = parse_url($url);
124 124
 		// grab query string from URL
125
-		$query = isset( $url_bits[ 'query' ] ) ? $url_bits[ 'query' ] : '';
125
+		$query = isset($url_bits['query']) ? $url_bits['query'] : '';
126 126
 		// if we don't want the query string formatted into an array of key => value pairs, then just return it as is
127
-		if ( ! $as_array ) {
127
+		if ( ! $as_array) {
128 128
 			return $query;
129 129
 		}
130 130
 		// if no query string exists then just return an empty array now
131
-		if ( empty( $query )) {
131
+		if (empty($query)) {
132 132
 			return array();
133 133
 		}
134 134
 		// empty array to hold results
135 135
 		$query_params = array();
136 136
 		// now break apart the query string into separate params
137
-		$query = explode( '&', $query );
137
+		$query = explode('&', $query);
138 138
 		// loop thru our query params
139
-		foreach ( $query as $query_args ) {
139
+		foreach ($query as $query_args) {
140 140
 			// break apart the key value pairs
141
-			$query_args = explode( '=', $query_args );
141
+			$query_args = explode('=', $query_args);
142 142
 			// and add to our results array
143
-			$query_params[ $query_args[0] ] = $query_args[1];
143
+			$query_params[$query_args[0]] = $query_args[1];
144 144
 		}
145 145
 		return $query_params;
146 146
 	}
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * prevent_prefetching
152 152
 	 * @return void
153 153
 	 */
154
-	public static function prevent_prefetching(){
154
+	public static function prevent_prefetching() {
155 155
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
156 156
 		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
157 157
 	}
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	 * @param   string $prefix Use this to prefix the string with something.
167 167
 	 * @return string
168 168
 	 */
169
-	public static function generate_unique_token( $prefix = '' ) {
170
-		$token =  md5( uniqid() . mt_rand() );
171
-		return $prefix ? $prefix . '_' . $token : $token;
169
+	public static function generate_unique_token($prefix = '') {
170
+		$token = md5(uniqid().mt_rand());
171
+		return $prefix ? $prefix.'_'.$token : $token;
172 172
 	}
173 173
 
174 174
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * add_nocache_headers
178 178
 	 * @return void
179 179
 	 */
180
-	public static function add_nocache_headers(){
180
+	public static function add_nocache_headers() {
181 181
 		// add no cache headers
182 182
 //		add_action( 'wp_head' , array( 'EED_Single_Page_Checkout', 'nocache_headers' ), 10 );
183 183
 		// plus a little extra for nginx
@@ -194,19 +194,19 @@  discard block
 block discarded – undo
194 194
 	 * @param string $server_variable
195 195
 	 * @return string
196 196
 	 */
197
-	public static function filter_input_server_url( $server_variable = 'REQUEST_URI' ){
197
+	public static function filter_input_server_url($server_variable = 'REQUEST_URI') {
198 198
 		$URL = '';
199 199
 		$server_variables = array(
200 200
 			'REQUEST_URI' => 1,
201 201
 			'HTTP_HOST' => 1,
202 202
 			'PHP_SELF' => 1,
203 203
 		);
204
-		$server_variable = strtoupper( $server_variable );
204
+		$server_variable = strtoupper($server_variable);
205 205
 		// whitelist INPUT_SERVER var
206
-		if ( isset( $server_variables[ $server_variable ] ) ) {
207
-			$URL = filter_input( INPUT_SERVER, $server_variable, FILTER_SANITIZE_URL, FILTER_NULL_ON_FAILURE );
208
-			if ( empty( $URL ) ) {
209
-				$URL = esc_url( $_SERVER[ $server_variable ] );
206
+		if (isset($server_variables[$server_variable])) {
207
+			$URL = filter_input(INPUT_SERVER, $server_variable, FILTER_SANITIZE_URL, FILTER_NULL_ON_FAILURE);
208
+			if (empty($URL)) {
209
+				$URL = esc_url($_SERVER[$server_variable]);
210 210
 			}
211 211
 		}
212 212
 		return $URL;
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 	 * @return string
220 220
 	 */
221 221
 	public static function current_url() {
222
-		if ( isset( $_SERVER[ 'HTTP_HOST' ], $_SERVER[ 'REQUEST_URI' ] ) ) {
222
+		if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) {
223 223
 			$url = is_ssl() ? 'https://' : 'http://';
224
-			$url .= \EEH_URL::filter_input_server_url( 'HTTP_HOST' );
225
-			$url .= \EEH_URL::filter_input_server_url( 'REQUEST_URI' );
224
+			$url .= \EEH_URL::filter_input_server_url('HTTP_HOST');
225
+			$url .= \EEH_URL::filter_input_server_url('REQUEST_URI');
226 226
 		} else {
227 227
 			$url = 'unknown';
228 228
 		}
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_Checkout.class.php 2 patches
Indentation   +28 added lines, -28 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_Checkout
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_Checkout
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_Checkout {
15 15
 
16 16
 	/**
@@ -804,10 +804,10 @@  discard block
 block discarded – undo
804 804
 	 */
805 805
 	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
806 806
 		return ! $this->revisit
807
-		       || $this->primary_revisit
808
-		       || (
809
-			       $this->revisit && $this->reg_url_link === $registration->reg_url_link()
810
-		       )
807
+			   || $this->primary_revisit
808
+			   || (
809
+				   $this->revisit && $this->reg_url_link === $registration->reg_url_link()
810
+			   )
811 811
 			? true
812 812
 			: false;
813 813
 	}
@@ -1190,19 +1190,19 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 
1192 1192
 
1193
-    /**
1194
-     *    __sleep
1195
-     * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon serialization
1196
-     * EE_Checkout will handle the reimplementation of itself upon waking,
1197
-     * but we won't bother with the reg form, because if needed, it will be regenerated anyways
1198
-     *
1199
-     * @return array
1200
-     */
1201
-    public function __sleep()
1202
-    {
1203
-        // remove the reg form and the checkout
1204
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1205
-    }
1193
+	/**
1194
+	 *    __sleep
1195
+	 * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon serialization
1196
+	 * EE_Checkout will handle the reimplementation of itself upon waking,
1197
+	 * but we won't bother with the reg form, because if needed, it will be regenerated anyways
1198
+	 *
1199
+	 * @return array
1200
+	 */
1201
+	public function __sleep()
1202
+	{
1203
+		// remove the reg form and the checkout
1204
+		return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1205
+	}
1206 1206
 
1207 1207
 
1208 1208
 	/**
Please login to merge, or discard this patch.
Spacing   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 		$this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url();
248 248
 		$this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url();
249 249
 		$this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url();
250
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE );
250
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE);
251 251
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax;
252
-		$this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' ));
252
+		$this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC'));
253 253
 	}
254 254
 
255 255
 
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 	 * @return boolean
261 261
 	 */
262 262
 	public function any_reg_status_updated() {
263
-		foreach ( $this->reg_status_updated as $reg_status ) {
264
-			if ( $reg_status ) {
263
+		foreach ($this->reg_status_updated as $reg_status) {
264
+			if ($reg_status) {
265 265
 				return true;
266 266
 			}
267 267
 		}
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 	 * @param $REG_ID
275 275
 	 * @return boolean
276 276
 	 */
277
-	public function reg_status_updated( $REG_ID ) {
278
-		return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false;
277
+	public function reg_status_updated($REG_ID) {
278
+		return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false;
279 279
 	}
280 280
 
281 281
 
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 	 * @param $REG_ID
285 285
 	 * @param $reg_status
286 286
 	 */
287
-	public function set_reg_status_updated( $REG_ID, $reg_status ) {
288
-		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
287
+	public function set_reg_status_updated($REG_ID, $reg_status) {
288
+		$this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN);
289 289
 	}
290 290
 
291 291
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * can ONLY be set by the  Finalize_Registration reg step
307 307
 	 */
308 308
 	public function set_exit_spco() {
309
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
309
+		if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
310 310
 			$this->exit_spco = true;
311 311
 		}
312 312
 	}
@@ -323,12 +323,12 @@  discard block
 block discarded – undo
323 323
 	 */
324 324
 	public function reset_for_current_request() {
325 325
 		$this->process_form_submission = FALSE;
326
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true );
326
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true);
327 327
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax;
328 328
 		$this->continue_reg = true;
329 329
 		$this->redirect = false;
330 330
 		// don't reset the cached redirect form if we're about to be asked to display it !!!
331
-		if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) {
331
+		if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') {
332 332
 			$this->redirect_form = '';
333 333
 		}
334 334
 		$this->redirect_url = '';
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 	 * @param EE_SPCO_Reg_Step $reg_step_obj
346 346
 	 * @return    void
347 347
 	 */
348
-	public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) {
349
-		$this->reg_steps[ $reg_step_obj->slug()  ] = $reg_step_obj;
348
+	public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) {
349
+		$this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj;
350 350
 	}
351 351
 
352 352
 
@@ -362,22 +362,22 @@  discard block
 block discarded – undo
362 362
 	 * @return    void
363 363
 	 * @throws \EE_Error
364 364
 	 */
365
-	public function skip_reg_step( $reg_step_slug = '' ) {
366
-		$step_to_skip = $this->find_reg_step( $reg_step_slug );
367
-		if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) {
368
-			$step_to_skip->set_is_current_step( false );
365
+	public function skip_reg_step($reg_step_slug = '') {
366
+		$step_to_skip = $this->find_reg_step($reg_step_slug);
367
+		if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) {
368
+			$step_to_skip->set_is_current_step(false);
369 369
 			$step_to_skip->set_completed();
370 370
 			// advance to the next step
371
-			$this->set_current_step( $this->next_step->slug() );
371
+			$this->set_current_step($this->next_step->slug());
372 372
 			// also reset the step param in the request in case any other code references that directly
373
-			EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() );
373
+			EE_Registry::instance()->REQ->set('step', $this->current_step->slug());
374 374
 			// since we are skipping a step and setting the current step to be what was previously the next step,
375 375
 			// we need to check that the next step is now correct, and not still set to the current step.
376
-			if ( $this->current_step->slug() === $this->next_step->slug() ) {
376
+			if ($this->current_step->slug() === $this->next_step->slug()) {
377 377
 				// correctly setup the next step
378 378
 				$this->set_next_step();
379 379
 			}
380
-			$this->set_reg_step_initiated( $this->current_step );
380
+			$this->set_reg_step_initiated($this->current_step);
381 381
 		}
382 382
 	}
383 383
 
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
 	 * @param bool   $reset whether to reset reg steps after removal
392 392
 	 * @throws EE_Error
393 393
 	 */
394
-	public function remove_reg_step( $reg_step_slug = '', $reset = true ) {
395
-		unset( $this->reg_steps[ $reg_step_slug  ] );
396
-		if ( $this->transaction instanceof EE_Transaction ) {
394
+	public function remove_reg_step($reg_step_slug = '', $reset = true) {
395
+		unset($this->reg_steps[$reg_step_slug]);
396
+		if ($this->transaction instanceof EE_Transaction) {
397 397
 			// now remove reg step from TXN and save
398
-			$this->transaction->remove_reg_step( $reg_step_slug );
398
+			$this->transaction->remove_reg_step($reg_step_slug);
399 399
 			$this->transaction->save();
400 400
 		}
401
-		if ( $reset ) {
401
+		if ($reset) {
402 402
 			$this->reset_reg_steps();
403 403
 		}
404 404
 	}
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 	 * @param int    $order
414 414
 	 * @return    void
415 415
 	 */
416
-	public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) {
417
-		if ( isset( $this->reg_steps[ $reg_step_slug  ] )) {
418
-			$this->reg_steps[ $reg_step_slug ]->set_order( $order );
416
+	public function set_reg_step_order($reg_step_slug = '', $order = 100) {
417
+		if (isset($this->reg_steps[$reg_step_slug])) {
418
+			$this->reg_steps[$reg_step_slug]->set_order($order);
419 419
 		}
420 420
 	}
421 421
 
@@ -428,25 +428,25 @@  discard block
 block discarded – undo
428 428
 	 * @param string $current_step
429 429
 	 * @return    void
430 430
 	 */
431
-	public function set_current_step( $current_step ) {
431
+	public function set_current_step($current_step) {
432 432
 		// grab what step we're on
433
-		$this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps );
433
+		$this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps);
434 434
 		// verify instance
435
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step ) {
435
+		if ($this->current_step instanceof EE_SPCO_Reg_Step) {
436 436
 			// we don't want to repeat completed steps if this is the first time through SPCO
437
-			if ( $this->continue_reg && ! $this->revisit && $this->current_step->completed() ) {
437
+			if ($this->continue_reg && ! $this->revisit && $this->current_step->completed()) {
438 438
 				// so advance to the next step
439 439
 				$this->set_next_step();
440
-				if ( $this->next_step instanceof EE_SPCO_Reg_Step ) {
440
+				if ($this->next_step instanceof EE_SPCO_Reg_Step) {
441 441
 					// and attempt to set it as the current step
442
-					$this->set_current_step( $this->next_step->slug() );
442
+					$this->set_current_step($this->next_step->slug());
443 443
 				}
444 444
 				return;
445 445
 			}
446
-			$this->current_step->set_is_current_step( TRUE );
446
+			$this->current_step->set_is_current_step(TRUE);
447 447
 		} else {
448 448
 			EE_Error::add_error(
449
-				__( 'The current step could not be set.', 'event_espresso' ),
449
+				__('The current step could not be set.', 'event_espresso'),
450 450
 				__FILE__, __FUNCTION__, __LINE__
451 451
 			);
452 452
 		}
@@ -463,20 +463,20 @@  discard block
 block discarded – undo
463 463
 	 */
464 464
 	public function set_next_step() {
465 465
 		// set pointer to start of array
466
-		reset( $this->reg_steps );
466
+		reset($this->reg_steps);
467 467
 		// if there is more than one step
468
-		if ( count( $this->reg_steps ) > 1 ) {
468
+		if (count($this->reg_steps) > 1) {
469 469
 			// advance to the current step and set pointer
470
-			while ( key( $this->reg_steps ) !== $this->current_step->slug() && key( $this->reg_steps ) !== '' ) {
471
-				next( $this->reg_steps );
470
+			while (key($this->reg_steps) !== $this->current_step->slug() && key($this->reg_steps) !== '') {
471
+				next($this->reg_steps);
472 472
 			}
473 473
 		}
474 474
 		// advance one more spot ( if it exists )
475
-		$this->next_step = next( $this->reg_steps );
475
+		$this->next_step = next($this->reg_steps);
476 476
 		// verify instance
477
-		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step  : NULL;
477
+		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL;
478 478
 		// then back to current step to reset
479
-		prev( $this->reg_steps );
479
+		prev($this->reg_steps);
480 480
 	}
481 481
 
482 482
 
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	 *  @return 	EE_SPCO_Reg_Step | null
491 491
 	 */
492 492
 	public function get_next_reg_step() {
493
-		$next = next( $this->reg_steps );
494
-		prev( $this->reg_steps );
493
+		$next = next($this->reg_steps);
494
+		prev($this->reg_steps);
495 495
 		return $next instanceof EE_SPCO_Reg_Step ? $next : null;
496 496
 	}
497 497
 
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 	 *  @return 	EE_SPCO_Reg_Step | null
507 507
 	 */
508 508
 	public function get_prev_reg_step() {
509
-		$prev = prev( $this->reg_steps );
510
-		next( $this->reg_steps );
509
+		$prev = prev($this->reg_steps);
510
+		next($this->reg_steps);
511 511
 		return $prev instanceof EE_SPCO_Reg_Step ? $prev : null;
512 512
 	}
513 513
 
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 	 * @return void
521 521
 	 */
522 522
 	public function sort_reg_steps() {
523
-		$reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' );
524
-		uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback ));
523
+		$reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback');
524
+		uasort($this->reg_steps, array($this, $reg_step_sorting_callback));
525 525
 	}
526 526
 
527 527
 
@@ -534,19 +534,19 @@  discard block
 block discarded – undo
534 534
 	 * @param string $reg_step_slug
535 535
 	 * @return EE_SPCO_Reg_Step|null
536 536
 	 */
537
-	public function find_reg_step( $reg_step_slug = '' ) {
538
-		if ( ! empty( $reg_step_slug ) ) {
537
+	public function find_reg_step($reg_step_slug = '') {
538
+		if ( ! empty($reg_step_slug)) {
539 539
 			// copy reg step array
540 540
 			$reg_steps = $this->reg_steps;
541 541
 			// set pointer to start of array
542
-			reset( $reg_steps );
542
+			reset($reg_steps);
543 543
 			// if there is more than one step
544
-			if ( count( $reg_steps ) > 1 ) {
544
+			if (count($reg_steps) > 1) {
545 545
 				// advance to the current step and set pointer
546
-				while ( key( $reg_steps ) !== $reg_step_slug && key( $reg_steps ) !== '' ) {
547
-					next( $reg_steps );
546
+				while (key($reg_steps) !== $reg_step_slug && key($reg_steps) !== '') {
547
+					next($reg_steps);
548 548
 				}
549
-				return current( $reg_steps );
549
+				return current($reg_steps);
550 550
 			}
551 551
 		}
552 552
 		return null;
@@ -562,17 +562,17 @@  discard block
 block discarded – undo
562 562
 	 * @param EE_SPCO_Reg_Step $reg_step_B
563 563
 	 * @return int
564 564
 	 */
565
-	public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) {
565
+	public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) {
566 566
 		// send finalize_registration step to the end of the array
567
-		if ( $reg_step_A->slug() === 'finalize_registration' ) {
567
+		if ($reg_step_A->slug() === 'finalize_registration') {
568 568
 			return 1;
569
-		} else if ( $reg_step_B->slug() === 'finalize_registration' ) {
569
+		} else if ($reg_step_B->slug() === 'finalize_registration') {
570 570
 			return -1;
571 571
 		}
572
-		if ( $reg_step_A->order() === $reg_step_B->order() ) {
572
+		if ($reg_step_A->order() === $reg_step_B->order()) {
573 573
 			return 0;
574 574
 		}
575
-		return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1;
575
+		return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1;
576 576
 	}
577 577
 
578 578
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 	 * @param    EE_SPCO_Reg_Step $reg_step
585 585
 	 * @throws \EE_Error
586 586
 	 */
587
-	public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) {
587
+	public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) {
588 588
 		// call set_reg_step_initiated ???
589 589
 		if (
590 590
 			// first time visiting SPCO ?
@@ -597,11 +597,11 @@  discard block
 block discarded – undo
597 597
 			)
598 598
 		) {
599 599
 			// set the start time for this reg step
600
-			if ( ! $this->transaction->set_reg_step_initiated( $reg_step->slug() ) ) {
601
-				if ( WP_DEBUG ) {
600
+			if ( ! $this->transaction->set_reg_step_initiated($reg_step->slug())) {
601
+				if (WP_DEBUG) {
602 602
 					EE_Error::add_error(
603 603
 						sprintf(
604
-							__( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ),
604
+							__('The "%1$s" registration step was not initialized properly.', 'event_espresso'),
605 605
 							$reg_step->name()
606 606
 						),
607 607
 						__FILE__, __FUNCTION__, __LINE__
@@ -620,10 +620,10 @@  discard block
 block discarded – undo
620 620
 	 * 	@return 	void
621 621
 	 */
622 622
 	public function set_reg_step_JSON_info() {
623
-		EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array();
623
+		EE_Registry::$i18n_js_strings['reg_steps'] = array();
624 624
 		// pass basic reg step data to JS
625
-		foreach ( $this->reg_steps as $reg_step ) {
626
-			EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug();
625
+		foreach ($this->reg_steps as $reg_step) {
626
+			EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug();
627 627
 		}
628 628
 		// reset reg step html
629 629
 //		$this->json_response->set_reg_step_html( '' );
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	 */
640 640
 	public function reset_reg_steps() {
641 641
 		$this->sort_reg_steps();
642
-		$this->set_current_step( EE_Registry::instance()->REQ->get( 'step' ));
642
+		$this->set_current_step(EE_Registry::instance()->REQ->get('step'));
643 643
 		$this->set_next_step();
644 644
 		// the text that appears on the reg step form submit button
645 645
 		$this->current_step->set_submit_button_text();
@@ -656,9 +656,9 @@  discard block
 block discarded – undo
656 656
 	 */
657 657
 	public function get_registration_time_limit() {
658 658
 
659
-		$registration_time_limit = (float)( EE_Registry::instance()	->SSN->expiration() - time() );
659
+		$registration_time_limit = (float) (EE_Registry::instance()	->SSN->expiration() - time());
660 660
 		$time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s';
661
-		$registration_time_limit = date( $time_limit_format, $registration_time_limit );
661
+		$registration_time_limit = date($time_limit_format, $registration_time_limit);
662 662
 		return apply_filters(
663 663
 			'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit',
664 664
 			$registration_time_limit
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 		//		overpaid TXN
679 679
 		//		free TXN ( total = 0.00 )
680 680
 		// then payment required is TRUE
681
-		return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE;
681
+		return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE;
682 682
 	}
683 683
 
684 684
 
@@ -690,12 +690,12 @@  discard block
 block discarded – undo
690 690
 	 * @param EE_Transaction $transaction
691 691
 	 * @return EE_Cart
692 692
 	 */
693
-	public function get_cart_for_transaction( $transaction ) {
694
-		$session = EE_Registry::instance()->load_core( 'Session' );
695
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction, $session ) : null;
693
+	public function get_cart_for_transaction($transaction) {
694
+		$session = EE_Registry::instance()->load_core('Session');
695
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction, $session) : null;
696 696
 		// verify cart
697
-		if ( ! $cart instanceof EE_Cart ) {
698
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
697
+		if ( ! $cart instanceof EE_Cart) {
698
+			$cart = EE_Registry::instance()->load_core('Cart');
699 699
 		}
700 700
 
701 701
 		return $cart;
@@ -711,8 +711,8 @@  discard block
 block discarded – undo
711 711
 	 */
712 712
 	public function initialize_txn_reg_steps_array() {
713 713
 		$txn_reg_steps_array = array();
714
-		foreach ( $this->reg_steps as $reg_step ) {
715
-			$txn_reg_steps_array[ $reg_step->slug() ] = FALSE;
714
+		foreach ($this->reg_steps as $reg_step) {
715
+			$txn_reg_steps_array[$reg_step->slug()] = FALSE;
716 716
 		}
717 717
 		return $txn_reg_steps_array;
718 718
 	}
@@ -728,14 +728,14 @@  discard block
 block discarded – undo
728 728
 	 */
729 729
 	public function update_txn_reg_steps_array() {
730 730
 		$updated = false;
731
-		foreach ( $this->reg_steps as $reg_step ) {
732
-			if ( $reg_step->completed() ) {
733
-				$updated = $this->transaction->set_reg_step_completed( $reg_step->slug() )
731
+		foreach ($this->reg_steps as $reg_step) {
732
+			if ($reg_step->completed()) {
733
+				$updated = $this->transaction->set_reg_step_completed($reg_step->slug())
734 734
 					? true
735 735
 					: $updated;
736 736
 			}
737 737
 		}
738
-		if ( $updated ) {
738
+		if ($updated) {
739 739
 			$this->transaction->save();
740 740
 		}
741 741
 		return $updated;
@@ -751,14 +751,14 @@  discard block
 block discarded – undo
751 751
 	 * @throws \EE_Error
752 752
 	 */
753 753
 	public function stash_transaction_and_checkout() {
754
-		if ( ! $this->revisit ) {
754
+		if ( ! $this->revisit) {
755 755
 			$this->update_txn_reg_steps_array();
756 756
 		}
757 757
 		$this->track_transaction_and_registration_status_updates();
758 758
 		// save all data to the db, but suppress errors
759 759
 		//$this->save_all_data( FALSE );
760 760
 		// cache the checkout in the session
761
-		EE_Registry::instance()->SSN->set_checkout( $this );
761
+		EE_Registry::instance()->SSN->set_checkout($this);
762 762
 	}
763 763
 
764 764
 
@@ -773,15 +773,15 @@  discard block
 block discarded – undo
773 773
 	 */
774 774
 	public function track_transaction_and_registration_status_updates() {
775 775
 		// verify the transaction
776
-		if ( $this->transaction instanceof EE_Transaction ) {
776
+		if ($this->transaction instanceof EE_Transaction) {
777 777
 			// has there been a TXN status change during this checkout?
778 778
 			$this->txn_status_updated = $this->transaction->txn_status_updated();
779 779
 			/** @type EE_Registration_Processor $registration_processor */
780
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
780
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
781 781
 			// grab the saved registrations from the transaction
782
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) {
783
-				if ( $registration_processor->reg_status_updated( $registration->ID() ) ) {
784
-					$this->set_reg_status_updated( $registration->ID(), true );
782
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) {
783
+				if ($registration_processor->reg_status_updated($registration->ID())) {
784
+					$this->set_reg_status_updated($registration->ID(), true);
785 785
 				}
786 786
 			}
787 787
 		}
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 	 * @return    bool
803 803
 	 * @throws \EE_Error
804 804
 	 */
805
-	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
805
+	public function visit_allows_processing_of_this_registration(EE_Registration $registration) {
806 806
 		return ! $this->revisit
807 807
 		       || $this->primary_revisit
808 808
 		       || (
@@ -835,18 +835,18 @@  discard block
 block discarded – undo
835 835
 	 * @return bool
836 836
 	 * @throws \EE_Error
837 837
 	 */
838
-	public function save_all_data( $show_errors = TRUE ) {
838
+	public function save_all_data($show_errors = TRUE) {
839 839
 		// verify the transaction
840
-		if ( $this->transaction instanceof EE_Transaction ) {
840
+		if ($this->transaction instanceof EE_Transaction) {
841 841
 			// save to ensure that TXN has ID
842 842
 			$this->transaction->save();
843 843
 			// grab the saved registrations from the transaction
844
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as  $registration ) {
845
-				$this->_save_registration( $registration, $show_errors );
844
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as  $registration) {
845
+				$this->_save_registration($registration, $show_errors);
846 846
 			}
847 847
 		} else {
848
-			if ( $show_errors ) {
849
-				EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
848
+			if ($show_errors) {
849
+				EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850 850
 			}
851 851
 			return FALSE;
852 852
 		}
@@ -863,32 +863,32 @@  discard block
 block discarded – undo
863 863
 	 * @return void
864 864
 	 * @throws \EE_Error
865 865
 	 */
866
-	private function _save_registration( $registration, $show_errors = TRUE  ) {
866
+	private function _save_registration($registration, $show_errors = TRUE) {
867 867
 		// verify object
868
-		if ( $registration instanceof EE_Registration ) {
868
+		if ($registration instanceof EE_Registration) {
869 869
 			// should this registration be processed during this visit ?
870
-			if ( $this->visit_allows_processing_of_this_registration( $registration ) ) {
870
+			if ($this->visit_allows_processing_of_this_registration($registration)) {
871 871
 				//set TXN ID
872
-				if ( ! $registration->transaction_ID() ) {
873
-					$registration->set_transaction_id( $this->transaction->ID() );
872
+				if ( ! $registration->transaction_ID()) {
873
+					$registration->set_transaction_id($this->transaction->ID());
874 874
 				}
875 875
 				// verify and save the attendee
876
-				$this->_save_registration_attendee( $registration, $show_errors );
876
+				$this->_save_registration_attendee($registration, $show_errors);
877 877
 				// save answers to reg form questions
878
-				$this->_save_registration_answers( $registration, $show_errors );
878
+				$this->_save_registration_answers($registration, $show_errors);
879 879
 				// save changes
880 880
 				$registration->save();
881 881
 				// update txn cache
882
-				if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) {
883
-					if ( $show_errors ) {
884
-						EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
882
+				if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) {
883
+					if ($show_errors) {
884
+						EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
885 885
 					}
886 886
 				}
887 887
 			}
888 888
 		} else {
889
-			if ( $show_errors ) {
889
+			if ($show_errors) {
890 890
 				EE_Error::add_error(
891
-					__( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ),
891
+					__('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'),
892 892
 					__FILE__, __FUNCTION__, __LINE__
893 893
 				);
894 894
 			}
@@ -905,25 +905,25 @@  discard block
 block discarded – undo
905 905
 	 * @return void
906 906
 	 * @throws \EE_Error
907 907
 	 */
908
-	private function _save_registration_attendee( $registration, $show_errors = TRUE ) {
909
-		if ( $registration->attendee() instanceof EE_Attendee ) {
908
+	private function _save_registration_attendee($registration, $show_errors = TRUE) {
909
+		if ($registration->attendee() instanceof EE_Attendee) {
910 910
 			// save so that ATT has ID
911 911
 			$registration->attendee()->save();
912
-			if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() ) ) {
913
-				if ( $show_errors ) {
912
+			if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) {
913
+				if ($show_errors) {
914 914
 					EE_Error::add_error(
915
-						__( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ),
915
+						__('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'),
916 916
 						__FILE__, __FUNCTION__, __LINE__
917 917
 					);
918 918
 				}
919 919
 			}
920 920
 		} else {
921
-			if ( $show_errors ) {
921
+			if ($show_errors) {
922 922
 				EE_Error::add_error(
923 923
 					sprintf(
924 924
 						'%1$s||%1$s $attendee = %2$s',
925
-						__( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ),
926
-						var_export( $registration->attendee(), true )
925
+						__('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'),
926
+						var_export($registration->attendee(), true)
927 927
 					),
928 928
 					__FILE__, __FUNCTION__, __LINE__
929 929
 				);
@@ -941,25 +941,25 @@  discard block
 block discarded – undo
941 941
 	 * @return void
942 942
 	 * @throws \EE_Error
943 943
 	 */
944
-	private function _save_registration_answers( $registration, $show_errors = TRUE ) {
944
+	private function _save_registration_answers($registration, $show_errors = TRUE) {
945 945
 		// now save the answers
946
-		foreach ( $registration->answers() as $cache_key => $answer ) {
946
+		foreach ($registration->answers() as $cache_key => $answer) {
947 947
 			// verify object
948
-			if ( $answer instanceof EE_Answer ) {
949
-				$answer->set_registration( $registration->ID() );
948
+			if ($answer instanceof EE_Answer) {
949
+				$answer->set_registration($registration->ID());
950 950
 				$answer->save();
951
-				if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) {
952
-					if ( $show_errors ) {
951
+				if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) {
952
+					if ($show_errors) {
953 953
 						EE_Error::add_error(
954
-							__( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ),
954
+							__('The newly saved Answer object could not be cached on the registration.', 'event_espresso'),
955 955
 							__FILE__, __FUNCTION__, __LINE__
956 956
 						);
957 957
 					}
958 958
 				}
959 959
 			} else {
960
-				if ( $show_errors ) {
960
+				if ($show_errors) {
961 961
 					EE_Error::add_error(
962
-						__( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ),
962
+						__('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'),
963 963
 						__FILE__, __FUNCTION__, __LINE__
964 964
 					);
965 965
 				}
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 	 * @return bool
979 979
 	 * @throws \EE_Error
980 980
 	 */
981
-	public function refresh_all_entities( $from_db = false ) {
981
+	public function refresh_all_entities($from_db = false) {
982 982
 		$from_db = $this->current_step->is_final_step() || $this->action === 'process_gateway_response'
983 983
 			? true
984 984
 			: $from_db;
@@ -1002,11 +1002,11 @@  discard block
 block discarded – undo
1002 1002
 	 */
1003 1003
 	protected function refresh_from_db() {
1004 1004
 		// verify the transaction
1005
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1005
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1006 1006
 			// pull fresh TXN data from the db
1007
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() );
1007
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID());
1008 1008
 			// update EE_Checkout's cached primary_attendee object
1009
-			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction );
1009
+			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction);
1010 1010
 			// update EE_Checkout's cached payment object
1011 1011
 			$payment = $this->transaction->last_payment();
1012 1012
 			$this->payment = $payment instanceof EE_Payment ? $payment : $this->payment;
@@ -1014,9 +1014,9 @@  discard block
 block discarded – undo
1014 1014
 			$payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null;
1015 1015
 			$this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method;
1016 1016
 			//now refresh the cart, based on the TXN
1017
-			$this->cart = $this->get_cart_for_transaction( $this->transaction );
1017
+			$this->cart = $this->get_cart_for_transaction($this->transaction);
1018 1018
 		} else {
1019
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1019
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1020 1020
 			return FALSE;
1021 1021
 		}
1022 1022
 		return TRUE;
@@ -1031,21 +1031,21 @@  discard block
 block discarded – undo
1031 1031
 	 * @return  EE_Attendee | null
1032 1032
 	 * @throws \EE_Error
1033 1033
 	 */
1034
-	protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) {
1034
+	protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) {
1035 1035
 
1036 1036
 		$primary_attendee_obj = null;
1037 1037
 		// grab the saved registrations from the transaction
1038
-		foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) {
1038
+		foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) {
1039 1039
 			// verify object
1040
-			if ( $registration instanceof EE_Registration ) {
1040
+			if ($registration instanceof EE_Registration) {
1041 1041
 				$attendee = $registration->attendee();
1042 1042
 				// verify object && maybe cache primary_attendee_obj ?
1043
-				if ( $attendee instanceof EE_Attendee&& $registration->is_primary_registrant() ) {
1043
+				if ($attendee instanceof EE_Attendee && $registration->is_primary_registrant()) {
1044 1044
 					$primary_attendee_obj = $attendee;
1045 1045
 				}
1046 1046
 			} else {
1047 1047
 				EE_Error::add_error(
1048
-						__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1048
+						__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1049 1049
 						__FILE__, __FUNCTION__, __LINE__
1050 1050
 				);
1051 1051
 			}
@@ -1066,43 +1066,43 @@  discard block
 block discarded – undo
1066 1066
 	 */
1067 1067
 	protected function refresh_entity_map() {
1068 1068
 		// verify the transaction
1069
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1069
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1070 1070
 			// never cache payment info
1071
-			$this->transaction->clear_cache( 'Payment' );
1071
+			$this->transaction->clear_cache('Payment');
1072 1072
 			// is the Payment Options Reg Step completed ?
1073
-			if ( $this->transaction->reg_step_completed( 'payment_options' ) ) {
1073
+			if ($this->transaction->reg_step_completed('payment_options')) {
1074 1074
 				// then check for payments and update TXN accordingly
1075 1075
 				/** @type EE_Transaction_Payments $transaction_payments */
1076
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1077
-				$transaction_payments->calculate_total_payments_and_update_status( $this->transaction );
1076
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1077
+				$transaction_payments->calculate_total_payments_and_update_status($this->transaction);
1078 1078
 			}
1079 1079
 			// grab the saved registrations from the transaction
1080 1080
 			foreach (
1081
-				$this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration
1081
+				$this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration
1082 1082
 			) {
1083
-				$this->_refresh_registration( $reg_cache_ID, $registration );
1083
+				$this->_refresh_registration($reg_cache_ID, $registration);
1084 1084
 			}
1085 1085
 			// make sure our cached TXN is added to the model entity mapper
1086
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction );
1086
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction);
1087 1087
 
1088 1088
 		} else {
1089
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1089
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1090 1090
 			return FALSE;
1091 1091
 		}
1092 1092
 		// verify and update the cart because inaccurate totals are not so much fun
1093
-		if ( $this->cart instanceof EE_Cart ) {
1093
+		if ($this->cart instanceof EE_Cart) {
1094 1094
 			$grand_total = $this->cart->get_grand_total();
1095
-			if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) {
1095
+			if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) {
1096 1096
 				$grand_total->recalculate_total_including_taxes();
1097 1097
 				$grand_total = $grand_total->get_model()->refresh_entity_map_with(
1098 1098
 					$this->cart->get_grand_total()->ID(),
1099 1099
 					$this->cart->get_grand_total()
1100 1100
 				);
1101 1101
 			}
1102
-			if ( $grand_total instanceof EE_Line_Item ) {
1103
-				$this->cart = EE_Cart::instance( $grand_total );
1102
+			if ($grand_total instanceof EE_Line_Item) {
1103
+				$this->cart = EE_Cart::instance($grand_total);
1104 1104
 			} else {
1105
-				EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1105
+				EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1106 1106
 				return false;
1107 1107
 			}
1108 1108
 		}
@@ -1119,19 +1119,19 @@  discard block
 block discarded – undo
1119 1119
 	 * @return void
1120 1120
 	 * @throws \EE_Error
1121 1121
 	 */
1122
-	protected function _refresh_registration( $reg_cache_ID, $registration ) {
1122
+	protected function _refresh_registration($reg_cache_ID, $registration) {
1123 1123
 
1124 1124
 		// verify object
1125
-		if ( $registration instanceof EE_Registration ) {
1125
+		if ($registration instanceof EE_Registration) {
1126 1126
 			// update the entity mapper attendee
1127
-			$this->_refresh_registration_attendee( $registration );
1127
+			$this->_refresh_registration_attendee($registration);
1128 1128
 			// update the entity mapper answers for reg form questions
1129
-			$this->_refresh_registration_answers( $registration );
1129
+			$this->_refresh_registration_answers($registration);
1130 1130
 			// make sure the cached registration is added to the model entity mapper
1131
-			$registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration );
1131
+			$registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration);
1132 1132
 		} else {
1133 1133
 			EE_Error::add_error(
1134
-				__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1134
+				__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1135 1135
 				__FILE__, __FUNCTION__, __LINE__
1136 1136
 			);
1137 1137
 		}
@@ -1146,15 +1146,15 @@  discard block
 block discarded – undo
1146 1146
 	 * @return void
1147 1147
 	 * @throws \EE_Error
1148 1148
 	 */
1149
-	protected function _refresh_registration_attendee( $registration ) {
1149
+	protected function _refresh_registration_attendee($registration) {
1150 1150
 
1151 1151
 		$attendee = $registration->attendee();
1152 1152
 		// verify object
1153
-		if ( $attendee instanceof EE_Attendee && $attendee->ID() ) {
1153
+		if ($attendee instanceof EE_Attendee && $attendee->ID()) {
1154 1154
 			// make sure the cached attendee is added to the model entity mapper
1155
-			$registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee );
1155
+			$registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee);
1156 1156
 			// maybe cache primary_attendee_obj ?
1157
-			if ( $registration->is_primary_registrant() ) {
1157
+			if ($registration->is_primary_registrant()) {
1158 1158
 				$this->primary_attendee_obj = $attendee;
1159 1159
 			}
1160 1160
 		}
@@ -1169,19 +1169,19 @@  discard block
 block discarded – undo
1169 1169
 	 * @return void
1170 1170
 	 * @throws \EE_Error
1171 1171
 	 */
1172
-	protected function _refresh_registration_answers( $registration ) {
1172
+	protected function _refresh_registration_answers($registration) {
1173 1173
 
1174 1174
 		// now update the answers
1175
-		foreach ( $registration->answers() as $cache_key => $answer ) {
1175
+		foreach ($registration->answers() as $cache_key => $answer) {
1176 1176
 			// verify object
1177
-			if ( $answer instanceof EE_Answer ) {
1178
-				if ( $answer->ID() ) {
1177
+			if ($answer instanceof EE_Answer) {
1178
+				if ($answer->ID()) {
1179 1179
 					// make sure the cached answer is added to the model entity mapper
1180
-					$answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer );
1180
+					$answer->get_model()->refresh_entity_map_with($answer->ID(), $answer);
1181 1181
 				}
1182 1182
 			} else {
1183 1183
 				EE_Error::add_error(
1184
-					__( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1184
+					__('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1185 1185
 					__FILE__, __FUNCTION__, __LINE__
1186 1186
 				);
1187 1187
 			}
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
     public function __sleep()
1202 1202
     {
1203 1203
         // remove the reg form and the checkout
1204
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1204
+        return array_diff(array_keys(get_object_vars($this)), array('billing_form', 'registration_form'));
1205 1205
     }
1206 1206
 
1207 1207
 
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 	 * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object
1212 1212
 	 */
1213 1213
 	public function __wakeup() {
1214
-		foreach ( $this->reg_steps as $reg_step ) {
1214
+		foreach ($this->reg_steps as $reg_step) {
1215 1215
 			$reg_step->checkout = $this;
1216 1216
 		}
1217 1217
 	}
@@ -1228,12 +1228,12 @@  discard block
 block discarded – undo
1228 1228
 	 * @param bool   $display_request
1229 1229
 	 * @throws \EE_Error
1230 1230
 	 */
1231
-	public function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) {
1231
+	public function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) {
1232 1232
 		$disabled = true;
1233
-		if ( WP_DEBUG && ! $disabled ) {
1234
-			$debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() );
1233
+		if (WP_DEBUG && ! $disabled) {
1234
+			$debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array());
1235 1235
 			$default_data = array(
1236
-				$class 		=> $func . '() : ' . $line,
1236
+				$class 		=> $func.'() : '.$line,
1237 1237
 				'request->step' 		=> $this->step,
1238 1238
 				'request->action' 	=> $this->action,
1239 1239
 				'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ?
@@ -1245,24 +1245,24 @@  discard block
 block discarded – undo
1245 1245
 				'reg_url_link' => $this->reg_url_link,
1246 1246
 				'REQ' => $display_request ? $_REQUEST : '',
1247 1247
 			);
1248
-			if ( $this->transaction instanceof EE_Transaction ) {
1249
-				$default_data[ 'TXN_status' ] 		= $this->transaction->status_ID();
1250
-				$default_data[ 'TXN_reg_steps' ] 	= $this->transaction->reg_steps();
1251
-				foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) {
1252
-					$default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID();
1248
+			if ($this->transaction instanceof EE_Transaction) {
1249
+				$default_data['TXN_status'] = $this->transaction->status_ID();
1250
+				$default_data['TXN_reg_steps'] = $this->transaction->reg_steps();
1251
+				foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) {
1252
+					$default_data['registrations'][$REG_ID] = $registration->status_ID();
1253 1253
 				}
1254
-				if ( $this->transaction->ID() ) {
1255
-					$TXN_ID = 'EE_Transaction: ' . $this->transaction->ID();
1254
+				if ($this->transaction->ID()) {
1255
+					$TXN_ID = 'EE_Transaction: '.$this->transaction->ID();
1256 1256
 					// don't serialize objects
1257
-					$info = $this->_strip_objects( $info );
1258
-					if ( ! isset( $debug_data[ $TXN_ID ] ) ) {
1259
-						$debug_data[ $TXN_ID ] = array();
1257
+					$info = $this->_strip_objects($info);
1258
+					if ( ! isset($debug_data[$TXN_ID])) {
1259
+						$debug_data[$TXN_ID] = array();
1260 1260
 					}
1261
-					$debug_data[ $TXN_ID ][ microtime() ] = array_merge(
1261
+					$debug_data[$TXN_ID][microtime()] = array_merge(
1262 1262
 						$default_data,
1263 1263
 						$info
1264 1264
 					);
1265
-					update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data );
1265
+					update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data);
1266 1266
 				}
1267 1267
 			}
1268 1268
 		}
@@ -1275,23 +1275,23 @@  discard block
 block discarded – undo
1275 1275
 	 * @param array $info
1276 1276
 	 * @return array
1277 1277
 	 */
1278
-	public function _strip_objects( $info = array() ) {
1279
-		foreach ( (array)$info as $key => $value ) {
1280
-			if ( is_array( $value )) {
1281
-				$info[ $key ] = $this->_strip_objects( $value );
1282
-			} else if ( is_object( $value ) ) {
1283
-				$object_class = get_class( $value );
1284
-				$info[ $object_class ] = array();
1285
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0;
1286
-				if ( method_exists( $value, 'status' ) ) {
1287
-					$info[ $object_class ][ 'status' ] = $value->status();
1288
-				} else if ( method_exists( $value, 'status_ID' ) ) {
1289
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
1278
+	public function _strip_objects($info = array()) {
1279
+		foreach ((array) $info as $key => $value) {
1280
+			if (is_array($value)) {
1281
+				$info[$key] = $this->_strip_objects($value);
1282
+			} else if (is_object($value)) {
1283
+				$object_class = get_class($value);
1284
+				$info[$object_class] = array();
1285
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0;
1286
+				if (method_exists($value, 'status')) {
1287
+					$info[$object_class]['status'] = $value->status();
1288
+				} else if (method_exists($value, 'status_ID')) {
1289
+					$info[$object_class]['status'] = $value->status_ID();
1290 1290
 				}
1291
-				unset( $info[ $key ] );
1291
+				unset($info[$key]);
1292 1292
 			}
1293 1293
 		}
1294
-		return (array)$info;
1294
+		return (array) $info;
1295 1295
 	}
1296 1296
 
1297 1297
 
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -466,38 +466,38 @@  discard block
 block discarded – undo
466 466
 	 * @throws \EE_Error
467 467
 	 */
468 468
 	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
469
-        // registrations per event
469
+		// registrations per event
470 470
 		$event_reg_count = array();
471 471
 		// spaces left per event
472 472
 		$event_spaces_remaining = array();
473
-        // tickets left sorted by ID
474
-        $tickets_remaining = array();
475
-        // registrations that have lost their space
473
+		// tickets left sorted by ID
474
+		$tickets_remaining = array();
475
+		// registrations that have lost their space
476 476
 		$ejected_registrations = array();
477 477
 		foreach ( $registrations as $REG_ID => $registration ) {
478 478
 			if ( $registration->status_ID() === EEM_Registration::status_id_approved ) {
479 479
 				continue;
480 480
 			}
481 481
 			$EVT_ID = $registration->event_ID();
482
-            $ticket = $registration->ticket();
483
-            if ( ! isset($tickets_remaining[$ticket->ID()])) {
484
-                $tickets_remaining[$ticket->ID()] = $ticket->remaining();
485
-            }
486
-            if ($tickets_remaining[$ticket->ID()] > 0) {
487
-                if ( ! isset($event_reg_count[$EVT_ID])) {
488
-                    $event_reg_count[$EVT_ID] = 0;
489
-                }
490
-                $event_reg_count[$EVT_ID]++;
491
-                if ( ! isset($event_spaces_remaining[$EVT_ID])) {
492
-                    $event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
493
-                }
494
-            }
482
+			$ticket = $registration->ticket();
483
+			if ( ! isset($tickets_remaining[$ticket->ID()])) {
484
+				$tickets_remaining[$ticket->ID()] = $ticket->remaining();
485
+			}
486
+			if ($tickets_remaining[$ticket->ID()] > 0) {
487
+				if ( ! isset($event_reg_count[$EVT_ID])) {
488
+					$event_reg_count[$EVT_ID] = 0;
489
+				}
490
+				$event_reg_count[$EVT_ID]++;
491
+				if ( ! isset($event_spaces_remaining[$EVT_ID])) {
492
+					$event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
493
+				}
494
+			}
495 495
 			if (
496 496
 				$revisit
497 497
 				&& (
498
-                    $tickets_remaining[$ticket->ID()] === 0
499
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
500
-                )
498
+					$tickets_remaining[$ticket->ID()] === 0
499
+					|| $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
500
+				)
501 501
 			) {
502 502
 				$ejected_registrations[ $REG_ID ] = $registration->event();
503 503
 				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
@@ -572,9 +572,9 @@  discard block
 block discarded – undo
572 572
 				'layout_strategy' => new EE_Template_Layout(
573 573
 					array(
574 574
 						'layout_template_file' => SPCO_REG_STEPS_PATH
575
-						                          . $this->_slug
576
-						                          . DS
577
-						                          . 'sold_out_events.template.php',
575
+												  . $this->_slug
576
+												  . DS
577
+												  . 'sold_out_events.template.php',
578 578
 						'template_args'        => apply_filters(
579 579
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
580 580
 							array(
@@ -625,9 +625,9 @@  discard block
 block discarded – undo
625 625
 				'layout_strategy' => new EE_Template_Layout(
626 626
 					array(
627 627
 						'layout_template_file' => SPCO_REG_STEPS_PATH
628
-						                          . $this->_slug
629
-						                          . DS
630
-						                          . 'sold_out_events.template.php',
628
+												  . $this->_slug
629
+												  . DS
630
+												  . 'sold_out_events.template.php',
631 631
 						'template_args'        => apply_filters(
632 632
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___insufficient_spaces_available__template_args',
633 633
 							array(
@@ -679,9 +679,9 @@  discard block
 block discarded – undo
679 679
 				'layout_strategy' => new EE_Template_Layout(
680 680
 					array(
681 681
 						'layout_template_file' => SPCO_REG_STEPS_PATH
682
-						                          . $this->_slug
683
-						                          . DS
684
-						                          . 'events_requiring_pre_approval.template.php', // layout_template
682
+												  . $this->_slug
683
+												  . DS
684
+												  . 'events_requiring_pre_approval.template.php', // layout_template
685 685
 						'template_args'        => apply_filters(
686 686
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
687 687
 							array(
@@ -723,9 +723,9 @@  discard block
 block discarded – undo
723 723
 				'layout_strategy' => new EE_Template_Layout(
724 724
 					array(
725 725
 						'layout_template_file' => SPCO_REG_STEPS_PATH
726
-						                          . $this->_slug
727
-						                          . DS
728
-						                          . 'no_payment_required.template.php', // layout_template
726
+												  . $this->_slug
727
+												  . DS
728
+												  . 'no_payment_required.template.php', // layout_template
729 729
 						'template_args'        => apply_filters(
730 730
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
731 731
 							array(
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
956 956
 				}
957 957
 				$payment_methods_billing_info[ $payment_method->slug()
958
-				                               . '-info' ] = $this->_payment_method_billing_info(
958
+											   . '-info' ] = $this->_payment_method_billing_info(
959 959
 					$payment_method
960 960
 				);
961 961
 			}
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
 		// fill form with attendee info if applicable
1144 1144
 		if (
1145 1145
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
1146
-		    && $this->checkout->transaction_has_primary_registrant()
1146
+			&& $this->checkout->transaction_has_primary_registrant()
1147 1147
 		) {
1148 1148
 			$payment_method_billing_form->populate_from_attendee(
1149 1149
 				$this->checkout->transaction->primary_registration()->attendee()
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 		// and debug content
1153 1153
 		if (
1154 1154
 			$payment_method_billing_form instanceof EE_Billing_Info_Form
1155
-		    && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1155
+			&& $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1156 1156
 		) {
1157 1157
 			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1158 1158
 				$payment_method_billing_form
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
 		}
1328 1328
 		// and debug content
1329 1329
 		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1330
-		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1330
+			 && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1331 1331
 		) {
1332 1332
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1333 1333
 				$this->checkout->billing_form
@@ -1461,8 +1461,8 @@  discard block
 block discarded – undo
1461 1461
 		}
1462 1462
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1463 1463
 		if ( ! empty( $attendee_data['ATT_fname'] )
1464
-		     && ! empty( $attendee_data['ATT_lname'] )
1465
-		     && ! empty( $attendee_data['ATT_email'] )
1464
+			 && ! empty( $attendee_data['ATT_lname'] )
1465
+			 && ! empty( $attendee_data['ATT_email'] )
1466 1466
 		) {
1467 1467
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1468 1468
 				array(
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
 			$payment_status = $payment->status();
1703 1703
 			if (
1704 1704
 				$payment_status === EEM_Payment::status_id_approved
1705
-			    || $payment_status === EEM_Payment::status_id_pending
1705
+				|| $payment_status === EEM_Payment::status_id_pending
1706 1706
 			) {
1707 1707
 				return true;
1708 1708
 			} else {
@@ -1888,8 +1888,8 @@  discard block
 block discarded – undo
1888 1888
 			return false;
1889 1889
 		}
1890 1890
 		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1891
-		       instanceof
1892
-		       EE_Attendee
1891
+			   instanceof
1892
+			   EE_Attendee
1893 1893
 		) {
1894 1894
 			EE_Error::add_error(
1895 1895
 				sprintf(
@@ -2607,19 +2607,19 @@  discard block
 block discarded – undo
2607 2607
 
2608 2608
 
2609 2609
 
2610
-    /**
2611
-     *    __sleep
2612
-     * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon serialization
2613
-     * EE_Checkout will handle the reimplementation of itself upon waking,
2614
-     * but we won't bother with the reg form, because if needed, it will be regenerated anyways
2615
-     *
2616
-     * @return array
2617
-     */
2618
-    public function __sleep()
2619
-    {
2620
-        // remove the reg form and the checkout
2621
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'reg_form', 'checkout', 'line_item_display' ) );
2622
-    }
2610
+	/**
2611
+	 *    __sleep
2612
+	 * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon serialization
2613
+	 * EE_Checkout will handle the reimplementation of itself upon waking,
2614
+	 * but we won't bother with the reg form, because if needed, it will be regenerated anyways
2615
+	 *
2616
+	 * @return array
2617
+	 */
2618
+	public function __sleep()
2619
+	{
2620
+		// remove the reg form and the checkout
2621
+		return array_diff( array_keys( get_object_vars( $this ) ), array( 'reg_form', 'checkout', 'line_item_display' ) );
2622
+	}
2623 2623
 
2624 2624
 
2625 2625
 
Please login to merge, or discard this patch.
Spacing   +348 added lines, -348 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -38,32 +38,32 @@  discard block
 block discarded – undo
38 38
 	public static function set_hooks() {
39 39
 		add_filter(
40 40
 			'FHEE__SPCO__EE_Line_Item_Filter_Collection',
41
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' )
41
+			array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')
42 42
 		);
43 43
 		add_action(
44 44
 			'wp_ajax_switch_spco_billing_form',
45
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )
45
+			array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')
46 46
 		);
47 47
 		add_action(
48 48
 			'wp_ajax_nopriv_switch_spco_billing_form',
49
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )
49
+			array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')
50 50
 		);
51
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) );
51
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
52 52
 		add_action(
53 53
 			'wp_ajax_nopriv_save_payer_details',
54
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )
54
+			array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')
55 55
 		);
56 56
 		add_action(
57 57
 			'wp_ajax_get_transaction_details_for_gateways',
58
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
58
+			array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
59 59
 		);
60 60
 		add_action(
61 61
 			'wp_ajax_nopriv_get_transaction_details_for_gateways',
62
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
62
+			array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
63 63
 		);
64 64
 		add_filter(
65 65
 			'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array',
66
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ),
66
+			array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'),
67 67
 			10,
68 68
 			1
69 69
 		);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @throws \EE_Error
78 78
 	 */
79 79
 	public static function switch_spco_billing_form() {
80
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
80
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
81 81
 	}
82 82
 
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @throws \EE_Error
89 89
 	 */
90 90
 	public static function save_payer_details() {
91
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
91
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
92 92
 	}
93 93
 
94 94
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @throws \EE_Error
100 100
 	 */
101 101
 	public static function get_transaction_details() {
102
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
102
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
103 103
 	}
104 104
 
105 105
 
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
 	 * @access    public
127 127
 	 * @param    EE_Checkout $checkout
128 128
 	 */
129
-	public function __construct( EE_Checkout $checkout ) {
129
+	public function __construct(EE_Checkout $checkout) {
130 130
 		$this->_slug = 'payment_options';
131
-		$this->_name = __( 'Payment Options', 'event_espresso' );
132
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
131
+		$this->_name = __('Payment Options', 'event_espresso');
132
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
133 133
 		$this->checkout = $checkout;
134 134
 		$this->_reset_success_message();
135 135
 		$this->set_instructions(
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	/**
155 155
 	 * @param null $line_item_display
156 156
 	 */
157
-	public function set_line_item_display( $line_item_display ) {
157
+	public function set_line_item_display($line_item_display) {
158 158
 		$this->line_item_display = $line_item_display;
159 159
 	}
160 160
 
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	/**
173 173
 	 * @param boolean $handle_IPN_in_this_request
174 174
 	 */
175
-	public function set_handle_IPN_in_this_request( $handle_IPN_in_this_request ) {
176
-		$this->handle_IPN_in_this_request = filter_var( $handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN );
175
+	public function set_handle_IPN_in_this_request($handle_IPN_in_this_request) {
176
+		$this->handle_IPN_in_this_request = filter_var($handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN);
177 177
 	}
178 178
 
179 179
 
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
 	public function enqueue_styles_and_scripts() {
209 209
 		$transaction = $this->checkout->transaction;
210 210
 		//if the transaction isn't set or nothing is owed on it, don't enqueue any JS
211
-		if( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats( $transaction->remaining(), 0 ) ) {
211
+		if ( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats($transaction->remaining(), 0)) {
212 212
 			return;
213 213
 		}
214
-		foreach( EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ) as $payment_method ) {
214
+		foreach (EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart) as $payment_method) {
215 215
 			$type_obj = $payment_method->type_obj();
216
-			if( $type_obj instanceof EE_PMT_Base ) {
217
-				$billing_form = $type_obj->generate_new_billing_form( $transaction );
218
-				if( $billing_form instanceof EE_Form_Section_Proper ) {
216
+			if ($type_obj instanceof EE_PMT_Base) {
217
+				$billing_form = $type_obj->generate_new_billing_form($transaction);
218
+				if ($billing_form instanceof EE_Form_Section_Proper) {
219 219
 					$billing_form->enqueue_js();
220 220
 				}
221 221
 			}
@@ -240,20 +240,20 @@  discard block
 block discarded – undo
240 240
 			// 	$ 0.00 transactions (no payment required)
241 241
 			! $this->checkout->payment_required()
242 242
 			// but do NOT remove if current action being called belongs to this reg step
243
-			&& ! is_callable( array( $this, $this->checkout->action ) )
243
+			&& ! is_callable(array($this, $this->checkout->action))
244 244
 			&& ! $this->completed()
245 245
 		) {
246 246
 			// and if so, then we no longer need the Payment Options step
247
-			if ( $this->is_current_step() ) {
247
+			if ($this->is_current_step()) {
248 248
 				$this->checkout->generate_reg_form = false;
249 249
 			}
250
-			$this->checkout->remove_reg_step( $this->_slug );
250
+			$this->checkout->remove_reg_step($this->_slug);
251 251
 			// DEBUG LOG
252 252
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
253 253
 			return false;
254 254
 		}
255 255
 		// load EEM_Payment_Method
256
-		EE_Registry::instance()->load_model( 'Payment_Method' );
256
+		EE_Registry::instance()->load_model('Payment_Method');
257 257
 		// get all active payment methods
258 258
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
259 259
 			$this->checkout->transaction,
@@ -280,15 +280,15 @@  discard block
 block discarded – undo
280 280
 		$insufficient_spaces_available = array();
281 281
 		$reg_count = 0;
282 282
 		// loop thru registrations to gather info
283
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
283
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
284 284
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
285 285
 			$registrations,
286 286
 			$this->checkout->revisit
287 287
 		);
288
-		foreach ( $registrations as $REG_ID => $registration ) {
288
+		foreach ($registrations as $REG_ID => $registration) {
289 289
 			// has this registration lost it's space ?
290
-			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
291
-				$insufficient_spaces_available[ $registration->event()->ID() ] = $registration->event();
290
+			if (isset($ejected_registrations[$REG_ID])) {
291
+				$insufficient_spaces_available[$registration->event()->ID()] = $registration->event();
292 292
 				continue;
293 293
 			}
294 294
 			/** @var $registration EE_Registration */
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
 				&& $registration->status_ID() === EEM_Registration::status_id_approved
301 301
 			)
302 302
 			) {
303
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true ) ) {
303
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
304 304
 					// add event to list of events that are sold out
305
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
305
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
306 306
 					do_action(
307 307
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
308 308
 						$registration->event(),
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 					continue;
312 312
 				}
313 313
 				// event requires admin approval
314
-				if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) {
314
+				if ($registration->status_ID() === EEM_Registration::status_id_not_approved) {
315 315
 					// add event to list of events with pre-approval reg status
316
-					$registrations_requiring_pre_approval[ $REG_ID ] = $registration;
316
+					$registrations_requiring_pre_approval[$REG_ID] = $registration;
317 317
 					do_action(
318 318
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
319 319
 						$registration->event(),
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 				}
323 323
 			}
324 324
 			// are they allowed to pay now and is there monies owing?
325
-			if ( $registration->owes_monies_and_can_pay() ) {
326
-				$registrations_requiring_payment[ $REG_ID ] = $registration;
325
+			if ($registration->owes_monies_and_can_pay()) {
326
+				$registrations_requiring_payment[$REG_ID] = $registration;
327 327
 				do_action(
328 328
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
329 329
 					$registration->event(),
@@ -334,29 +334,29 @@  discard block
 block discarded – undo
334 334
 				&& $registration->status_ID() !== EEM_Registration::status_id_not_approved
335 335
 				&& $registration->ticket()->is_free()
336 336
 			) {
337
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
337
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
338 338
 			}
339 339
 		}
340 340
 		$subsections = array();
341 341
 		// now decide which template to load
342
-		if ( ! empty( $sold_out_events ) ) {
343
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
342
+		if ( ! empty($sold_out_events)) {
343
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
344 344
 		}
345
-		if ( ! empty( $insufficient_spaces_available ) ) {
345
+		if ( ! empty($insufficient_spaces_available)) {
346 346
 			$subsections['insufficient_space'] = $this->_insufficient_spaces_available(
347 347
 				$insufficient_spaces_available
348 348
 			);
349 349
 		}
350
-		if ( ! empty( $registrations_requiring_pre_approval ) ) {
350
+		if ( ! empty($registrations_requiring_pre_approval)) {
351 351
 			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval(
352 352
 				$registrations_requiring_pre_approval
353 353
 			);
354 354
 		}
355
-		if ( ! empty( $registrations_for_free_events ) ) {
356
-			$subsections['no_payment_required'] = $this->_no_payment_required( $registrations_for_free_events );
355
+		if ( ! empty($registrations_for_free_events)) {
356
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
357 357
 		}
358
-		if ( ! empty( $registrations_requiring_payment ) ) {
359
-			if ( $this->checkout->amount_owing > 0 ) {
358
+		if ( ! empty($registrations_requiring_payment)) {
359
+			if ($this->checkout->amount_owing > 0) {
360 360
 				// autoload Line_Item_Display classes
361 361
 				EEH_Autoloader::register_line_item_filter_autoloaders();
362 362
 				$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -369,15 +369,15 @@  discard block
 block discarded – undo
369 369
 				/** @var EE_Line_Item $filtered_line_item_tree */
370 370
 				$filtered_line_item_tree = $line_item_filter_processor->process();
371 371
 				EEH_Autoloader::register_line_item_display_autoloaders();
372
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
372
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
373 373
 				$subsections['payment_options'] = $this->_display_payment_options(
374 374
 					$this->line_item_display->display_line_item(
375 375
 						$filtered_line_item_tree,
376
-						array( 'registrations' => $registrations )
376
+						array('registrations' => $registrations)
377 377
 					)
378 378
 				);
379 379
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
380
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
380
+				$this->_apply_registration_payments_to_amount_owing($registrations);
381 381
 			}
382 382
 		} else {
383 383
 			$this->_hide_reg_step_submit_button_if_revisit();
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 * @return \EE_Line_Item_Filter_Collection
409 409
 	 * @throws \EE_Error
410 410
 	 */
411
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
411
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
412 412
 		$line_item_filter_collection->add(
413 413
 			new EE_Billable_Line_Item_Filter(
414 414
 				EE_SPCO_Reg_Step_Payment_Options::remove_ejected_registrations(
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 				)
419 419
 			)
420 420
 		);
421
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
421
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
422 422
 		return $line_item_filter_collection;
423 423
 	}
424 424
 
@@ -434,15 +434,15 @@  discard block
 block discarded – undo
434 434
 	 * @return \EE_Registration[]
435 435
 	 * @throws \EE_Error
436 436
 	 */
437
-	public static function remove_ejected_registrations( array $registrations ) {
437
+	public static function remove_ejected_registrations(array $registrations) {
438 438
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
439 439
 			$registrations,
440 440
 			EE_Registry::instance()->SSN->checkout()->revisit
441 441
 		);
442
-		foreach ( $registrations as $REG_ID => $registration ) {
442
+		foreach ($registrations as $REG_ID => $registration) {
443 443
 			// has this registration lost it's space ?
444
-			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
445
-				unset( $registrations[ $REG_ID ] );
444
+			if (isset($ejected_registrations[$REG_ID])) {
445
+				unset($registrations[$REG_ID]);
446 446
 				continue;
447 447
 			}
448 448
 		}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	 * @return array
466 466
 	 * @throws \EE_Error
467 467
 	 */
468
-	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
468
+	public static function find_registrations_that_lost_their_space(array $registrations, $revisit = false) {
469 469
         // registrations per event
470 470
 		$event_reg_count = array();
471 471
 		// spaces left per event
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
         $tickets_remaining = array();
475 475
         // registrations that have lost their space
476 476
 		$ejected_registrations = array();
477
-		foreach ( $registrations as $REG_ID => $registration ) {
478
-			if ( $registration->status_ID() === EEM_Registration::status_id_approved ) {
477
+		foreach ($registrations as $REG_ID => $registration) {
478
+			if ($registration->status_ID() === EEM_Registration::status_id_approved) {
479 479
 				continue;
480 480
 			}
481 481
 			$EVT_ID = $registration->event_ID();
@@ -496,13 +496,13 @@  discard block
 block discarded – undo
496 496
 				$revisit
497 497
 				&& (
498 498
                     $tickets_remaining[$ticket->ID()] === 0
499
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
499
+				    || $event_reg_count[$EVT_ID] > $event_spaces_remaining[$EVT_ID]
500 500
                 )
501 501
 			) {
502
-				$ejected_registrations[ $REG_ID ] = $registration->event();
503
-				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
502
+				$ejected_registrations[$REG_ID] = $registration->event();
503
+				if ($registration->status_ID() !== EEM_Registration::status_id_wait_list) {
504 504
 					/** @type EE_Registration_Processor $registration_processor */
505
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
505
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
506 506
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
507 507
 					$registration_processor->manually_update_registration_status(
508 508
 						$registration,
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
 	 * @return void
538 538
 	 */
539 539
 	protected function _hide_reg_step_submit_button_if_revisit() {
540
-		if ( $this->checkout->revisit ) {
541
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
540
+		if ($this->checkout->revisit) {
541
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
542 542
 		}
543 543
 	}
544 544
 
@@ -552,13 +552,13 @@  discard block
 block discarded – undo
552 552
 	 * @return \EE_Form_Section_Proper
553 553
 	 * @throws \EE_Error
554 554
 	 */
555
-	private function _sold_out_events( $sold_out_events_array = array() ) {
555
+	private function _sold_out_events($sold_out_events_array = array()) {
556 556
 		// set some defaults
557 557
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
558 558
 		$sold_out_events = '';
559
-		foreach ( $sold_out_events_array as $sold_out_event ) {
559
+		foreach ($sold_out_events_array as $sold_out_event) {
560 560
 			$sold_out_events .= EEH_HTML::li(
561
-				EEH_HTML::span( '  ' .$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
561
+				EEH_HTML::span('  '.$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
562 562
 			);
563 563
 		}
564 564
 		return new EE_Form_Section_Proper(
@@ -605,14 +605,14 @@  discard block
 block discarded – undo
605 605
 	 * @return \EE_Form_Section_Proper
606 606
 	 * @throws \EE_Error
607 607
 	 */
608
-	private function _insufficient_spaces_available( $insufficient_spaces_events_array = array() ) {
608
+	private function _insufficient_spaces_available($insufficient_spaces_events_array = array()) {
609 609
 		// set some defaults
610 610
 		$this->checkout->selected_method_of_payment = 'invoice';
611 611
 		$insufficient_space_events = '';
612
-		foreach ( $insufficient_spaces_events_array as $event ) {
613
-			if ( $event instanceof EE_Event ) {
612
+		foreach ($insufficient_spaces_events_array as $event) {
613
+			if ($event instanceof EE_Event) {
614 614
 				$insufficient_space_events .= EEH_HTML::li(
615
-					EEH_HTML::span( ' ' . $event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
615
+					EEH_HTML::span(' '.$event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
616 616
 				);
617 617
 			}
618 618
 		}
@@ -656,17 +656,17 @@  discard block
 block discarded – undo
656 656
 	 * @return \EE_Form_Section_Proper
657 657
 	 * @throws \EE_Error
658 658
 	 */
659
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array() ) {
659
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
660 660
 		$events_requiring_pre_approval = '';
661
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
662
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
663
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
661
+		foreach ($registrations_requiring_pre_approval as $registration) {
662
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
663
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
664 664
 					EEH_HTML::span(
665 665
 						'',
666 666
 						'',
667 667
 						'dashicons dashicons-marker ee-icon-size-16 orange-text'
668 668
 					)
669
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
669
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
670 670
 				);
671 671
 			}
672 672
 		}
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 						'template_args'        => apply_filters(
686 686
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
687 687
 							array(
688
-								'events_requiring_pre_approval'     => implode( '', $events_requiring_pre_approval ),
688
+								'events_requiring_pre_approval'     => implode('', $events_requiring_pre_approval),
689 689
 								'events_requiring_pre_approval_msg' => apply_filters(
690 690
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
691 691
 									__(
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	 * @return \EE_Form_Section_Proper
711 711
 	 * @throws \EE_Error
712 712
 	 */
713
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
713
+	private function _no_payment_required($registrations_for_free_events = array()) {
714 714
 		// set some defaults
715 715
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
716 716
 		// generate no_payment_required form
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 								'ticket_count'                  => array(),
735 735
 								'registrations_for_free_events' => $registrations_for_free_events,
736 736
 								'no_payment_required_msg'       => EEH_HTML::p(
737
-									__( 'This is a free event, so no billing will occur.', 'event_espresso' )
737
+									__('This is a free event, so no billing will occur.', 'event_espresso')
738 738
 								)
739 739
 							)
740 740
 						),
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 	 * @return \EE_Form_Section_Proper
754 754
 	 * @throws \EE_Error
755 755
 	 */
756
-	private function _display_payment_options( $transaction_details = '' ) {
756
+	private function _display_payment_options($transaction_details = '') {
757 757
 		// has method_of_payment been set by no-js user?
758 758
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
759 759
 		// build payment options form
@@ -765,18 +765,18 @@  discard block
 block discarded – undo
765 765
 						'before_payment_options' => apply_filters(
766 766
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
767 767
 							new EE_Form_Section_Proper(
768
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
768
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
769 769
 							)
770 770
 						),
771 771
 						'payment_options'        => $this->_setup_payment_options(),
772 772
 						'after_payment_options'  => apply_filters(
773 773
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
774 774
 							new EE_Form_Section_Proper(
775
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
775
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
776 776
 							)
777 777
 						),
778 778
 						'default_hidden_inputs'  => $this->reg_step_hidden_inputs(),
779
-						'extra_hidden_inputs'    => $this->_extra_hidden_inputs( false )
779
+						'extra_hidden_inputs'    => $this->_extra_hidden_inputs(false)
780 780
 					),
781 781
 					'layout_strategy' => new EE_Template_Layout(
782 782
 						array(
@@ -805,10 +805,10 @@  discard block
 block discarded – undo
805 805
 	 * @return \EE_Form_Section_Proper
806 806
 	 * @throws \EE_Error
807 807
 	 */
808
-	private function _extra_hidden_inputs( $no_payment_required = true ) {
808
+	private function _extra_hidden_inputs($no_payment_required = true) {
809 809
 		return new EE_Form_Section_Proper(
810 810
 			array(
811
-				'html_id'         => 'ee-' . $this->slug() . '-extra-hidden-inputs',
811
+				'html_id'         => 'ee-'.$this->slug().'-extra-hidden-inputs',
812 812
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
813 813
 				'subsections'     => array(
814 814
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -840,16 +840,16 @@  discard block
 block discarded – undo
840 840
 	 * @access protected
841 841
 	 * @param array $registrations
842 842
 	 */
843
-	protected function _apply_registration_payments_to_amount_owing( array $registrations ) {
843
+	protected function _apply_registration_payments_to_amount_owing(array $registrations) {
844 844
 		$payments = array();
845
-		foreach ( $registrations as $registration ) {
846
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
845
+		foreach ($registrations as $registration) {
846
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
847 847
 				$payments += $registration->registration_payments();
848 848
 			}
849 849
 		}
850
-		if ( ! empty( $payments ) ) {
851
-			foreach ( $payments as $payment ) {
852
-				if ( $payment instanceof EE_Registration_Payment ) {
850
+		if ( ! empty($payments)) {
851
+			foreach ($payments as $payment) {
852
+				if ($payment instanceof EE_Registration_Payment) {
853 853
 					$this->checkout->amount_owing -= $payment->amount();
854 854
 				}
855 855
 			}
@@ -865,11 +865,11 @@  discard block
 block discarded – undo
865 865
 	 * @param    bool $force_reset
866 866
 	 * @return    void
867 867
 	 */
868
-	private function _reset_selected_method_of_payment( $force_reset = false ) {
868
+	private function _reset_selected_method_of_payment($force_reset = false) {
869 869
 		$reset_payment_method = $force_reset
870 870
 			? true
871
-			: sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', false ) );
872
-		if ( $reset_payment_method ) {
871
+			: sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', false));
872
+		if ($reset_payment_method) {
873 873
 			$this->checkout->selected_method_of_payment = null;
874 874
 			$this->checkout->payment_method = null;
875 875
 			$this->checkout->billing_form = null;
@@ -888,12 +888,12 @@  discard block
 block discarded – undo
888 888
 	 * @param string $selected_method_of_payment
889 889
 	 * @return  void
890 890
 	 */
891
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
892
-		$selected_method_of_payment = ! empty( $selected_method_of_payment )
891
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
892
+		$selected_method_of_payment = ! empty($selected_method_of_payment)
893 893
 			? $selected_method_of_payment
894 894
 			: $this->checkout->selected_method_of_payment;
895 895
 		EE_Registry::instance()->SSN->set_session_data(
896
-			array( 'selected_method_of_payment' => $selected_method_of_payment )
896
+			array('selected_method_of_payment' => $selected_method_of_payment)
897 897
 		);
898 898
 	}
899 899
 
@@ -909,19 +909,19 @@  discard block
 block discarded – undo
909 909
 		// load payment method classes
910 910
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
911 911
 		// switch up header depending on number of available payment methods
912
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
912
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
913 913
 			? apply_filters(
914 914
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
915
-				__( 'Please Select Your Method of Payment', 'event_espresso' )
915
+				__('Please Select Your Method of Payment', 'event_espresso')
916 916
 			)
917 917
 			: apply_filters(
918 918
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
919
-				__( 'Method of Payment', 'event_espresso' )
919
+				__('Method of Payment', 'event_espresso')
920 920
 			);
921 921
 		$available_payment_methods = array(
922 922
 			// display the "Payment Method" header
923 923
 			'payment_method_header' => new EE_Form_Section_HTML(
924
-				EEH_HTML::h4( $payment_method_header, 'method-of-payment-hdr' )
924
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
925 925
 			)
926 926
 		);
927 927
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
@@ -930,32 +930,32 @@  discard block
 block discarded – undo
930 930
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
931 931
 		$payment_methods_billing_info = array(
932 932
 			new EE_Form_Section_HTML(
933
-				EEH_HTML::div( '<br />', '', '', 'clear:both;' )
933
+				EEH_HTML::div('<br />', '', '', 'clear:both;')
934 934
 			)
935 935
 		);
936 936
 		// loop through payment methods
937
-		foreach ( $this->checkout->available_payment_methods as $payment_method ) {
938
-			if ( $payment_method instanceof EE_Payment_Method ) {
937
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
938
+			if ($payment_method instanceof EE_Payment_Method) {
939 939
 				$payment_method_button = EEH_HTML::img(
940 940
 					$payment_method->button_url(),
941 941
 					$payment_method->name(),
942
-					'spco-payment-method-' . $payment_method->slug() . '-btn-img',
942
+					'spco-payment-method-'.$payment_method->slug().'-btn-img',
943 943
 					'spco-payment-method-btn-img'
944 944
 				);
945 945
 				// check if any payment methods are set as default
946 946
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
947 947
 				if (
948
-					( $this->checkout->selected_method_of_payment === $payment_method->slug() )
949
-					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )
948
+					($this->checkout->selected_method_of_payment === $payment_method->slug())
949
+					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())
950 950
 				) {
951 951
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
952 952
 					$this->_save_selected_method_of_payment();
953
-					$default_payment_method_option[ $payment_method->slug() ] = $payment_method_button;
953
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
954 954
 				} else {
955
-					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
955
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
956 956
 				}
957
-				$payment_methods_billing_info[ $payment_method->slug()
958
-				                               . '-info' ] = $this->_payment_method_billing_info(
957
+				$payment_methods_billing_info[$payment_method->slug()
958
+				                               . '-info'] = $this->_payment_method_billing_info(
959 959
 					$payment_method
960 960
 				);
961 961
 			}
@@ -985,12 +985,12 @@  discard block
 block discarded – undo
985 985
 	 * @return EE_Payment_Method[]
986 986
 	 */
987 987
 	protected function _get_available_payment_methods() {
988
-		if ( ! empty( $this->checkout->available_payment_methods ) ) {
988
+		if ( ! empty($this->checkout->available_payment_methods)) {
989 989
 			return $this->checkout->available_payment_methods;
990 990
 		}
991 991
 		$available_payment_methods = array();
992 992
 		// load EEM_Payment_Method
993
-		EE_Registry::instance()->load_model( 'Payment_Method' );
993
+		EE_Registry::instance()->load_model('Payment_Method');
994 994
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
995 995
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
996 996
 		// get all active payment methods
@@ -998,9 +998,9 @@  discard block
 block discarded – undo
998 998
 			$this->checkout->transaction,
999 999
 			EEM_Payment_Method::scope_cart
1000 1000
 		);
1001
-		foreach ( $payment_methods as $payment_method ) {
1002
-			if ( $payment_method instanceof EE_Payment_Method ) {
1003
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
1001
+		foreach ($payment_methods as $payment_method) {
1002
+			if ($payment_method instanceof EE_Payment_Method) {
1003
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
1004 1004
 			}
1005 1005
 		}
1006 1006
 		return $available_payment_methods;
@@ -1015,14 +1015,14 @@  discard block
 block discarded – undo
1015 1015
 	 * @param    array $available_payment_method_options
1016 1016
 	 * @return    \EE_Form_Section_Proper
1017 1017
 	 */
1018
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
1018
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
1019 1019
 		// generate inputs
1020 1020
 		return new EE_Form_Section_Proper(
1021 1021
 			array(
1022 1022
 				'html_id'         => 'ee-available-payment-method-inputs',
1023 1023
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1024 1024
 				'subsections'     => array(
1025
-					'' => new EE_Radio_Button_Input (
1025
+					'' => new EE_Radio_Button_Input(
1026 1026
 						$available_payment_method_options,
1027 1027
 						array(
1028 1028
 							'html_name'          => 'selected_method_of_payment',
@@ -1047,28 +1047,28 @@  discard block
 block discarded – undo
1047 1047
 	 * @return    \EE_Form_Section_Proper
1048 1048
 	 * @throws \EE_Error
1049 1049
 	 */
1050
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
1050
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
1051 1051
 		$currently_selected = $this->checkout->selected_method_of_payment === $payment_method->slug()
1052 1052
 			? true
1053 1053
 			: false;
1054 1054
 		// generate the billing form for payment method
1055 1055
 		$billing_form = $currently_selected
1056
-			? $this->_get_billing_form_for_payment_method( $payment_method )
1056
+			? $this->_get_billing_form_for_payment_method($payment_method)
1057 1057
 			: new EE_Form_Section_HTML();
1058 1058
 		$this->checkout->billing_form = $currently_selected
1059 1059
 			? $billing_form
1060 1060
 			: $this->checkout->billing_form;
1061 1061
 		// it's all in the details
1062 1062
 		$info_html = EEH_HTML::h3(
1063
-			__( 'Important information regarding your payment', 'event_espresso' ),
1063
+			__('Important information regarding your payment', 'event_espresso'),
1064 1064
 			'',
1065 1065
 			'spco-payment-method-hdr'
1066 1066
 		);
1067 1067
 		// add some info regarding the step, either from what's saved in the admin,
1068 1068
 		// or a default string depending on whether the PM has a billing form or not
1069
-		if ( $payment_method->description() ) {
1069
+		if ($payment_method->description()) {
1070 1070
 			$payment_method_info = $payment_method->description();
1071
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
1071
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
1072 1072
 			$payment_method_info = sprintf(
1073 1073
 				__(
1074 1074
 					'Please provide the following billing information, then click the "%1$s" button below in order to proceed.',
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 			);
1079 1079
 		} else {
1080 1080
 			$payment_method_info = sprintf(
1081
-				__( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ),
1081
+				__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'),
1082 1082
 				$this->submit_button_text()
1083 1083
 			);
1084 1084
 		}
@@ -1092,13 +1092,13 @@  discard block
 block discarded – undo
1092 1092
 		);
1093 1093
 		return new EE_Form_Section_Proper(
1094 1094
 			array(
1095
-				'html_id'         => 'spco-payment-method-info-' . $payment_method->slug(),
1095
+				'html_id'         => 'spco-payment-method-info-'.$payment_method->slug(),
1096 1096
 				'html_class'      => 'spco-payment-method-info-dv',
1097 1097
 				// only display the selected or default PM
1098 1098
 				'html_style'      => $currently_selected ? '' : 'display:none;',
1099 1099
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1100 1100
 				'subsections'     => array(
1101
-					'info'         => new EE_Form_Section_HTML( $info_html ),
1101
+					'info'         => new EE_Form_Section_HTML($info_html),
1102 1102
 					'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML()
1103 1103
 				)
1104 1104
 			)
@@ -1116,15 +1116,15 @@  discard block
 block discarded – undo
1116 1116
 	 */
1117 1117
 	public function get_billing_form_html_for_payment_method() {
1118 1118
 		// how have they chosen to pay?
1119
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1119
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1120 1120
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1121
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1121
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1122 1122
 			return false;
1123 1123
 		}
1124
-		if ( apply_filters(
1124
+		if (apply_filters(
1125 1125
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1126 1126
 			false
1127
-		) ) {
1127
+		)) {
1128 1128
 			EE_Error::add_success(
1129 1129
 				apply_filters(
1130 1130
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 			);
1140 1140
 		}
1141 1141
 		// now generate billing form for selected method of payment
1142
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1142
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1143 1143
 		// fill form with attendee info if applicable
1144 1144
 		if (
1145 1145
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
@@ -1161,10 +1161,10 @@  discard block
 block discarded – undo
1161 1161
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper
1162 1162
 			? $payment_method_billing_form->get_html()
1163 1163
 			: '';
1164
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ) );
1164
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
1165 1165
 		// localize validation rules for main form
1166 1166
 		$this->checkout->current_step->reg_form->localize_validation_rules();
1167
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1167
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1168 1168
 		return true;
1169 1169
 	}
1170 1170
 
@@ -1178,18 +1178,18 @@  discard block
 block discarded – undo
1178 1178
 	 * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML
1179 1179
 	 * @throws \EE_Error
1180 1180
 	 */
1181
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
1181
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
1182 1182
 		$billing_form = $payment_method->type_obj()->billing_form(
1183 1183
 			$this->checkout->transaction,
1184
-			array( 'amount_owing' => $this->checkout->amount_owing )
1184
+			array('amount_owing' => $this->checkout->amount_owing)
1185 1185
 		);
1186
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
1186
+		if ($billing_form instanceof EE_Billing_Info_Form) {
1187 1187
 			if (
1188 1188
 				apply_filters(
1189 1189
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1190 1190
 					false
1191 1191
 				)
1192
-				&& EE_Registry::instance()->REQ->is_set( 'payment_method' )
1192
+				&& EE_Registry::instance()->REQ->is_set('payment_method')
1193 1193
 			) {
1194 1194
 				EE_Error::add_success(
1195 1195
 					apply_filters(
@@ -1231,15 +1231,15 @@  discard block
 block discarded – undo
1231 1231
 		$request_param = 'selected_method_of_payment'
1232 1232
 	) {
1233 1233
 		// is selected_method_of_payment set in the request ?
1234
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, false );
1235
-		if ( $selected_method_of_payment ) {
1234
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, false);
1235
+		if ($selected_method_of_payment) {
1236 1236
 			// sanitize it
1237
-			$selected_method_of_payment = is_array( $selected_method_of_payment )
1238
-				? array_shift( $selected_method_of_payment )
1237
+			$selected_method_of_payment = is_array($selected_method_of_payment)
1238
+				? array_shift($selected_method_of_payment)
1239 1239
 				: $selected_method_of_payment;
1240
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
1240
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
1241 1241
 			// store it in the session so that it's available for all subsequent requests including AJAX
1242
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
1242
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
1243 1243
 		} else {
1244 1244
 			// or is is set in the session ?
1245 1245
 			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data(
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
 			);
1248 1248
 		}
1249 1249
 		// do ya really really gotta have it?
1250
-		if ( empty( $selected_method_of_payment ) && $required ) {
1250
+		if (empty($selected_method_of_payment) && $required) {
1251 1251
 			EE_Error::add_error(
1252 1252
 				sprintf(
1253 1253
 					__(
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
 					),
1257 1257
 					'<br/>',
1258 1258
 					'<br/>',
1259
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1259
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1260 1260
 				),
1261 1261
 				__FILE__,
1262 1262
 				__FUNCTION__,
@@ -1283,13 +1283,13 @@  discard block
 block discarded – undo
1283 1283
 	 * @throws \EE_Error
1284 1284
 	 */
1285 1285
 	public function switch_payment_method() {
1286
-		if ( ! $this->_verify_payment_method_is_set() ) {
1286
+		if ( ! $this->_verify_payment_method_is_set()) {
1287 1287
 			return false;
1288 1288
 		}
1289
-		if ( apply_filters(
1289
+		if (apply_filters(
1290 1290
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1291 1291
 			false
1292
-		) ) {
1292
+		)) {
1293 1293
 			EE_Error::add_success(
1294 1294
 				apply_filters(
1295 1295
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 			);
1305 1305
 		}
1306 1306
 		// generate billing form for selected method of payment if it hasn't been done already
1307
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1307
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1308 1308
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1309 1309
 				$this->checkout->payment_method
1310 1310
 			);
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
 			);
1327 1327
 		}
1328 1328
 		// and debug content
1329
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1329
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form
1330 1330
 		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1331 1331
 		) {
1332 1332
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
@@ -1334,15 +1334,15 @@  discard block
 block discarded – undo
1334 1334
 			);
1335 1335
 		}
1336 1336
 		// get html and validation rules for form
1337
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
1337
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
1338 1338
 			$this->checkout->json_response->set_return_data(
1339
-				array( 'payment_method_info' => $this->checkout->billing_form->get_html() )
1339
+				array('payment_method_info' => $this->checkout->billing_form->get_html())
1340 1340
 			);
1341 1341
 			// localize validation rules for main form
1342
-			$this->checkout->billing_form->localize_validation_rules( true );
1343
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1342
+			$this->checkout->billing_form->localize_validation_rules(true);
1343
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1344 1344
 		} else {
1345
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ) );
1345
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
1346 1346
 		}
1347 1347
 		//prevents advancement to next step
1348 1348
 		$this->checkout->continue_reg = false;
@@ -1359,12 +1359,12 @@  discard block
 block discarded – undo
1359 1359
 	 */
1360 1360
 	protected function _verify_payment_method_is_set() {
1361 1361
 		// generate billing form for selected method of payment if it hasn't been done already
1362
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1362
+		if (empty($this->checkout->selected_method_of_payment)) {
1363 1363
 			// how have they chosen to pay?
1364
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1364
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1365 1365
 		}
1366 1366
 		// verify payment method
1367
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1367
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1368 1368
 			// get payment method for selected method of payment
1369 1369
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1370 1370
 		}
@@ -1383,25 +1383,25 @@  discard block
 block discarded – undo
1383 1383
 	 * @throws \EE_Error
1384 1384
 	 */
1385 1385
 	public function save_payer_details_via_ajax() {
1386
-		if ( ! $this->_verify_payment_method_is_set() ) {
1386
+		if ( ! $this->_verify_payment_method_is_set()) {
1387 1387
 			return;
1388 1388
 		}
1389 1389
 		// generate billing form for selected method of payment if it hasn't been done already
1390
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1390
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1391 1391
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1392 1392
 				$this->checkout->payment_method
1393 1393
 			);
1394 1394
 		}
1395 1395
 		// generate primary attendee from payer info if applicable
1396
-		if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1396
+		if ( ! $this->checkout->transaction_has_primary_registrant()) {
1397 1397
 			$attendee = $this->_create_attendee_from_request_data();
1398
-			if ( $attendee instanceof EE_Attendee ) {
1399
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
1400
-					if ( $registration->is_primary_registrant() ) {
1398
+			if ($attendee instanceof EE_Attendee) {
1399
+				foreach ($this->checkout->transaction->registrations() as $registration) {
1400
+					if ($registration->is_primary_registrant()) {
1401 1401
 						$this->checkout->primary_attendee_obj = $attendee;
1402
-						$registration->_add_relation_to( $attendee, 'Attendee' );
1403
-						$registration->set_attendee_id( $attendee->ID() );
1404
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
1402
+						$registration->_add_relation_to($attendee, 'Attendee');
1403
+						$registration->set_attendee_id($attendee->ID());
1404
+						$registration->update_cache_after_object_save('Attendee', $attendee);
1405 1405
 					}
1406 1406
 				}
1407 1407
 			}
@@ -1419,50 +1419,50 @@  discard block
 block discarded – undo
1419 1419
 	 */
1420 1420
 	protected function _create_attendee_from_request_data() {
1421 1421
 		// get State ID
1422
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
1423
-		if ( ! empty( $STA_ID ) ) {
1422
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
1423
+		if ( ! empty($STA_ID)) {
1424 1424
 			// can we get state object from name ?
1425
-			EE_Registry::instance()->load_model( 'State' );
1426
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1 ), 'STA_ID' );
1427
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
1425
+			EE_Registry::instance()->load_model('State');
1426
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
1427
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
1428 1428
 		}
1429 1429
 		// get Country ISO
1430
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
1431
-		if ( ! empty( $CNT_ISO ) ) {
1430
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
1431
+		if ( ! empty($CNT_ISO)) {
1432 1432
 			// can we get country object from name ?
1433
-			EE_Registry::instance()->load_model( 'Country' );
1433
+			EE_Registry::instance()->load_model('Country');
1434 1434
 			$country = EEM_Country::instance()->get_col(
1435
-				array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1 ),
1435
+				array(array('CNT_name' => $CNT_ISO), 'limit' => 1),
1436 1436
 				'CNT_ISO'
1437 1437
 			);
1438
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
1438
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
1439 1439
 		}
1440 1440
 		// grab attendee data
1441 1441
 		$attendee_data = array(
1442
-			'ATT_fname'    => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
1443
-			'ATT_lname'    => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1444
-			'ATT_email'    => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1445
-			'ATT_address'  => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1446
-			'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1447
-			'ATT_city'     => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
1442
+			'ATT_fname'    => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
1443
+			'ATT_lname'    => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1444
+			'ATT_email'    => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1445
+			'ATT_address'  => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1446
+			'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1447
+			'ATT_city'     => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1448 1448
 			'STA_ID'       => $STA_ID,
1449 1449
 			'CNT_ISO'      => $CNT_ISO,
1450
-			'ATT_zip'      => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1451
-			'ATT_phone'    => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1450
+			'ATT_zip'      => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1451
+			'ATT_phone'    => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1452 1452
 		);
1453 1453
 		// validate the email address since it is the most important piece of info
1454
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] !== $_REQUEST['email'] ) {
1454
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] !== $_REQUEST['email']) {
1455 1455
 			EE_Error::add_error(
1456
-				__( 'An invalid email address was submitted.', 'event_espresso' ),
1456
+				__('An invalid email address was submitted.', 'event_espresso'),
1457 1457
 				__FILE__,
1458 1458
 				__FUNCTION__,
1459 1459
 				__LINE__
1460 1460
 			);
1461 1461
 		}
1462 1462
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1463
-		if ( ! empty( $attendee_data['ATT_fname'] )
1464
-		     && ! empty( $attendee_data['ATT_lname'] )
1465
-		     && ! empty( $attendee_data['ATT_email'] )
1463
+		if ( ! empty($attendee_data['ATT_fname'])
1464
+		     && ! empty($attendee_data['ATT_lname'])
1465
+		     && ! empty($attendee_data['ATT_email'])
1466 1466
 		) {
1467 1467
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1468 1468
 				array(
@@ -1471,19 +1471,19 @@  discard block
 block discarded – undo
1471 1471
 					'ATT_email' => $attendee_data['ATT_email']
1472 1472
 				)
1473 1473
 			);
1474
-			if ( $existing_attendee instanceof EE_Attendee ) {
1474
+			if ($existing_attendee instanceof EE_Attendee) {
1475 1475
 				return $existing_attendee;
1476 1476
 			}
1477 1477
 		}
1478 1478
 		// no existing attendee? kk let's create a new one
1479 1479
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1480
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] )
1480
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname'])
1481 1481
 			? $attendee_data['ATT_fname']
1482 1482
 			: $attendee_data['ATT_email'];
1483
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] )
1483
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname'])
1484 1484
 			? $attendee_data['ATT_lname']
1485 1485
 			: $attendee_data['ATT_email'];
1486
-		return EE_Attendee::new_instance( $attendee_data );
1486
+		return EE_Attendee::new_instance($attendee_data);
1487 1487
 	}
1488 1488
 
1489 1489
 
@@ -1501,26 +1501,26 @@  discard block
 block discarded – undo
1501 1501
 		// how have they chosen to pay?
1502 1502
 		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free()
1503 1503
 			? 'no_payment_required'
1504
-			: $this->_get_selected_method_of_payment( true );
1504
+			: $this->_get_selected_method_of_payment(true);
1505 1505
 		// choose your own adventure based on method_of_payment
1506
-		switch ( $this->checkout->selected_method_of_payment ) {
1506
+		switch ($this->checkout->selected_method_of_payment) {
1507 1507
 
1508 1508
 			case 'events_sold_out' :
1509 1509
 				$this->checkout->redirect = true;
1510 1510
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1511
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1511
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1512 1512
 				// mark this reg step as completed
1513 1513
 				$this->set_completed();
1514 1514
 				return false;
1515 1515
 				break;
1516 1516
 
1517 1517
 			case 'payments_closed' :
1518
-				if ( apply_filters(
1518
+				if (apply_filters(
1519 1519
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success',
1520 1520
 					false
1521
-				) ) {
1521
+				)) {
1522 1522
 					EE_Error::add_success(
1523
-						__( 'no payment required at this time.', 'event_espresso' ),
1523
+						__('no payment required at this time.', 'event_espresso'),
1524 1524
 						__FILE__,
1525 1525
 						__FUNCTION__,
1526 1526
 						__LINE__
@@ -1532,12 +1532,12 @@  discard block
 block discarded – undo
1532 1532
 				break;
1533 1533
 
1534 1534
 			case 'no_payment_required' :
1535
-				if ( apply_filters(
1535
+				if (apply_filters(
1536 1536
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success',
1537 1537
 					false
1538
-				) ) {
1538
+				)) {
1539 1539
 					EE_Error::add_success(
1540
-						__( 'no payment required.', 'event_espresso' ),
1540
+						__('no payment required.', 'event_espresso'),
1541 1541
 						__FILE__,
1542 1542
 						__FUNCTION__,
1543 1543
 						__LINE__
@@ -1557,15 +1557,15 @@  discard block
 block discarded – undo
1557 1557
 					EE_Registry::instance()->SSN->checkout()->revisit
1558 1558
 				);
1559 1559
 				// calculate difference between the two arrays
1560
-				$registrations = array_diff( $registrations, $ejected_registrations );
1561
-				if ( empty( $registrations ) ) {
1560
+				$registrations = array_diff($registrations, $ejected_registrations);
1561
+				if (empty($registrations)) {
1562 1562
 					$this->_redirect_because_event_sold_out();
1563 1563
 					return false;
1564 1564
 				}
1565 1565
 				$payment_successful = $this->_process_payment();
1566
-				if ( $payment_successful ) {
1566
+				if ($payment_successful) {
1567 1567
 					$this->checkout->continue_reg = true;
1568
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1568
+					$this->_maybe_set_completed($this->checkout->payment_method);
1569 1569
 				} else {
1570 1570
 					$this->checkout->continue_reg = false;
1571 1571
 				}
@@ -1586,10 +1586,10 @@  discard block
 block discarded – undo
1586 1586
 		$this->checkout->continue_reg = false;
1587 1587
 		// set redirect URL
1588 1588
 		$this->checkout->redirect_url = add_query_arg(
1589
-			array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1589
+			array('e_reg_url_link' => $this->checkout->reg_url_link),
1590 1590
 			$this->checkout->current_step->reg_step_url()
1591 1591
 		);
1592
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1592
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1593 1593
 	}
1594 1594
 
1595 1595
 
@@ -1602,8 +1602,8 @@  discard block
 block discarded – undo
1602 1602
 	 * @return void
1603 1603
 	 * @throws \EE_Error
1604 1604
 	 */
1605
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1606
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1605
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1606
+		switch ($payment_method->type_obj()->payment_occurs()) {
1607 1607
 			case EE_PMT_Base::offsite :
1608 1608
 				break;
1609 1609
 			case EE_PMT_Base::onsite :
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
 	public function update_reg_step() {
1627 1627
 		$success = true;
1628 1628
 		// if payment required
1629
-		if ( $this->checkout->transaction->total() > 0 ) {
1629
+		if ($this->checkout->transaction->total() > 0) {
1630 1630
 			do_action(
1631 1631
 				'AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway',
1632 1632
 				$this->checkout->transaction
@@ -1634,13 +1634,13 @@  discard block
 block discarded – undo
1634 1634
 			// attempt payment via payment method
1635 1635
 			$success = $this->process_reg_step();
1636 1636
 		}
1637
-		if ( $success && ! $this->checkout->redirect ) {
1637
+		if ($success && ! $this->checkout->redirect) {
1638 1638
 			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn(
1639 1639
 				$this->checkout->transaction->ID()
1640 1640
 			);
1641 1641
 			// set return URL
1642 1642
 			$this->checkout->redirect_url = add_query_arg(
1643
-				array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1643
+				array('e_reg_url_link' => $this->checkout->reg_url_link),
1644 1644
 				$this->checkout->thank_you_page_url
1645 1645
 			);
1646 1646
 		}
@@ -1660,28 +1660,28 @@  discard block
 block discarded – undo
1660 1660
 		// clear any previous errors related to not selecting a payment method
1661 1661
 //		EE_Error::overwrite_errors();
1662 1662
 		// ya gotta make a choice man
1663
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1663
+		if (empty($this->checkout->selected_method_of_payment)) {
1664 1664
 			$this->checkout->json_response->set_plz_select_method_of_payment(
1665
-				__( 'Please select a method of payment before proceeding.', 'event_espresso' )
1665
+				__('Please select a method of payment before proceeding.', 'event_espresso')
1666 1666
 			);
1667 1667
 			return false;
1668 1668
 		}
1669 1669
 		// get EE_Payment_Method object
1670
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1670
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1671 1671
 			return false;
1672 1672
 		}
1673 1673
 		// setup billing form
1674
-		if ( $this->checkout->payment_method->is_on_site() ) {
1674
+		if ($this->checkout->payment_method->is_on_site()) {
1675 1675
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1676 1676
 				$this->checkout->payment_method
1677 1677
 			);
1678 1678
 			// bad billing form ?
1679
-			if ( ! $this->_billing_form_is_valid() ) {
1679
+			if ( ! $this->_billing_form_is_valid()) {
1680 1680
 				return false;
1681 1681
 			}
1682 1682
 		}
1683 1683
 		// ensure primary registrant has been fully processed
1684
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1684
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1685 1685
 			return false;
1686 1686
 		}
1687 1687
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1689,12 +1689,12 @@  discard block
 block discarded – undo
1689 1689
 		// 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
1690 1690
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1691 1691
 		// attempt payment
1692
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1692
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1693 1693
 		// process results
1694
-		$payment = $this->_validate_payment( $payment );
1695
-		$payment = $this->_post_payment_processing( $payment );
1694
+		$payment = $this->_validate_payment($payment);
1695
+		$payment = $this->_post_payment_processing($payment);
1696 1696
 		// verify payment
1697
-		if ( $payment instanceof EE_Payment ) {
1697
+		if ($payment instanceof EE_Payment) {
1698 1698
 			// store that for later
1699 1699
 			$this->checkout->payment = $payment;
1700 1700
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
 			} else {
1709 1709
 				return false;
1710 1710
 			}
1711
-		} else if ( $payment === true ) {
1711
+		} else if ($payment === true) {
1712 1712
 			// please note that offline payment methods will NOT make a payment,
1713 1713
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1714 1714
 			$this->checkout->payment = $payment;
@@ -1733,7 +1733,7 @@  discard block
 block discarded – undo
1733 1733
 		);
1734 1734
 		$html = $payment_method_billing_info->get_html();
1735 1735
 		$html .= $this->checkout->redirect_form;
1736
-		EE_Registry::instance()->REQ->add_output( $html );
1736
+		EE_Registry::instance()->REQ->add_output($html);
1737 1737
 		return true;
1738 1738
 	}
1739 1739
 
@@ -1747,28 +1747,28 @@  discard block
 block discarded – undo
1747 1747
 	 * @throws \EE_Error
1748 1748
 	 */
1749 1749
 	private function _billing_form_is_valid() {
1750
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1750
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1751 1751
 			return true;
1752 1752
 		}
1753
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1754
-			if ( $this->checkout->billing_form->was_submitted() ) {
1753
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1754
+			if ($this->checkout->billing_form->was_submitted()) {
1755 1755
 				$this->checkout->billing_form->receive_form_submission();
1756
-				if ( $this->checkout->billing_form->is_valid() ) {
1756
+				if ($this->checkout->billing_form->is_valid()) {
1757 1757
 					return true;
1758 1758
 				}
1759 1759
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1760 1760
 				$error_strings = array();
1761
-				foreach ( $validation_errors as $validation_error ) {
1762
-					if ( $validation_error instanceof EE_Validation_Error ) {
1761
+				foreach ($validation_errors as $validation_error) {
1762
+					if ($validation_error instanceof EE_Validation_Error) {
1763 1763
 						$form_section = $validation_error->get_form_section();
1764
-						if ( $form_section instanceof EE_Form_Input_Base ) {
1764
+						if ($form_section instanceof EE_Form_Input_Base) {
1765 1765
 							$label = $form_section->html_label_text();
1766
-						} elseif ( $form_section instanceof EE_Form_Section_Base ) {
1766
+						} elseif ($form_section instanceof EE_Form_Section_Base) {
1767 1767
 							$label = $form_section->name();
1768 1768
 						} else {
1769
-							$label = __( 'Validation Error', 'event_espresso' );
1769
+							$label = __('Validation Error', 'event_espresso');
1770 1770
 						}
1771
-						$error_strings[] = sprintf( '%1$s: %2$s', $label, $validation_error->getMessage() );
1771
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1772 1772
 					}
1773 1773
 				}
1774 1774
 				EE_Error::add_error(
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
 							'event_espresso'
1779 1779
 						),
1780 1780
 						'<br/>',
1781
-						implode( '<br/>', $error_strings )
1781
+						implode('<br/>', $error_strings)
1782 1782
 					),
1783 1783
 					__FILE__,
1784 1784
 					__FUNCTION__,
@@ -1797,7 +1797,7 @@  discard block
 block discarded – undo
1797 1797
 			}
1798 1798
 		} else {
1799 1799
 			EE_Error::add_error(
1800
-				__( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ),
1800
+				__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'),
1801 1801
 				__FILE__,
1802 1802
 				__FUNCTION__,
1803 1803
 				__LINE__
@@ -1836,7 +1836,7 @@  discard block
 block discarded – undo
1836 1836
 		// save the TXN ( which clears cached copy of primary_registration)
1837 1837
 		$this->checkout->transaction->save();
1838 1838
 		// grab TXN ID and save it to the primary_registration
1839
-		$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1839
+		$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1840 1840
 		// save what we have so far
1841 1841
 		$primary_registration->save();
1842 1842
 		return true;
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
 	private function _capture_primary_registration_data_from_billing_form() {
1855 1855
 		// convert billing form data into an attendee
1856 1856
 		$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1857
-		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1857
+		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1858 1858
 			EE_Error::add_error(
1859 1859
 				sprintf(
1860 1860
 					__(
@@ -1862,7 +1862,7 @@  discard block
 block discarded – undo
1862 1862
 						'event_espresso'
1863 1863
 					),
1864 1864
 					'<br/>',
1865
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1865
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1866 1866
 				),
1867 1867
 				__FILE__,
1868 1868
 				__FUNCTION__,
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
 			return false;
1872 1872
 		}
1873 1873
 		$primary_registration = $this->checkout->transaction->primary_registration();
1874
-		if ( ! $primary_registration instanceof EE_Registration ) {
1874
+		if ( ! $primary_registration instanceof EE_Registration) {
1875 1875
 			EE_Error::add_error(
1876 1876
 				sprintf(
1877 1877
 					__(
@@ -1879,7 +1879,7 @@  discard block
 block discarded – undo
1879 1879
 						'event_espresso'
1880 1880
 					),
1881 1881
 					'<br/>',
1882
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1882
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1883 1883
 				),
1884 1884
 				__FILE__,
1885 1885
 				__FUNCTION__,
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 			);
1888 1888
 			return false;
1889 1889
 		}
1890
-		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1890
+		if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee')
1891 1891
 		       instanceof
1892 1892
 		       EE_Attendee
1893 1893
 		) {
@@ -1898,7 +1898,7 @@  discard block
 block discarded – undo
1898 1898
 						'event_espresso'
1899 1899
 					),
1900 1900
 					'<br/>',
1901
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1901
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1902 1902
 				),
1903 1903
 				__FILE__,
1904 1904
 				__FUNCTION__,
@@ -1907,9 +1907,9 @@  discard block
 block discarded – undo
1907 1907
 			return false;
1908 1908
 		}
1909 1909
 		/** @type EE_Registration_Processor $registration_processor */
1910
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1910
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1911 1911
 		// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1912
-		$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1912
+		$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1913 1913
 		return true;
1914 1914
 	}
1915 1915
 
@@ -1924,22 +1924,22 @@  discard block
 block discarded – undo
1924 1924
 	 * @throws \EE_Error
1925 1925
 	 */
1926 1926
 	private function _get_payment_method_for_selected_method_of_payment() {
1927
-		if ( $this->checkout->selected_method_of_payment === 'events_sold_out' ) {
1927
+		if ($this->checkout->selected_method_of_payment === 'events_sold_out') {
1928 1928
 			$this->_redirect_because_event_sold_out();
1929 1929
 			return null;
1930 1930
 		}
1931 1931
 		// get EE_Payment_Method object
1932
-		if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] ) ) {
1933
-			$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1932
+		if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1933
+			$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1934 1934
 		} else {
1935 1935
 			// load EEM_Payment_Method
1936
-			EE_Registry::instance()->load_model( 'Payment_Method' );
1936
+			EE_Registry::instance()->load_model('Payment_Method');
1937 1937
 			/** @type EEM_Payment_Method $EEM_Payment_Method */
1938 1938
 			$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1939
-			$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1939
+			$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1940 1940
 		}
1941 1941
 		// verify $payment_method
1942
-		if ( ! $payment_method instanceof EE_Payment_Method ) {
1942
+		if ( ! $payment_method instanceof EE_Payment_Method) {
1943 1943
 			// not a payment
1944 1944
 			EE_Error::add_error(
1945 1945
 				sprintf(
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
 						'event_espresso'
1949 1949
 					),
1950 1950
 					'<br/>',
1951
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1951
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1952 1952
 				),
1953 1953
 				__FILE__,
1954 1954
 				__FUNCTION__,
@@ -1957,7 +1957,7 @@  discard block
 block discarded – undo
1957 1957
 			return null;
1958 1958
 		}
1959 1959
 		// and verify it has a valid Payment_Method Type object
1960
-		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1960
+		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1961 1961
 			// not a payment
1962 1962
 			EE_Error::add_error(
1963 1963
 				sprintf(
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
 						'event_espresso'
1967 1967
 					),
1968 1968
 					'<br/>',
1969
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1969
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1970 1970
 				),
1971 1971
 				__FILE__,
1972 1972
 				__FUNCTION__,
@@ -1987,29 +1987,29 @@  discard block
 block discarded – undo
1987 1987
 	 * @return    mixed    EE_Payment | boolean
1988 1988
 	 * @throws \EE_Error
1989 1989
 	 */
1990
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1990
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1991 1991
 		$payment = null;
1992 1992
 		$this->checkout->transaction->save();
1993
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1994
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1993
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1994
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1995 1995
 			return false;
1996 1996
 		}
1997 1997
 		try {
1998
-			$payment_processor->set_revisit( $this->checkout->revisit );
1998
+			$payment_processor->set_revisit($this->checkout->revisit);
1999 1999
 			// generate payment object
2000 2000
 			$payment = $payment_processor->process_payment(
2001 2001
 				$payment_method,
2002 2002
 				$this->checkout->transaction,
2003 2003
 				$this->checkout->amount_owing,
2004 2004
 				$this->checkout->billing_form,
2005
-				$this->_get_return_url( $payment_method ),
2005
+				$this->_get_return_url($payment_method),
2006 2006
 				'CART',
2007 2007
 				$this->checkout->admin_request,
2008 2008
 				true,
2009 2009
 				$this->reg_step_url()
2010 2010
 			);
2011
-		} catch ( Exception $e ) {
2012
-			$this->_handle_payment_processor_exception( $e );
2011
+		} catch (Exception $e) {
2012
+			$this->_handle_payment_processor_exception($e);
2013 2013
 		}
2014 2014
 		return $payment;
2015 2015
 	}
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
 	 * @return void
2025 2025
 	 * @throws \EE_Error
2026 2026
 	 */
2027
-	protected function _handle_payment_processor_exception( Exception $e ) {
2027
+	protected function _handle_payment_processor_exception(Exception $e) {
2028 2028
 		EE_Error::add_error(
2029 2029
 			sprintf(
2030 2030
 				__(
@@ -2032,7 +2032,7 @@  discard block
 block discarded – undo
2032 2032
 					'event_espresso'
2033 2033
 				),
2034 2034
 				'<br/>',
2035
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
2035
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
2036 2036
 				$e->getMessage(),
2037 2037
 				$e->getFile(),
2038 2038
 				$e->getLine()
@@ -2053,9 +2053,9 @@  discard block
 block discarded – undo
2053 2053
 	 * @return string
2054 2054
 	 * @throws \EE_Error
2055 2055
 	 */
2056
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
2056
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
2057 2057
 		$return_url = '';
2058
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
2058
+		switch ($payment_method->type_obj()->payment_occurs()) {
2059 2059
 			case EE_PMT_Base::offsite :
2060 2060
 				$return_url = add_query_arg(
2061 2061
 					array(
@@ -2084,12 +2084,12 @@  discard block
 block discarded – undo
2084 2084
 	 * @return EE_Payment | FALSE
2085 2085
 	 * @throws \EE_Error
2086 2086
 	 */
2087
-	private function _validate_payment( $payment = null ) {
2088
-		if ( $this->checkout->payment_method->is_off_line() ) {
2087
+	private function _validate_payment($payment = null) {
2088
+		if ($this->checkout->payment_method->is_off_line()) {
2089 2089
 			return true;
2090 2090
 		}
2091 2091
 		// verify payment object
2092
-		if ( ! $payment instanceof EE_Payment ) {
2092
+		if ( ! $payment instanceof EE_Payment) {
2093 2093
 			// not a payment
2094 2094
 			EE_Error::add_error(
2095 2095
 				sprintf(
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
 						'event_espresso'
2099 2099
 					),
2100 2100
 					'<br/>',
2101
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2101
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2102 2102
 				),
2103 2103
 				__FILE__,
2104 2104
 				__FUNCTION__,
@@ -2119,27 +2119,27 @@  discard block
 block discarded – undo
2119 2119
 	 * @return bool
2120 2120
 	 * @throws \EE_Error
2121 2121
 	 */
2122
-	private function _post_payment_processing( $payment = null ) {
2122
+	private function _post_payment_processing($payment = null) {
2123 2123
 		// Off-Line payment?
2124
-		if ( $payment === true ) {
2124
+		if ($payment === true) {
2125 2125
 			//$this->_setup_redirect_for_next_step();
2126 2126
 			return true;
2127 2127
 		// On-Site payment?
2128
-		} else if ( $this->checkout->payment_method->is_on_site() ) {
2129
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite ) ) {
2128
+		} else if ($this->checkout->payment_method->is_on_site()) {
2129
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
2130 2130
 				//$this->_setup_redirect_for_next_step();
2131 2131
 				$this->checkout->continue_reg = false;
2132 2132
 			}
2133 2133
 		// Off-Site payment?
2134
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
2134
+		} else if ($this->checkout->payment_method->is_off_site()) {
2135 2135
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
2136
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ) {
2137
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
2136
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
2137
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
2138 2138
 				$this->checkout->redirect = true;
2139 2139
 				$this->checkout->redirect_form = $payment->redirect_form();
2140
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
2140
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
2141 2141
 				// set JSON response
2142
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
2142
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
2143 2143
 				// set cron job for finalizing the TXN
2144 2144
 				// in case the user does not return from the off-site gateway
2145 2145
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -2147,7 +2147,7 @@  discard block
 block discarded – undo
2147 2147
 					$this->checkout->transaction->ID()
2148 2148
 				);
2149 2149
 				// and lastly, let's bump the payment status to pending
2150
-				$payment->set_status( EEM_Payment::status_id_pending );
2150
+				$payment->set_status(EEM_Payment::status_id_pending);
2151 2151
 				$payment->save();
2152 2152
 			} else {
2153 2153
 				// not a payment
@@ -2159,7 +2159,7 @@  discard block
 block discarded – undo
2159 2159
 							'event_espresso'
2160 2160
 						),
2161 2161
 						'<br/>',
2162
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2162
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
2163 2163
 					),
2164 2164
 					__FILE__,
2165 2165
 					__FUNCTION__,
@@ -2197,21 +2197,21 @@  discard block
 block discarded – undo
2197 2197
 	 * @return bool
2198 2198
 	 * @throws \EE_Error
2199 2199
 	 */
2200
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
2200
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
2201 2201
 		// off-line payment? carry on
2202
-		if ( $payment_occurs === EE_PMT_Base::offline ) {
2202
+		if ($payment_occurs === EE_PMT_Base::offline) {
2203 2203
 			return true;
2204 2204
 		}
2205 2205
 		// verify payment validity
2206
-		if ( $payment instanceof EE_Payment ) {
2207
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
2206
+		if ($payment instanceof EE_Payment) {
2207
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
2208 2208
 			$msg = $payment->gateway_response();
2209 2209
 			// check results
2210
-			switch ( $payment->status() ) {
2210
+			switch ($payment->status()) {
2211 2211
 				// good payment
2212 2212
 				case EEM_Payment::status_id_approved :
2213 2213
 					EE_Error::add_success(
2214
-						__( 'Your payment was processed successfully.', 'event_espresso' ),
2214
+						__('Your payment was processed successfully.', 'event_espresso'),
2215 2215
 						__FILE__,
2216 2216
 						__FUNCTION__,
2217 2217
 						__LINE__
@@ -2220,45 +2220,45 @@  discard block
 block discarded – undo
2220 2220
 					break;
2221 2221
 				// slow payment
2222 2222
 				case EEM_Payment::status_id_pending :
2223
-					if ( empty( $msg ) ) {
2223
+					if (empty($msg)) {
2224 2224
 						$msg = __(
2225 2225
 							'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.',
2226 2226
 							'event_espresso'
2227 2227
 						);
2228 2228
 					}
2229
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
2229
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
2230 2230
 					return true;
2231 2231
 					break;
2232 2232
 				// don't wanna payment
2233 2233
 				case EEM_Payment::status_id_cancelled :
2234
-					if ( empty( $msg ) ) {
2234
+					if (empty($msg)) {
2235 2235
 						$msg = _n(
2236 2236
 							'Payment cancelled. Please try again.',
2237 2237
 							'Payment cancelled. Please try again or select another method of payment.',
2238
-							count( $this->checkout->available_payment_methods ),
2238
+							count($this->checkout->available_payment_methods),
2239 2239
 							'event_espresso'
2240 2240
 						);
2241 2241
 					}
2242
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2242
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2243 2243
 					return false;
2244 2244
 					break;
2245 2245
 				// not enough payment
2246 2246
 				case EEM_Payment::status_id_declined :
2247
-					if ( empty( $msg ) ) {
2247
+					if (empty($msg)) {
2248 2248
 						$msg = _n(
2249 2249
 							'We\'re sorry but your payment was declined. Please try again.',
2250 2250
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
2251
-							count( $this->checkout->available_payment_methods ),
2251
+							count($this->checkout->available_payment_methods),
2252 2252
 							'event_espresso'
2253 2253
 						);
2254 2254
 					}
2255
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2255
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2256 2256
 					return false;
2257 2257
 					break;
2258 2258
 				// bad payment
2259 2259
 				case EEM_Payment::status_id_failed :
2260
-					if ( ! empty( $msg ) ) {
2261
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2260
+					if ( ! empty($msg)) {
2261
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2262 2262
 						return false;
2263 2263
 					}
2264 2264
 					// default to error below
@@ -2267,7 +2267,7 @@  discard block
 block discarded – undo
2267 2267
 		}
2268 2268
 		// off-site payment gateway responses are too unreliable, so let's just assume that
2269 2269
 		// the payment processing is just running slower than the registrant's request
2270
-		if ( $payment_occurs === EE_PMT_Base::offsite ) {
2270
+		if ($payment_occurs === EE_PMT_Base::offsite) {
2271 2271
 			return true;
2272 2272
 		}
2273 2273
 		EE_Error::add_error(
@@ -2277,7 +2277,7 @@  discard block
 block discarded – undo
2277 2277
 					'event_espresso'
2278 2278
 				),
2279 2279
 				'<br/>',
2280
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2280
+				EE_Registry::instance()->CFG->organization->get_pretty('email')
2281 2281
 			),
2282 2282
 			__FILE__,
2283 2283
 			__FUNCTION__,
@@ -2310,13 +2310,13 @@  discard block
 block discarded – undo
2310 2310
 	public function process_gateway_response() {
2311 2311
 		$payment = null;
2312 2312
 		// how have they chosen to pay?
2313
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
2313
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
2314 2314
 		// get EE_Payment_Method object
2315
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
2315
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
2316 2316
 			$this->checkout->continue_reg = false;
2317 2317
 			return false;
2318 2318
 		}
2319
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
2319
+		if ( ! $this->checkout->payment_method->is_off_site()) {
2320 2320
 			return false;
2321 2321
 		}
2322 2322
 		$this->_validate_offsite_return();
@@ -2330,23 +2330,23 @@  discard block
 block discarded – undo
2330 2330
 		//	true
2331 2331
 		//);
2332 2332
 		// verify TXN
2333
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
2333
+		if ($this->checkout->transaction instanceof EE_Transaction) {
2334 2334
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
2335
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
2335
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
2336 2336
 				$this->checkout->continue_reg = false;
2337 2337
 				return false;
2338 2338
 			}
2339
-			$payment = $this->_process_off_site_payment( $gateway );
2340
-			$payment = $this->_process_cancelled_payments( $payment );
2341
-			$payment = $this->_validate_payment( $payment );
2339
+			$payment = $this->_process_off_site_payment($gateway);
2340
+			$payment = $this->_process_cancelled_payments($payment);
2341
+			$payment = $this->_validate_payment($payment);
2342 2342
 			// if payment was not declined by the payment gateway or cancelled by the registrant
2343
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
2343
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
2344 2344
 				//$this->_setup_redirect_for_next_step();
2345 2345
 				// store that for later
2346 2346
 				$this->checkout->payment = $payment;
2347 2347
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
2348 2348
 				// because we will complete this step during the IPN processing then
2349
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request() ) {
2349
+				if ($gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request()) {
2350 2350
 					$this->set_completed();
2351 2351
 				}
2352 2352
 				return true;
@@ -2370,21 +2370,21 @@  discard block
 block discarded – undo
2370 2370
 	 * @throws \EE_Error
2371 2371
 	 */
2372 2372
 	private function _validate_offsite_return() {
2373
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
2374
-		if ( $TXN_ID !== $this->checkout->transaction->ID() ) {
2373
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
2374
+		if ($TXN_ID !== $this->checkout->transaction->ID()) {
2375 2375
 			// Houston... we might have a problem
2376 2376
 			$invalid_TXN = false;
2377 2377
 			// first gather some info
2378
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
2378
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
2379 2379
 			$primary_registrant = $valid_TXN instanceof EE_Transaction
2380 2380
 				? $valid_TXN->primary_registration()
2381 2381
 				: null;
2382 2382
 			// let's start by retrieving the cart for this TXN
2383
-			$cart = $this->checkout->get_cart_for_transaction( $this->checkout->transaction );
2384
-			if ( $cart instanceof EE_Cart ) {
2383
+			$cart = $this->checkout->get_cart_for_transaction($this->checkout->transaction);
2384
+			if ($cart instanceof EE_Cart) {
2385 2385
 				// verify that the current cart has tickets
2386 2386
 				$tickets = $cart->get_tickets();
2387
-				if ( empty( $tickets ) ) {
2387
+				if (empty($tickets)) {
2388 2388
 					$invalid_TXN = true;
2389 2389
 				}
2390 2390
 			} else {
@@ -2394,35 +2394,35 @@  discard block
 block discarded – undo
2394 2394
 				? $primary_registrant->session_ID()
2395 2395
 				: null;
2396 2396
 			// validate current Session ID and compare against valid TXN session ID
2397
-			if ( EE_Session::instance()->id() === null ) {
2397
+			if (EE_Session::instance()->id() === null) {
2398 2398
 				$invalid_TXN = true;
2399
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
2399
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
2400 2400
 				// WARNING !!!
2401 2401
 				// this could be PayPal sending back duplicate requests (ya they do that)
2402 2402
 				// or it **could** mean someone is simply registering AGAIN after having just done so
2403 2403
 				// so now we need to determine if this current TXN looks valid or not
2404 2404
 				// has this step even been started ?
2405
-				if ( $this->checkout->transaction->reg_step_completed( $this->slug() === false )
2405
+				if ($this->checkout->transaction->reg_step_completed($this->slug() === false)
2406 2406
 				) {
2407 2407
 					// really? you're half way through this reg step, but you never started it ?
2408 2408
 					$invalid_TXN = true;
2409 2409
 				}
2410 2410
 			}
2411
-			if ( $invalid_TXN ) {
2411
+			if ($invalid_TXN) {
2412 2412
 				// is the valid TXN completed ?
2413
-				if ( $valid_TXN instanceof EE_Transaction ) {
2413
+				if ($valid_TXN instanceof EE_Transaction) {
2414 2414
 					// has this step even been started ?
2415
-					$reg_step_completed = $valid_TXN->reg_step_completed( $this->slug() );
2416
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
2415
+					$reg_step_completed = $valid_TXN->reg_step_completed($this->slug());
2416
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
2417 2417
 						// so it **looks** like this is a double request from PayPal
2418 2418
 						// so let's try to pick up where we left off
2419 2419
 						$this->checkout->transaction = $valid_TXN;
2420
-						$this->checkout->refresh_all_entities( true );
2420
+						$this->checkout->refresh_all_entities(true);
2421 2421
 						return;
2422 2422
 					}
2423 2423
 				}
2424 2424
 				// you appear to be lost?
2425
-				$this->_redirect_wayward_request( $primary_registrant );
2425
+				$this->_redirect_wayward_request($primary_registrant);
2426 2426
 			}
2427 2427
 		}
2428 2428
 	}
@@ -2437,14 +2437,14 @@  discard block
 block discarded – undo
2437 2437
 	 * @return bool
2438 2438
 	 * @throws \EE_Error
2439 2439
 	 */
2440
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
2441
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2440
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
2441
+		if ( ! $primary_registrant instanceof EE_Registration) {
2442 2442
 			// try redirecting based on the current TXN
2443 2443
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction
2444 2444
 				? $this->checkout->transaction->primary_registration()
2445 2445
 				: null;
2446 2446
 		}
2447
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2447
+		if ( ! $primary_registrant instanceof EE_Registration) {
2448 2448
 			EE_Error::add_error(
2449 2449
 				sprintf(
2450 2450
 					__(
@@ -2452,7 +2452,7 @@  discard block
 block discarded – undo
2452 2452
 						'event_espresso'
2453 2453
 					),
2454 2454
 					'<br/>',
2455
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2455
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2456 2456
 				),
2457 2457
 				__FILE__,
2458 2458
 				__FUNCTION__,
@@ -2483,17 +2483,17 @@  discard block
 block discarded – undo
2483 2483
 	 * @return \EE_Payment
2484 2484
 	 * @throws \EE_Error
2485 2485
 	 */
2486
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
2486
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
2487 2487
 		try {
2488 2488
 			$request_data = \EE_Registry::instance()->REQ->params();
2489 2489
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
2490 2490
 			$this->set_handle_IPN_in_this_request(
2491
-				$gateway->handle_IPN_in_this_request( $request_data, false )
2491
+				$gateway->handle_IPN_in_this_request($request_data, false)
2492 2492
 			);
2493
-			if ( $this->handle_IPN_in_this_request() ) {
2493
+			if ($this->handle_IPN_in_this_request()) {
2494 2494
 				// get payment details and process results
2495 2495
 				/** @type EE_Payment_Processor $payment_processor */
2496
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
2496
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
2497 2497
 				$payment = $payment_processor->process_ipn(
2498 2498
 					$request_data,
2499 2499
 					$this->checkout->transaction,
@@ -2506,14 +2506,14 @@  discard block
 block discarded – undo
2506 2506
 				$payment = $this->checkout->transaction->last_payment();
2507 2507
 				//$payment_source = 'last_payment';
2508 2508
 			}
2509
-		} catch ( Exception $e ) {
2509
+		} catch (Exception $e) {
2510 2510
 			// let's just eat the exception and try to move on using any previously set payment info
2511 2511
 			$payment = $this->checkout->transaction->last_payment();
2512 2512
 			//$payment_source = 'last_payment after Exception';
2513 2513
 			// but if we STILL don't have a payment object
2514
-			if ( ! $payment instanceof EE_Payment ) {
2514
+			if ( ! $payment instanceof EE_Payment) {
2515 2515
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
2516
-				$this->_handle_payment_processor_exception( $e );
2516
+				$this->_handle_payment_processor_exception($e);
2517 2517
 			}
2518 2518
 		}
2519 2519
 		// DEBUG LOG
@@ -2538,13 +2538,13 @@  discard block
 block discarded – undo
2538 2538
 	 * @return EE_Payment | FALSE
2539 2539
 	 * @throws \EE_Error
2540 2540
 	 */
2541
-	private function _process_cancelled_payments( $payment = null ) {
2541
+	private function _process_cancelled_payments($payment = null) {
2542 2542
 		if (
2543 2543
 			$payment instanceof EE_Payment
2544
-			&& isset( $_REQUEST['ee_cancel_payment'] )
2544
+			&& isset($_REQUEST['ee_cancel_payment'])
2545 2545
 			&& $payment->status() === EEM_Payment::status_id_failed
2546 2546
 		) {
2547
-			$payment->set_status( EEM_Payment::status_id_cancelled );
2547
+			$payment->set_status(EEM_Payment::status_id_cancelled);
2548 2548
 		}
2549 2549
 		return $payment;
2550 2550
 	}
@@ -2561,14 +2561,14 @@  discard block
 block discarded – undo
2561 2561
 	public function get_transaction_details_for_gateways() {
2562 2562
 		$txn_details = array();
2563 2563
 		// ya gotta make a choice man
2564
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
2564
+		if (empty($this->checkout->selected_method_of_payment)) {
2565 2565
 			$txn_details = array(
2566
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
2566
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
2567 2567
 			);
2568 2568
 		}
2569 2569
 		// get EE_Payment_Method object
2570 2570
 		if (
2571
-			empty( $txn_details )
2571
+			empty($txn_details)
2572 2572
 			&&
2573 2573
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
2574 2574
 		) {
@@ -2580,8 +2580,8 @@  discard block
 block discarded – undo
2580 2580
 				)
2581 2581
 			);
2582 2582
 		}
2583
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
2584
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
2583
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
2584
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
2585 2585
 			$txn_details = array(
2586 2586
 				'TXN_ID'         => $this->checkout->transaction->ID(),
2587 2587
 				'TXN_timestamp'  => $this->checkout->transaction->datetime(),
@@ -2592,7 +2592,7 @@  discard block
 block discarded – undo
2592 2592
 				'PMD_ID'         => $this->checkout->transaction->payment_method_ID(),
2593 2593
 				'payment_amount' => $this->checkout->amount_owing,
2594 2594
 				'return_url'     => $return_url,
2595
-				'cancel_url'     => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
2595
+				'cancel_url'     => add_query_arg(array('ee_cancel_payment' => true), $return_url),
2596 2596
 				'notify_url'     => EE_Config::instance()->core->txn_page_url(
2597 2597
 					array(
2598 2598
 						'e_reg_url_link'    => $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -2601,7 +2601,7 @@  discard block
 block discarded – undo
2601 2601
 				)
2602 2602
 			);
2603 2603
 		}
2604
-		echo json_encode( $txn_details );
2604
+		echo json_encode($txn_details);
2605 2605
 		exit();
2606 2606
 	}
2607 2607
 
@@ -2618,7 +2618,7 @@  discard block
 block discarded – undo
2618 2618
     public function __sleep()
2619 2619
     {
2620 2620
         // remove the reg form and the checkout
2621
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'reg_form', 'checkout', 'line_item_display' ) );
2621
+        return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout', 'line_item_display'));
2622 2622
     }
2623 2623
 
2624 2624
 
Please login to merge, or discard this patch.