Completed
Branch BUG-9680-compress-dompdf-files... (43e183)
by
unknown
577:38 queued 559:24
created
core/libraries/messages/validators/EE_Messages_Validator.core.php 1 patch
Spacing   +100 added lines, -100 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
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 	 * @param       $context
120 120
 	 * @throws \EE_Error
121 121
 	 */
122
-	public function __construct( $fields, $context ) {
122
+	public function __construct($fields, $context) {
123 123
 		//check that _m_name and _mt_name have been set by child class otherwise we get out.
124
-		if ( empty($this->_m_name ) || empty( $this->_mt_name) )
124
+		if (empty($this->_m_name) || empty($this->_mt_name))
125 125
 			throw new EE_Error(
126 126
 				__(
127 127
 					'EE_Messages_Validator child classes MUST set the $_m_name and $_mt_name property.  Check that the child class is doing this',
@@ -167,14 +167,14 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	private function _load_objects() {
169 169
 		//load messenger
170
-		$messenger = ucwords( str_replace( '_', ' ', $this->_m_name ) );
171
-		$messenger = str_replace( ' ', '_', $messenger );
172
-		$messenger = 'EE_' . $messenger . '_messenger';
170
+		$messenger = ucwords(str_replace('_', ' ', $this->_m_name));
171
+		$messenger = str_replace(' ', '_', $messenger);
172
+		$messenger = 'EE_'.$messenger.'_messenger';
173 173
 
174
-		if ( ! class_exists( $messenger ) ) {
174
+		if ( ! class_exists($messenger)) {
175 175
 			throw new EE_Error(
176 176
 				sprintf(
177
-					__( 'There is no messenger class for the given string (%s)', 'event_espresso' ),
177
+					__('There is no messenger class for the given string (%s)', 'event_espresso'),
178 178
 					$this->_m_name
179 179
 				)
180 180
 			);
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 		$this->_messenger = new $messenger();
184 184
 
185 185
 		//load message type
186
-		$message_type = ucwords( str_replace( '_', ' ', $this->_mt_name ) );
187
-		$message_type = str_replace( ' ', '_', $message_type );
188
-		$message_type = 'EE_' . $message_type . '_message_type';
186
+		$message_type = ucwords(str_replace('_', ' ', $this->_mt_name));
187
+		$message_type = str_replace(' ', '_', $message_type);
188
+		$message_type = 'EE_'.$message_type.'_message_type';
189 189
 
190
-		if ( !class_exists( $message_type ) ) {
190
+		if ( ! class_exists($message_type)) {
191 191
 			throw new EE_Error(
192 192
 				sprintf(
193
-					__( 'There is no message type class for the given string (%s)', 'event_espresso' ),
193
+					__('There is no message type class for the given string (%s)', 'event_espresso'),
194 194
 					$this->_mt_name
195 195
 				)
196 196
 			);
@@ -227,25 +227,25 @@  discard block
 block discarded – undo
227 227
 		$shortcode_groups = $mt_codes;
228 228
 		$groups_per_field = array();
229 229
 
230
-		foreach ( $msgr_validator as $field => $config ) {
231
-			if ( empty($config) || !isset($config['shortcodes']) )
232
-				continue;  //Nothing to see here.
233
-			$groups_per_field[$field] = array_intersect( $config['shortcodes'], $mt_codes );
234
-			$shortcode_groups = array_merge( $config[ 'shortcodes'], $shortcode_groups );
230
+		foreach ($msgr_validator as $field => $config) {
231
+			if (empty($config) || ! isset($config['shortcodes']))
232
+				continue; //Nothing to see here.
233
+			$groups_per_field[$field] = array_intersect($config['shortcodes'], $mt_codes);
234
+			$shortcode_groups = array_merge($config['shortcodes'], $shortcode_groups);
235 235
 		}
236 236
 
237
-		$shortcode_groups = array_unique( $shortcode_groups);
237
+		$shortcode_groups = array_unique($shortcode_groups);
238 238
 
239 239
 		// okay now we've got our groups.
240 240
 		// Let's get the codes from the objects into an array indexed by group for easy retrieval later.
241 241
 		$codes_from_objs = array();
242 242
 
243
-		foreach ( $shortcode_groups as $group ) {
244
-			$ref = ucwords( str_replace('_', ' ', $group ) );
245
-			$ref = str_replace( ' ', '_', $ref );
246
-			$classname = 'EE_' . $ref . '_Shortcodes';
247
-			if ( class_exists( $classname ) ) {
248
-				$a = new ReflectionClass( $classname );
243
+		foreach ($shortcode_groups as $group) {
244
+			$ref = ucwords(str_replace('_', ' ', $group));
245
+			$ref = str_replace(' ', '_', $ref);
246
+			$classname = 'EE_'.$ref.'_Shortcodes';
247
+			if (class_exists($classname)) {
248
+				$a = new ReflectionClass($classname);
249 249
 				$obj = $a->newInstance();
250 250
 				$codes_from_objs[$group] = $obj->get_shortcodes();
251 251
 			}
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 
255 255
 		//let's just replace the $mt shortcode group indexes with the actual shortcodes (unique)
256 256
 		$final_mt_codes = array();
257
-		foreach ( $mt_codes as $group ) {
258
-			$final_mt_codes = array_merge( $final_mt_codes, $codes_from_objs[$group] );
257
+		foreach ($mt_codes as $group) {
258
+			$final_mt_codes = array_merge($final_mt_codes, $codes_from_objs[$group]);
259 259
 		}
260 260
 
261 261
 		$mt_codes = $final_mt_codes;
@@ -263,60 +263,60 @@  discard block
 block discarded – undo
263 263
 
264 264
 		// k now in this next loop we're going to loop through $msgr_validator again
265 265
 		// and setup the _validators property from the data we've setup so far.
266
-		foreach ( $msgr_validator as $field => $config ) {
266
+		foreach ($msgr_validator as $field => $config) {
267 267
 			//if required shortcode is not in our list of codes for the given field, then we skip this field.
268 268
 			$required = isset($config['required'])
269 269
 				? array_intersect($config['required'], array_keys($mt_codes))
270 270
 				: true;
271
-			if ( empty($required) )
271
+			if (empty($required))
272 272
 				continue;
273 273
 
274 274
 			//If we have an override then we use it to indicate the codes we want.
275
-			if ( isset( $this->_valid_shortcodes_modifier[$context][$field] ) ) {
276
-				$this->_validators[ $field ][ 'shortcodes' ] = $this->_reassemble_valid_shortcodes_from_group(
277
-					$this->_valid_shortcodes_modifier[ $context ][ $field ],
275
+			if (isset($this->_valid_shortcodes_modifier[$context][$field])) {
276
+				$this->_validators[$field]['shortcodes'] = $this->_reassemble_valid_shortcodes_from_group(
277
+					$this->_valid_shortcodes_modifier[$context][$field],
278 278
 					$codes_from_objs
279 279
 				);
280 280
 			}
281 281
 
282 282
 			//if we have specific shortcodes for a field then we need to use them
283
-			else if ( isset( $groups_per_field[$field] ) ) {
284
-				$this->_validators[ $field ][ 'shortcodes' ] = $this->_reassemble_valid_shortcodes_from_group(
285
-					$groups_per_field[ $field ],
283
+			else if (isset($groups_per_field[$field])) {
284
+				$this->_validators[$field]['shortcodes'] = $this->_reassemble_valid_shortcodes_from_group(
285
+					$groups_per_field[$field],
286 286
 					$codes_from_objs
287 287
 				);
288 288
 			}
289 289
 
290 290
 			//if empty config then we're assuming we're just going to use the shortcodes from the message type context
291
-			else if ( empty( $config ) ) {
291
+			else if (empty($config)) {
292 292
 				$this->_validators[$field]['shortcodes'] = $mt_codes;
293 293
 			}
294 294
 
295 295
 			//if we have specific shortcodes then we need to use them
296
-			else if ( isset($config['specific_shortcodes'] ) ) {
296
+			else if (isset($config['specific_shortcodes'])) {
297 297
 				$this->_validators[$field]['shortcodes'] = $config['specific_shortcodes'];
298 298
 			}
299 299
 
300 300
 			//otherwise the shortcodes are what is set by the messenger for that field
301 301
 			else {
302
-				foreach ( $config['shortcodes'] as $group ) {
302
+				foreach ($config['shortcodes'] as $group) {
303 303
 					$this->_validators[$field]['shortcodes'] = isset($this->_validators[$field]['shortcodes'])
304
-						? array_merge( $this->_validators[$field]['shortcodes'], $codes_from_objs[$group] )
304
+						? array_merge($this->_validators[$field]['shortcodes'], $codes_from_objs[$group])
305 305
 						: $codes_from_objs[$group];
306 306
 				}
307 307
 			}
308 308
 
309 309
 			//now let's just make sure that any excluded specific shortcodes are removed.
310 310
 			$specific_excludes = $this->get_specific_shortcode_excludes();
311
-			if ( isset( $specific_excludes[$field] ) ) {
312
-				foreach( $specific_excludes[$field] as $sex ) {
313
-					if ( isset( $this->_validators[$field]['shortcodes'][$sex] ) )
314
-						unset( $this->_validators[$field]['shortcodes'][$sex] );
311
+			if (isset($specific_excludes[$field])) {
312
+				foreach ($specific_excludes[$field] as $sex) {
313
+					if (isset($this->_validators[$field]['shortcodes'][$sex]))
314
+						unset($this->_validators[$field]['shortcodes'][$sex]);
315 315
 				}
316 316
 			}
317 317
 
318 318
 			//hey! don't forget to include the type if present!
319
-			$this->_validators[$field]['type'] = isset( $config['type'] ) ? $config['type'] : NULL;
319
+			$this->_validators[$field]['type'] = isset($config['type']) ? $config['type'] : NULL;
320 320
 		}
321 321
 	}
322 322
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	public function get_specific_shortcode_excludes() {
345 345
 		//specific validator filter
346 346
 		$shortcode_excludes = apply_filters(
347
-			'FHEE__' . get_class( $this ) . '__get_specific_shortcode_excludes;',
347
+			'FHEE__'.get_class($this).'__get_specific_shortcode_excludes;',
348 348
 			$this->_specific_shortcode_excludes,
349 349
 			$this->_context
350 350
 		);
@@ -372,20 +372,20 @@  discard block
 block discarded – undo
372 372
 		//some defaults
373 373
 		$template_fields = $this->_messenger->get_template_fields();
374 374
 		//loop through the fields and check!
375
-		foreach ( $this->_fields as $field => $value ) {
375
+		foreach ($this->_fields as $field => $value) {
376 376
 			$this->_errors[$field] = array();
377 377
 			$err_msg = '';
378 378
 			$field_label = '';
379 379
 			//if field is not present in the _validators array then we continue
380
-			if ( !isset( $this->_validators[$field] ) ) {
381
-				unset( $this->_errors[$field] );
380
+			if ( ! isset($this->_validators[$field])) {
381
+				unset($this->_errors[$field]);
382 382
 				continue;
383 383
 			}
384 384
 
385 385
 			//get the translated field label!
386 386
 			//first check if it's in the main fields list
387
-			if ( isset( $template_fields[$field] ) ) {
388
-				if ( empty( $template_fields[$field] ) )
387
+			if (isset($template_fields[$field])) {
388
+				if (empty($template_fields[$field]))
389 389
 					$field_label = $field; //most likely the field is found in the 'extra' array.
390 390
 				else
391 391
 					$field_label = $template_fields[$field]['label'];
@@ -393,16 +393,16 @@  discard block
 block discarded – undo
393 393
 
394 394
 			// if field label is empty OR is equal to the current field
395 395
 			// then we need to loop through the 'extra' fields in the template_fields config (if present)
396
-			if ( isset( $template_fields['extra'] ) && ( empty($field_label) ) || $field_label == $field ) {
397
-				foreach( $template_fields['extra'] as $main_field => $secondary_field ) {
398
-					foreach ( $secondary_field as $name => $values ) {
399
-						if ( $name == $field ) {
396
+			if (isset($template_fields['extra']) && (empty($field_label)) || $field_label == $field) {
397
+				foreach ($template_fields['extra'] as $main_field => $secondary_field) {
398
+					foreach ($secondary_field as $name => $values) {
399
+						if ($name == $field) {
400 400
 							$field_label = $values['label'];
401 401
 						}
402 402
 
403 403
 						// if we've got a 'main' secondary field, let's see if that matches what field we're on
404 404
 						// which means it contains the label for this field.
405
-						if ( $name == 'main' && $main_field == $field_label )
405
+						if ($name == 'main' && $main_field == $field_label)
406 406
 							$field_label = $values['label'];
407 407
 					}
408 408
 				}
@@ -410,27 +410,27 @@  discard block
 block discarded – undo
410 410
 
411 411
 			//field is present. Let's validate shortcodes first (but only if shortcodes present).
412 412
 			if (
413
-				isset( $this->_validators[ $field ][ 'shortcodes' ] )
414
-				&& ! empty( $this->_validators[ $field ][ 'shortcodes' ] )
413
+				isset($this->_validators[$field]['shortcodes'])
414
+				&& ! empty($this->_validators[$field]['shortcodes'])
415 415
 			) {
416
-				$invalid_shortcodes = $this->_invalid_shortcodes( $value, $this->_validators[$field]['shortcodes'] );
416
+				$invalid_shortcodes = $this->_invalid_shortcodes($value, $this->_validators[$field]['shortcodes']);
417 417
 				// if true then that means there is a returned error message
418 418
 				// that we'll need to add to the _errors array for this field.
419
-				if ( $invalid_shortcodes ) {
419
+				if ($invalid_shortcodes) {
420 420
 					$v_s = array_keys($this->_validators[$field]['shortcodes']);
421 421
 					$err_msg = sprintf(
422 422
 						__(
423 423
 							'%3$sThe following shortcodes were found in the "%1$s" field that ARE not valid: %2$s%4$s',
424 424
 							'event_espresso'
425 425
 						),
426
-						'<strong>' . $field_label . '</strong>',
426
+						'<strong>'.$field_label.'</strong>',
427 427
 						$invalid_shortcodes,
428 428
 						'<p>',
429 429
 						'</p >'
430 430
 					);
431 431
 					$err_msg .= sprintf(
432
-						__( '%2$sValid shortcodes for this field are: %1$s%3$s', 'event_espresso' ),
433
-						implode( ', ', $v_s ),
432
+						__('%2$sValid shortcodes for this field are: %1$s%3$s', 'event_espresso'),
433
+						implode(', ', $v_s),
434 434
 						'<strong>',
435 435
 						'</strong>'
436 436
 					);
@@ -438,10 +438,10 @@  discard block
 block discarded – undo
438 438
 			}
439 439
 
440 440
 			//if there's a "type" to be validated then let's do that too.
441
-			if ( isset( $this->_validators[$field]['type'] ) && !empty( $this->_validators[$field]['type'] ) ) {
442
-				switch ( $this->_validators[$field]['type'] ) {
441
+			if (isset($this->_validators[$field]['type']) && ! empty($this->_validators[$field]['type'])) {
442
+				switch ($this->_validators[$field]['type']) {
443 443
 					case 'number' :
444
-						if ( !is_numeric($value) )
444
+						if ( ! is_numeric($value))
445 445
 							$err_msg .= sprintf(
446 446
 								__(
447 447
 									'%3$sThe %1$s field is supposed to be a number. The value given (%2$s)  is not.  Please double-check and make sure the field contains a number%4$s',
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 						break;
456 456
 					case 'email' :
457 457
 						$valid_email = $this->_validate_email($value);
458
-						if ( !$valid_email )
458
+						if ( ! $valid_email)
459 459
 							$err_msg .= htmlentities(
460 460
 								sprintf(
461 461
 									__(
@@ -472,23 +472,23 @@  discard block
 block discarded – undo
472 472
 			}
473 473
 
474 474
 			//if $err_msg isn't empty let's setup the _errors array for this field.
475
-			if ( !empty($err_msg ) ) {
475
+			if ( ! empty($err_msg)) {
476 476
 				$this->_errors[$field]['msg'] = $err_msg;
477 477
 			} else {
478
-				unset( $this->_errors[$field] );
478
+				unset($this->_errors[$field]);
479 479
 			}
480 480
 		}
481 481
 
482 482
 		// if we have ANY errors, then we want to make sure we return the values
483 483
 		// for ALL the fields so the user doesn't have to retype them all.
484
-		if ( !empty( $this->_errors ) ) {
485
-			foreach ( $this->_fields as $field => $value ) {
484
+		if ( ! empty($this->_errors)) {
485
+			foreach ($this->_fields as $field => $value) {
486 486
 				$this->_errors[$field]['value'] = stripslashes($value);
487 487
 			}
488 488
 		}
489 489
 
490 490
 		//return any errors or just TRUE if everything validates
491
-		return empty( $this->_errors ) ? TRUE : $this->_errors;
491
+		return empty($this->_errors) ? TRUE : $this->_errors;
492 492
 	}
493 493
 
494 494
 
@@ -501,10 +501,10 @@  discard block
 block discarded – undo
501 501
 	 * @param  array $codes_from_objs All the codes available.
502 502
 	 * @return array                   an array of actual shortcodes (that will be used for validation).
503 503
 	 */
504
-	private function _reassemble_valid_shortcodes_from_group( $groups, $codes_from_objs ) {
504
+	private function _reassemble_valid_shortcodes_from_group($groups, $codes_from_objs) {
505 505
 		$shortcodes = array();
506
-		foreach ( $groups as $group ) {
507
-			$shortcodes = array_merge( $shortcodes, $codes_from_objs[$group] );
506
+		foreach ($groups as $group) {
507
+			$shortcodes = array_merge($shortcodes, $codes_from_objs[$group]);
508 508
 		}
509 509
 		return $shortcodes;
510 510
 	}
@@ -523,29 +523,29 @@  discard block
 block discarded – undo
523 523
 	 */
524 524
 	protected function _invalid_shortcodes($value, $valid_shortcodes) {
525 525
 		//first we need to go through the string and get the shortcodes in the string
526
-		preg_match_all( '/(\[.+?\])/', $value, $matches );
526
+		preg_match_all('/(\[.+?\])/', $value, $matches);
527 527
 		$incoming_shortcodes = (array) $matches[0];
528 528
 
529 529
 		//get a diff of the shortcodes in the string vs the valid shortcodes
530
-		$diff = array_diff( $incoming_shortcodes, array_keys($valid_shortcodes) );
530
+		$diff = array_diff($incoming_shortcodes, array_keys($valid_shortcodes));
531 531
 
532 532
 		//we need to account for custom codes so let's loop through the diff and remove any of those type of codes
533
-		foreach ( $diff as $ind => $code ) {
534
-			if ( preg_match('/(\[[A-Za-z0-9\_]+_\*)/', $code ) ) {
533
+		foreach ($diff as $ind => $code) {
534
+			if (preg_match('/(\[[A-Za-z0-9\_]+_\*)/', $code)) {
535 535
 				//strip the shortcode so we just have the BASE string (i.e. [ANSWER_*] )
536 536
 				$dynamic_sc = preg_replace('/(_\*+.+)/', '_*]', $code);
537 537
 				//does this exist in the $valid_shortcodes?  If so then unset.
538
-				if ( isset( $valid_shortcodes[$dynamic_sc] ) ) {
539
-					unset( $diff[$ind] );
538
+				if (isset($valid_shortcodes[$dynamic_sc])) {
539
+					unset($diff[$ind]);
540 540
 				}
541 541
 			}
542 542
 		}
543 543
 
544
-		if ( empty( $diff ) ) return FALSE; //there is no diff, we have no invalid shortcodes, so return
544
+		if (empty($diff)) return FALSE; //there is no diff, we have no invalid shortcodes, so return
545 545
 
546 546
 		//made it here? then let's assemble the error message
547
-		$invalid_shortcodes = implode( '</strong>,<strong>', $diff );
548
-		$invalid_shortcodes = '<strong>' . $invalid_shortcodes . '</strong>';
547
+		$invalid_shortcodes = implode('</strong>,<strong>', $diff);
548
+		$invalid_shortcodes = '<strong>'.$invalid_shortcodes.'</strong>';
549 549
 		return $invalid_shortcodes;
550 550
 	}
551 551
 
@@ -557,13 +557,13 @@  discard block
 block discarded – undo
557 557
 	 * @param  string $value incoming value to validate
558 558
 	 * @return bool        true if the string validates, false if it doesn't
559 559
 	 */
560
-	protected function _validate_email( $value ) {
560
+	protected function _validate_email($value) {
561 561
 		$validate = TRUE;
562 562
 		$or_val = $value;
563 563
 
564 564
 		// empty strings will validate because this is how a message template
565 565
 		// for a particular context can be "turned off" (if there is no email then no message)
566
-		if ( empty( $value ) )
566
+		if (empty($value))
567 567
 			return $validate;
568 568
 
569 569
 		// first determine if there ARE any shortcodes.
@@ -581,19 +581,19 @@  discard block
 block discarded – undo
581 581
 		// its possible that this message is being "turned off" for a particular context
582 582
 
583 583
 
584
-		if ( !empty($or_val) && empty($value) )
584
+		if ( ! empty($or_val) && empty($value))
585 585
 			return $validate;
586 586
 
587 587
 		//trim any commas from beginning and end of string ( after whitespace trimmed );
588
-		$value = trim( trim($value), ',' );
588
+		$value = trim(trim($value), ',');
589 589
 
590 590
 
591 591
 		//next we need to split up the string if its comma delimited.
592 592
 		$emails = explode(',', $value);
593 593
 		$empty = FALSE; //used to indicate that there is an empty comma.
594 594
 		//now let's loop through the emails and do our checks
595
-		foreach ( $emails as $email ) {
596
-			if ( empty($email) ) {
595
+		foreach ($emails as $email) {
596
+			if (empty($email)) {
597 597
 				$empty = TRUE;
598 598
 				continue;
599 599
 			}
@@ -601,20 +601,20 @@  discard block
 block discarded – undo
601 601
 			//trim whitespace
602 602
 			$email = trim($email);
603 603
 			//either its of type "[email protected]", or its of type "fname lname <[email protected]>"
604
-			if(is_email($email)){
604
+			if (is_email($email)) {
605 605
 				continue;
606
-			}else{
606
+			} else {
607 607
 				$matches = array();
608
-				$validate = preg_match( '/(.*)<(.+)>/', $email, $matches ) ? TRUE : FALSE;
609
-				if( $validate && is_email($matches[2])){
608
+				$validate = preg_match('/(.*)<(.+)>/', $email, $matches) ? TRUE : FALSE;
609
+				if ($validate && is_email($matches[2])) {
610 610
 					continue;
611
-				}else{
611
+				} else {
612 612
 					return false;
613 613
 				}
614 614
 			}
615 615
 		}
616 616
 
617
-		$validate = $empty && !$has_shortcodes ? FALSE : $validate;
617
+		$validate = $empty && ! $has_shortcodes ? FALSE : $validate;
618 618
 
619 619
 		return $validate;
620 620
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	 * @throws Exception
631 631
 	 * @return mixed
632 632
 	 */
633
-	public function __get( $property ) {
633
+	public function __get($property) {
634 634
 		$expected_properties_map = array(
635 635
 			/**
636 636
 			 * @deprecated 4.9.0
@@ -642,15 +642,15 @@  discard block
 block discarded – undo
642 642
 			'_MSGTYP' => '_message_type'
643 643
 		);
644 644
 
645
-		if ( isset( $expected_properties_map[ $property ] ) ) {
646
-			return $this->{$expected_properties_map[ $property ]};
645
+		if (isset($expected_properties_map[$property])) {
646
+			return $this->{$expected_properties_map[$property]};
647 647
 		}
648 648
 
649 649
 		throw new Exception(
650 650
 			sprintf(
651
-				__( 'The property %1$s being requested on %2$s does not exist', 'event_espresso' ),
651
+				__('The property %1$s being requested on %2$s does not exist', 'event_espresso'),
652 652
 				$property,
653
-				get_class( $this )
653
+				get_class($this)
654 654
 			)
655 655
 		);
656 656
 	}
Please login to merge, or discard this patch.
core/libraries/messages/EE_Messages_Generator.lib.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this
459 459
 		//context is turned off) EXCEPT if we're previewing
460 460
 		if ( empty( $templates['to'][ $context ] )
461
-		     && ! $this->_generation_queue->get_message_repository()->is_preview()
462
-		     && ! $this->_current_messenger->allow_empty_to_field() ) {
461
+			 && ! $this->_generation_queue->get_message_repository()->is_preview()
462
+			 && ! $this->_current_messenger->allow_empty_to_field() ) {
463 463
 			//we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field.
464 464
 			return false;
465 465
 		}
@@ -575,9 +575,9 @@  discard block
 block discarded – undo
575 575
 		 * Check if there is any generation data, but only if this is not for a preview.
576 576
 		 */
577 577
 		if ( ! $this->_generation_queue->get_message_repository()->get_generation_data()
578
-		     && (
579
-			     ! $this->_generation_queue->get_message_repository()->is_preview()
580
-			     && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
578
+			 && (
579
+				 ! $this->_generation_queue->get_message_repository()->is_preview()
580
+				 && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
581 581
 		) {
582 582
 			$this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' );
583 583
 		}
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); }
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 
3 3
 /**
4 4
  * This class is used for generating EE_Message objects with given info.
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return EE_Messages_Queue  The new queue for holding generated EE_Message objects.
118 118
 	 */
119
-	public function generate( $save = true ) {
119
+	public function generate($save = true) {
120 120
 		//iterate through the messages in the queue, generate, and add to new queue.
121 121
 		$this->_generation_queue->get_message_repository()->rewind();
122
-		while ( $this->_generation_queue->get_message_repository()->valid() ) {
122
+		while ($this->_generation_queue->get_message_repository()->valid()) {
123 123
 			//reset "current" properties
124 124
 			$this->_reset_current_properties();
125 125
 
@@ -133,18 +133,18 @@  discard block
 block discarded – undo
133 133
 			$this->_generation_queue->get_message_repository()->next();
134 134
 			$next_msg = $this->_generation_queue->get_message_repository()->current();
135 135
 			//restore pointer to current item
136
-			$this->_generation_queue->get_message_repository()->set_current( $msg );
136
+			$this->_generation_queue->get_message_repository()->set_current($msg);
137 137
 
138 138
 			//skip and delete if the current $msg is NOT incomplete (queued for generation)
139
-			if ( $msg->STS_ID() !== EEM_Message::status_incomplete ) {
139
+			if ($msg->STS_ID() !== EEM_Message::status_incomplete) {
140 140
 				//we keep this item in the db just remove from the repo.
141
-				$this->_generation_queue->get_message_repository()->remove( $msg );
141
+				$this->_generation_queue->get_message_repository()->remove($msg);
142 142
 				//next item
143
-				$this->_generation_queue->get_message_repository()->set_current( $next_msg );
143
+				$this->_generation_queue->get_message_repository()->set_current($next_msg);
144 144
 				continue;
145 145
 			}
146 146
 
147
-			if ( $this->_verify() ) {
147
+			if ($this->_verify()) {
148 148
 				//let's get generating!
149 149
 				$this->_generate();
150 150
 			}
@@ -155,28 +155,28 @@  discard block
 block discarded – undo
155 155
 				&& ! EEM_Message::debug()
156 156
 			) {
157 157
 				$this->_generation_queue->get_message_repository()->delete();
158
-				$this->_generation_queue->get_message_repository()->set_current( $next_msg );
158
+				$this->_generation_queue->get_message_repository()->set_current($next_msg);
159 159
 				continue;
160 160
 			}
161 161
 
162 162
 			//if there are error messages then let's set the status and the error message.
163
-			if ( $this->_error_msg ) {
163
+			if ($this->_error_msg) {
164 164
 				//if the status is already debug only, then let's leave it at that.
165
-				if ( $msg->STS_ID() !== EEM_Message::status_debug_only ) {
166
-					$msg->set_STS_ID( EEM_Message::status_failed );
165
+				if ($msg->STS_ID() !== EEM_Message::status_debug_only) {
166
+					$msg->set_STS_ID(EEM_Message::status_failed);
167 167
 				}
168 168
 				$msg->set_error_message(
169
-					__( 'Message failed to generate for the following reasons: ' )
169
+					__('Message failed to generate for the following reasons: ')
170 170
 					. "\n"
171
-					. implode( "\n", $this->_error_msg )
171
+					. implode("\n", $this->_error_msg)
172 172
 				);
173
-				$msg->set_modified( time() );
173
+				$msg->set_modified(time());
174 174
 			} else {
175 175
 				//remove from db
176 176
 				$this->_generation_queue->get_message_repository()->delete();
177 177
 			}
178 178
 			//next item
179
-			$this->_generation_queue->get_message_repository()->set_current( $next_msg );
179
+			$this->_generation_queue->get_message_repository()->set_current($next_msg);
180 180
 		}
181 181
 
182 182
 		//generation queue is ALWAYS saved to record any errors in the generation process.
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		 * so a EE_Extra_Meta entry could be created and attached to the EE_Message.  In those cases the save flag is
190 190
 		 * irrelevant.
191 191
 		 */
192
-		if ( $save ) {
192
+		if ($save) {
193 193
 			$this->_ready_queue->save();
194 194
 		}
195 195
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	protected function _reset_current_properties() {
208 208
 		$this->_verified = false;
209 209
 		//make sure any _data value in the current message type is reset
210
-		if ( $this->_current_message_type instanceof EE_message_type ) {
210
+		if ($this->_current_message_type instanceof EE_message_type) {
211 211
 			$this->_current_message_type->reset_data();
212 212
 		}
213 213
 		$this->_current_messenger = $this->_current_message_type = $this->_current_data_handler = null;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	protected function _generate() {
228 228
 		//double check verification has run and that everything is ready to work with (saves us having to validate everything again).
229
-		if ( ! $this->_verified ) {
229
+		if ( ! $this->_verified) {
230 230
 			return false; //get out because we don't have a valid setup to work with.
231 231
 		}
232 232
 
@@ -236,34 +236,34 @@  discard block
 block discarded – undo
236 236
 				$this->_current_data_handler,
237 237
 				$this->_generation_queue->get_message_repository()->current()->context()
238 238
 			);
239
-		} catch ( EE_Error $e ) {
239
+		} catch (EE_Error $e) {
240 240
 			$this->_error_msg[] = $e->getMessage();
241 241
 			return false;
242 242
 		}
243 243
 
244 244
 
245 245
 		//if no addressees then get out because there is nothing to generation (possible bad data).
246
-		if ( ! $this->_valid_addressees( $addressees ) ) {
247
-			$this->_generation_queue->get_message_repository()->current()->set_STS_ID( EEM_Message::status_debug_only );
248
-			$this->_error_msg[] = __( 'This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects.  There were no attendees prepared by the data handler.
249
-			  Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso' );
246
+		if ( ! $this->_valid_addressees($addressees)) {
247
+			$this->_generation_queue->get_message_repository()->current()->set_STS_ID(EEM_Message::status_debug_only);
248
+			$this->_error_msg[] = __('This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects.  There were no attendees prepared by the data handler.
249
+			  Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso');
250 250
 			return false;
251 251
 		}
252 252
 
253 253
 		$message_template_group = $this->_get_message_template_group();
254 254
 
255 255
 		//in the unlikely event there is no EE_Message_Template_Group available, get out!
256
-		if ( ! $message_template_group instanceof EE_Message_Template_Group ) {
257
-			$this->_error_msg[] = __( 'Unable to get the Message Templates for the Message being generated.  No message template group accessible.', 'event_espresso' );
256
+		if ( ! $message_template_group instanceof EE_Message_Template_Group) {
257
+			$this->_error_msg[] = __('Unable to get the Message Templates for the Message being generated.  No message template group accessible.', 'event_espresso');
258 258
 			return false;
259 259
 		}
260 260
 
261 261
 		//get formatted templates for using to parse and setup EE_Message objects.
262
-		$templates = $this->_get_templates( $message_template_group );
262
+		$templates = $this->_get_templates($message_template_group);
263 263
 
264 264
 
265 265
 		//setup new EE_Message objects (and add to _ready_queue)
266
-		return $this->_assemble_messages( $addressees, $templates, $message_template_group );
266
+		return $this->_assemble_messages($addressees, $templates, $message_template_group);
267 267
 	}
268 268
 
269 269
 
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
 		//so let's use that.
282 282
 		$GRP_ID = $this->_generation_queue->get_message_repository()->current()->GRP_ID();
283 283
 
284
-		if ( $GRP_ID ) {
284
+		if ($GRP_ID) {
285 285
 			//attempt to retrieve from repo first
286
-			$GRP = $this->_template_collection->get_by_ID( $GRP_ID );
287
-			if ( $GRP instanceof EE_Message_Template_Group ) {
288
-				return $GRP;  //got it!
286
+			$GRP = $this->_template_collection->get_by_ID($GRP_ID);
287
+			if ($GRP instanceof EE_Message_Template_Group) {
288
+				return $GRP; //got it!
289 289
 			}
290 290
 
291 291
 			//nope don't have it yet.  Get from DB then add to repo
292
-			$GRP = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
293
-			if ( $GRP instanceof EE_Message_Template_Group ) {
294
-				$this->_template_collection->add( $GRP );
292
+			$GRP = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
293
+			if ($GRP instanceof EE_Message_Template_Group) {
294
+				$this->_template_collection->add($GRP);
295 295
 			}
296 296
 			return $GRP;
297 297
 		}
@@ -310,41 +310,41 @@  discard block
 block discarded – undo
310 310
 		//in vanilla EE we're assuming there's only one event.
311 311
 		//However, if there are multiple events then we'll just use the default templates instead of different
312 312
 		// templates per event (which could create problems).
313
-		if ( count( $this->_current_data_handler->events ) === 1 ) {
314
-			foreach ( $this->_current_data_handler->events as $event ) {
313
+		if (count($this->_current_data_handler->events) === 1) {
314
+			foreach ($this->_current_data_handler->events as $event) {
315 315
 				$EVT_ID = $event['ID'];
316 316
 			}
317 317
 		}
318 318
 
319 319
 		//before going any further, let's see if its in the queue
320
-		$GRP = $this->_template_collection->get_by_key( $this->_template_collection->get_key( $this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID ) );
320
+		$GRP = $this->_template_collection->get_by_key($this->_template_collection->get_key($this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID));
321 321
 
322
-		if ( $GRP instanceof EE_Message_Template_Group ) {
322
+		if ($GRP instanceof EE_Message_Template_Group) {
323 323
 			return $GRP;
324 324
 		}
325 325
 
326 326
 		//nope still no GRP?
327 327
 		//first we get the global template in case it has an override set.
328
-		$global_template_qa = array_merge( array( 'MTP_is_global' => true ), $template_qa );
329
-		$global_GRP = EEM_Message_Template_Group::instance()->get_one( array( $global_template_qa ) );
328
+		$global_template_qa = array_merge(array('MTP_is_global' => true), $template_qa);
329
+		$global_GRP = EEM_Message_Template_Group::instance()->get_one(array($global_template_qa));
330 330
 
331 331
 		//if this is an override, then we just return it.
332
-		if ( $global_GRP instanceof EE_Message_Template_Group && $global_GRP->get( 'MTP_is_override' ) ) {
333
-			$this->_template_collection->add( $global_GRP, $EVT_ID );
332
+		if ($global_GRP instanceof EE_Message_Template_Group && $global_GRP->get('MTP_is_override')) {
333
+			$this->_template_collection->add($global_GRP, $EVT_ID);
334 334
 			return $global_GRP;
335 335
 		}
336 336
 
337 337
 		//STILL here? Okay that means we want to see if there is event specific group and if there is we return it,
338 338
 		//otherwise we return the global group we retrieved.
339
-		if ( $EVT_ID ) {
339
+		if ($EVT_ID) {
340 340
 			$template_qa['Event.EVT_ID'] = $EVT_ID;
341 341
 		}
342 342
 
343
-		$GRP = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) );
343
+		$GRP = EEM_Message_Template_Group::instance()->get_one(array($template_qa));
344 344
 		$GRP = $GRP instanceof EE_Message_Template_Group ? $GRP : $global_GRP;
345 345
 
346
-		if ( $GRP instanceof EE_Message_Template_Group ) {
347
-			$this->_template_collection->add( $GRP, $EVT_ID );
346
+		if ($GRP instanceof EE_Message_Template_Group) {
347
+			$this->_template_collection->add($GRP, $EVT_ID);
348 348
 			return $GRP;
349 349
 		}
350 350
 
@@ -368,15 +368,15 @@  discard block
 block discarded – undo
368 368
 	 *                      )
369 369
 	 *                  )
370 370
 	 */
371
-	protected function _get_templates( EE_Message_Template_Group $message_template_group ) {
371
+	protected function _get_templates(EE_Message_Template_Group $message_template_group) {
372 372
 		$templates = array();
373 373
 		$context_templates = $message_template_group->context_templates();
374
-		foreach ( $context_templates as $context => $template_fields ) {
375
-			foreach ( $template_fields as $template_field => $template_obj ) {
376
-				if ( ! $template_obj instanceof EE_Message_Template ) {
374
+		foreach ($context_templates as $context => $template_fields) {
375
+			foreach ($template_fields as $template_field => $template_obj) {
376
+				if ( ! $template_obj instanceof EE_Message_Template) {
377 377
 					continue;
378 378
 				}
379
-				$templates[ $template_field ][ $context ] = $template_obj->get( 'MTP_content' );
379
+				$templates[$template_field][$context] = $template_obj->get('MTP_content');
380 380
 			}
381 381
 		}
382 382
 		return $templates;
@@ -398,20 +398,20 @@  discard block
 block discarded – undo
398 398
 	 *                get added to the queue with EEM_Message::status_idle, unsuccessfully generated messages will get added
399 399
 	 *                to the queue as EEM_Message::status_failed.  Very rarely should "false" be returned from this method.
400 400
 	 */
401
-	protected function _assemble_messages( $addressees, $templates, EE_Message_Template_Group $message_template_group ) {
401
+	protected function _assemble_messages($addressees, $templates, EE_Message_Template_Group $message_template_group) {
402 402
 
403 403
 		//if templates are empty then get out because we can't generate anything.
404
-		if ( ! $templates ) {
404
+		if ( ! $templates) {
405 405
 			return false;
406 406
 		}
407 407
 
408 408
 		//We use this as the counter for generated messages because don't forget we may be executing this inside of a
409 409
 		//generation_queue.  So _ready_queue may have generated EE_Message objects already.
410 410
 		$generated_count = 0;
411
-		foreach ( $addressees as $context => $recipients ) {
412
-			foreach ( $recipients as $recipient ) {
413
-				$message = $this->_setup_message_object( $context, $recipient, $templates, $message_template_group );
414
-				if ( $message instanceof EE_Message ) {
411
+		foreach ($addressees as $context => $recipients) {
412
+			foreach ($recipients as $recipient) {
413
+				$message = $this->_setup_message_object($context, $recipient, $templates, $message_template_group);
414
+				if ($message instanceof EE_Message) {
415 415
 					$this->_ready_queue->add(
416 416
 						$message,
417 417
 						array(),
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 				}
423 423
 
424 424
 				//if the current MSG being generated is for a test send then we'll only use ONE message in the generation.
425
-				if ( $this->_generation_queue->get_message_repository()->is_test_send() ) {
425
+				if ($this->_generation_queue->get_message_repository()->is_test_send()) {
426 426
 					break 2;
427 427
 				}
428 428
 			}
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	) {
452 452
 		//stuff we already know
453 453
 		$transaction_id = $recipient->txn instanceof EE_Transaction ? $recipient->txn->ID() : 0;
454
-		$transaction_id = empty( $transaction_id ) && $this->_current_data_handler->txn instanceof EE_Transaction
454
+		$transaction_id = empty($transaction_id) && $this->_current_data_handler->txn instanceof EE_Transaction
455 455
 			? $this->_current_data_handler->txn->ID()
456 456
 			: $transaction_id;
457 457
 		$message_fields = array(
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
 		//recipient id and type should be on the EE_Messages_Addressee object but if this is empty, let's try to grab the
466 466
 		//info from the att_obj found in the EE_Messages_Addressee object.
467
-		if ( empty( $recipient->recipient_id ) || empty( $recipient->recipient_type ) ) {
467
+		if (empty($recipient->recipient_id) || empty($recipient->recipient_type)) {
468 468
 			$message_fields['MSG_recipient_ID'] = $recipient->att_obj instanceof EE_Attendee
469 469
 				? $recipient->att_obj->ID()
470 470
 				: 0;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			$message_fields['MSG_recipient_ID'] = $recipient->recipient_id;
474 474
 			$message_fields['MSG_recipient_type'] = $recipient->recipient_type;
475 475
 		}
476
-		$message = EE_Message_Factory::create( $message_fields );
476
+		$message = EE_Message_Factory::create($message_fields);
477 477
 
478 478
 		//grab valid shortcodes for shortcode parser
479 479
 		$mt_shortcodes = $this->_current_message_type->get_valid_shortcodes();
@@ -481,43 +481,43 @@  discard block
 block discarded – undo
481 481
 
482 482
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this
483 483
 		//context is turned off) EXCEPT if we're previewing
484
-		if ( empty( $templates['to'][ $context ] )
484
+		if (empty($templates['to'][$context])
485 485
 		     && ! $this->_generation_queue->get_message_repository()->is_preview()
486
-		     && ! $this->_current_messenger->allow_empty_to_field() ) {
486
+		     && ! $this->_current_messenger->allow_empty_to_field()) {
487 487
 			//we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field.
488 488
 			return false;
489 489
 		}
490 490
 		$error_msg = array();
491
-		foreach ( $templates as $field => $field_context ) {
491
+		foreach ($templates as $field => $field_context) {
492 492
 			$error_msg = array();
493 493
 			//let's setup the valid shortcodes for the incoming context.
494
-			$valid_shortcodes = $mt_shortcodes[ $context ];
494
+			$valid_shortcodes = $mt_shortcodes[$context];
495 495
 			//merge in valid shortcodes for the field.
496
-			$shortcodes = isset($m_shortcodes[ $field ]) ? $m_shortcodes[ $field ] : $valid_shortcodes;
497
-			if ( isset( $templates[ $field ][ $context ] ) ) {
496
+			$shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes;
497
+			if (isset($templates[$field][$context])) {
498 498
 				//prefix field.
499
-				$column_name = 'MSG_' . $field;
499
+				$column_name = 'MSG_'.$field;
500 500
 				try {
501 501
 					$content = $this->_shortcode_parser->parse_message_template(
502
-						$templates[ $field ][ $context ],
502
+						$templates[$field][$context],
503 503
 						$recipient,
504 504
 						$shortcodes,
505 505
 						$this->_current_message_type,
506 506
 						$this->_current_messenger,
507 507
 						$message );
508
-					$message->set_field_or_extra_meta( $column_name, $content );
509
-				} catch ( EE_Error $e ) {
510
-					$error_msg[] = sprintf( __( 'There was a problem generating the content for the field %s: %s', 'event_espresso' ), $field, $e->getMessage() );
511
-					$message->set_STS_ID( EEM_Message::status_failed );
508
+					$message->set_field_or_extra_meta($column_name, $content);
509
+				} catch (EE_Error $e) {
510
+					$error_msg[] = sprintf(__('There was a problem generating the content for the field %s: %s', 'event_espresso'), $field, $e->getMessage());
511
+					$message->set_STS_ID(EEM_Message::status_failed);
512 512
 				}
513 513
 			}
514 514
 		}
515 515
 
516
-		if ( $message->STS_ID() === EEM_Message::status_failed ) {
517
-			$error_msg = __( 'There were problems generating this message:', 'event_espresso' ) . "\n" . implode( "\n", $error_msg );
518
-			$message->set_error_message( $error_msg );
516
+		if ($message->STS_ID() === EEM_Message::status_failed) {
517
+			$error_msg = __('There were problems generating this message:', 'event_espresso')."\n".implode("\n", $error_msg);
518
+			$message->set_error_message($error_msg);
519 519
 		} else {
520
-			$message->set_STS_ID( EEM_Message::status_idle );
520
+			$message->set_STS_ID(EEM_Message::status_idle);
521 521
 		}
522 522
 		return $message;
523 523
 	}
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
 	 * @param array $addressees  Keys correspond to contexts for the message type and values are EE_Messages_Addressee[]
552 552
 	 * @return bool
553 553
 	 */
554
-	protected function _valid_addressees( $addressees ) {
555
-		if ( ! $addressees || ! is_array( $addressees ) ) {
554
+	protected function _valid_addressees($addressees) {
555
+		if ( ! $addressees || ! is_array($addressees)) {
556 556
 			return false;
557 557
 		}
558 558
 
559
-		foreach( $addressees as $addressee_array ) {
560
-			foreach ( $addressee_array as $addressee ) {
561
-				if ( ! $addressee instanceof EE_Messages_Addressee ) {
559
+		foreach ($addressees as $addressee_array) {
560
+			foreach ($addressee_array as $addressee) {
561
+				if ( ! $addressee instanceof EE_Messages_Addressee) {
562 562
 					return false;
563 563
 				}
564 564
 			}
@@ -579,19 +579,19 @@  discard block
 block discarded – undo
579 579
 	protected function _validate_messenger_and_message_type() {
580 580
 
581 581
 		//first are there any existing error messages?  If so then return.
582
-		if ( $this->_error_msg ) {
582
+		if ($this->_error_msg) {
583 583
 			return false;
584 584
 		}
585 585
 		/** @type EE_Message $message */
586 586
 		$message = $this->_generation_queue->get_message_repository()->current();
587 587
 		try {
588
-			$this->_current_messenger = $message->valid_messenger( true ) ? $message->messenger_object() : null;
589
-		} catch ( Exception $e ) {
588
+			$this->_current_messenger = $message->valid_messenger(true) ? $message->messenger_object() : null;
589
+		} catch (Exception $e) {
590 590
 			$this->_error_msg[] = $e->getMessage();
591 591
 		}
592 592
 		try {
593
-			$this->_current_message_type = $message->valid_message_type( true ) ? $message->message_type_object() : null;
594
-		} catch ( Exception $e ) {
593
+			$this->_current_message_type = $message->valid_message_type(true) ? $message->message_type_object() : null;
594
+		} catch (Exception $e) {
595 595
 			$this->_error_msg[] = $e->getMessage();
596 596
 		}
597 597
 
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
 			     ! $this->_generation_queue->get_message_repository()->is_preview()
604 604
 			     && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
605 605
 		) {
606
-			$this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' );
606
+			$this->_error_msg[] = __('There is no generation data for this message. Unable to generate.');
607 607
 		}
608 608
 
609
-		return empty( $this->_error_msg );
609
+		return empty($this->_error_msg);
610 610
 	}
611 611
 
612 612
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 
624 624
 		//First, are there any existing error messages?  If so, return because if there were errors elsewhere this can't
625 625
 		//be used anyways.
626
-		if ( $this->_error_msg ) {
626
+		if ($this->_error_msg) {
627 627
 			return false;
628 628
 		}
629 629
 
@@ -632,29 +632,29 @@  discard block
 block discarded – undo
632 632
 		/** @type EE_Messages_incoming_data $data_handler_class_name - well not really... just the class name actually */
633 633
 		$data_handler_class_name = $this->_generation_queue->get_message_repository()->get_data_handler()
634 634
 			? $this->_generation_queue->get_message_repository()->get_data_handler()
635
-			: 'EE_Messages_' .  $this->_current_message_type->get_data_handler( $generation_data ) . '_incoming_data';
635
+			: 'EE_Messages_'.$this->_current_message_type->get_data_handler($generation_data).'_incoming_data';
636 636
 
637 637
 		//If this EE_Message is for a preview, then let's switch out to the preview data handler.
638
-		if ( $this->_generation_queue->get_message_repository()->is_preview() ) {
639
-			$data_handler_class_name  = 'EE_Messages_Preview_incoming_data';
638
+		if ($this->_generation_queue->get_message_repository()->is_preview()) {
639
+			$data_handler_class_name = 'EE_Messages_Preview_incoming_data';
640 640
 		}
641 641
 
642 642
 		//First get the class name for the data handler (and also verifies it exists.
643
-		if ( ! class_exists( $data_handler_class_name ) ) {
643
+		if ( ! class_exists($data_handler_class_name)) {
644 644
 			$this->_error_msg[] = sprintf(
645
-				__( 'The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes.  Looking for %s.', 'event_espresso' ),
645
+				__('The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes.  Looking for %s.', 'event_espresso'),
646 646
 				$data_handler_class_name
647 647
 			);
648 648
 			return false;
649 649
 		}
650 650
 
651 651
 		//convert generation_data for data_handler_instantiation.
652
-		$generation_data = $data_handler_class_name::convert_data_from_persistent_storage( $generation_data );
652
+		$generation_data = $data_handler_class_name::convert_data_from_persistent_storage($generation_data);
653 653
 
654 654
 		//note, this may set error messages as well.
655
-		$this->_set_data_handler( $generation_data, $data_handler_class_name );
655
+		$this->_set_data_handler($generation_data, $data_handler_class_name);
656 656
 
657
-		return empty( $this->_error_msg );
657
+		return empty($this->_error_msg);
658 658
 	}
659 659
 
660 660
 
@@ -671,16 +671,16 @@  discard block
 block discarded – undo
671 671
 	 *
672 672
 	 * @return void.
673 673
 	 */
674
-	protected function _set_data_handler( $generating_data, $data_handler_class_name ) {
674
+	protected function _set_data_handler($generating_data, $data_handler_class_name) {
675 675
 		//valid classname for the data handler.  Now let's setup the key for the data handler repository to see if there
676 676
 		//is already a ready data handler in the repository.
677
-		$this->_current_data_handler = $this->_data_handler_collection->get_by_key( $this->_data_handler_collection->get_key( $data_handler_class_name, $generating_data ) );
678
-		if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data ) {
677
+		$this->_current_data_handler = $this->_data_handler_collection->get_by_key($this->_data_handler_collection->get_key($data_handler_class_name, $generating_data));
678
+		if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data) {
679 679
 			//no saved data_handler in the repo so let's set one up and add it to the repo.
680 680
 			try {
681
-				$this->_current_data_handler = new $data_handler_class_name( $generating_data );
682
-				$this->_data_handler_collection->add( $this->_current_data_handler, $generating_data );
683
-			} catch( EE_Error $e ) {
681
+				$this->_current_data_handler = new $data_handler_class_name($generating_data);
682
+				$this->_data_handler_collection->add($this->_current_data_handler, $generating_data);
683
+			} catch (EE_Error $e) {
684 684
 				$this->_error_msg[] = $e->get_error();
685 685
 			}
686 686
 		}
@@ -700,13 +700,13 @@  discard block
 block discarded – undo
700 700
 	 * @param bool                   $preview Indicate whether this is being used for a preview or not.
701 701
 	 * @return mixed Prepped data for persisting to the queue.  false is returned if unable to prep data.
702 702
 	 */
703
-	protected function _prepare_data_for_queue( EE_Message_To_Generate $message_to_generate, $preview ) {
703
+	protected function _prepare_data_for_queue(EE_Message_To_Generate $message_to_generate, $preview) {
704 704
 		/** @type EE_Messages_incoming_data $data_handler - well not really... just the class name actually */
705
-		$data_handler = $message_to_generate->get_data_handler_class_name( $preview );
706
-		if ( ! $message_to_generate->valid() ) {
705
+		$data_handler = $message_to_generate->get_data_handler_class_name($preview);
706
+		if ( ! $message_to_generate->valid()) {
707 707
 			return false; //unable to get the data because the info in the EE_Message_To_Generate class is invalid.
708 708
 		}
709
-		return $data_handler::convert_data_for_persistent_storage( $message_to_generate->data() );
709
+		return $data_handler::convert_data_for_persistent_storage($message_to_generate->data());
710 710
 	}
711 711
 
712 712
 
@@ -719,26 +719,26 @@  discard block
 block discarded – undo
719 719
 	 * @param EE_Message_To_Generate $message_to_generate
720 720
 	 * @param bool                   $test_send Whether this is just a test send or not.  Typically used for previews.
721 721
 	 */
722
-	public function create_and_add_message_to_queue( EE_Message_To_Generate $message_to_generate, $test_send = false ) {
722
+	public function create_and_add_message_to_queue(EE_Message_To_Generate $message_to_generate, $test_send = false) {
723 723
 		//prep data
724
-		$data = $this->_prepare_data_for_queue( $message_to_generate, $message_to_generate->preview() );
724
+		$data = $this->_prepare_data_for_queue($message_to_generate, $message_to_generate->preview());
725 725
 
726 726
 		$message = $message_to_generate->get_EE_Message();
727 727
 
728 728
 		//is there a GRP_ID in the request?
729
-		if ( $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID' ) ) {
730
-			$message->set_GRP_ID( $GRP_ID );
729
+		if ($GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID')) {
730
+			$message->set_GRP_ID($GRP_ID);
731 731
 		}
732 732
 
733
-		if ( $data === false ) {
734
-			$message->set_STS_ID( EEM_Message::status_failed );
735
-			$message->set_error_message( __( 'Unable to prepare data for persistence to the database.', 'event_espresso' ) );
733
+		if ($data === false) {
734
+			$message->set_STS_ID(EEM_Message::status_failed);
735
+			$message->set_error_message(__('Unable to prepare data for persistence to the database.', 'event_espresso'));
736 736
 		} else {
737 737
 			//make sure that the data handler is cached on the message as well
738 738
 			$data['data_handler_class_name'] = $message_to_generate->get_data_handler_class_name();
739 739
 		}
740 740
 
741
-		$this->_generation_queue->add( $message, $data, $message_to_generate->preview(), $test_send );
741
+		$this->_generation_queue->add($message, $data, $message_to_generate->preview(), $test_send);
742 742
 	}
743 743
 
744 744
 
Please login to merge, or discard this patch.
core/db_classes/EE_Message_Template_Group.class.php 1 patch
Spacing   +51 added lines, -51 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
  * EE_Message_Template_Group class
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	 * @param string $timezone
19 19
 	 * @return EE_Message_Template_Group|mixed
20 20
 	 */
21
-	public static function new_instance( $props_n_values = array(), $timezone = '' ) {
22
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone );
23
-		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
21
+	public static function new_instance($props_n_values = array(), $timezone = '') {
22
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone);
23
+		return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
24 24
 	}
25 25
 
26 26
 
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	 * @param string $timezone
31 31
 	 * @return EE_Message_Template_Group
32 32
 	 */
33
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) {
34
-		return new self( $props_n_values, TRUE, $timezone );
33
+	public static function new_instance_from_db($props_n_values = array(), $timezone = '') {
34
+		return new self($props_n_values, TRUE, $timezone);
35 35
 	}
36 36
 
37 37
 
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
 	 * @param bool $message_type
41 41
 	 * @throws EE_Error
42 42
 	 */
43
-	public function set_message_type( $message_type = FALSE ) {
44
-		if ( ! $message_type ) {
45
-			throw new EE_Error( __( 'Missing required value for the message_type parameter', 'event_espresso' ) );
43
+	public function set_message_type($message_type = FALSE) {
44
+		if ( ! $message_type) {
45
+			throw new EE_Error(__('Missing required value for the message_type parameter', 'event_espresso'));
46 46
 		}
47
-		$this->set( 'MTP_message_type', $message_type );
47
+		$this->set('MTP_message_type', $message_type);
48 48
 	}
49 49
 
50 50
 
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	 * @param bool $messenger
54 54
 	 * @throws EE_Error
55 55
 	 */
56
-	public function set_messenger( $messenger = FALSE ) {
57
-		if ( ! $messenger ) {
58
-			throw new EE_Error( __( 'Missing required value for the messenger parameter', 'event_espresso' ) );
56
+	public function set_messenger($messenger = FALSE) {
57
+		if ( ! $messenger) {
58
+			throw new EE_Error(__('Missing required value for the messenger parameter', 'event_espresso'));
59 59
 		}
60
-		$this->set( 'MTP_messenger', $messenger );
60
+		$this->set('MTP_messenger', $messenger);
61 61
 	}
62 62
 
63 63
 
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 	 * @param bool $GRP_ID
67 67
 	 * @throws EE_Error
68 68
 	 */
69
-	public function set_group_template_id( $GRP_ID = FALSE ) {
70
-		if ( ! $GRP_ID ) {
71
-			throw new EE_Error( __( 'Missing required value for the message template group id', 'event_espresso' ) );
69
+	public function set_group_template_id($GRP_ID = FALSE) {
70
+		if ( ! $GRP_ID) {
71
+			throw new EE_Error(__('Missing required value for the message template group id', 'event_espresso'));
72 72
 		}
73
-		$this->set( 'GRP_ID', $GRP_ID );
73
+		$this->set('GRP_ID', $GRP_ID);
74 74
 	}
75 75
 
76 76
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @return int
82 82
 	 */
83 83
 	public function GRP_ID() {
84
-		return $this->get( 'GRP_ID' );
84
+		return $this->get('GRP_ID');
85 85
 	}
86 86
 
87 87
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 * @return int
93 93
 	 */
94 94
 	public function user() {
95
-		$user_id = $this->get( 'MTP_user_id' );
96
-		return empty( $user_id ) ? get_current_user_id() : $user_id;
95
+		$user_id = $this->get('MTP_user_id');
96
+		return empty($user_id) ? get_current_user_id() : $user_id;
97 97
 	}
98 98
 
99 99
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @return int
117 117
 	 */
118 118
 	public function count_events() {
119
-		return $this->count_related( 'Event' );
119
+		return $this->count_related('Event');
120 120
 	}
121 121
 
122 122
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @return string
127 127
 	 */
128 128
 	public function name() {
129
-		return $this->get( 'MTP_name' );
129
+		return $this->get('MTP_name');
130 130
 	}
131 131
 
132 132
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @return string
137 137
 	 */
138 138
 	public function description() {
139
-		return $this->get( 'MTP_description' );
139
+		return $this->get('MTP_description');
140 140
 	}
141 141
 
142 142
 
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 	 * @param  array $query_params like EEM_Base::get_all()
147 147
 	 * @return EE_Message_Template[]
148 148
 	 */
149
-	public function message_templates( $query_params = array() ) {
150
-		return $this->get_many_related( 'Message_Template', $query_params );
149
+	public function message_templates($query_params = array()) {
150
+		return $this->get_many_related('Message_Template', $query_params);
151 151
 	}
152 152
 
153 153
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @return string
159 159
 	 */
160 160
 	public function messenger() {
161
-		return $this->get( 'MTP_messenger' );
161
+		return $this->get('MTP_messenger');
162 162
 	}
163 163
 
164 164
 
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 	public function messenger_obj() {
176 176
 		$messenger = $this->messenger();
177 177
 		try {
178
-			$messenger = EEH_MSG_Template::messenger_obj( $messenger );
179
-		} catch( EE_Error $e ) {
178
+			$messenger = EEH_MSG_Template::messenger_obj($messenger);
179
+		} catch (EE_Error $e) {
180 180
 			//if an exception was thrown then let's deactivate this message template group because it means there is no class for this messenger in this group.
181
-			$this->set( 'MTP_is_active', false );
181
+			$this->set('MTP_is_active', false);
182 182
 			$this->save();
183 183
 			return null;
184 184
 		}
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 * @return string
195 195
 	 */
196 196
 	public function message_type() {
197
-		return $this->get( 'MTP_message_type' );
197
+		return $this->get('MTP_message_type');
198 198
 	}
199 199
 
200 200
 
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 	public function message_type_obj() {
213 213
 		$message_type = $this->message_type();
214 214
 		try {
215
-			$message_type = EEH_MSG_Template::message_type_obj( $message_type );
216
-		} catch(EE_Error $e) {
215
+			$message_type = EEH_MSG_Template::message_type_obj($message_type);
216
+		} catch (EE_Error $e) {
217 217
 			//if an exception was thrown then let's deactivate this message template group because it means there is no class for the message type in this group.
218
-			$this->set( 'MTP_is_active', false );
218
+			$this->set('MTP_is_active', false);
219 219
 			$this->save();
220 220
 			return null;
221 221
 		}
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function context_templates() {
254 254
 		$mtps_arr = array();
255
-		$mtps = $this->get_many_related( 'Message_Template' );
256
-		if ( empty( $mtps ) ) {
255
+		$mtps = $this->get_many_related('Message_Template');
256
+		if (empty($mtps)) {
257 257
 			return array();
258 258
 		}
259 259
 		//note contexts could have CHECKBOX fields per context. So we return the objects indexed by context AND field.
260
-		foreach ( $mtps as $mtp ) {
261
-			$mtps_arr[ $mtp->get( 'MTP_context' ) ][ $mtp->get( 'MTP_template_field' ) ] = $mtp;
260
+		foreach ($mtps as $mtp) {
261
+			$mtps_arr[$mtp->get('MTP_context')][$mtp->get('MTP_template_field')] = $mtp;
262 262
 		}
263 263
 		return $mtps_arr;
264 264
 	}
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 * @return boolean true if it is, false if it isn't
271 271
 	 */
272 272
 	public function is_global() {
273
-		return $this->get( 'MTP_is_global' );
273
+		return $this->get('MTP_is_global');
274 274
 	}
275 275
 
276 276
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 * @return boolean true if it is, false if it isn't
281 281
 	 */
282 282
 	public function is_active() {
283
-		return $this->get( 'MTP_is_active' );
283
+		return $this->get('MTP_is_active');
284 284
 	}
285 285
 
286 286
 
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
 	 * @param bool   $merged  If TRUE then we don't return shortcodes indexed by field but instead an array of the unique shortcodes for all the given (or all) fields.
297 297
 	 * @return mixed (array|bool) an array of shortcodes in the format array( '[shortcode] => 'label') OR FALSE if no shortcodes found.
298 298
 	 */
299
-	public function get_shortcodes( $context, $fields = array(), $merged = FALSE ) {
299
+	public function get_shortcodes($context, $fields = array(), $merged = FALSE) {
300 300
 		$messenger = $this->messenger();
301 301
 		$message_type = $this->message_type();
302
-		return EEH_MSG_Template::get_shortcodes( $message_type, $messenger, $fields, $context, $merged );
302
+		return EEH_MSG_Template::get_shortcodes($message_type, $messenger, $fields, $context, $merged);
303 303
 	}
304 304
 
305 305
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 * @return string
341 341
 	 */
342 342
 	public function get_template_pack_name() {
343
-		return $this->get_extra_meta( 'MTP_template_pack', true, 'default' );
343
+		return $this->get_extra_meta('MTP_template_pack', true, 'default');
344 344
 	}
345 345
 
346 346
 
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	public function get_template_pack() {
357 357
 		$pack_name = $this->get_template_pack_name();
358
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
359
-		return EEH_MSG_Template::get_template_pack( $pack_name );
358
+		EE_Registry::instance()->load_helper('MSG_Template');
359
+		return EEH_MSG_Template::get_template_pack($pack_name);
360 360
 	}
361 361
 
362 362
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 	 * @return string
370 370
 	 */
371 371
 	public function get_template_pack_variation() {
372
-		return $this->get_extra_meta( 'MTP_variation', TRUE, 'default' );
372
+		return $this->get_extra_meta('MTP_variation', TRUE, 'default');
373 373
 	}
374 374
 
375 375
 
@@ -381,8 +381,8 @@  discard block
 block discarded – undo
381 381
 	 * @param string $template_pack_name What message template pack is assigned.
382 382
 	 * @return int
383 383
 	 */
384
-	public function set_template_pack_name( $template_pack_name ) {
385
-		return $this->update_extra_meta( 'MTP_template_pack', $template_pack_name );
384
+	public function set_template_pack_name($template_pack_name) {
385
+		return $this->update_extra_meta('MTP_template_pack', $template_pack_name);
386 386
 	}
387 387
 
388 388
 
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 	 * @param string $variation What variation is being set on the message template group.
395 395
 	 * @return int
396 396
 	 */
397
-	public function set_template_pack_variation( $variation ) {
398
-		return $this->update_extra_meta( 'MTP_variation', $variation );
397
+	public function set_template_pack_variation($variation) {
398
+		return $this->update_extra_meta('MTP_variation', $variation);
399 399
 	}
400 400
 }
401 401
 //end EE_Message_Template_Group class
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Form_Input_Base.input.php 2 patches
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 					$this->html_id()
244 244
 				)
245 245
 			);
246
-		}else{
246
+		} else{
247 247
 			return $this->_display_strategy;
248 248
 		}
249 249
 	}
@@ -458,14 +458,14 @@  discard block
 block discarded – undo
458 458
 			if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
459 459
 				try{
460 460
 					$validation_strategy->validate($this->normalized_value());
461
-				}catch(EE_Validation_Error $e){
461
+				} catch(EE_Validation_Error $e){
462 462
 					$this->add_validation_error($e);
463 463
 				}
464 464
 			}
465 465
 		}
466 466
 		if( $this->get_validation_errors()){
467 467
 			return false;
468
-		}else{
468
+		} else{
469 469
 			return true;
470 470
 		}
471 471
 	}
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
829 829
 			$name_parts = $matches[ 1 ];
830 830
 			array_unshift($name_parts, $before_any_brackets);
831
-		}else{
831
+		} else{
832 832
 			$name_parts = array( $before_any_brackets );
833 833
 		}
834 834
 		// now get the value for the input
@@ -853,13 +853,13 @@  discard block
 block discarded – undo
853 853
 		if( isset( $req_data[ $first_part_to_consider ] ) ){
854 854
 			if( empty($html_name_parts ) ){
855 855
 				return $req_data[ $first_part_to_consider ];
856
-			}else{
856
+			} else{
857 857
 				return $this->_find_form_data_for_this_section_using_name_parts(
858 858
 					$html_name_parts,
859 859
 					$req_data[ $first_part_to_consider ]
860 860
 				);
861 861
 			}
862
-		}else{
862
+		} else{
863 863
 			return NULL;
864 864
 		}
865 865
 	}
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 		$checked_value = $this->find_form_data_for_this_section( $req_data );
881 881
 		if( $checked_value !== null ){
882 882
 			return TRUE;
883
-		}else{
883
+		} else{
884 884
 			return FALSE;
885 885
 		}
886 886
 	}
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage
9 9
  * @author				Mike Nelson
10 10
  */
11
-abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
11
+abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable {
12 12
 
13 13
 	/**
14 14
 	 * the input's name attribute
@@ -143,54 +143,54 @@  discard block
 block discarded – undo
143 143
 	 *  @type EE_Validation_Strategy_Base[]  $validation_strategies
144 144
 	 * }
145 145
 	 */
146
-	public function __construct( $input_args = array() ){
147
-		$input_args = (array) apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this );
146
+	public function __construct($input_args = array()) {
147
+		$input_args = (array) apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this);
148 148
 		// the following properties must be cast as arrays
149
-		if ( isset( $input_args['validation_strategies'] ) ) {
150
-			foreach ( (array) $input_args['validation_strategies'] as $validation_strategy ) {
151
-				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
152
-					$this->_validation_strategies[ get_class( $validation_strategy ) ] = $validation_strategy;
149
+		if (isset($input_args['validation_strategies'])) {
150
+			foreach ((array) $input_args['validation_strategies'] as $validation_strategy) {
151
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
152
+					$this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy;
153 153
 				}
154 154
 			}
155
-			unset( $input_args['validation_strategies'] );
155
+			unset($input_args['validation_strategies']);
156 156
 		}
157 157
 		// loop thru incoming options
158
-		foreach( $input_args as $key => $value ) {
158
+		foreach ($input_args as $key => $value) {
159 159
 			// add underscore to $key to match property names
160
-			$_key = '_' . $key;
161
-			if ( property_exists( $this, $_key )) {
160
+			$_key = '_'.$key;
161
+			if (property_exists($this, $_key)) {
162 162
 				$this->{$_key} = $value;
163 163
 			}
164 164
 		}
165 165
 		// ensure that "required" is set correctly
166 166
 		$this->set_required(
167
-			$this->_required, isset( $input_args[ 'required_validation_error_message' ] )
168
-				? $input_args[ 'required_validation_error_message' ]
167
+			$this->_required, isset($input_args['required_validation_error_message'])
168
+				? $input_args['required_validation_error_message']
169 169
 				: null
170 170
 		);
171 171
 
172 172
 		//$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE;
173 173
 
174 174
 		$this->_display_strategy->_construct_finalize($this);
175
-		foreach( $this->_validation_strategies as $validation_strategy ){
175
+		foreach ($this->_validation_strategies as $validation_strategy) {
176 176
 			$validation_strategy->_construct_finalize($this);
177 177
 		}
178 178
 
179
-		if( ! $this->_normalization_strategy){
179
+		if ( ! $this->_normalization_strategy) {
180 180
 			$this->_normalization_strategy = new EE_Text_Normalization();
181 181
 		}
182 182
 		$this->_normalization_strategy->_construct_finalize($this);
183 183
 
184 184
 		//at least we can use the normalization strategy to populate the default
185
-		if( isset( $input_args[ 'default' ] ) ) {
186
-			$this->set_default( $input_args[ 'default' ] );
185
+		if (isset($input_args['default'])) {
186
+			$this->set_default($input_args['default']);
187 187
 		}
188 188
 
189
-		if( ! $this->_sensitive_data_removal_strategy){
189
+		if ( ! $this->_sensitive_data_removal_strategy) {
190 190
 			$this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal();
191 191
 		}
192 192
 		$this->_sensitive_data_removal_strategy->_construct_finalize($this);
193
-		parent::__construct( $input_args );
193
+		parent::__construct($input_args);
194 194
 	}
195 195
 
196 196
 
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @throws \EE_Error
203 203
 	 */
204
-	protected function _set_default_html_name_if_empty(){
205
-		if( ! $this->_html_name){
204
+	protected function _set_default_html_name_if_empty() {
205
+		if ( ! $this->_html_name) {
206 206
 			$this->_html_name = $this->name();
207
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
208
-				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
207
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
208
+				$this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]";
209 209
 			}
210 210
 		}
211 211
 	}
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 	public function _construct_finalize($parent_form_section, $name) {
221 221
 		parent::_construct_finalize($parent_form_section, $name);
222 222
 		$this->_set_default_html_name_if_empty();
223
-		if( ! $this->_html_label && ! $this->_html_label_text){
224
-			$this->_html_label_text = ucwords( str_replace("_"," ",$name));
223
+		if ( ! $this->_html_label && ! $this->_html_label_text) {
224
+			$this->_html_label_text = ucwords(str_replace("_", " ", $name));
225 225
 		}
226
-		do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name );
226
+		do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name);
227 227
 	}
228 228
 
229 229
 	 /**
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 	  * @return EE_Display_Strategy_Base
232 232
 	  * @throws EE_Error
233 233
 	  */
234
-	protected function _get_display_strategy(){
235
-		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
234
+	protected function _get_display_strategy() {
235
+		if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) {
236 236
 			throw new EE_Error(
237 237
 				sprintf(
238 238
 					__(
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 					$this->html_id()
244 244
 				)
245 245
 			);
246
-		}else{
246
+		} else {
247 247
 			return $this->_display_strategy;
248 248
 		}
249 249
 	}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * Sets the display strategy.
252 252
 	 * @param EE_Display_Strategy_Base $strategy
253 253
 	 */
254
-	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){
254
+	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) {
255 255
 		$this->_display_strategy = $strategy;
256 256
 	}
257 257
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 * Sets the sanitization strategy
260 260
 	 * @param EE_Normalization_Strategy_Base $strategy
261 261
 	 */
262
-	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){
262
+	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) {
263 263
 		$this->_normalization_strategy = $strategy;
264 264
 	}
265 265
 
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 	 * Gets the display strategy for this input
286 286
 	 * @return EE_Display_Strategy_Base
287 287
 	 */
288
-	public function get_display_strategy(){
288
+	public function get_display_strategy() {
289 289
 		return $this->_display_strategy;
290 290
 	}
291 291
 	/**
292 292
 	 * Overwrites the display strategy
293 293
 	 * @param EE_Display_Strategy_Base $display_strategy
294 294
 	 */
295
-	public function set_display_strategy($display_strategy){
295
+	public function set_display_strategy($display_strategy) {
296 296
 		$this->_display_strategy = $display_strategy;
297 297
 		$this->_display_strategy->_construct_finalize($this);
298 298
 	}
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 	 * Gets the normalization strategy set on this input
301 301
 	 * @return EE_Normalization_Strategy_Base
302 302
 	 */
303
-	public function get_normalization_strategy(){
303
+	public function get_normalization_strategy() {
304 304
 		return $this->_normalization_strategy;
305 305
 	}
306 306
 	/**
307 307
 	 * Overwrites the normalization strategy
308 308
 	 * @param EE_Normalization_Strategy_Base $normalization_strategy
309 309
 	 */
310
-	public function set_normalization_strategy($normalization_strategy){
310
+	public function set_normalization_strategy($normalization_strategy) {
311 311
 		$this->_normalization_strategy = $normalization_strategy;
312 312
 		$this->_normalization_strategy->_construct_finalize($this);
313 313
 	}
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 * Returns all teh validation strategies which apply to this field, numerically indexed
317 317
 	 * @return EE_Validation_Strategy_Base[]
318 318
 	 */
319
-	public function get_validation_strategies(){
319
+	public function get_validation_strategies() {
320 320
 		return $this->_validation_strategies;
321 321
 	}
322 322
 
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 	 * @param EE_Validation_Strategy_Base $validation_strategy
328 328
 	 * @return void
329 329
 	 */
330
-	protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){
331
-		$validation_strategy->_construct_finalize( $this );
330
+	protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
331
+		$validation_strategy->_construct_finalize($this);
332 332
 		$this->_validation_strategies[] = $validation_strategy;
333 333
 	}
334 334
 
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 	 * @param EE_Validation_Strategy_Base $validation_strategy
340 340
 	 * @return void
341 341
 	 */
342
-	public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) {
343
-		$this->_add_validation_strategy( $validation_strategy );
342
+	public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
343
+		$this->_add_validation_strategy($validation_strategy);
344 344
 	}
345 345
 
346 346
 
@@ -350,13 +350,13 @@  discard block
 block discarded – undo
350 350
 	 *
351 351
 	 * @param string $validation_strategy_classname
352 352
 	 */
353
-	public function remove_validation_strategy( $validation_strategy_classname ) {
354
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
355
-			if(
353
+	public function remove_validation_strategy($validation_strategy_classname) {
354
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
355
+			if (
356 356
 				$validation_strategy instanceof $validation_strategy_classname
357
-				|| is_subclass_of( $validation_strategy, $validation_strategy_classname )
357
+				|| is_subclass_of($validation_strategy, $validation_strategy_classname)
358 358
 			) {
359
-				unset( $this->_validation_strategies[ $key ] );
359
+				unset($this->_validation_strategies[$key]);
360 360
 			}
361 361
 		}
362 362
 	}
@@ -369,12 +369,12 @@  discard block
 block discarded – undo
369 369
 	 * @param array $validation_strategy_classnames
370 370
 	 * @return bool
371 371
 	 */
372
-	public function has_validation_strategy( $validation_strategy_classnames ) {
373
-		$validation_strategy_classnames = is_array( $validation_strategy_classnames )
372
+	public function has_validation_strategy($validation_strategy_classnames) {
373
+		$validation_strategy_classnames = is_array($validation_strategy_classnames)
374 374
 			? $validation_strategy_classnames
375
-			: array( $validation_strategy_classnames );
376
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
377
-			if( in_array( $key, $validation_strategy_classnames ) ) {
375
+			: array($validation_strategy_classnames);
376
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
377
+			if (in_array($key, $validation_strategy_classnames)) {
378 378
 				return true;
379 379
 			}
380 380
 		}
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	 * Gets the HTML
388 388
 	 * @return string
389 389
 	 */
390
-	public function get_html(){
390
+	public function get_html() {
391 391
 		return $this->_parent_section->get_html_for_input($this);
392 392
 	}
393 393
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 * @return string
402 402
 	 * @throws \EE_Error
403 403
 	 */
404
-	public function get_html_for_input(){
404
+	public function get_html_for_input() {
405 405
 		return  $this->_get_display_strategy()->display();
406 406
 	}
407 407
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 	 * @return string
412 412
 	 */
413 413
 	public function html_other_attributes() {
414
-		return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : '';
414
+		return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : '';
415 415
 	}
416 416
 
417 417
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	/**
420 420
 	 * @param string $html_other_attributes
421 421
 	 */
422
-	public function set_html_other_attributes( $html_other_attributes ) {
422
+	public function set_html_other_attributes($html_other_attributes) {
423 423
 		$this->_html_other_attributes = $html_other_attributes;
424 424
 	}
425 425
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 * according to the form section's layout strategy
429 429
 	 * @return string
430 430
 	 */
431
-	public function get_html_for_label(){
431
+	public function get_html_for_label() {
432 432
 		return $this->_parent_section->get_layout_strategy()->display_label($this);
433 433
 	}
434 434
 	/**
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 	 * according to the form section's layout strategy
437 437
 	 * @return string
438 438
 	 */
439
-	public function get_html_for_errors(){
439
+	public function get_html_for_errors() {
440 440
 		return $this->_parent_section->get_layout_strategy()->display_errors($this);
441 441
 	}
442 442
 	/**
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 * according to the form section's layout strategy
445 445
 	 * @return string
446 446
 	 */
447
-	public function get_html_for_help(){
447
+	public function get_html_for_help() {
448 448
 		return $this->_parent_section->get_layout_strategy()->display_help_text($this);
449 449
 	}
450 450
 	/**
@@ -453,18 +453,18 @@  discard block
 block discarded – undo
453 453
 	 * @return boolean
454 454
 	 */
455 455
 	protected function _validate() {
456
-		foreach($this->_validation_strategies as $validation_strategy){
457
-			if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
458
-				try{
456
+		foreach ($this->_validation_strategies as $validation_strategy) {
457
+			if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
458
+				try {
459 459
 					$validation_strategy->validate($this->normalized_value());
460
-				}catch(EE_Validation_Error $e){
460
+				} catch (EE_Validation_Error $e) {
461 461
 					$this->add_validation_error($e);
462 462
 				}
463 463
 			}
464 464
 		}
465
-		if( $this->get_validation_errors()){
465
+		if ($this->get_validation_errors()) {
466 466
 			return false;
467
-		}else{
467
+		} else {
468 468
 			return true;
469 469
 		}
470 470
 	}
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 	 * @param string $value
479 479
 	 * @return null|string
480 480
 	 */
481
-	private function _sanitize( $value ) {
482
-		return $value !== null ? stripslashes( html_entity_decode( trim( $value ) ) ) : null;
481
+	private function _sanitize($value) {
482
+		return $value !== null ? stripslashes(html_entity_decode(trim($value))) : null;
483 483
 	}
484 484
 
485 485
 
@@ -493,24 +493,24 @@  discard block
 block discarded – undo
493 493
 	 * @return boolean whether or not there was an error
494 494
 	 * @throws \EE_Error
495 495
 	 */
496
-	protected function _normalize( $req_data ) {
496
+	protected function _normalize($req_data) {
497 497
 		//any existing validation errors don't apply so clear them
498 498
 		$this->_validation_errors = array();
499 499
 		try {
500
-			$raw_input = $this->find_form_data_for_this_section( $req_data );
500
+			$raw_input = $this->find_form_data_for_this_section($req_data);
501 501
 			//super simple sanitization for now
502
-			if ( is_array( $raw_input )) {
502
+			if (is_array($raw_input)) {
503 503
 				$this->_raw_value = array();
504
-				foreach( $raw_input as $key => $value ) {
505
-					$this->_raw_value[ $key ] = $this->_sanitize( $value );
504
+				foreach ($raw_input as $key => $value) {
505
+					$this->_raw_value[$key] = $this->_sanitize($value);
506 506
 				}
507 507
 			} else {
508
-				$this->_raw_value = $this->_sanitize( $raw_input );
508
+				$this->_raw_value = $this->_sanitize($raw_input);
509 509
 			}
510 510
 			//we want ot mostly leave the input alone in case we need to re-display it to the user
511
-			$this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() );
512
-		} catch ( EE_Validation_Error $e ) {
513
-			$this->add_validation_error( $e );
511
+			$this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value());
512
+		} catch (EE_Validation_Error $e) {
513
+			$this->add_validation_error($e);
514 514
 		}
515 515
 	}
516 516
 
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	/**
520 520
 	 * @return string
521 521
 	 */
522
-	public function html_name(){
522
+	public function html_name() {
523 523
 		return $this->_html_name;
524 524
 	}
525 525
 
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
 	/**
529 529
 	 * @return string
530 530
 	 */
531
-	public function html_label_id(){
532
-		return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl';
531
+	public function html_label_id() {
532
+		return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl';
533 533
 	}
534 534
 
535 535
 
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 	/**
538 538
 	 * @return string
539 539
 	 */
540
-	public function html_label_class(){
540
+	public function html_label_class() {
541 541
 		return $this->_html_label_class;
542 542
 	}
543 543
 
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	/**
547 547
 	 * @return string
548 548
 	 */
549
-	public function html_label_style(){
549
+	public function html_label_style() {
550 550
 		return $this->_html_label_style;
551 551
 	}
552 552
 
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 	/**
556 556
 	 * @return string
557 557
 	 */
558
-	public function html_label_text(){
558
+	public function html_label_text() {
559 559
 		return $this->_html_label_text;
560 560
 	}
561 561
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 	/**
565 565
 	 * @return string
566 566
 	 */
567
-	public function html_help_text(){
567
+	public function html_help_text() {
568 568
 		return $this->_html_help_text;
569 569
 	}
570 570
 
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 	/**
574 574
 	 * @return string
575 575
 	 */
576
-	public function html_help_class(){
576
+	public function html_help_class() {
577 577
 		return $this->_html_help_class;
578 578
 	}
579 579
 
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	/**
583 583
 	 * @return string
584 584
 	 */
585
-	public function html_help_style(){
585
+	public function html_help_style() {
586 586
 		return $this->_html_style;
587 587
 	}
588 588
 	/**
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 	 * in which case, we would have stored the malicious content to our database.
596 596
 	 * @return string
597 597
 	 */
598
-	public function raw_value(){
598
+	public function raw_value() {
599 599
 		return $this->_raw_value;
600 600
 	}
601 601
 	/**
@@ -603,15 +603,15 @@  discard block
 block discarded – undo
603 603
 	 * it escapes all html entities
604 604
 	 * @return string
605 605
 	 */
606
-	public function raw_value_in_form(){
607
-		return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8');
606
+	public function raw_value_in_form() {
607
+		return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8');
608 608
 	}
609 609
 	/**
610 610
 	 * returns the value after it's been sanitized, and then converted into it's proper type
611 611
 	 * in PHP. Eg, a string, an int, an array,
612 612
 	 * @return mixed
613 613
 	 */
614
-	public function normalized_value(){
614
+	public function normalized_value() {
615 615
 		return $this->_normalized_value;
616 616
 	}
617 617
 
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 	 * the best thing to display
622 622
 	 * @return string
623 623
 	 */
624
-	public function pretty_value(){
624
+	public function pretty_value() {
625 625
 		return $this->_normalized_value;
626 626
 	}
627 627
 	/**
@@ -640,19 +640,19 @@  discard block
 block discarded – undo
640 640
 		  }</code>
641 641
 	 * @return array
642 642
 	 */
643
-	public function get_jquery_validation_rules(){
643
+	public function get_jquery_validation_rules() {
644 644
 		$jquery_validation_js = array();
645 645
 		$jquery_validation_rules = array();
646
-		foreach($this->get_validation_strategies() as $validation_strategy){
646
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
647 647
 			$jquery_validation_rules = array_replace_recursive(
648 648
 				$jquery_validation_rules,
649 649
 				$validation_strategy->get_jquery_validation_rule_array()
650 650
 			);
651 651
 		}
652 652
 
653
-		if(! empty($jquery_validation_rules)){
654
-			foreach( $this->get_display_strategy()->get_html_input_ids( true ) as $html_id_with_pound_sign ) {
655
-				$jquery_validation_js[ $html_id_with_pound_sign ] = $jquery_validation_rules;
653
+		if ( ! empty($jquery_validation_rules)) {
654
+			foreach ($this->get_display_strategy()->get_html_input_ids(true) as $html_id_with_pound_sign) {
655
+				$jquery_validation_js[$html_id_with_pound_sign] = $jquery_validation_rules;
656 656
 			}
657 657
 		}
658 658
 		return $jquery_validation_js;
@@ -664,9 +664,9 @@  discard block
 block discarded – undo
664 664
 	 * @param mixed $value
665 665
 	 * @return void
666 666
 	 */
667
-	public function set_default($value){
667
+	public function set_default($value) {
668 668
 		$this->_normalized_value = $value;
669
-		$this->_raw_value = $this->_normalization_strategy->unnormalize( $value );
669
+		$this->_raw_value = $this->_normalization_strategy->unnormalize($value);
670 670
 	}
671 671
 
672 672
 	/**
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 * @param string $label
675 675
 	 * @return void
676 676
 	 */
677
-	public function set_html_label_text($label){
677
+	public function set_html_label_text($label) {
678 678
 		$this->_html_label_text = $label;
679 679
 	}
680 680
 
@@ -688,13 +688,13 @@  discard block
 block discarded – undo
688 688
 	 * @param boolean $required boolean
689 689
 	 * @param null    $required_text
690 690
 	 */
691
-	public function set_required($required = true, $required_text = NULL ){
692
-		$required = filter_var( $required, FILTER_VALIDATE_BOOLEAN  );
691
+	public function set_required($required = true, $required_text = NULL) {
692
+		$required = filter_var($required, FILTER_VALIDATE_BOOLEAN);
693 693
 		//whether $required is a string or a boolean, we want to add a required validation strategy
694
-		if ( $required ) {
695
-			$this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) );
694
+		if ($required) {
695
+			$this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text));
696 696
 		} else {
697
-			unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] );
697
+			unset($this->_validation_strategies['EE_Required_Validation_Strategy']);
698 698
 		}
699 699
 		$this->_required = $required;
700 700
 	}
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	 * Returns whether or not this field is required
703 703
 	 * @return boolean
704 704
 	 */
705
-	public function required(){
705
+	public function required() {
706 706
 		return $this->_required;
707 707
 	}
708 708
 
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	/**
712 712
 	 * @param string $required_css_class
713 713
 	 */
714
-	public function set_required_css_class( $required_css_class ) {
714
+	public function set_required_css_class($required_css_class) {
715 715
 		$this->_required_css_class = $required_css_class;
716 716
 	}
717 717
 
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	 * Sets the help text, in case
731 731
 	 * @param string $text
732 732
 	 */
733
-	public function set_html_help_text($text){
733
+	public function set_html_help_text($text) {
734 734
 		$this->_html_help_text = $text;
735 735
 	}
736 736
 	/**
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
 	public function clean_sensitive_data() {
743 743
 		//if we do ANY kind of sensitive data removal on this, then just clear out the raw value
744 744
 		//if we need more logic than this we'll make a strategy for it
745
-		if( $this->_sensitive_data_removal_strategy &&
746
-				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){
745
+		if ($this->_sensitive_data_removal_strategy &&
746
+				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) {
747 747
 			$this->_raw_value = NULL;
748 748
 		}
749 749
 		//and clean the normalized value according to the appropriate strategy
@@ -759,10 +759,10 @@  discard block
 block discarded – undo
759 759
 	 * @param string $button_size
760 760
 	 * @param string $other_attributes
761 761
 	 */
762
-	public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) {
762
+	public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') {
763 763
 		$button_css_attributes = 'button';
764 764
 		$button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary';
765
-		switch ( $button_size ) {
765
+		switch ($button_size) {
766 766
 			case 'xs' :
767 767
 			case 'extra-small' :
768 768
 				$button_css_attributes .= ' button-xs';
@@ -783,8 +783,8 @@  discard block
 block discarded – undo
783 783
 			default :
784 784
 				$button_css_attributes .= '';
785 785
 		}
786
-		$this->_button_css_attributes .= ! empty( $other_attributes )
787
-			? $button_css_attributes . ' ' . $other_attributes
786
+		$this->_button_css_attributes .= ! empty($other_attributes)
787
+			? $button_css_attributes.' '.$other_attributes
788 788
 			: $button_css_attributes;
789 789
 	}
790 790
 
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 	 * @return string
795 795
 	 */
796 796
 	public function button_css_attributes() {
797
-		if ( empty( $this->_button_css_attributes )) {
797
+		if (empty($this->_button_css_attributes)) {
798 798
 			$this->set_button_css_attributes();
799 799
 		}
800 800
 		return $this->_button_css_attributes;
@@ -816,26 +816,26 @@  discard block
 block discarded – undo
816 816
 	 * @return mixed whatever the raw value of this form section is in the request data
817 817
 	 * @throws \EE_Error
818 818
 	 */
819
-	public function find_form_data_for_this_section( $req_data ){
819
+	public function find_form_data_for_this_section($req_data) {
820 820
 		// break up the html name by "[]"
821
-		if ( strpos( $this->html_name(), '[' ) !== FALSE ) {
822
-			$before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') );
821
+		if (strpos($this->html_name(), '[') !== FALSE) {
822
+			$before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '['));
823 823
 		} else {
824 824
 			$before_any_brackets = $this->html_name();
825 825
 		}
826 826
 		// grab all of the segments
827
-		preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches);
828
-		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
829
-			$name_parts = $matches[ 1 ];
827
+		preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches);
828
+		if (isset($matches[1]) && is_array($matches[1])) {
829
+			$name_parts = $matches[1];
830 830
 			array_unshift($name_parts, $before_any_brackets);
831
-		}else{
832
-			$name_parts = array( $before_any_brackets );
831
+		} else {
832
+			$name_parts = array($before_any_brackets);
833 833
 		}
834 834
 		// now get the value for the input
835 835
 		$value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data);
836 836
 		// check if this thing's name is at the TOP level of the request data
837
-		if( $value === null && isset( $req_data[ $this->name() ] ) ){
838
-			$value = $req_data[ $this->name() ];
837
+		if ($value === null && isset($req_data[$this->name()])) {
838
+			$value = $req_data[$this->name()];
839 839
 		}
840 840
 		return $value;
841 841
 	}
@@ -848,18 +848,18 @@  discard block
 block discarded – undo
848 848
 	 * @param array $req_data
849 849
 	 * @return array | NULL
850 850
 	 */
851
-	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){
852
-		$first_part_to_consider = array_shift( $html_name_parts );
853
-		if( isset( $req_data[ $first_part_to_consider ] ) ){
854
-			if( empty($html_name_parts ) ){
855
-				return $req_data[ $first_part_to_consider ];
856
-			}else{
851
+	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) {
852
+		$first_part_to_consider = array_shift($html_name_parts);
853
+		if (isset($req_data[$first_part_to_consider])) {
854
+			if (empty($html_name_parts)) {
855
+				return $req_data[$first_part_to_consider];
856
+			} else {
857 857
 				return $this->_find_form_data_for_this_section_using_name_parts(
858 858
 					$html_name_parts,
859
-					$req_data[ $first_part_to_consider ]
859
+					$req_data[$first_part_to_consider]
860 860
 				);
861 861
 			}
862
-		}else{
862
+		} else {
863 863
 			return NULL;
864 864
 		}
865 865
 	}
@@ -873,14 +873,14 @@  discard block
 block discarded – undo
873 873
 	 * @return boolean
874 874
 	 * @throws \EE_Error
875 875
 	 */
876
-	public function form_data_present_in($req_data = NULL){
877
-		if( $req_data === NULL ){
876
+	public function form_data_present_in($req_data = NULL) {
877
+		if ($req_data === NULL) {
878 878
 			$req_data = $_POST;
879 879
 		}
880
-		$checked_value = $this->find_form_data_for_this_section( $req_data );
881
-		if( $checked_value !== null ){
880
+		$checked_value = $this->find_form_data_for_this_section($req_data);
881
+		if ($checked_value !== null) {
882 882
 			return TRUE;
883
-		}else{
883
+		} else {
884 884
 			return FALSE;
885 885
 		}
886 886
 	}
@@ -891,8 +891,8 @@  discard block
 block discarded – undo
891 891
 	 * @param array $form_other_js_data
892 892
 	 * @return array
893 893
 	 */
894
-	public function get_other_js_data( $form_other_js_data = array() ) {
895
-		$form_other_js_data = $this->get_other_js_data_from_strategies( $form_other_js_data );
894
+	public function get_other_js_data($form_other_js_data = array()) {
895
+		$form_other_js_data = $this->get_other_js_data_from_strategies($form_other_js_data);
896 896
 		return $form_other_js_data;
897 897
 	}
898 898
 
@@ -905,10 +905,10 @@  discard block
 block discarded – undo
905 905
 	 * @param array $form_other_js_data
906 906
 	 * @return array
907 907
 	 */
908
-	public function get_other_js_data_from_strategies( $form_other_js_data = array() ) {
909
-		$form_other_js_data = $this->get_display_strategy()->get_other_js_data( $form_other_js_data );
910
-		foreach( $this->get_validation_strategies() as $validation_strategy ) {
911
-			$form_other_js_data = $validation_strategy->get_other_js_data( $form_other_js_data );
908
+	public function get_other_js_data_from_strategies($form_other_js_data = array()) {
909
+		$form_other_js_data = $this->get_display_strategy()->get_other_js_data($form_other_js_data);
910
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
911
+			$form_other_js_data = $validation_strategy->get_other_js_data($form_other_js_data);
912 912
 		}
913 913
 		return $form_other_js_data;
914 914
 	}
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 	 * Override parent because we want to give our strategies an opportunity to enqueue some js and css
918 918
 	 * @return void
919 919
 	 */
920
-	public function enqueue_js(){
920
+	public function enqueue_js() {
921 921
 		//ask our display strategy and validation strategies if they have js to enqueue
922 922
 		$this->enqueue_js_from_strategies();
923 923
 	}
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 	 */
929 929
 	public function enqueue_js_from_strategies() {
930 930
 		$this->get_display_strategy()->enqueue_js();
931
-		foreach( $this->get_validation_strategies() as $validation_strategy ) {
931
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
932 932
 			$validation_strategy->enqueue_js();
933 933
 		}
934 934
 	}
Please login to merge, or discard this patch.
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 1 patch
Spacing   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  * Single Page Checkout (SPCO)
4 4
  *
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 * @return EED_Single_Page_Checkout
48 48
 	 */
49 49
 	public static function instance() {
50
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
51
-		return parent::get_instance( __CLASS__ );
50
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
51
+		return parent::get_instance(__CLASS__);
52 52
 	}
53 53
 
54 54
 
@@ -93,22 +93,22 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public static function set_hooks_admin() {
95 95
 		EED_Single_Page_Checkout::set_definitions();
96
-		if ( defined( 'DOING_AJAX' )) {
96
+		if (defined('DOING_AJAX')) {
97 97
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
98 98
 			ob_start();
99 99
 			EED_Single_Page_Checkout::load_request_handler();
100 100
 			EED_Single_Page_Checkout::load_reg_steps();
101 101
 		} else {
102 102
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
103
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
103
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
104 104
 		}
105 105
 		// set ajax hooks
106
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
107
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
108
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
109
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
110
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
111
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
106
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
107
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
108
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
109
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
110
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
111
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
112 112
 	}
113 113
 
114 114
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 * @param string $ajax_action
120 120
 	 * @throws \EE_Error
121 121
 	 */
122
-	public static function process_ajax_request( $ajax_action ) {
123
-		EE_Registry::instance()->REQ->set( 'action', $ajax_action );
122
+	public static function process_ajax_request($ajax_action) {
123
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
124 124
 		EED_Single_Page_Checkout::instance()->_initialize();
125 125
 	}
126 126
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 * @throws \EE_Error
133 133
 	 */
134 134
 	public static function display_reg_step() {
135
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
135
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
136 136
 	}
137 137
 
138 138
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @throws \EE_Error
144 144
 	 */
145 145
 	public static function process_reg_step() {
146
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
146
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
147 147
 	}
148 148
 
149 149
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @throws \EE_Error
155 155
 	 */
156 156
 	public static function update_reg_step() {
157
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
157
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
158 158
 	}
159 159
 
160 160
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @throws \EE_Error
168 168
 	 */
169 169
 	public static function update_checkout() {
170
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
170
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
171 171
 	}
172 172
 
173 173
 
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public static function load_request_handler() {
182 182
 		// load core Request_Handler class
183
-		if ( ! isset( EE_Registry::instance()->REQ )) {
184
-			EE_Registry::instance()->load_core( 'Request_Handler' );
183
+		if ( ! isset(EE_Registry::instance()->REQ)) {
184
+			EE_Registry::instance()->load_core('Request_Handler');
185 185
 		}
186 186
 	}
187 187
 
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 	 * @throws \EE_Error
196 196
 	 */
197 197
 	public static function set_definitions() {
198
-		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
199
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
200
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
201
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
202
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
203
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
204
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
205
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
198
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
199
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
200
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
201
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
202
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
203
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
204
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
205
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
206 206
 	}
207 207
 
208 208
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	public static function load_reg_steps() {
219 219
 		static $reg_steps_loaded = FALSE;
220
-		if ( $reg_steps_loaded ) {
220
+		if ($reg_steps_loaded) {
221 221
 			return;
222 222
 		}
223 223
 		// filter list of reg_steps
@@ -226,24 +226,24 @@  discard block
 block discarded – undo
226 226
 			EED_Single_Page_Checkout::get_reg_steps()
227 227
 		);
228 228
 		// sort by key (order)
229
-		ksort( $reg_steps_to_load );
229
+		ksort($reg_steps_to_load);
230 230
 		// loop through folders
231
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
231
+		foreach ($reg_steps_to_load as $order => $reg_step) {
232 232
 			// we need a
233
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
233
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
234 234
 				// copy over to the reg_steps_array
235
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
235
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
236 236
 				// register custom key route for each reg step
237 237
 				// ie: step=>"slug" - this is the entire reason we load the reg steps array now
238
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
238
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
239 239
 				// add AJAX or other hooks
240
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
240
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
241 241
 					// setup autoloaders if necessary
242
-					if ( ! class_exists( $reg_step['class_name'] )) {
243
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
242
+					if ( ! class_exists($reg_step['class_name'])) {
243
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
244 244
 					}
245
-					if ( is_callable( $reg_step['class_name'], 'set_hooks' )) {
246
-						call_user_func( array( $reg_step['class_name'], 'set_hooks' ));
245
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
246
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
247 247
 					}
248 248
 				}
249 249
 			}
@@ -262,28 +262,28 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	public static function get_reg_steps() {
264 264
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
265
-		if ( empty( $reg_steps )) {
265
+		if (empty($reg_steps)) {
266 266
 			$reg_steps = array(
267 267
 				10 => array(
268
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
268
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
269 269
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
270 270
 					'slug' => 'attendee_information',
271 271
 					'has_hooks' => FALSE
272 272
 				),
273 273
 				20 => array(
274
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
274
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
275 275
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
276 276
 					'slug' => 'registration_confirmation',
277 277
 					'has_hooks' => FALSE
278 278
 				),
279 279
 				30 => array(
280
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
280
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
281 281
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
282 282
 					'slug' => 'payment_options',
283 283
 					'has_hooks' => TRUE
284 284
 				),
285 285
 				999 => array(
286
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
286
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
287 287
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
288 288
 					'slug' => 'finalize_registration',
289 289
 					'has_hooks' => FALSE
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 	 */
305 305
 	public static function registration_checkout_for_admin() {
306 306
 		EED_Single_Page_Checkout::load_reg_steps();
307
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
308
-		EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' );
309
-		EE_Registry::instance()->REQ->set( 'process_form_submission', false );
307
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
308
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
309
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
310 310
 		EED_Single_Page_Checkout::instance()->_initialize();
311 311
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
312 312
 		return EE_Registry::instance()->REQ->get_output();
@@ -323,15 +323,15 @@  discard block
 block discarded – undo
323 323
 	 */
324 324
 	public static function process_registration_from_admin() {
325 325
 		EED_Single_Page_Checkout::load_reg_steps();
326
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
327
-		EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' );
328
-		EE_Registry::instance()->REQ->set( 'process_form_submission', true );
326
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
327
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
328
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
329 329
 		EED_Single_Page_Checkout::instance()->_initialize();
330
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
331
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
332
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
333
-				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step );
334
-				if ( $final_reg_step->process_reg_step() ) {
330
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
331
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
332
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
333
+				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step);
334
+				if ($final_reg_step->process_reg_step()) {
335 335
 					$final_reg_step->set_completed();
336 336
 					EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array();
337 337
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 	 * @return    void
352 352
 	 * @throws \EE_Error
353 353
 	 */
354
-	public function run( $WP_Query ) {
354
+	public function run($WP_Query) {
355 355
 		if (
356 356
 			$WP_Query instanceof WP_Query
357 357
 			&& $WP_Query->is_main_query()
358
-			&& apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )
358
+			&& apply_filters('FHEE__EED_Single_Page_Checkout__run', true)
359 359
 		) {
360 360
 			$this->_initialize();
361 361
 		}
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @return    void
372 372
 	 * @throws \EE_Error
373 373
 	 */
374
-	public static function init( $WP_Query ) {
375
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
374
+	public static function init($WP_Query) {
375
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
376 376
 	}
377 377
 
378 378
 
@@ -386,34 +386,34 @@  discard block
 block discarded – undo
386 386
 	 */
387 387
 	private function _initialize() {
388 388
 		// ensure SPCO doesn't run twice
389
-		if ( EED_Single_Page_Checkout::$_initialized ) {
389
+		if (EED_Single_Page_Checkout::$_initialized) {
390 390
 			return;
391 391
 		}
392 392
 		try {
393 393
 			// setup the EE_Checkout object
394 394
 			$this->checkout = $this->_initialize_checkout();
395 395
 			// filter checkout
396
-			$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
396
+			$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
397 397
 			// get the $_GET
398 398
 			$this->_get_request_vars();
399 399
 			// filter continue_reg
400
-			$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
400
+			$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
401 401
 			// load the reg steps array
402
-			if ( ! $this->_load_and_instantiate_reg_steps() ) {
402
+			if ( ! $this->_load_and_instantiate_reg_steps()) {
403 403
 				EED_Single_Page_Checkout::$_initialized = true;
404 404
 				return;
405 405
 			}
406 406
 			// set the current step
407
-			$this->checkout->set_current_step( $this->checkout->step );
407
+			$this->checkout->set_current_step($this->checkout->step);
408 408
 			// and the next step
409 409
 			$this->checkout->set_next_step();
410 410
 			// was there already a valid transaction in the checkout from the session ?
411
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
411
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
412 412
 				// get transaction from db or session
413 413
 				$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin()
414 414
 					? $this->_get_transaction_and_cart_for_previous_visit()
415 415
 					: $this->_get_cart_for_current_session_and_setup_new_transaction();
416
-				if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
416
+				if ( ! $this->checkout->transaction instanceof EE_Transaction) {
417 417
 					// add some style and make it dance
418 418
 					$this->checkout->transaction = EE_Transaction::new_instance();
419 419
 					$this->add_styles_and_scripts();
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
 					return;
422 422
 				}
423 423
 				// and the registrations for the transaction
424
-				$this->_get_registrations( $this->checkout->transaction );
424
+				$this->_get_registrations($this->checkout->transaction);
425 425
 			}
426 426
 			// verify that everything has been setup correctly
427
-			if ( ! $this->_final_verifications() ) {
427
+			if ( ! $this->_final_verifications()) {
428 428
 				EED_Single_Page_Checkout::$_initialized = true;
429 429
 				return;
430 430
 			}
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 			// set no cache headers and constants
450 450
 			EE_System::do_not_cache();
451 451
 			// add anchor
452
-			add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
453
-		} catch ( Exception $e ) {
454
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
452
+			add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
453
+		} catch (Exception $e) {
454
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
455 455
 		}
456 456
 	}
457 457
 
@@ -469,20 +469,20 @@  discard block
 block discarded – undo
469 469
 		// look in session for existing checkout
470 470
 		$checkout = EE_Registry::instance()->SSN->checkout();
471 471
 		// verify
472
-		if ( ! $checkout instanceof EE_Checkout ) {
472
+		if ( ! $checkout instanceof EE_Checkout) {
473 473
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
474
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
474
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
475 475
 		} else {
476
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
476
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
477 477
 				$this->unlock_transaction();
478
-				wp_safe_redirect( $checkout->redirect_url );
478
+				wp_safe_redirect($checkout->redirect_url);
479 479
 				exit();
480 480
 			}
481 481
 		}
482
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
482
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
483 483
 		// verify again
484
-		if ( ! $checkout instanceof EE_Checkout ) {
485
-			throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
484
+		if ( ! $checkout instanceof EE_Checkout) {
485
+			throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
486 486
 		}
487 487
 		// reset anything that needs a clean slate for each request
488 488
 		$checkout->reset_for_current_request();
@@ -502,24 +502,24 @@  discard block
 block discarded – undo
502 502
 		// load classes
503 503
 		EED_Single_Page_Checkout::load_request_handler();
504 504
 		//make sure this request is marked as belonging to EE
505
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
505
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
506 506
 		// which step is being requested ?
507
-		$this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() );
507
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
508 508
 		// which step is being edited ?
509
-		$this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' );
509
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
510 510
 		// and what we're doing on the current step
511
-		$this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' );
511
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
512 512
 		// returning to edit ?
513
-		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' );
513
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
514 514
 		// or some other kind of revisit ?
515
-		$this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
515
+		$this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE);
516 516
 		// and whether or not to generate a reg form for this request
517
-		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
517
+		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE 	FALSE
518 518
 		// and whether or not to process a reg form submission for this request
519
-		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
519
+		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE 	FALSE
520 520
 		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step'
521 521
 			? $this->checkout->process_form_submission
522
-			: FALSE; 		// TRUE 	FALSE
522
+			: FALSE; // TRUE 	FALSE
523 523
 		// $this->_display_request_vars();
524 524
 	}
525 525
 
@@ -532,17 +532,17 @@  discard block
 block discarded – undo
532 532
 	 * @return    void
533 533
 	 */
534 534
 	protected function _display_request_vars() {
535
-		if ( ! WP_DEBUG ) {
535
+		if ( ! WP_DEBUG) {
536 536
 			return;
537 537
 		}
538
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
539
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
540
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
541
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
542
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
543
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
544
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
545
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
538
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
539
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
540
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
541
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
542
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
543
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
544
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
545
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
546 546
 	}
547 547
 
548 548
 
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
 	 * @return    array
557 557
 	 */
558 558
 	private function _get_first_step() {
559
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
560
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
559
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
560
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
561 561
 	}
562 562
 
563 563
 
@@ -573,27 +573,27 @@  discard block
 block discarded – undo
573 573
 	private function _load_and_instantiate_reg_steps() {
574 574
 		// have reg_steps already been instantiated ?
575 575
 		if (
576
-			empty( $this->checkout->reg_steps ) ||
577
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
576
+			empty($this->checkout->reg_steps) ||
577
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
578 578
 		) {
579 579
 			// if not, then loop through raw reg steps array
580
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
581
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
580
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
581
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
582 582
 					return false;
583 583
 				}
584 584
 			}
585 585
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
586 586
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
587 587
 			// skip the registration_confirmation page ?
588
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
588
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
589 589
 				// just remove it from the reg steps array
590
-				$this->checkout->remove_reg_step( 'registration_confirmation', false );
590
+				$this->checkout->remove_reg_step('registration_confirmation', false);
591 591
 			} else if (
592
-				isset( $this->checkout->reg_steps['registration_confirmation'] )
592
+				isset($this->checkout->reg_steps['registration_confirmation'])
593 593
 				&& EE_Registry::instance()->CFG->registration->reg_confirmation_last
594 594
 			) {
595 595
 				// set the order to something big like 100
596
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
596
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
597 597
 			}
598 598
 			// filter the array for good luck
599 599
 			$this->checkout->reg_steps = apply_filters(
@@ -603,13 +603,13 @@  discard block
 block discarded – undo
603 603
 			// finally re-sort based on the reg step class order properties
604 604
 			$this->checkout->sort_reg_steps();
605 605
 		} else {
606
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
606
+			foreach ($this->checkout->reg_steps as $reg_step) {
607 607
 				// set all current step stati to FALSE
608
-				$reg_step->set_is_current_step( FALSE );
608
+				$reg_step->set_is_current_step(FALSE);
609 609
 			}
610 610
 		}
611
-		if ( empty( $this->checkout->reg_steps )) {
612
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
611
+		if (empty($this->checkout->reg_steps)) {
612
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
613 613
 			return false;
614 614
 		}
615 615
 			// make reg step details available to JS
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 	 * @param int   $order
628 628
 	 * @return bool
629 629
 	 */
630
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
630
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
631 631
 
632 632
 		// we need a file_path, class_name, and slug to add a reg step
633
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
633
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
634 634
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
635 635
 			if (
636 636
 				$this->checkout->reg_url_link
@@ -648,26 +648,26 @@  discard block
 block discarded – undo
648 648
 				FALSE
649 649
 			);
650 650
 			// did we gets the goods ?
651
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
651
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
652 652
 				// set reg step order based on config
653
-				$reg_step_obj->set_order( $order );
653
+				$reg_step_obj->set_order($order);
654 654
 				// add instantiated reg step object to the master reg steps array
655
-				$this->checkout->add_reg_step( $reg_step_obj );
655
+				$this->checkout->add_reg_step($reg_step_obj);
656 656
 			} else {
657 657
 				EE_Error::add_error(
658
-					__( 'The current step could not be set.', 'event_espresso' ),
658
+					__('The current step could not be set.', 'event_espresso'),
659 659
 					__FILE__, __FUNCTION__, __LINE__
660 660
 				);
661 661
 				return false;
662 662
 			}
663 663
 		} else {
664
-			if ( WP_DEBUG ) {
664
+			if (WP_DEBUG) {
665 665
 				EE_Error::add_error(
666 666
 					sprintf(
667
-						__( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ),
668
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
669
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
670
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
667
+						__('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'),
668
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
669
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
670
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
671 671
 						'<ul>',
672 672
 						'<li>',
673 673
 						'</li>',
@@ -691,16 +691,16 @@  discard block
 block discarded – undo
691 691
 	 */
692 692
 	private function _get_transaction_and_cart_for_previous_visit() {
693 693
 		/** @var $TXN_model EEM_Transaction */
694
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
694
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
695 695
 		// because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
696
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
696
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
697 697
 		// verify transaction
698
-		if ( $transaction instanceof EE_Transaction ) {
698
+		if ($transaction instanceof EE_Transaction) {
699 699
 			// and get the cart that was used for that transaction
700
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
700
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
701 701
 			return $transaction;
702 702
 		} else {
703
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
703
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
704 704
 			return NULL;
705 705
 		}
706 706
 	}
@@ -714,8 +714,8 @@  discard block
 block discarded – undo
714 714
 	 * @param EE_Transaction $transaction
715 715
 	 * @return EE_Cart
716 716
 	 */
717
-	private function _get_cart_for_transaction( $transaction ) {
718
-		return $this->checkout->get_cart_for_transaction( $transaction );
717
+	private function _get_cart_for_transaction($transaction) {
718
+		return $this->checkout->get_cart_for_transaction($transaction);
719 719
 	}
720 720
 
721 721
 
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
 	 * @param EE_Transaction $transaction
728 728
 	 * @return EE_Cart
729 729
 	 */
730
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
731
-		return $this->checkout->get_cart_for_transaction( $transaction );
730
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
731
+		return $this->checkout->get_cart_for_transaction($transaction);
732 732
 	}
733 733
 
734 734
 
@@ -744,17 +744,17 @@  discard block
 block discarded – undo
744 744
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
745 745
 		//  if there's no transaction, then this is the FIRST visit to SPCO
746 746
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
747
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
747
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
748 748
 		// and then create a new transaction
749 749
 		$transaction = $this->_initialize_transaction();
750 750
 		// verify transaction
751
-		if ( $transaction instanceof EE_Transaction ) {
751
+		if ($transaction instanceof EE_Transaction) {
752 752
 			// save it so that we have an ID for other objects to use
753 753
 			$transaction->save();
754 754
 			// and save TXN data to the cart
755
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
755
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
756 756
 		} else {
757
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
757
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
758 758
 		}
759 759
 		return $transaction;
760 760
 	}
@@ -774,15 +774,15 @@  discard block
 block discarded – undo
774 774
 			// grab the cart grand total
775 775
 			$cart_total = $this->checkout->cart->get_cart_grand_total();
776 776
 			// create new TXN
777
-			return EE_Transaction::new_instance( array(
777
+			return EE_Transaction::new_instance(array(
778 778
 				'TXN_timestamp' 	=> time(),
779 779
 				'TXN_reg_steps' 		=> $this->checkout->initialize_txn_reg_steps_array(),
780 780
 				'TXN_total' 				=> $cart_total > 0 ? $cart_total : 0,
781 781
 				'TXN_paid' 				=> 0,
782 782
 				'STS_ID' 					=> EEM_Transaction::failed_status_code,
783 783
 			));
784
-		} catch( Exception $e ) {
785
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
784
+		} catch (Exception $e) {
785
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
786 786
 		}
787 787
 		return NULL;
788 788
 	}
@@ -797,38 +797,38 @@  discard block
 block discarded – undo
797 797
 	 * @return EE_Cart
798 798
 	 * @throws \EE_Error
799 799
 	 */
800
-	private function _get_registrations( EE_Transaction $transaction ) {
800
+	private function _get_registrations(EE_Transaction $transaction) {
801 801
 		// first step: grab the registrants  { : o
802
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
802
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
803 803
 		// verify registrations have been set
804
-		if ( empty( $registrations )) {
804
+		if (empty($registrations)) {
805 805
 			// if no cached registrations, then check the db
806
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
806
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
807 807
 			// still nothing ? well as long as this isn't a revisit
808
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
808
+			if (empty($registrations) && ! $this->checkout->revisit) {
809 809
 				// generate new registrations from scratch
810
-				$registrations = $this->_initialize_registrations( $transaction );
810
+				$registrations = $this->_initialize_registrations($transaction);
811 811
 			}
812 812
 		}
813 813
 		// sort by their original registration order
814
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
814
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
815 815
 		// then loop thru the array
816
-		foreach ( $registrations as $registration ) {
816
+		foreach ($registrations as $registration) {
817 817
 			// verify each registration
818
-			if ( $registration instanceof EE_Registration ) {
818
+			if ($registration instanceof EE_Registration) {
819 819
 				// we display all attendee info for the primary registrant
820
-				if ( $this->checkout->reg_url_link === $registration->reg_url_link()
820
+				if ($this->checkout->reg_url_link === $registration->reg_url_link()
821 821
 				     && $registration->is_primary_registrant()
822 822
 				) {
823 823
 					$this->checkout->primary_revisit = true;
824 824
 					break;
825
-				} else if ( $this->checkout->revisit
825
+				} else if ($this->checkout->revisit
826 826
 				            && $this->checkout->reg_url_link !== $registration->reg_url_link()
827 827
 				) {
828 828
 					// but hide info if it doesn't belong to you
829
-					$transaction->clear_cache( 'Registration', $registration->ID() );
829
+					$transaction->clear_cache('Registration', $registration->ID());
830 830
 				}
831
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
831
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
832 832
 			}
833 833
 		}
834 834
 	}
@@ -843,17 +843,17 @@  discard block
 block discarded – undo
843 843
 	 * @return    array
844 844
 	 * @throws \EE_Error
845 845
 	 */
846
-	private function _initialize_registrations( EE_Transaction $transaction ) {
846
+	private function _initialize_registrations(EE_Transaction $transaction) {
847 847
 		$att_nmbr = 0;
848 848
 		$registrations = array();
849
-		if ( $transaction instanceof EE_Transaction ) {
849
+		if ($transaction instanceof EE_Transaction) {
850 850
 			/** @type EE_Registration_Processor $registration_processor */
851
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
851
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
852 852
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
853 853
 			// now let's add the cart items to the $transaction
854
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
854
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
855 855
 				//do the following for each ticket of this type they selected
856
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
856
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
857 857
 					$att_nmbr++;
858 858
 					$registration = $registration_processor->generate_ONE_registration_from_line_item(
859 859
 						$line_item,
@@ -861,12 +861,12 @@  discard block
 block discarded – undo
861 861
 						$att_nmbr,
862 862
 						$this->checkout->total_ticket_count
863 863
 					);
864
-					if ( $registration instanceof EE_Registration ) {
865
-						$registrations[ $registration->ID() ] = $registration;
864
+					if ($registration instanceof EE_Registration) {
865
+						$registrations[$registration->ID()] = $registration;
866 866
 					}
867 867
 				}
868 868
 			}
869
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
869
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
870 870
 		}
871 871
 		return $registrations;
872 872
 	}
@@ -881,12 +881,12 @@  discard block
 block discarded – undo
881 881
 	 * @param EE_Registration $reg_B
882 882
 	 * @return array()
883 883
 	 */
884
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
884
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
885 885
 		// this shouldn't ever happen within the same TXN, but oh well
886
-		if ( $reg_A->count() === $reg_B->count() ) {
886
+		if ($reg_A->count() === $reg_B->count()) {
887 887
 			return 0;
888 888
 		}
889
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
889
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
890 890
 	}
891 891
 
892 892
 
@@ -901,21 +901,21 @@  discard block
 block discarded – undo
901 901
 	 */
902 902
 	private function _final_verifications() {
903 903
 		// filter checkout
904
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
904
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
905 905
 		//verify that current step is still set correctly
906
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
907
-			EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
906
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
907
+			EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
908 908
 			return false;
909 909
 		}
910 910
 		// if returning to SPCO, then verify that primary registrant is set
911
-		if ( ! empty( $this->checkout->reg_url_link )) {
911
+		if ( ! empty($this->checkout->reg_url_link)) {
912 912
 			$valid_registrant = $this->checkout->transaction->primary_registration();
913
-			if ( ! $valid_registrant instanceof EE_Registration ) {
914
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
913
+			if ( ! $valid_registrant instanceof EE_Registration) {
914
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
915 915
 				return false;
916 916
 			}
917 917
 			$valid_registrant = null;
918
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
918
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
919 919
 				if (
920 920
 					$registration instanceof EE_Registration
921 921
 					&& $registration->reg_url_link() === $this->checkout->reg_url_link
@@ -923,9 +923,9 @@  discard block
 block discarded – undo
923 923
 					$valid_registrant = $registration;
924 924
 				}
925 925
 			}
926
-			if ( ! $valid_registrant instanceof EE_Registration ) {
926
+			if ( ! $valid_registrant instanceof EE_Registration) {
927 927
 				// hmmm... maybe we have the wrong session because the user is opening multiple tabs ?
928
-				if ( EED_Single_Page_Checkout::$_checkout_verified ) {
928
+				if (EED_Single_Page_Checkout::$_checkout_verified) {
929 929
 					// clear the session, mark the checkout as unverified, and try again
930 930
 					EE_Registry::instance()->SSN->clear_session();
931 931
 					EED_Single_Page_Checkout::$_initialized = false;
@@ -934,13 +934,13 @@  discard block
 block discarded – undo
934 934
 					EE_Error::reset_notices();
935 935
 					return false;
936 936
 				}
937
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
937
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
938 938
 				return false;
939 939
 			}
940 940
 		}
941 941
 		// now that things have been kinda sufficiently verified,
942 942
 		// let's add the checkout to the session so that's available other systems
943
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
943
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
944 944
 		return true;
945 945
 	}
946 946
 
@@ -955,28 +955,28 @@  discard block
 block discarded – undo
955 955
 	 * @param bool $reinitializing
956 956
 	 * @throws \EE_Error
957 957
 	 */
958
-	private function _initialize_reg_steps( $reinitializing = false ) {
959
-		$this->checkout->set_reg_step_initiated( $this->checkout->current_step );
958
+	private function _initialize_reg_steps($reinitializing = false) {
959
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
960 960
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
961
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
962
-			if ( ! $reg_step->initialize_reg_step() ) {
961
+		foreach ($this->checkout->reg_steps as $reg_step) {
962
+			if ( ! $reg_step->initialize_reg_step()) {
963 963
 				// if not initialized then maybe this step is being removed...
964
-				if ( ! $reinitializing && $reg_step->is_current_step() ) {
964
+				if ( ! $reinitializing && $reg_step->is_current_step()) {
965 965
 					// if it was the current step, then we need to start over here
966
-					$this->_initialize_reg_steps( true );
966
+					$this->_initialize_reg_steps(true);
967 967
 					return;
968 968
 				}
969 969
 				continue;
970 970
 			}
971 971
 			// i18n
972 972
 			$reg_step->translate_js_strings();
973
-			if ( $reg_step->is_current_step() ) {
973
+			if ($reg_step->is_current_step()) {
974 974
 				// the text that appears on the reg step form submit button
975 975
 				$reg_step->set_submit_button_text();
976 976
 			}
977 977
 		}
978 978
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
979
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
979
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
980 980
 	}
981 981
 
982 982
 
@@ -989,43 +989,43 @@  discard block
 block discarded – undo
989 989
 	 */
990 990
 	private function _check_form_submission() {
991 991
 		//does this request require the reg form to be generated ?
992
-		if ( $this->checkout->generate_reg_form ) {
992
+		if ($this->checkout->generate_reg_form) {
993 993
 			// ever heard that song by Blue Rodeo ?
994 994
 			try {
995 995
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
996 996
 				// if not displaying a form, then check for form submission
997
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
997
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
998 998
 					// clear out any old data in case this step is being run again
999
-					$this->checkout->current_step->set_valid_data( array() );
999
+					$this->checkout->current_step->set_valid_data(array());
1000 1000
 					// capture submitted form data
1001 1001
 					$this->checkout->current_step->reg_form->receive_form_submission(
1002
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout )
1002
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout)
1003 1003
 					);
1004 1004
 					// validate submitted form data
1005
-					if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) {
1005
+					if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) {
1006 1006
 						// thou shall not pass !!!
1007 1007
 						$this->checkout->continue_reg = FALSE;
1008 1008
 						// any form validation errors?
1009
-						if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) {
1009
+						if ($this->checkout->current_step->reg_form->submission_error_message() !== '') {
1010 1010
 							$submission_error_messages = array();
1011 1011
 							// bad, bad, bad registrant
1012
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
1013
-								if ( $validation_error instanceof EE_Validation_Error ) {
1012
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
1013
+								if ($validation_error instanceof EE_Validation_Error) {
1014 1014
 									$submission_error_messages[] = sprintf(
1015
-										__( '%s : %s', 'event_espresso' ),
1015
+										__('%s : %s', 'event_espresso'),
1016 1016
 										$validation_error->get_form_section()->html_label_text(),
1017 1017
 										$validation_error->getMessage()
1018 1018
 									);
1019 1019
 								}
1020 1020
 							}
1021
-							EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1021
+							EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1022 1022
 						}
1023 1023
 						// well not really... what will happen is we'll just get redirected back to redo the current step
1024 1024
 						$this->go_to_next_step();
1025 1025
 						return;
1026 1026
 					}
1027 1027
 				}
1028
-			} catch( EE_Error $e ) {
1028
+			} catch (EE_Error $e) {
1029 1029
 				$e->get_error();
1030 1030
 			}
1031 1031
 		}
@@ -1042,22 +1042,22 @@  discard block
 block discarded – undo
1042 1042
 	 */
1043 1043
 	private function _process_form_action() {
1044 1044
 		// what cha wanna do?
1045
-		switch( $this->checkout->action ) {
1045
+		switch ($this->checkout->action) {
1046 1046
 			// AJAX next step reg form
1047 1047
 			case 'display_spco_reg_step' :
1048 1048
 				$this->checkout->redirect = FALSE;
1049
-				if ( EE_Registry::instance()->REQ->ajax ) {
1050
-					$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
1049
+				if (EE_Registry::instance()->REQ->ajax) {
1050
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
1051 1051
 				}
1052 1052
 				break;
1053 1053
 
1054 1054
 			default :
1055 1055
 				// meh... do one of those other steps first
1056
-				if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
1056
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
1057 1057
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
1058
-					do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1058
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1059 1059
 					// call action on current step
1060
-					if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) {
1060
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
1061 1061
 						// good registrant, you get to proceed
1062 1062
 						if (
1063 1063
 							$this->checkout->current_step->success_message() !== ''
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
 						) {
1069 1069
 								EE_Error::add_success(
1070 1070
 									$this->checkout->current_step->success_message()
1071
-									. '<br />' . $this->checkout->next_step->_instructions()
1071
+									. '<br />'.$this->checkout->next_step->_instructions()
1072 1072
 								);
1073 1073
 
1074 1074
 						}
@@ -1076,12 +1076,12 @@  discard block
 block discarded – undo
1076 1076
 						$this->_setup_redirect();
1077 1077
 					}
1078 1078
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
1079
-					do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1079
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1080 1080
 
1081 1081
 				} else {
1082 1082
 					EE_Error::add_error(
1083 1083
 						sprintf(
1084
-							__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1084
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1085 1085
 							$this->checkout->action,
1086 1086
 							$this->checkout->current_step->name()
1087 1087
 						),
@@ -1107,10 +1107,10 @@  discard block
 block discarded – undo
1107 1107
 	public function add_styles_and_scripts() {
1108 1108
 		// i18n
1109 1109
 		$this->translate_js_strings();
1110
-		if ( $this->checkout->admin_request ) {
1111
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1110
+		if ($this->checkout->admin_request) {
1111
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1112 1112
 		} else {
1113
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1113
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1114 1114
 		}
1115 1115
 	}
1116 1116
 
@@ -1126,42 +1126,42 @@  discard block
 block discarded – undo
1126 1126
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1127 1127
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1128 1128
 		EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1129
-		EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' );
1130
-		EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' );
1131
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' );
1129
+		EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1130
+		EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso');
1131
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso');
1132 1132
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1133 1133
 		EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso');
1134
-		EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' );
1135
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1134
+		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>');
1135
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1136 1136
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1137 1137
 		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1138 1138
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1139
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1140
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1141
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1142
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1143
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1144
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1145
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1146
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1147
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1148
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1149
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1150
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1151
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1152
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1139
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1140
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1141
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1142
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1143
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1144
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1145
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1146
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1147
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1148
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1149
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1150
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1151
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1152
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1153 1153
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1154
-			__( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
1154
+			__('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
1155 1155
 			'<h4 class="important-notice">',
1156 1156
 			'</h4>',
1157 1157
 			'<br />',
1158 1158
 			'<p>',
1159
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1159
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1160 1160
 			'">',
1161 1161
 			'</a>',
1162 1162
 			'</p>'
1163 1163
 		);
1164
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1164
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1165 1165
 	}
1166 1166
 
1167 1167
 
@@ -1174,25 +1174,25 @@  discard block
 block discarded – undo
1174 1174
 	 */
1175 1175
 	public function enqueue_styles_and_scripts() {
1176 1176
 		// load css
1177
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1178
-		wp_enqueue_style( 'single_page_checkout' );
1177
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1178
+		wp_enqueue_style('single_page_checkout');
1179 1179
 		// load JS
1180
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1181
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1182
-		wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE );
1183
-		wp_enqueue_script( 'single_page_checkout' );
1180
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1181
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1182
+		wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE);
1183
+		wp_enqueue_script('single_page_checkout');
1184 1184
 
1185 1185
 		/**
1186 1186
 		 * global action hook for enqueueing styles and scripts with
1187 1187
 		 * spco calls.
1188 1188
 		 */
1189
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1189
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1190 1190
 
1191 1191
 		/**
1192 1192
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1193 1193
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1194 1194
 		 */
1195
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1195
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1196 1196
 
1197 1197
 		// add css and JS for current step
1198 1198
 		$this->checkout->current_step->enqueue_styles_and_scripts();
@@ -1209,19 +1209,19 @@  discard block
 block discarded – undo
1209 1209
 	 */
1210 1210
 	private function _display_spco_reg_form() {
1211 1211
 		// if registering via the admin, just display the reg form for the current step
1212
-		if ( $this->checkout->admin_request ) {
1213
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1212
+		if ($this->checkout->admin_request) {
1213
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1214 1214
 		} else {
1215 1215
 			// add powered by EE msg
1216
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1216
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1217 1217
 
1218
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1218
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1219 1219
 			$cookies_not_set_msg = '';
1220
-			if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1220
+			if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) {
1221 1221
 				$cookies_not_set_msg = apply_filters(
1222 1222
 					'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1223 1223
 					sprintf(
1224
-						__( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ),
1224
+						__('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'),
1225 1225
 						'<div class="ee-attention">',
1226 1226
 						'</div>',
1227 1227
 						'<h6 class="important-notice">',
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 					'layout_strategy' =>
1242 1242
 						new EE_Template_Layout(
1243 1243
 							array(
1244
-								'layout_template_file' 			=> SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1244
+								'layout_template_file' 			=> SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1245 1245
 								'template_args' => array(
1246 1246
 									'empty_cart' 		=> $empty_cart,
1247 1247
 									'revisit' 				=> $this->checkout->revisit,
@@ -1250,8 +1250,8 @@  discard block
 block discarded – undo
1250 1250
 									'empty_msg' 		=> apply_filters(
1251 1251
 										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1252 1252
 										sprintf(
1253
-											__( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ),
1254
-											'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1253
+											__('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'),
1254
+											'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1255 1255
 											'">',
1256 1256
 											'</a>'
1257 1257
 										)
@@ -1259,14 +1259,14 @@  discard block
 block discarded – undo
1259 1259
 									'cookies_not_set_msg' 		=> $cookies_not_set_msg,
1260 1260
 									'registration_time_limit' 	=> $this->checkout->get_registration_time_limit(),
1261 1261
 									'session_expiration' 			=>
1262
-										gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) )
1262
+										gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS))
1263 1263
 							)
1264 1264
 						)
1265 1265
 					)
1266 1266
 				)
1267 1267
 			);
1268 1268
 			// load template and add to output sent that gets filtered into the_content()
1269
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() );
1269
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js());
1270 1270
 		}
1271 1271
 	}
1272 1272
 
@@ -1280,8 +1280,8 @@  discard block
 block discarded – undo
1280 1280
 	 * @internal  param string $label
1281 1281
 	 * @return        string
1282 1282
 	 */
1283
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1284
-		if ( $next_step === 'finalize_registration' ) {
1283
+	public function add_extra_finalize_registration_inputs($next_step) {
1284
+		if ($next_step === 'finalize_registration') {
1285 1285
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1286 1286
 		}
1287 1287
 	}
@@ -1295,18 +1295,18 @@  discard block
 block discarded – undo
1295 1295
 	 *  @return 	string
1296 1296
 	 */
1297 1297
 	public static function display_registration_footer() {
1298
-		if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) {
1299
-			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1300
-			$url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' );
1301
-			$url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1298
+		if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) {
1299
+			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1300
+			$url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/');
1301
+			$url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1302 1302
 			echo apply_filters(
1303 1303
 				'FHEE__EE_Front_Controller__display_registration_footer',
1304 1304
 				sprintf(
1305
-					__( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ),
1306
-					'<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="',
1305
+					__('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'),
1306
+					'<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="',
1307 1307
 					'" target="_blank">',
1308 1308
 					'</a>',
1309
-					'<a href="' . $url . '" title="',
1309
+					'<a href="'.$url.'" title="',
1310 1310
 					'" target="_blank">',
1311 1311
 					'</a></div>'
1312 1312
 				)
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
 	 * @throws \EE_Error
1325 1325
 	 */
1326 1326
 	public function unlock_transaction() {
1327
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1327
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1328 1328
 			$this->checkout->transaction->unlock();
1329 1329
 		}
1330 1330
 	}
@@ -1339,12 +1339,12 @@  discard block
 block discarded – undo
1339 1339
 	 * @return 	array
1340 1340
 	 */
1341 1341
 	private function _setup_redirect() {
1342
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1342
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1343 1343
 			$this->checkout->redirect = TRUE;
1344
-			if ( empty( $this->checkout->redirect_url )) {
1344
+			if (empty($this->checkout->redirect_url)) {
1345 1345
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1346 1346
 			}
1347
-			$this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout );
1347
+			$this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout);
1348 1348
 		}
1349 1349
 	}
1350 1350
 
@@ -1358,9 +1358,9 @@  discard block
 block discarded – undo
1358 1358
 	 * @throws \EE_Error
1359 1359
 	 */
1360 1360
 	public function go_to_next_step() {
1361
-		if ( EE_Registry::instance()->REQ->ajax ) {
1361
+		if (EE_Registry::instance()->REQ->ajax) {
1362 1362
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1363
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1363
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1364 1364
 		}
1365 1365
 		$this->unlock_transaction();
1366 1366
 		// just return for these conditions
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 	 */
1390 1390
 	protected function _handle_json_response() {
1391 1391
 		// if this is an ajax request
1392
-		if ( EE_Registry::instance()->REQ->ajax ) {
1392
+		if (EE_Registry::instance()->REQ->ajax) {
1393 1393
 			// DEBUG LOG
1394 1394
 			//$this->checkout->log(
1395 1395
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
 			$this->checkout->json_response->set_registration_time_limit(
1403 1403
 				$this->checkout->get_registration_time_limit()
1404 1404
 			);
1405
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1405
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1406 1406
 			// just send the ajax (
1407 1407
 			$json_response = apply_filters(
1408 1408
 				'FHEE__EE_Single_Page_Checkout__JSON_response',
@@ -1423,9 +1423,9 @@  discard block
 block discarded – undo
1423 1423
 	 */
1424 1424
 	protected function _handle_html_redirects() {
1425 1425
 		// going somewhere ?
1426
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1426
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1427 1427
 			// store notices in a transient
1428
-			EE_Error::get_notices( false, true, true );
1428
+			EE_Error::get_notices(false, true, true);
1429 1429
 			// DEBUG LOG
1430 1430
 			//$this->checkout->log(
1431 1431
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 			//		'headers_list'    => headers_list(),
1436 1436
 			//	)
1437 1437
 			//);
1438
-			wp_safe_redirect( $this->checkout->redirect_url );
1438
+			wp_safe_redirect($this->checkout->redirect_url);
1439 1439
 			exit();
1440 1440
 		}
1441 1441
 	}
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Select2_Display_Strategy.strategy.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @since 				$VID:$
13 13
  *
14 14
  */
15
-class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy{
15
+class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy {
16 16
 	
17 17
 	/**
18 18
 	 * Arguments that will be passed into the select2 javascript constructor
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param array $select2_js_args pass in the EXACT array of JS arguments you want
26 26
 	 * to pass into the select2 js/html input. See https://select2.github.io
27 27
 	 */
28
-	public function __construct( $select2_js_args = array() ) {
28
+	public function __construct($select2_js_args = array()) {
29 29
 		$this->_select2_js_args = $select2_js_args;
30 30
 		parent::__construct();
31 31
 	}
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 	 * the select2 css
36 36
 	 */
37 37
 	public function enqueue_js() {
38
-		wp_enqueue_script( 'form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true );
39
-		wp_enqueue_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' );
38
+		wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL.'scripts/form_section_select2_init.js', array('select2'), '1.0.0', true);
39
+		wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all');
40 40
 	}
41 41
 	
42 42
 	/**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * Sets the exact js args which will be passed into the select2 js/html input
52 52
 	 * @param array $js_args
53 53
 	 */
54
-	public function set_js_args( $js_args ) {
54
+	public function set_js_args($js_args) {
55 55
 		$this->_select2_js_args = $js_args;
56 56
 	}
57 57
 	
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 	 * @param array $other_js_data
61 61
 	 * @return array
62 62
 	 */
63
-	public function get_other_js_data( $other_js_data = array() ) {
64
-		$other_js_data = parent::get_other_js_data( $other_js_data );
65
-		if( ! isset( $other_js_data[ 'select2s' ] ) ) {
63
+	public function get_other_js_data($other_js_data = array()) {
64
+		$other_js_data = parent::get_other_js_data($other_js_data);
65
+		if ( ! isset($other_js_data['select2s'])) {
66 66
 			$other_js_data['select2s'] = array();
67 67
 		}
68
-		$other_js_data[ 'select2s' ][ $this->_input->html_id() ] = $this->get_js_args();
68
+		$other_js_data['select2s'][$this->_input->html_id()] = $this->get_js_args();
69 69
 		return $other_js_data;
70 70
 	}
71 71
 }
72 72
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Proper.form.php 1 patch
Spacing   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts).
8 8
  * However, you may output the form (usually by calling get_html) anywhere you like.
9 9
  */
10
-class EE_Form_Section_Proper extends EE_Form_Section_Validatable{
10
+class EE_Form_Section_Proper extends EE_Form_Section_Validatable {
11 11
 
12 12
 	/**
13 13
 	 * Subsections
@@ -69,49 +69,49 @@  discard block
 block discarded – undo
69 69
 	 *                               } @see EE_Form_Section_Validatable::__construct()
70 70
 	 * @throws \EE_Error
71 71
 	 */
72
-	public function __construct( $options_array = array() ){
73
-		$options_array = (array) apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this );
72
+	public function __construct($options_array = array()) {
73
+		$options_array = (array) apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this);
74 74
 		//call parent first, as it may be setting the name
75 75
 		parent::__construct($options_array);
76 76
 		//if they've included subsections in the constructor, add them now
77
-		if( isset( $options_array['include'] )){
77
+		if (isset($options_array['include'])) {
78 78
 			//we are going to make sure we ONLY have those subsections to include
79 79
 			//AND we are going to make sure they're in that specified order
80 80
 			$reordered_subsections = array();
81
-			foreach($options_array['include'] as $input_name){
82
-				if(isset($this->_subsections[$input_name])){
81
+			foreach ($options_array['include'] as $input_name) {
82
+				if (isset($this->_subsections[$input_name])) {
83 83
 					$reordered_subsections[$input_name] = $this->_subsections[$input_name];
84 84
 				}
85 85
 			}
86 86
 			$this->_subsections = $reordered_subsections;
87 87
 		}
88
-		if(isset($options_array['exclude'])){
88
+		if (isset($options_array['exclude'])) {
89 89
 			$exclude = $options_array['exclude'];
90 90
 			$this->_subsections = array_diff_key($this->_subsections, array_flip($exclude));
91 91
 		}
92
-		if(isset($options_array['layout_strategy'])){
92
+		if (isset($options_array['layout_strategy'])) {
93 93
 			$this->_layout_strategy = $options_array['layout_strategy'];
94 94
 		}
95
-		if( ! $this->_layout_strategy){
95
+		if ( ! $this->_layout_strategy) {
96 96
 			$this->_layout_strategy = new EE_Two_Column_Layout();
97 97
 		}
98 98
 		$this->_layout_strategy->_construct_finalize($this);
99 99
 
100 100
 		//ok so we are definitely going to want the forms JS,
101 101
 		//so enqueue it or remember to enqueue it during wp_enqueue_scripts
102
-		if( did_action( 'wp_enqueue_scripts' )
103
-			|| did_action( 'admin_enqueue_scripts' ) ) {
102
+		if (did_action('wp_enqueue_scripts')
103
+			|| did_action('admin_enqueue_scripts')) {
104 104
 			//ok so they've constructed this object after when they should have.
105 105
 			//just enqueue the generic form scripts and initialize the form immediately in the JS
106
-			\EE_Form_Section_Proper::wp_enqueue_scripts( true );
106
+			\EE_Form_Section_Proper::wp_enqueue_scripts(true);
107 107
 		} else {
108
-			add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
109
-			add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
108
+			add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
109
+			add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
110 110
 		}
111
-		add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 );
111
+		add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1);
112 112
 
113
-		if( isset( $options_array[ 'name' ] ) ) {
114
-			$this->_construct_finalize( null, $options_array[ 'name' ] );
113
+		if (isset($options_array['name'])) {
114
+			$this->_construct_finalize(null, $options_array['name']);
115 115
 		}
116 116
 	}
117 117
 
@@ -124,25 +124,25 @@  discard block
 block discarded – undo
124 124
 	 * @param string                 $name
125 125
 	 * @throws \EE_Error
126 126
 	 */
127
-	public function _construct_finalize( $parent_form_section, $name ) {
127
+	public function _construct_finalize($parent_form_section, $name) {
128 128
 		parent::_construct_finalize($parent_form_section, $name);
129 129
 		$this->_set_default_name_if_empty();
130 130
 		$this->_set_default_html_id_if_empty();
131
-		foreach( $this->_subsections as $subsection_name => $subsection ){
132
-			if ( $subsection instanceof EE_Form_Section_Base ) {
133
-				$subsection->_construct_finalize( $this, $subsection_name );
131
+		foreach ($this->_subsections as $subsection_name => $subsection) {
132
+			if ($subsection instanceof EE_Form_Section_Base) {
133
+				$subsection->_construct_finalize($this, $subsection_name);
134 134
 			} else {
135 135
 				throw new EE_Error(
136 136
 					sprintf(
137
-						__( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ),
137
+						__('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'),
138 138
 						$subsection_name,
139 139
 						get_class($this),
140
-						$subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' )
140
+						$subsection ? get_class($subsection) : __('NULL', 'event_espresso')
141 141
 					)
142 142
 				);
143 143
 			}
144 144
 		}
145
-		do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name );
145
+		do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name);
146 146
 	}
147 147
 
148 148
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * Gets the layout strategy for this form section
152 152
 	 * @return EE_Form_Section_Layout_Base
153 153
 	 */
154
-	public function get_layout_strategy(){
154
+	public function get_layout_strategy() {
155 155
 		return $this->_layout_strategy;
156 156
 	}
157 157
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param EE_Form_Input_Base $input
164 164
 	 * @return string
165 165
 	 */
166
-	public function get_html_for_input($input){
166
+	public function get_html_for_input($input) {
167 167
 		return $this->_layout_strategy->layout_input($input);
168 168
 	}
169 169
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @param null $form_data
177 177
 	 * @return boolean
178 178
 	 */
179
-	public function was_submitted($form_data = NULL){
179
+	public function was_submitted($form_data = NULL) {
180 180
 		return $this->form_data_present_in($form_data);
181 181
 	}
182 182
 
@@ -201,17 +201,17 @@  discard block
 block discarded – undo
201 201
 	 *                          (eg you validated the data then stored it in the DB) you may want to skip this step.
202 202
 	 * @return void
203 203
 	 */
204
-	public function receive_form_submission($req_data = NULL, $validate = TRUE){
205
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate );
206
-		if( $req_data === NULL){
207
-			$req_data = array_merge( $_GET, $_POST );
204
+	public function receive_form_submission($req_data = NULL, $validate = TRUE) {
205
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate);
206
+		if ($req_data === NULL) {
207
+			$req_data = array_merge($_GET, $_POST);
208 208
 		}
209
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this );
209
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this);
210 210
 		$this->_normalize($req_data);
211
-		if( $validate ){
211
+		if ($validate) {
212 212
 			$this->_validate();
213 213
 		}
214
-		do_action( 'AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate );
214
+		do_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate);
215 215
 	}
216 216
 
217 217
 
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
 	 * the value being an array formatted in teh same way
225 225
 	 * @param array $default_data
226 226
 	 */
227
-	public function populate_defaults($default_data){
228
-		foreach($this->subsections() as $subsection_name => $subsection){
229
-			if(isset($default_data[$subsection_name])){
230
-				if($subsection instanceof EE_Form_Input_Base){
227
+	public function populate_defaults($default_data) {
228
+		foreach ($this->subsections() as $subsection_name => $subsection) {
229
+			if (isset($default_data[$subsection_name])) {
230
+				if ($subsection instanceof EE_Form_Input_Base) {
231 231
 					$subsection->set_default($default_data[$subsection_name]);
232
-				}elseif($subsection instanceof EE_Form_Section_Proper){
232
+				}elseif ($subsection instanceof EE_Form_Section_Proper) {
233 233
 					$subsection->populate_defaults($default_data[$subsection_name]);
234 234
 				}
235 235
 			}
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
 	 * @return EE_Form_Section_Base
252 252
 	 * @throws \EE_Error
253 253
 	 */
254
-	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
255
-		if( $require_construction_to_be_finalized ){
254
+	public function get_subsection($name, $require_construction_to_be_finalized = TRUE) {
255
+		if ($require_construction_to_be_finalized) {
256 256
 			$this->ensure_construct_finalized_called();
257 257
 		}
258 258
 		return isset($this->_subsections[$name]) ? $this->_subsections[$name] : NULL;
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 	 * Gets all the validatable subsections of this form section
265 265
 	 * @return EE_Form_Section_Validatable[]
266 266
 	 */
267
-	public function get_validatable_subsections(){
267
+	public function get_validatable_subsections() {
268 268
 		$validatable_subsections = array();
269
-		foreach($this->subsections() as $name=>$obj){
270
-			if($obj instanceof EE_Form_Section_Validatable){
269
+		foreach ($this->subsections() as $name=>$obj) {
270
+			if ($obj instanceof EE_Form_Section_Validatable) {
271 271
 				$validatable_subsections[$name] = $obj;
272 272
 			}
273 273
 		}
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 	 * @return EE_Form_Input_Base
288 288
 	 * @throws EE_Error
289 289
 	 */
290
-	public function get_input($name, $require_construction_to_be_finalized = TRUE ){
290
+	public function get_input($name, $require_construction_to_be_finalized = TRUE) {
291 291
 		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
292
-		if( ! $subsection instanceof EE_Form_Input_Base){
293
-			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'),$name, get_class($this),$subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
292
+		if ( ! $subsection instanceof EE_Form_Input_Base) {
293
+			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'), $name, get_class($this), $subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
294 294
 		}
295 295
 		return $subsection;
296 296
 	}
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 	 * @return EE_Form_Section_Proper
309 309
 	 * @throws EE_Error
310 310
 	 */
311
-	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){
312
-		$subsection = $this->get_subsection( $name, $require_construction_to_be_finalized );
313
-		if( ! $subsection instanceof EE_Form_Section_Proper){
314
-			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),$name, get_class($this)));
311
+	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) {
312
+		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
313
+		if ( ! $subsection instanceof EE_Form_Section_Proper) {
314
+			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'), $name, get_class($this)));
315 315
 		}
316 316
 		return $subsection;
317 317
 	}
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 * @return mixed depending on the input's type and its normalization strategy
327 327
 	 * @throws \EE_Error
328 328
 	 */
329
-	public function get_input_value($name){
329
+	public function get_input_value($name) {
330 330
 		$input = $this->get_input($name);
331 331
 		return $input->normalized_value();
332 332
 	}
@@ -339,16 +339,16 @@  discard block
 block discarded – undo
339 339
 	 * @return boolean
340 340
 	 */
341 341
 	public function is_valid() {
342
-		if( ! $this->has_received_submission()){
342
+		if ( ! $this->has_received_submission()) {
343 343
 			throw new EE_Error(sprintf(__("You cannot check if a form is valid before receiving the form submission using receive_form_submission", "event_espresso")));
344 344
 		}
345
-		if( ! parent::is_valid()){
345
+		if ( ! parent::is_valid()) {
346 346
 			return false;
347 347
 		}
348 348
 		//ok so no errors general to this entire form section. so let's check the subsections
349
-		foreach( $this->get_validatable_subsections() as $subsection ){
350
-			if( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '' ){
351
-				$this->set_submission_error_message( $subsection->get_validation_error_string() );
349
+		foreach ($this->get_validatable_subsections() as $subsection) {
350
+			if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '') {
351
+				$this->set_submission_error_message($subsection->get_validation_error_string());
352 352
 				return false;
353 353
 			}
354 354
 		}
@@ -361,11 +361,11 @@  discard block
 block discarded – undo
361 361
 	 * gets teh default name of this form section if none is specified
362 362
 	 * @return string
363 363
 	 */
364
-	protected function _set_default_name_if_empty(){
365
-		if( ! $this->_name ){
364
+	protected function _set_default_name_if_empty() {
365
+		if ( ! $this->_name) {
366 366
 			$classname = get_class($this);
367 367
 			$default_name = str_replace("EE_", "", $classname);
368
-			$this->_name =  $default_name;
368
+			$this->_name = $default_name;
369 369
 		}
370 370
 	}
371 371
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 *             and get_html when you are about to display the form.
381 381
 	 * @throws \EE_Error
382 382
 	 */
383
-	public function get_html_and_js(){
383
+	public function get_html_and_js() {
384 384
 		//no doing_it_wrong yet because we ourselves are still doing it wrong...
385 385
 		//and theoretically this CAN be used properly, provided its used during "wp_enqueue_scripts"
386 386
 		$this->enqueue_js();
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 * @return string
396 396
 	 * @throws \EE_Error
397 397
 	 */
398
-	public function get_html(){
398
+	public function get_html() {
399 399
 		$this->ensure_construct_finalized_called();
400 400
 		return $this->_layout_strategy->layout_form();
401 401
 	}
@@ -408,9 +408,9 @@  discard block
 block discarded – undo
408 408
 	 * @return string
409 409
 	 * @throws \EE_Error
410 410
 	 */
411
-	public function enqueue_js(){
411
+	public function enqueue_js() {
412 412
 		$this->_enqueue_and_localize_form_js();
413
-		foreach( $this->subsections() as $subsection ) {
413
+		foreach ($this->subsections() as $subsection) {
414 414
 			$subsection->enqueue_js();
415 415
 		}
416 416
 	}
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 	 * @param boolean $init_form_validation_automatically whether or not we want the form validation to be triggered automatically or not
428 428
 	 * @return void
429 429
 	 */
430
-	public static function wp_enqueue_scripts( $init_form_validation_automatically = true ){
431
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
432
-		wp_register_script( 'ee_form_section_validation', EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js', array( 'jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods' ), EVENT_ESPRESSO_VERSION, TRUE );
433
-		wp_localize_script( 'ee_form_section_validation', 'ee_form_section_validation_init', array( 'init' => $init_form_validation_automatically ? true : false ) );
430
+	public static function wp_enqueue_scripts($init_form_validation_automatically = true) {
431
+		add_filter('FHEE_load_jquery_validate', '__return_true');
432
+		wp_register_script('ee_form_section_validation', EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js', array('jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods'), EVENT_ESPRESSO_VERSION, TRUE);
433
+		wp_localize_script('ee_form_section_validation', 'ee_form_section_validation_init', array('init' => $init_form_validation_automatically ? true : false));
434 434
 	}
435 435
 
436 436
 
@@ -442,14 +442,14 @@  discard block
 block discarded – undo
442 442
 	 *
443 443
 	 * @throws \EE_Error
444 444
 	 */
445
-	public function _enqueue_and_localize_form_js(){
445
+	public function _enqueue_and_localize_form_js() {
446 446
 		$this->ensure_construct_finalized_called();
447 447
 		//actually, we don't want to localize just yet. There may be other forms on the page.
448 448
 		//so we need to add our form section data to a static variable accessible by all form sections
449 449
 		//and localize it just before the footer
450 450
 		$this->localize_validation_rules();
451
-		add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 );
452
-		add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) );
451
+		add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2);
452
+		add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'));
453 453
 	}
454 454
 
455 455
 
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
 	 * @return void
462 462
 	 * @throws \EE_Error
463 463
 	 */
464
-	public function localize_validation_rules( $return_for_subsection = FALSE ){
464
+	public function localize_validation_rules($return_for_subsection = FALSE) {
465 465
 		// we only want to localize vars ONCE for the entire form, so if the form section doesn't have a parent, then it must be the top dog
466
-		if ( $return_for_subsection || ! $this->parent_section() ) {
467
-			EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array(
468
-				'form_section_id'=> $this->html_id( TRUE ),
466
+		if ($return_for_subsection || ! $this->parent_section()) {
467
+			EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array(
468
+				'form_section_id'=> $this->html_id(TRUE),
469 469
 				'validation_rules'=> $this->get_jquery_validation_rules(),
470 470
 				'other_data' => $this->get_other_js_data(),
471 471
 				'errors'=> $this->subsection_validation_errors_by_html_name()
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
 	 * @param array $form_other_js_data
482 482
 	 * @return array
483 483
 	 */
484
-	public function get_other_js_data( $form_other_js_data = array() ) {
485
-		foreach( $this->subsections() as $subsection ) {
486
-			$form_other_js_data = $subsection->get_other_js_data( $form_other_js_data );
484
+	public function get_other_js_data($form_other_js_data = array()) {
485
+		foreach ($this->subsections() as $subsection) {
486
+			$form_other_js_data = $subsection->get_other_js_data($form_other_js_data);
487 487
 		}
488 488
 		return $form_other_js_data;
489 489
 	}
@@ -494,12 +494,12 @@  discard block
 block discarded – undo
494 494
 	 * Keys are their form names, and values are the inputs themselves
495 495
 	 * @return EE_Form_Input_Base
496 496
 	 */
497
-	public function inputs_in_subsections(){
497
+	public function inputs_in_subsections() {
498 498
 		$inputs = array();
499
-		foreach($this->subsections() as $subsection){
500
-			if( $subsection instanceof EE_Form_Input_Base ){
501
-				$inputs[ $subsection->html_name() ] = $subsection;
502
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
499
+		foreach ($this->subsections() as $subsection) {
500
+			if ($subsection instanceof EE_Form_Input_Base) {
501
+				$inputs[$subsection->html_name()] = $subsection;
502
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
503 503
 				$inputs += $subsection->inputs_in_subsections();
504 504
 			}
505 505
 		}
@@ -512,12 +512,12 @@  discard block
 block discarded – undo
512 512
 	 * and values are a string of all their validation errors
513 513
 	 * @return string[]
514 514
 	 */
515
-	public function subsection_validation_errors_by_html_name(){
515
+	public function subsection_validation_errors_by_html_name() {
516 516
 		$inputs = $this->inputs();
517 517
 		$errors = array();
518
-		foreach( $inputs as $form_input ){
519
-			if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){
520
-				$errors[ $form_input->html_name() ] = $form_input->get_validation_error_string();
518
+		foreach ($inputs as $form_input) {
519
+			if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) {
520
+				$errors[$form_input->html_name()] = $form_input->get_validation_error_string();
521 521
 			}
522 522
 		}
523 523
 		return $errors;
@@ -529,16 +529,16 @@  discard block
 block discarded – undo
529 529
 	 * passes all the form data required by the JS to the JS, and enqueues the few required JS files.
530 530
 	 * Should be setup by each form during the _enqueues_and_localize_form_js
531 531
 	 */
532
-	public static function localize_script_for_all_forms(){
532
+	public static function localize_script_for_all_forms() {
533 533
 		//allow inputs and stuff to hook in their JS and stuff here
534 534
 		do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin');
535 535
 		EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages();
536
-		$email_validation_level = isset( EE_Registry::instance()->CFG->registration->email_validation_level )
536
+		$email_validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level)
537 537
 			? EE_Registry::instance()->CFG->registration->email_validation_level
538 538
 			: 'wp_default';
539 539
 		EE_Form_Section_Proper::$_js_localization['email_validation_level'] = $email_validation_level;
540
-		wp_enqueue_script( 'ee_form_section_validation' );
541
-		wp_localize_script( 'ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization );
540
+		wp_enqueue_script('ee_form_section_validation');
541
+		wp_localize_script('ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization);
542 542
 	}
543 543
 
544 544
 
@@ -546,8 +546,8 @@  discard block
 block discarded – undo
546 546
 	/**
547 547
 	 * ensure_scripts_localized
548 548
 	 */
549
-	public function ensure_scripts_localized(){
550
-		if ( ! EE_Form_Section_Proper::$_scripts_localized ) {
549
+	public function ensure_scripts_localized() {
550
+		if ( ! EE_Form_Section_Proper::$_scripts_localized) {
551 551
 			$this->_enqueue_and_localize_form_js();
552 552
 		}
553 553
 	}
@@ -559,10 +559,10 @@  discard block
 block discarded – undo
559 559
 	 * is that the key here should be the same as the custom validation rule put in the JS file
560 560
 	 * @return array keys are custom validation rules, and values are internationalized strings
561 561
 	 */
562
-	private static function _get_localized_error_messages(){
562
+	private static function _get_localized_error_messages() {
563 563
 		return array(
564 564
 			'validUrl'=>  __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"),
565
-			'regex' => __( 'Please check your input', 'event_espresso' ),
565
+			'regex' => __('Please check your input', 'event_espresso'),
566 566
 		);
567 567
 	}
568 568
 
@@ -590,10 +590,10 @@  discard block
 block discarded – undo
590 590
 	 * Gets the JS to put inside the jquery validation rules for subsection of this form section. See parent function for more...
591 591
 	 * @return array
592 592
 	 */
593
-	public function get_jquery_validation_rules(){
593
+	public function get_jquery_validation_rules() {
594 594
 		$jquery_validation_rules = array();
595
-		foreach($this->get_validatable_subsections() as $subsection){
596
-			$jquery_validation_rules = array_merge( $jquery_validation_rules,  $subsection->get_jquery_validation_rules() );
595
+		foreach ($this->get_validatable_subsections() as $subsection) {
596
+			$jquery_validation_rules = array_merge($jquery_validation_rules, $subsection->get_jquery_validation_rules());
597 597
 		}
598 598
 		return $jquery_validation_rules;
599 599
 	}
@@ -608,11 +608,11 @@  discard block
 block discarded – undo
608 608
 	protected function _normalize($req_data) {
609 609
 		$this->_received_submission = TRUE;
610 610
 		$this->_validation_errors = array();
611
-		foreach($this->get_validatable_subsections() as $subsection){
612
-			try{
611
+		foreach ($this->get_validatable_subsections() as $subsection) {
612
+			try {
613 613
 				$subsection->_normalize($req_data);
614
-			}catch( EE_Validation_Error $e ){
615
-				$subsection->add_validation_error( $e );
614
+			} catch (EE_Validation_Error $e) {
615
+				$subsection->add_validation_error($e);
616 616
 			}
617 617
 		}
618 618
 	}
@@ -626,9 +626,9 @@  discard block
 block discarded – undo
626 626
 	 * calling parent::_validate() first.
627 627
 	 */
628 628
 	protected function _validate() {
629
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
630
-			if(method_exists($this,'_validate_'.$subsection_name)){
631
-				call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
629
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
630
+			if (method_exists($this, '_validate_'.$subsection_name)) {
631
+				call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
632 632
 			}
633 633
 			$subsection->_validate();
634 634
 		}
@@ -640,13 +640,13 @@  discard block
 block discarded – undo
640 640
 	 * Gets all the validated inputs for the form section
641 641
 	 * @return array
642 642
 	 */
643
-	public function valid_data(){
643
+	public function valid_data() {
644 644
 		$inputs = array();
645
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
646
-			if ( $subsection instanceof EE_Form_Section_Proper ) {
647
-				$inputs[ $subsection_name ] = $subsection->valid_data();
648
-			} else if ( $subsection instanceof EE_Form_Input_Base ){
649
-				$inputs[ $subsection_name ] = $subsection->normalized_value();
645
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
646
+			if ($subsection instanceof EE_Form_Section_Proper) {
647
+				$inputs[$subsection_name] = $subsection->valid_data();
648
+			} else if ($subsection instanceof EE_Form_Input_Base) {
649
+				$inputs[$subsection_name] = $subsection->normalized_value();
650 650
 			}
651 651
 		}
652 652
 		return $inputs;
@@ -658,11 +658,11 @@  discard block
 block discarded – undo
658 658
 	 * Gets all the inputs on this form section
659 659
 	 * @return EE_Form_Input_Base[]
660 660
 	 */
661
-	public function inputs(){
661
+	public function inputs() {
662 662
 		$inputs = array();
663
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
664
-			if ( $subsection instanceof EE_Form_Input_Base ){
665
-				$inputs[ $subsection_name ] = $subsection;
663
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
664
+			if ($subsection instanceof EE_Form_Input_Base) {
665
+				$inputs[$subsection_name] = $subsection;
666 666
 			}
667 667
 		}
668 668
 		return $inputs;
@@ -674,10 +674,10 @@  discard block
 block discarded – undo
674 674
 	 * Gets all the subsections which are a proper form
675 675
 	 * @return EE_Form_Section_Proper[]
676 676
 	 */
677
-	public function subforms(){
677
+	public function subforms() {
678 678
 		$form_sections = array();
679
-		foreach($this->subsections() as $name=>$obj){
680
-			if($obj instanceof EE_Form_Section_Proper){
679
+		foreach ($this->subsections() as $name=>$obj) {
680
+			if ($obj instanceof EE_Form_Section_Proper) {
681 681
 				$form_sections[$name] = $obj;
682 682
 			}
683 683
 		}
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 	 * if you only want form inputs or proper form sections.
693 693
 	 * @return EE_Form_Section_Proper[]
694 694
 	 */
695
-	public function subsections(){
695
+	public function subsections() {
696 696
 		$this->ensure_construct_finalized_called();
697 697
 		return $this->_subsections;
698 698
 	}
@@ -710,8 +710,8 @@  discard block
 block discarded – undo
710 710
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
711 711
 	 * input's normalized value, or an array like the top-level array
712 712
 	 */
713
-	public function input_values( $include_subform_inputs = false, $flatten = false ){
714
-		return $this->_input_values( false, $include_subform_inputs, $flatten );
713
+	public function input_values($include_subform_inputs = false, $flatten = false) {
714
+		return $this->_input_values(false, $include_subform_inputs, $flatten);
715 715
 	}
716 716
 
717 717
 	/**
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
728 728
 	 * input's normalized value, or an array like the top-level array
729 729
 	 */
730
-	public function input_pretty_values(  $include_subform_inputs = false, $flatten = false ){
731
-		return $this->_input_values( true, $include_subform_inputs, $flatten );
730
+	public function input_pretty_values($include_subform_inputs = false, $flatten = false) {
731
+		return $this->_input_values(true, $include_subform_inputs, $flatten);
732 732
 	}
733 733
 
734 734
 	/**
@@ -741,17 +741,17 @@  discard block
 block discarded – undo
741 741
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
742 742
 	 * input's normalized value, or an array like the top-level array
743 743
 	 */
744
-	public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) {
744
+	public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) {
745 745
 		$input_values = array();
746
-		foreach( $this->subsections() as $subsection_name => $subsection ) {
747
-			if( $subsection instanceof EE_Form_Input_Base ) {
748
-				$input_values[ $subsection_name ] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
749
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) {
750
-				$subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten );
751
-				if( $flatten ) {
752
-					$input_values = array_merge( $input_values, $subform_input_values );
746
+		foreach ($this->subsections() as $subsection_name => $subsection) {
747
+			if ($subsection instanceof EE_Form_Input_Base) {
748
+				$input_values[$subsection_name] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
749
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) {
750
+				$subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten);
751
+				if ($flatten) {
752
+					$input_values = array_merge($input_values, $subform_input_values);
753 753
 				} else {
754
-					$input_values[ $subsection_name ] = $subform_input_values;
754
+					$input_values[$subsection_name] = $subform_input_values;
755 755
 				}
756 756
 			}
757 757
 		}
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 	 * @return boolean
768 768
 	 * @throws \EE_Error
769 769
 	 */
770
-	public function has_received_submission(){
770
+	public function has_received_submission() {
771 771
 		$this->ensure_construct_finalized_called();
772 772
 		return $this->_received_submission;
773 773
 	}
@@ -780,8 +780,8 @@  discard block
 block discarded – undo
780 780
 	 * @param array $inputs_to_exclude values are the input names
781 781
 	 * @return void
782 782
 	 */
783
-	public function exclude($inputs_to_exclude = array()){
784
-		foreach($inputs_to_exclude as $input_to_exclude_name){
783
+	public function exclude($inputs_to_exclude = array()) {
784
+		foreach ($inputs_to_exclude as $input_to_exclude_name) {
785 785
 			unset($this->_subsections[$input_to_exclude_name]);
786 786
 		}
787 787
 	}
@@ -792,8 +792,8 @@  discard block
 block discarded – undo
792 792
 	 * @param array $inputs_to_hide
793 793
 	 * @throws \EE_Error
794 794
 	 */
795
-	public function hide($inputs_to_hide= array()){
796
-		foreach($inputs_to_hide as $input_to_hide){
795
+	public function hide($inputs_to_hide = array()) {
796
+		foreach ($inputs_to_hide as $input_to_hide) {
797 797
 			$input = $this->get_input($input_to_hide);
798 798
 
799 799
 			$input->set_display_strategy(new EE_Hidden_Display_Strategy());
@@ -818,13 +818,13 @@  discard block
 block discarded – undo
818 818
 	 * @return void
819 819
 	 * @throws \EE_Error
820 820
 	 */
821
-	public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){
822
-		foreach($new_subsections as $subsection_name => $subsection){
823
-			if( ! $subsection instanceof EE_Form_Section_Base){
821
+	public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) {
822
+		foreach ($new_subsections as $subsection_name => $subsection) {
823
+			if ( ! $subsection instanceof EE_Form_Section_Base) {
824 824
 				EE_Error::add_error(
825 825
 					sprintf(
826 826
 						__("Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.", "event_espresso"),
827
-						get_class( $subsection ),
827
+						get_class($subsection),
828 828
 						$subsection_name,
829 829
 						$this->name()
830 830
 					)
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 			}
834 834
 		}
835 835
 
836
-		$this->_subsections = EEH_Array::insert_into_array( $this->_subsections, $new_subsections, $subsection_name_to_target, $add_before );
836
+		$this->_subsections = EEH_Array::insert_into_array($this->_subsections, $new_subsections, $subsection_name_to_target, $add_before);
837 837
 
838 838
 		/*$subsections_before = array();
839 839
 		if( $subsection_name_to_target ){
@@ -864,8 +864,8 @@  discard block
 block discarded – undo
864 864
 				$this->_subsections = $new_subsections;
865 865
 			}
866 866
 		}*/
867
-		if( $this->_construction_finalized ){
868
-			foreach($this->_subsections as $name => $subsection){
867
+		if ($this->_construction_finalized) {
868
+			foreach ($this->_subsections as $name => $subsection) {
869 869
 				$subsection->_construct_finalize($this, $name);
870 870
 			}
871 871
 		}
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 	/**
877 877
 	 * Just gets all validatable subsections to clean their sensitive data
878 878
 	 */
879
-	public function clean_sensitive_data(){
880
-		foreach($this->get_validatable_subsections() as $subsection){
879
+	public function clean_sensitive_data() {
880
+		foreach ($this->get_validatable_subsections() as $subsection) {
881 881
 			$subsection->clean_sensitive_data();
882 882
 		}
883 883
 	}
@@ -887,8 +887,8 @@  discard block
 block discarded – undo
887 887
 	/**
888 888
 	 * @param string $form_submission_error_message
889 889
 	 */
890
-	public function set_submission_error_message( $form_submission_error_message = '' ) {
891
-		$this->_form_submission_error_message .= ! empty( $form_submission_error_message ) ? $form_submission_error_message : __( 'Form submission failed due to errors', 'event_espresso' );
890
+	public function set_submission_error_message($form_submission_error_message = '') {
891
+		$this->_form_submission_error_message .= ! empty($form_submission_error_message) ? $form_submission_error_message : __('Form submission failed due to errors', 'event_espresso');
892 892
 	}
893 893
 
894 894
 
@@ -905,8 +905,8 @@  discard block
 block discarded – undo
905 905
 	/**
906 906
 	 * @param string $form_submission_success_message
907 907
 	 */
908
-	public function set_submission_success_message( $form_submission_success_message ) {
909
-		$this->_form_submission_success_message .= ! empty( $form_submission_success_message ) ? $form_submission_success_message : __( 'Form submitted successfully', 'event_espresso' );
908
+	public function set_submission_success_message($form_submission_success_message) {
909
+		$this->_form_submission_success_message .= ! empty($form_submission_success_message) ? $form_submission_success_message : __('Form submitted successfully', 'event_espresso');
910 910
 	}
911 911
 
912 912
 
@@ -929,10 +929,10 @@  discard block
 block discarded – undo
929 929
 	 * @return string
930 930
 	 * @throws \EE_Error
931 931
 	 */
932
-	public function html_name_prefix(){
933
-		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
934
-			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
935
-		}else{
932
+	public function html_name_prefix() {
933
+		if ($this->parent_section() instanceof EE_Form_Section_Proper) {
934
+			return $this->parent_section()->html_name_prefix().'['.$this->name().']';
935
+		} else {
936 936
 			return $this->name();
937 937
 		}
938 938
 	}
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 	 * @return string
948 948
 	 * @throws \EE_Error
949 949
 	 */
950
-	public function name(){
950
+	public function name() {
951 951
 		$this->ensure_construct_finalized_called();
952 952
 		return parent::name();
953 953
 	}
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 	 * @return EE_Form_Section_Proper
959 959
 	 * @throws \EE_Error
960 960
 	 */
961
-	public function parent_section(){
961
+	public function parent_section() {
962 962
 		$this->ensure_construct_finalized_called();
963 963
 		return parent::parent_section();
964 964
 	}
@@ -971,9 +971,9 @@  discard block
 block discarded – undo
971 971
 	 * @return void
972 972
 	 * @throws \EE_Error
973 973
 	 */
974
-	public function ensure_construct_finalized_called(){
975
-		if( ! $this->_construction_finalized ){
976
-			$this->_construct_finalize($this->_parent_section, $this->_name );
974
+	public function ensure_construct_finalized_called() {
975
+		if ( ! $this->_construction_finalized) {
976
+			$this->_construct_finalize($this->_parent_section, $this->_name);
977 977
 		}
978 978
 	}
979 979
 
@@ -985,17 +985,17 @@  discard block
 block discarded – undo
985 985
 	 * @param array $req_data
986 986
 	 * @return boolean
987 987
 	 */
988
-	public function form_data_present_in( $req_data = NULL ) {
989
-		if( $req_data === NULL){
988
+	public function form_data_present_in($req_data = NULL) {
989
+		if ($req_data === NULL) {
990 990
 			$req_data = $_POST;
991 991
 		}
992
-		foreach( $this->subsections() as $subsection ) {
993
-			if($subsection instanceof EE_Form_Input_Base ) {
994
-				if( $subsection->form_data_present_in( $req_data ) ) {
992
+		foreach ($this->subsections() as $subsection) {
993
+			if ($subsection instanceof EE_Form_Input_Base) {
994
+				if ($subsection->form_data_present_in($req_data)) {
995 995
 					return TRUE;
996 996
 				}
997
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
998
-				if( $subsection->form_data_present_in( $req_data ) ) {
997
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
998
+				if ($subsection->form_data_present_in($req_data)) {
999 999
 					return TRUE;
1000 1000
 				}
1001 1001
 			}
@@ -1012,14 +1012,14 @@  discard block
 block discarded – undo
1012 1012
 	 */
1013 1013
 	public function get_validation_errors_accumulated() {
1014 1014
 		$validation_errors = $this->get_validation_errors();
1015
-		foreach($this->get_validatable_subsections() as $subsection ) {
1016
-			if( $subsection instanceof EE_Form_Section_Proper ) {
1015
+		foreach ($this->get_validatable_subsections() as $subsection) {
1016
+			if ($subsection instanceof EE_Form_Section_Proper) {
1017 1017
 				$validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated();
1018 1018
 			} else {
1019
-				$validation_errors_on_this_subsection =  $subsection->get_validation_errors();
1019
+				$validation_errors_on_this_subsection = $subsection->get_validation_errors();
1020 1020
 			}
1021
-			if( $validation_errors_on_this_subsection ){
1022
-				$validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection );
1021
+			if ($validation_errors_on_this_subsection) {
1022
+				$validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection);
1023 1023
 			}
1024 1024
 		}
1025 1025
 		return $validation_errors;
@@ -1041,24 +1041,24 @@  discard block
 block discarded – undo
1041 1041
 	 * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false
1042 1042
 	 * @return EE_Form_Section_Base
1043 1043
 	 */
1044
-	public function find_section_from_path( $form_section_path ) {
1044
+	public function find_section_from_path($form_section_path) {
1045 1045
 		//check if we can find the input from purely going straight up the tree
1046
-		$input = parent::find_section_from_path( $form_section_path );
1047
-		if( $input instanceof EE_Form_Section_Base ) {
1046
+		$input = parent::find_section_from_path($form_section_path);
1047
+		if ($input instanceof EE_Form_Section_Base) {
1048 1048
 			return $input;
1049 1049
 		}
1050 1050
 
1051
-		$next_slash_pos = strpos( $form_section_path, '/' );
1052
-		if( $next_slash_pos !== false ) {
1053
-			$child_section_name = substr( $form_section_path, 0, $next_slash_pos );
1054
-			$subpath = substr( $form_section_path, $next_slash_pos + 1 );
1051
+		$next_slash_pos = strpos($form_section_path, '/');
1052
+		if ($next_slash_pos !== false) {
1053
+			$child_section_name = substr($form_section_path, 0, $next_slash_pos);
1054
+			$subpath = substr($form_section_path, $next_slash_pos + 1);
1055 1055
 		} else {
1056 1056
 			$child_section_name = $form_section_path;
1057 1057
 			$subpath = '';
1058 1058
 		}
1059
-		$child_section =  $this->get_subsection( $child_section_name );
1060
-		if ( $child_section instanceof EE_Form_Section_Base ) {
1061
-			return $child_section->find_section_from_path( $subpath );
1059
+		$child_section = $this->get_subsection($child_section_name);
1060
+		if ($child_section instanceof EE_Form_Section_Base) {
1061
+			return $child_section->find_section_from_path($subpath);
1062 1062
 		} else {
1063 1063
 			return null;
1064 1064
 		}
Please login to merge, or discard this patch.
core/EE_Registry.core.php 1 patch
Spacing   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 * @param  \EE_Dependency_Map $dependency_map
179 179
 	 * @return \EE_Registry instance
180 180
 	 */
181
-	public static function instance( \EE_Dependency_Map $dependency_map = null ) {
181
+	public static function instance(\EE_Dependency_Map $dependency_map = null) {
182 182
 		// check if class object is instantiated
183
-		if ( ! self::$_instance instanceof EE_Registry ) {
184
-			self::$_instance = new EE_Registry( $dependency_map );
183
+		if ( ! self::$_instance instanceof EE_Registry) {
184
+			self::$_instance = new EE_Registry($dependency_map);
185 185
 		}
186 186
 		return self::$_instance;
187 187
 	}
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 	 * @param  \EE_Dependency_Map $dependency_map
197 197
 	 * @return \EE_Registry
198 198
 	 */
199
-	protected function __construct( \EE_Dependency_Map $dependency_map ) {
199
+	protected function __construct(\EE_Dependency_Map $dependency_map) {
200 200
 		$this->_dependency_map = $dependency_map;
201
-		add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) );
201
+		add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize'));
202 202
 	}
203 203
 
204 204
 
@@ -225,19 +225,19 @@  discard block
 block discarded – undo
225 225
 		$this->modules = new StdClass();
226 226
 		$this->shortcodes = new StdClass();
227 227
 		$this->widgets = new StdClass();
228
-		$this->load_core( 'Base', array(), true );
228
+		$this->load_core('Base', array(), true);
229 229
 		// add our request and response objects to the cache
230
-		$request_loader = $this->_dependency_map->class_loader( 'EE_Request' );
230
+		$request_loader = $this->_dependency_map->class_loader('EE_Request');
231 231
 		$this->_set_cached_class(
232 232
 			$request_loader(),
233 233
 			'EE_Request'
234 234
 		);
235
-		$response_loader = $this->_dependency_map->class_loader( 'EE_Response' );
235
+		$response_loader = $this->_dependency_map->class_loader('EE_Response');
236 236
 		$this->_set_cached_class(
237 237
 			$response_loader(),
238 238
 			'EE_Response'
239 239
 		);
240
-		add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' ) );
240
+		add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init'));
241 241
 	}
242 242
 
243 243
 
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function init() {
252 252
 		// Get current page protocol
253
-		$protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://';
253
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
254 254
 		// Output admin-ajax.php URL with same protocol as current page
255
-		self::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php', $protocol );
256
-		self::$i18n_js_strings[ 'wp_debug' ] = defined( 'WP_DEBUG' ) ? WP_DEBUG : false;
255
+		self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol);
256
+		self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : false;
257 257
 	}
258 258
 
259 259
 
@@ -264,14 +264,14 @@  discard block
 block discarded – undo
264 264
 	 * @return string
265 265
 	 */
266 266
 	public static function localize_i18n_js_strings() {
267
-		$i18n_js_strings = (array)EE_Registry::$i18n_js_strings;
268
-		foreach ( $i18n_js_strings as $key => $value ) {
269
-			if ( is_scalar( $value ) ) {
270
-				$i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' );
267
+		$i18n_js_strings = (array) EE_Registry::$i18n_js_strings;
268
+		foreach ($i18n_js_strings as $key => $value) {
269
+			if (is_scalar($value)) {
270
+				$i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
271 271
 			}
272 272
 		}
273 273
 
274
-		return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */';
274
+		return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */';
275 275
 	}
276 276
 
277 277
 
@@ -279,15 +279,15 @@  discard block
 block discarded – undo
279 279
 	/**
280 280
 	 * @param mixed string | EED_Module $module
281 281
 	 */
282
-	public function add_module( $module ) {
283
-		if ( $module instanceof EED_Module ) {
284
-			$module_class = get_class( $module );
282
+	public function add_module($module) {
283
+		if ($module instanceof EED_Module) {
284
+			$module_class = get_class($module);
285 285
 			$this->modules->{$module_class} = $module;
286 286
 		} else {
287
-			if ( ! class_exists( 'EE_Module_Request_Router' ) ) {
288
-				$this->load_core( 'Module_Request_Router' );
287
+			if ( ! class_exists('EE_Module_Request_Router')) {
288
+				$this->load_core('Module_Request_Router');
289 289
 			}
290
-			$this->modules->{$module} = EE_Module_Request_Router::module_factory( $module );
290
+			$this->modules->{$module} = EE_Module_Request_Router::module_factory($module);
291 291
 		}
292 292
 	}
293 293
 
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * @param string $module_name
298 298
 	 * @return mixed EED_Module | NULL
299 299
 	 */
300
-	public function get_module( $module_name = '' ) {
301
-		return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : null;
300
+	public function get_module($module_name = '') {
301
+		return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : null;
302 302
 	}
303 303
 
304 304
 
@@ -312,20 +312,20 @@  discard block
 block discarded – undo
312 312
 	 * @param bool $load_only
313 313
 	 * @return mixed
314 314
 	 */
315
-	public function load_core( $class_name, $arguments = array(), $load_only = false ) {
315
+	public function load_core($class_name, $arguments = array(), $load_only = false) {
316 316
 		$core_paths = apply_filters(
317 317
 			'FHEE__EE_Registry__load_core__core_paths',
318 318
 			array(
319 319
 				EE_CORE,
320 320
 				EE_ADMIN,
321 321
 				EE_CPTS,
322
-				EE_CORE . 'data_migration_scripts' . DS,
323
-				EE_CORE . 'request_stack' . DS,
324
-				EE_CORE . 'middleware' . DS,
322
+				EE_CORE.'data_migration_scripts'.DS,
323
+				EE_CORE.'request_stack'.DS,
324
+				EE_CORE.'middleware'.DS,
325 325
 			)
326 326
 		);
327 327
 		// retrieve instantiated class
328
-		return $this->_load( $core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only );
328
+		return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only);
329 329
 	}
330 330
 
331 331
 
@@ -339,15 +339,15 @@  discard block
 block discarded – undo
339 339
 	 * @param bool $load_only
340 340
 	 * @return mixed
341 341
 	 */
342
-	public function load_service( $class_name, $arguments = array(), $load_only = false ) {
342
+	public function load_service($class_name, $arguments = array(), $load_only = false) {
343 343
 		$service_paths = apply_filters(
344 344
 			'FHEE__EE_Registry__load_service__service_paths',
345 345
 			array(
346
-				EE_CORE . 'services' . DS,
346
+				EE_CORE.'services'.DS,
347 347
 			)
348 348
 		);
349 349
 		// retrieve instantiated class
350
-		return $this->_load( $service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only );
350
+		return $this->_load($service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only);
351 351
 	}
352 352
 
353 353
 
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 	 * @param mixed $arguments
361 361
 	 * @return EE_Data_Migration_Script_Base
362 362
 	 */
363
-	public function load_dms( $class_name, $arguments = array() ) {
363
+	public function load_dms($class_name, $arguments = array()) {
364 364
 		// retrieve instantiated class
365
-		return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false );
365
+		return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false);
366 366
 	}
367 367
 
368 368
 
@@ -377,14 +377,14 @@  discard block
 block discarded – undo
377 377
 	 * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default)
378 378
 	 * @return EE_Base_Class | bool
379 379
 	 */
380
-	public function load_class( $class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false ) {
381
-		$paths = apply_filters( 'FHEE__EE_Registry__load_class__paths', array(
380
+	public function load_class($class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false) {
381
+		$paths = apply_filters('FHEE__EE_Registry__load_class__paths', array(
382 382
 			EE_CORE,
383 383
 			EE_CLASSES,
384 384
 			EE_BUSINESS
385
-		) );
385
+		));
386 386
 		// retrieve instantiated class
387
-		return $this->_load( $paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only );
387
+		return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only);
388 388
 	}
389 389
 
390 390
 
@@ -397,11 +397,11 @@  discard block
 block discarded – undo
397 397
 	 * @param bool $load_only
398 398
 	 * @return EEH_Base | bool
399 399
 	 */
400
-	public function load_helper( $class_name, $arguments = array(), $load_only = true ) {
400
+	public function load_helper($class_name, $arguments = array(), $load_only = true) {
401 401
 		// todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed
402
-		$helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array( EE_HELPERS ) );
402
+		$helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS));
403 403
 		// retrieve instantiated class
404
-		return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only );
404
+		return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only);
405 405
 	}
406 406
 
407 407
 
@@ -416,16 +416,16 @@  discard block
 block discarded – undo
416 416
 	 * @param bool $cache  whether to cache the object or not.
417 417
 	 * @return mixed
418 418
 	 */
419
-	public function load_lib( $class_name, $arguments = array(), $load_only = false, $cache = true ) {
419
+	public function load_lib($class_name, $arguments = array(), $load_only = false, $cache = true) {
420 420
 		$paths = array(
421 421
 			EE_LIBRARIES,
422
-			EE_LIBRARIES . 'messages' . DS,
423
-			EE_LIBRARIES . 'shortcodes' . DS,
424
-			EE_LIBRARIES . 'qtips' . DS,
425
-			EE_LIBRARIES . 'payment_methods' . DS,
422
+			EE_LIBRARIES.'messages'.DS,
423
+			EE_LIBRARIES.'shortcodes'.DS,
424
+			EE_LIBRARIES.'qtips'.DS,
425
+			EE_LIBRARIES.'payment_methods'.DS,
426 426
 		);
427 427
 		// retrieve instantiated class
428
-		return $this->_load( $paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only );
428
+		return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only);
429 429
 	}
430 430
 
431 431
 
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
 	 * @param bool $load_only
439 439
 	 * @return EEM_Base | bool
440 440
 	 */
441
-	public function load_model( $class_name, $arguments = array(), $load_only = false ) {
442
-		$paths = apply_filters( 'FHEE__EE_Registry__load_model__paths', array(
441
+	public function load_model($class_name, $arguments = array(), $load_only = false) {
442
+		$paths = apply_filters('FHEE__EE_Registry__load_model__paths', array(
443 443
 			EE_MODELS,
444 444
 			EE_CORE
445
-		) );
445
+		));
446 446
 		// retrieve instantiated class
447
-		return $this->_load( $paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only );
447
+		return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only);
448 448
 	}
449 449
 
450 450
 
@@ -457,15 +457,15 @@  discard block
 block discarded – undo
457 457
 	 * @param bool $load_only
458 458
 	 * @return mixed | bool
459 459
 	 */
460
-	public function load_model_class( $class_name, $arguments = array(), $load_only = true ) {
460
+	public function load_model_class($class_name, $arguments = array(), $load_only = true) {
461 461
 		$paths = array(
462
-			EE_MODELS . 'fields' . DS,
463
-			EE_MODELS . 'helpers' . DS,
464
-			EE_MODELS . 'relations' . DS,
465
-			EE_MODELS . 'strategies' . DS
462
+			EE_MODELS.'fields'.DS,
463
+			EE_MODELS.'helpers'.DS,
464
+			EE_MODELS.'relations'.DS,
465
+			EE_MODELS.'strategies'.DS
466 466
 		);
467 467
 		// retrieve instantiated class
468
-		return $this->_load( $paths, 'EE_', $class_name, '', $arguments, false, true, $load_only );
468
+		return $this->_load($paths, 'EE_', $class_name, '', $arguments, false, true, $load_only);
469 469
 	}
470 470
 
471 471
 
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
 	 * @param string $model_name like Event, Attendee, Question_Group_Question, etc.
476 476
 	 * @return boolean
477 477
 	 */
478
-	public function is_model_name( $model_name ) {
479
-		return isset( $this->models[ $model_name ] ) ? true : false;
478
+	public function is_model_name($model_name) {
479
+		return isset($this->models[$model_name]) ? true : false;
480 480
 	}
481 481
 
482 482
 
@@ -491,9 +491,9 @@  discard block
 block discarded – undo
491 491
 	 * @param bool $load_only
492 492
 	 * @return mixed
493 493
 	 */
494
-	public function load_file( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true ) {
494
+	public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true) {
495 495
 		// retrieve instantiated class
496
-		return $this->_load( $path_to_file, '', $file_name, $type, $arguments, false, true, $load_only );
496
+		return $this->_load($path_to_file, '', $file_name, $type, $arguments, false, true, $load_only);
497 497
 	}
498 498
 
499 499
 
@@ -508,9 +508,9 @@  discard block
 block discarded – undo
508 508
 	 * @param bool $load_only
509 509
 	 * @return EE_Addon
510 510
 	 */
511
-	public function load_addon( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false ) {
511
+	public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false) {
512 512
 		// retrieve instantiated class
513
-		return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only );
513
+		return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only);
514 514
 	}
515 515
 
516 516
 
@@ -541,46 +541,46 @@  discard block
 block discarded – undo
541 541
 		$load_only = false
542 542
 	) {
543 543
 		// strip php file extension
544
-		$class_name = str_replace( '.php', '', trim( $class_name ) );
544
+		$class_name = str_replace('.php', '', trim($class_name));
545 545
 		// does the class have a prefix ?
546
-		if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) {
546
+		if ( ! empty($class_prefix) && $class_prefix != 'addon') {
547 547
 			// make sure $class_prefix is uppercase
548
-			$class_prefix = strtoupper( trim( $class_prefix ) );
548
+			$class_prefix = strtoupper(trim($class_prefix));
549 549
 			// add class prefix ONCE!!!
550
-			$class_name = $class_prefix . str_replace( $class_prefix, '', $class_name );
550
+			$class_name = $class_prefix.str_replace($class_prefix, '', $class_name);
551 551
 		}
552
-		$class_exists = class_exists( $class_name );
552
+		$class_exists = class_exists($class_name);
553 553
 		// if we're only loading the class and it already exists, then let's just return true immediately
554
-		if ( $load_only && $class_exists ) {
554
+		if ($load_only && $class_exists) {
555 555
 			return true;
556 556
 		}
557 557
 		// $this->_cache_on is toggled during the recursive loading that can occur with dependency injection
558 558
 		// $cache is controlled by individual calls to separate Registry loader methods like load_class()
559 559
 		// $load_only is also controlled by individual calls to separate Registry loader methods like load_file()
560
-		if ( $this->_cache_on && $cache && ! $load_only ) {
560
+		if ($this->_cache_on && $cache && ! $load_only) {
561 561
 			// return object if it's already cached
562
-			$cached_class = $this->_get_cached_class( $class_name, $class_prefix );
563
-			if ( $cached_class !== null ) {
562
+			$cached_class = $this->_get_cached_class($class_name, $class_prefix);
563
+			if ($cached_class !== null) {
564 564
 				return $cached_class;
565 565
 			}
566 566
 		}
567 567
 		// if the class doesn't already exist.. then we need to try and find the file and load it
568
-		if ( ! $class_exists ) {
568
+		if ( ! $class_exists) {
569 569
 			// get full path to file
570
-			$path = $this->_resolve_path( $class_name, $type, $file_paths );
570
+			$path = $this->_resolve_path($class_name, $type, $file_paths);
571 571
 			// load the file
572
-			$loaded = $this->_require_file( $path, $class_name, $type, $file_paths );
572
+			$loaded = $this->_require_file($path, $class_name, $type, $file_paths);
573 573
 			// if loading failed, or we are only loading a file but NOT instantiating an object
574
-			if ( ! $loaded || $load_only ) {
574
+			if ( ! $loaded || $load_only) {
575 575
 				// return boolean if only loading, or null if an object was expected
576 576
 				return $load_only ? $loaded : null;
577 577
 			}
578 578
 		}
579 579
 		// instantiate the requested object
580
-		$class_obj = $this->_create_object( $class_name, $arguments, $type, $from_db );
581
-		if ( $this->_cache_on && $cache ) {
580
+		$class_obj = $this->_create_object($class_name, $arguments, $type, $from_db);
581
+		if ($this->_cache_on && $cache) {
582 582
 			// save it for later... kinda like gum  { : $
583
-			$this->_set_cached_class( $class_obj, $class_name, $class_prefix, $from_db );
583
+			$this->_set_cached_class($class_obj, $class_name, $class_prefix, $from_db);
584 584
 		}
585 585
 		$this->_cache_on = true;
586 586
 		return $class_obj;
@@ -603,21 +603,21 @@  discard block
 block discarded – undo
603 603
 	 * @param string $class_prefix
604 604
 	 * @return null|object
605 605
 	 */
606
-	protected function _get_cached_class( $class_name, $class_prefix = '' ) {
607
-		if ( isset( $this->_class_abbreviations[ $class_name ] ) ) {
608
-			$class_abbreviation = $this->_class_abbreviations[ $class_name ];
606
+	protected function _get_cached_class($class_name, $class_prefix = '') {
607
+		if (isset($this->_class_abbreviations[$class_name])) {
608
+			$class_abbreviation = $this->_class_abbreviations[$class_name];
609 609
 		} else {
610 610
 			// have to specify something, but not anything that will conflict
611 611
 			$class_abbreviation = 'FANCY_BATMAN_PANTS';
612 612
 		}
613 613
 		// check if class has already been loaded, and return it if it has been
614
-		if ( isset( $this->{$class_abbreviation} ) && ! is_null( $this->{$class_abbreviation} ) ) {
614
+		if (isset($this->{$class_abbreviation} ) && ! is_null($this->{$class_abbreviation} )) {
615 615
 			return $this->{$class_abbreviation};
616
-		} else if ( isset ( $this->{$class_name} ) ) {
616
+		} else if (isset ($this->{$class_name} )) {
617 617
 			return $this->{$class_name};
618
-		} else if ( isset ( $this->LIB->{$class_name} ) ) {
618
+		} else if (isset ($this->LIB->{$class_name} )) {
619 619
 			return $this->LIB->{$class_name};
620
-		} else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) {
620
+		} else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) {
621 621
 			return $this->addons->{$class_name};
622 622
 		}
623 623
 		return null;
@@ -638,20 +638,20 @@  discard block
 block discarded – undo
638 638
 	 * @param array $file_paths
639 639
 	 * @return string | bool
640 640
 	 */
641
-	protected function _resolve_path( $class_name, $type = '', $file_paths = array() ) {
641
+	protected function _resolve_path($class_name, $type = '', $file_paths = array()) {
642 642
 		// make sure $file_paths is an array
643
-		$file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths );
643
+		$file_paths = is_array($file_paths) ? $file_paths : array($file_paths);
644 644
 		// cycle thru paths
645
-		foreach ( $file_paths as $key => $file_path ) {
645
+		foreach ($file_paths as $key => $file_path) {
646 646
 			// convert all separators to proper DS, if no filepath, then use EE_CLASSES
647
-			$file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES;
647
+			$file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES;
648 648
 			// prep file type
649
-			$type = ! empty( $type ) ? trim( $type, '.' ) . '.' : '';
649
+			$type = ! empty($type) ? trim($type, '.').'.' : '';
650 650
 			// build full file path
651
-			$file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php';
651
+			$file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php';
652 652
 			//does the file exist and can be read ?
653
-			if ( is_readable( $file_paths[ $key ] ) ) {
654
-				return $file_paths[ $key ];
653
+			if (is_readable($file_paths[$key])) {
654
+				return $file_paths[$key];
655 655
 			}
656 656
 		}
657 657
 		return false;
@@ -673,29 +673,29 @@  discard block
 block discarded – undo
673 673
 	 * @return boolean
674 674
 	 * @throws \EE_Error
675 675
 	 */
676
-	protected function _require_file( $path, $class_name, $type = '', $file_paths = array() ) {
676
+	protected function _require_file($path, $class_name, $type = '', $file_paths = array()) {
677 677
 		// don't give up! you gotta...
678 678
 		try {
679 679
 			//does the file exist and can it be read ?
680
-			if ( ! $path ) {
680
+			if ( ! $path) {
681 681
 				// so sorry, can't find the file
682
-				throw new EE_Error (
682
+				throw new EE_Error(
683 683
 					sprintf(
684
-						__( 'The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso' ),
685
-						trim( $type, '.' ),
684
+						__('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'),
685
+						trim($type, '.'),
686 686
 						$class_name,
687
-						'<br />' . implode( ',<br />', $file_paths )
687
+						'<br />'.implode(',<br />', $file_paths)
688 688
 					)
689 689
 				);
690 690
 			}
691 691
 			// get the file
692
-			require_once( $path );
692
+			require_once($path);
693 693
 			// if the class isn't already declared somewhere
694
-			if ( class_exists( $class_name, false ) === false ) {
694
+			if (class_exists($class_name, false) === false) {
695 695
 				// so sorry, not a class
696 696
 				throw new EE_Error(
697 697
 					sprintf(
698
-						__( 'The %s file %s does not appear to contain the %s Class.', 'event_espresso' ),
698
+						__('The %s file %s does not appear to contain the %s Class.', 'event_espresso'),
699 699
 						$type,
700 700
 						$path,
701 701
 						$class_name
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 				);
704 704
 			}
705 705
 
706
-		} catch ( EE_Error $e ) {
706
+		} catch (EE_Error $e) {
707 707
 			$e->get_error();
708 708
 			return false;
709 709
 		}
@@ -735,55 +735,55 @@  discard block
 block discarded – undo
735 735
 	 * @return null | object
736 736
 	 * @throws \EE_Error
737 737
 	 */
738
-	protected function _create_object( $class_name, $arguments = array(), $type = '', $from_db = false ) {
738
+	protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false) {
739 739
 		$class_obj = null;
740 740
 		// don't give up! you gotta...
741 741
 		try {
742 742
 			// create reflection
743
-			$reflector = $this->get_ReflectionClass( $class_name );
743
+			$reflector = $this->get_ReflectionClass($class_name);
744 744
 			// make sure arguments are an array
745
-			$arguments = is_array( $arguments ) ? $arguments : array( $arguments );
745
+			$arguments = is_array($arguments) ? $arguments : array($arguments);
746 746
 			// and if arguments array is numerically and sequentially indexed, then we want it to remain as is,
747 747
 			// else wrap it in an additional array so that it doesn't get split into multiple parameters
748
-			$arguments = $this->_array_is_numerically_and_sequentially_indexed( $arguments )
748
+			$arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments)
749 749
 				? $arguments
750
-				: array( $arguments );
750
+				: array($arguments);
751 751
 			// attempt to inject dependencies ?
752
-			if ( $this->_dependency_map->has( $class_name ) ) {
753
-				$arguments = $this->_resolve_dependencies( $reflector, $class_name, $arguments );
752
+			if ($this->_dependency_map->has($class_name)) {
753
+				$arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments);
754 754
 			}
755 755
 			// instantiate the class and add to the LIB array for tracking
756 756
 			// EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db)
757
-			if ( $reflector->getConstructor() === null || $reflector->isAbstract() ) {
757
+			if ($reflector->getConstructor() === null || $reflector->isAbstract()) {
758 758
 				// no constructor = static methods only... nothing to instantiate, loading file was enough
759 759
 				//$instantiation_mode = "no constructor";
760 760
 				$class_obj = true;
761
-			} else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) {
761
+			} else if ($from_db && method_exists($class_name, 'new_instance_from_db')) {
762 762
 				//$instantiation_mode = "new_instance_from_db";
763
-				$class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments );
764
-			} else if ( method_exists( $class_name, 'new_instance' ) ) {
763
+				$class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments);
764
+			} else if (method_exists($class_name, 'new_instance')) {
765 765
 				//$instantiation_mode = "new_instance";
766
-				$class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments );
767
-			} else if ( method_exists( $class_name, 'instance' ) ) {
766
+				$class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments);
767
+			} else if (method_exists($class_name, 'instance')) {
768 768
 				//$instantiation_mode = "instance";
769
-				$class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments );
770
-			} else if ( $reflector->isInstantiable() ) {
769
+				$class_obj = call_user_func_array(array($class_name, 'instance'), $arguments);
770
+			} else if ($reflector->isInstantiable()) {
771 771
 				//$instantiation_mode = "isInstantiable";
772
-				$class_obj = $reflector->newInstanceArgs( $arguments );
772
+				$class_obj = $reflector->newInstanceArgs($arguments);
773 773
 			} else {
774 774
 				// heh ? something's not right !
775 775
 				//$instantiation_mode = 'none';
776 776
 				throw new EE_Error(
777 777
 					sprintf(
778
-						__( 'The %s file %s could not be instantiated.', 'event_espresso' ),
778
+						__('The %s file %s could not be instantiated.', 'event_espresso'),
779 779
 						$type,
780 780
 						$class_name
781 781
 					)
782 782
 				);
783 783
 			}
784
-		} catch ( Exception $e ) {
785
-			if ( ! $e instanceof EE_Error ) {
786
-				$e = new EE_Error( $e->getMessage() );
784
+		} catch (Exception $e) {
785
+			if ( ! $e instanceof EE_Error) {
786
+				$e = new EE_Error($e->getMessage());
787 787
 			}
788 788
 			$e->get_error();
789 789
 		}
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
 	 * @param array $array
798 798
 	 * @return bool
799 799
 	 */
800
-	protected function _array_is_numerically_and_sequentially_indexed( array $array ) {
801
-		return ! empty( $array ) ? array_keys( $array ) === range( 0, count( $array ) - 1 ) : true;
800
+	protected function _array_is_numerically_and_sequentially_indexed(array $array) {
801
+		return ! empty($array) ? array_keys($array) === range(0, count($array) - 1) : true;
802 802
 	}
803 803
 
804 804
 
@@ -813,14 +813,14 @@  discard block
 block discarded – undo
813 813
 	 * @param string $class_name
814 814
 	 * @return ReflectionClass
815 815
 	 */
816
-	public function get_ReflectionClass( $class_name ) {
816
+	public function get_ReflectionClass($class_name) {
817 817
 		if (
818
-			! isset( $this->_reflectors[ $class_name ] )
819
-			|| ! $this->_reflectors[ $class_name ] instanceof ReflectionClass
818
+			! isset($this->_reflectors[$class_name])
819
+			|| ! $this->_reflectors[$class_name] instanceof ReflectionClass
820 820
 		) {
821
-			$this->_reflectors[ $class_name ] = new ReflectionClass( $class_name );
821
+			$this->_reflectors[$class_name] = new ReflectionClass($class_name);
822 822
 		}
823
-		return $this->_reflectors[ $class_name ];
823
+		return $this->_reflectors[$class_name];
824 824
 	}
825 825
 
826 826
 
@@ -845,45 +845,45 @@  discard block
 block discarded – undo
845 845
 	 * @param array $arguments
846 846
 	 * @return array
847 847
 	 */
848
-	protected function _resolve_dependencies( ReflectionClass $reflector, $class_name, $arguments = array() ) {
848
+	protected function _resolve_dependencies(ReflectionClass $reflector, $class_name, $arguments = array()) {
849 849
 		// let's examine the constructor
850 850
 		$constructor = $reflector->getConstructor();
851 851
 		// whu? huh? nothing?
852
-		if ( ! $constructor ) {
852
+		if ( ! $constructor) {
853 853
 			return $arguments;
854 854
 		}
855 855
 		// get constructor parameters
856 856
 		$params = $constructor->getParameters();
857 857
 		// and the keys for the incoming arguments array so that we can compare existing arguments with what is expected
858
-		$argument_keys = array_keys( $arguments );
858
+		$argument_keys = array_keys($arguments);
859 859
 		// now loop thru all of the constructors expected parameters
860
-		foreach ( $params as $index => $param ) {
860
+		foreach ($params as $index => $param) {
861 861
 			// is this a dependency for a specific class ?
862 862
 			$param_class = $param->getClass() ? $param->getClass()->name : null;
863 863
 			if (
864 864
 				// param is not even a class
865
-				empty( $param_class )
865
+				empty($param_class)
866 866
 				// and something already exists in the incoming arguments for this param
867
-				&& isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] )
867
+				&& isset($argument_keys[$index], $arguments[$argument_keys[$index]])
868 868
 			) {
869 869
 				// so let's skip this argument and move on to the next
870 870
 				continue;
871 871
 			} else if (
872 872
 				// parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class
873
-				! empty( $param_class )
874
-				&& isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] )
875
-				&& $arguments[ $argument_keys[ $index ] ] instanceof $param_class
873
+				! empty($param_class)
874
+				&& isset($argument_keys[$index], $arguments[$argument_keys[$index]])
875
+				&& $arguments[$argument_keys[$index]] instanceof $param_class
876 876
 			) {
877 877
 				// skip this argument and move on to the next
878 878
 				continue;
879 879
 			} else if (
880 880
 				// parameter is type hinted as a class, and should be injected
881
-				! empty( $param_class )
882
-				&& $this->_dependency_map->has_dependency_for_class( $class_name, $param_class )
881
+				! empty($param_class)
882
+				&& $this->_dependency_map->has_dependency_for_class($class_name, $param_class)
883 883
 			) {
884
-				$arguments = $this->_resolve_dependency( $class_name, $param_class, $arguments, $index );
884
+				$arguments = $this->_resolve_dependency($class_name, $param_class, $arguments, $index);
885 885
 			} else {
886
-				$arguments[ $index ] = $param->getDefaultValue();
886
+				$arguments[$index] = $param->getDefaultValue();
887 887
 			}
888 888
 
889 889
 		}
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 	 * @param mixed $index
901 901
 	 * @return array
902 902
 	 */
903
-	protected function _resolve_dependency( $class_name, $param_class , $arguments, $index ) {
903
+	protected function _resolve_dependency($class_name, $param_class, $arguments, $index) {
904 904
 		$dependency = null;
905 905
 		// should dependency be loaded from cache ?
906 906
 		$cache_on = $this->_dependency_map->loading_strategy_for_class_dependency(
@@ -910,30 +910,30 @@  discard block
 block discarded – undo
910 910
 			: false;
911 911
 		// we might have a dependency...
912 912
 		// let's MAYBE try and find it in our cache if that's what's been requested
913
-		$cached_class = $cache_on ? $this->_get_cached_class( $param_class ) : null;
913
+		$cached_class = $cache_on ? $this->_get_cached_class($param_class) : null;
914 914
 		// and grab it if it exists
915
-		if ( $cached_class instanceof $param_class ) {
915
+		if ($cached_class instanceof $param_class) {
916 916
 			$dependency = $cached_class;
917
-		} else if ( $param_class != $class_name ) {
917
+		} else if ($param_class != $class_name) {
918 918
 			// obtain the loader method from the dependency map
919
-			$loader = $this->_dependency_map->class_loader( $param_class );
919
+			$loader = $this->_dependency_map->class_loader($param_class);
920 920
 			// is loader a custom closure ?
921
-			if ( $loader instanceof Closure ) {
921
+			if ($loader instanceof Closure) {
922 922
 				$dependency = $loader();
923 923
 			} else {
924 924
 				// set the cache on property for the recursive loading call
925 925
 				$this->_cache_on = $cache_on;
926 926
 				// if not, then let's try and load it via the registry
927
-				$dependency = $this->{$loader}( $param_class );
927
+				$dependency = $this->{$loader}($param_class);
928 928
 			}
929 929
 		}
930 930
 		// did we successfully find the correct dependency ?
931
-		if ( $dependency instanceof $param_class ) {
931
+		if ($dependency instanceof $param_class) {
932 932
 			// then let's inject it into the incoming array of arguments at the correct location
933
-			if ( isset( $argument_keys[ $index ] ) ) {
934
-				$arguments[ $argument_keys[ $index ] ] = $dependency;
933
+			if (isset($argument_keys[$index])) {
934
+				$arguments[$argument_keys[$index]] = $dependency;
935 935
 			} else {
936
-				$arguments[ $index ] = $dependency;
936
+				$arguments[$index] = $dependency;
937 937
 			}
938 938
 		}
939 939
 		return $arguments;
@@ -958,16 +958,16 @@  discard block
 block discarded – undo
958 958
 	 * @param bool $from_db
959 959
 	 * @return void
960 960
 	 */
961
-	protected function _set_cached_class( $class_obj, $class_name, $class_prefix = '', $from_db = false ) {
961
+	protected function _set_cached_class($class_obj, $class_name, $class_prefix = '', $from_db = false) {
962 962
 		// return newly instantiated class
963
-		if ( isset( $this->_class_abbreviations[ $class_name ] ) ) {
964
-			$class_abbreviation = $this->_class_abbreviations[ $class_name ];
963
+		if (isset($this->_class_abbreviations[$class_name])) {
964
+			$class_abbreviation = $this->_class_abbreviations[$class_name];
965 965
 			$this->{$class_abbreviation} = $class_obj;
966
-		} else if ( property_exists( $this, $class_name ) ) {
966
+		} else if (property_exists($this, $class_name)) {
967 967
 			$this->{$class_name} = $class_obj;
968
-		} else if ( $class_prefix == 'addon' ) {
968
+		} else if ($class_prefix == 'addon') {
969 969
 			$this->addons->{$class_name} = $class_obj;
970
-		} else if ( ! $from_db ) {
970
+		} else if ( ! $from_db) {
971 971
 			$this->LIB->{$class_name} = $class_obj;
972 972
 		}
973 973
 	}
@@ -984,12 +984,12 @@  discard block
 block discarded – undo
984 984
 	 * @param array  $arguments
985 985
 	 * @return object
986 986
 	 */
987
-	public static function factory( $classname, $arguments = array() ) {
988
-		$loader = self::instance()->_dependency_map->class_loader( $classname );
989
-		if ( $loader instanceof Closure ) {
990
-			return $loader( $arguments );
991
-		} else if ( method_exists( EE_Registry::instance(), $loader ) ) {
992
-			return EE_Registry::instance()->{$loader}( $classname, $arguments );
987
+	public static function factory($classname, $arguments = array()) {
988
+		$loader = self::instance()->_dependency_map->class_loader($classname);
989
+		if ($loader instanceof Closure) {
990
+			return $loader($arguments);
991
+		} else if (method_exists(EE_Registry::instance(), $loader)) {
992
+			return EE_Registry::instance()->{$loader}($classname, $arguments);
993 993
 		}
994 994
 		return null;
995 995
 	}
@@ -1002,9 +1002,9 @@  discard block
 block discarded – undo
1002 1002
 	 * @param string $name
1003 1003
 	 * @return EE_Addon
1004 1004
 	 */
1005
-	public function get_addon_by_name( $name ) {
1006
-		foreach ( $this->addons as $addon ) {
1007
-			if ( $addon->name() == $name ) {
1005
+	public function get_addon_by_name($name) {
1006
+		foreach ($this->addons as $addon) {
1007
+			if ($addon->name() == $name) {
1008 1008
 				return $addon;
1009 1009
 			}
1010 1010
 		}
@@ -1020,8 +1020,8 @@  discard block
 block discarded – undo
1020 1020
 	 */
1021 1021
 	public function get_addons_by_name() {
1022 1022
 		$addons = array();
1023
-		foreach ( $this->addons as $addon ) {
1024
-			$addons[ $addon->name() ] = $addon;
1023
+		foreach ($this->addons as $addon) {
1024
+			$addons[$addon->name()] = $addon;
1025 1025
 		}
1026 1026
 		return $addons;
1027 1027
 	}
@@ -1036,14 +1036,14 @@  discard block
 block discarded – undo
1036 1036
 	 * @return \EEM_Base
1037 1037
 	 * @throws \EE_Error
1038 1038
 	 */
1039
-	public function reset_model( $model_name ) {
1040
-		$model = $this->load_model( $model_name );
1041
-		$model_class_name = get_class( $model );
1039
+	public function reset_model($model_name) {
1040
+		$model = $this->load_model($model_name);
1041
+		$model_class_name = get_class($model);
1042 1042
 		//get that model reset it and make sure we nuke the old reference to it
1043
-		if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) {
1043
+		if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) {
1044 1044
 			$this->LIB->{$model_class_name} = $model::reset();
1045 1045
 		} else {
1046
-			throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) );
1046
+			throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name));
1047 1047
 		}
1048 1048
 		return $this->LIB->{$model_class_name};
1049 1049
 	}
@@ -1064,16 +1064,16 @@  discard block
 block discarded – undo
1064 1064
 	 *                                  code instead can just change the model context to a different blog id if necessary
1065 1065
 	 * @return EE_Registry
1066 1066
 	 */
1067
-	public static function reset( $hard = false, $reinstantiate = true, $reset_models = true ) {
1067
+	public static function reset($hard = false, $reinstantiate = true, $reset_models = true) {
1068 1068
 		$instance = self::instance();
1069 1069
 		EEH_Activation::reset();
1070 1070
 		$instance->_cache_on = true;
1071
-		$instance->CFG = EE_Config::reset( $hard, $reinstantiate );
1071
+		$instance->CFG = EE_Config::reset($hard, $reinstantiate);
1072 1072
 		$instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset();
1073 1073
 		$instance->LIB = new stdClass();
1074
-		if ( $reset_models ) {
1075
-			foreach ( array_keys( $instance->non_abstract_db_models ) as $model_name ) {
1076
-				$instance->reset_model( $model_name );
1074
+		if ($reset_models) {
1075
+			foreach (array_keys($instance->non_abstract_db_models) as $model_name) {
1076
+				$instance->reset_model($model_name);
1077 1077
 			}
1078 1078
 		}
1079 1079
 		return $instance;
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 	 * @param $a
1095 1095
 	 * @param $b
1096 1096
 	 */
1097
-	final function __call( $a, $b ) {
1097
+	final function __call($a, $b) {
1098 1098
 	}
1099 1099
 
1100 1100
 
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
 	/**
1103 1103
 	 * @param $a
1104 1104
 	 */
1105
-	final function __get( $a ) {
1105
+	final function __get($a) {
1106 1106
 	}
1107 1107
 
1108 1108
 
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 	 * @param $a
1112 1112
 	 * @param $b
1113 1113
 	 */
1114
-	final function __set( $a, $b ) {
1114
+	final function __set($a, $b) {
1115 1115
 	}
1116 1116
 
1117 1117
 
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 	/**
1120 1120
 	 * @param $a
1121 1121
 	 */
1122
-	final function __isset( $a ) {
1122
+	final function __isset($a) {
1123 1123
 	}
1124 1124
 
1125 1125
 
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 	/**
1128 1128
 	 * @param $a
1129 1129
 	 */
1130
-	final function __unset( $a ) {
1130
+	final function __unset($a) {
1131 1131
 	}
1132 1132
 
1133 1133
 
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 	 * @param $a
1175 1175
 	 * @param $b
1176 1176
 	 */
1177
-	final static function __callStatic( $a, $b ) {
1177
+	final static function __callStatic($a, $b) {
1178 1178
 	}
1179 1179
 
1180 1180
 	/**
@@ -1183,9 +1183,9 @@  discard block
 block discarded – undo
1183 1183
 	 */
1184 1184
 	public function cpt_models() {
1185 1185
 		$cpt_models = array();
1186
-		foreach( $this->non_abstract_db_models as $short_name => $classname ) {
1187
-			if( is_subclass_of(  $classname, 'EEM_CPT_Base' ) ) {
1188
-				$cpt_models[ $short_name ] = $classname;
1186
+		foreach ($this->non_abstract_db_models as $short_name => $classname) {
1187
+			if (is_subclass_of($classname, 'EEM_CPT_Base')) {
1188
+				$cpt_models[$short_name] = $classname;
1189 1189
 			}
1190 1190
 		}
1191 1191
 		return $cpt_models;
Please login to merge, or discard this patch.
core/db_models/helpers/EE_Table_Base.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * Base class for defining the tables that comprise models. This is used to store information
5 5
  * about the table\s alias, private key, etc.
6 6
  */
7
-abstract class EE_Table_Base{
7
+abstract class EE_Table_Base {
8 8
 
9 9
 	/**
10 10
 	 * This holds the table_name without the table prefix.
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite install,
42 42
 	 *					or whether each site on a multisite install has a copy of this table
43 43
 	 */
44
-	function __construct($table_name, $pk_column, $global = false ){
44
+	function __construct($table_name, $pk_column, $global = false) {
45 45
 		$this->_global = $global;
46 46
 		$prefix = $this->get_table_prefix();
47 47
 		//if they added the prefix, let's remove it because we delay adding the prefix until right when its needed.
48
-		if ( strpos( $table_name, $prefix ) === 0 ) {
49
-			$table_name = ltrim( $table_name, $prefix );
48
+		if (strpos($table_name, $prefix) === 0) {
49
+			$table_name = ltrim($table_name, $prefix);
50 50
 		}
51 51
 		$this->_table_name = $table_name;
52 52
 		$this->_pk_column = $pk_column;
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	public function get_table_prefix() {
65 65
 		global $wpdb;
66 66
 
67
-		if ( $this->_global ) {
67
+		if ($this->_global) {
68 68
 			$prefix = $wpdb->base_prefix;
69 69
 		} else {
70
-			$prefix = $wpdb->get_blog_prefix( EEM_Base::get_model_query_blog_id() );
70
+			$prefix = $wpdb->get_blog_prefix(EEM_Base::get_model_query_blog_id());
71 71
 		}
72 72
 		return $prefix;
73 73
 	}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param string $table_alias
80 80
 	 */
81
-	function _construct_finalize_with_alias($table_alias){
81
+	function _construct_finalize_with_alias($table_alias) {
82 82
 		$this->_table_alias = $table_alias;
83 83
 	}
84 84
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 * Returns the fully qualified table name for the database (includes the table prefix current for the blog).
88 88
 	 * @return string
89 89
 	 */
90
-	function get_table_name(){
91
-		return $this->get_table_prefix() . $this->_table_name;
90
+	function get_table_name() {
91
+		return $this->get_table_prefix().$this->_table_name;
92 92
 	}
93 93
 
94 94
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	 * @return string
101 101
 	 * @throws EE_Error
102 102
 	 */
103
-	function get_table_alias(){
104
-		if( ! $this->_table_alias){
103
+	function get_table_alias() {
104
+		if ( ! $this->_table_alias) {
105 105
 			throw new EE_Error("You must call _construct_finalize_with_alias before using the EE_Table_Base. Did you forget to call parent::__construct at the end of your EEMerimental_Base child's __construct?");
106 106
 		}
107 107
 		return $this->_table_alias;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return string name of column of PK
115 115
 	 */
116
-	function get_pk_column(){
116
+	function get_pk_column() {
117 117
 		return $this->_pk_column;
118 118
 	}
119 119
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 * returns a string with the table alias, a period, and the private key's column.
124 124
 	 * @return string
125 125
 	 */
126
-	function get_fully_qualified_pk_column(){
127
-		$sql =  $this->get_table_alias().".".$this->get_pk_column();
126
+	function get_fully_qualified_pk_column() {
127
+		$sql = $this->get_table_alias().".".$this->get_pk_column();
128 128
 		return $sql;
129 129
 	}
130 130
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 * returns the special sql for a inner select with a limit.
134 134
 	 * @return string    SQL select
135 135
 	 */
136
-	public function get_select_join_limit( $limit ) {
137
-		$limit = is_array( $limit ) ? 'LIMIT ' . implode(',', array_map( 'intval', $limit ) ) : 'LIMIT ' . (int) $limit;
138
-		$SQL = SP . '(SELECT * FROM ' . $this->_table_name . SP . $limit . ') AS ' . $this->_table_alias;
136
+	public function get_select_join_limit($limit) {
137
+		$limit = is_array($limit) ? 'LIMIT '.implode(',', array_map('intval', $limit)) : 'LIMIT '.(int) $limit;
138
+		$SQL = SP.'(SELECT * FROM '.$this->_table_name.SP.$limit.') AS '.$this->_table_alias;
139 139
 		return $SQL;
140 140
 	}
141 141
 }
Please login to merge, or discard this patch.