Completed
Branch BUG-10042-attendee-mover-confl... (090c9d)
by
unknown
16:23
created
core/libraries/messages/EE_messenger.lib.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use \EventEspresso\core\exceptions\SendMessageException;
3 3
 
4
-if (!defined('EVENT_ESPRESSO_VERSION') )
4
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
5 5
 	exit('NO direct script access allowed');
6 6
 
7 7
 /**
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @return void
280 280
 	 */
281 281
 	public function enqueue_scripts_styles() {
282
-		do_action( 'AHEE__EE_messenger__enqueue_scripts_styles');
282
+		do_action('AHEE__EE_messenger__enqueue_scripts_styles');
283 283
 	}
284 284
 
285 285
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 
350 350
 		$this->_supports_labels->template_variation_description = __('These are different styles to choose from for the selected template structure.  Usually these affect things like font style, color, borders etc.  In some cases the styles will also make minor layout changes.');
351 351
 
352
-		$this->_supports_labels = apply_filters( 'FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this );
352
+		$this->_supports_labels = apply_filters('FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this);
353 353
 	}
354 354
 
355 355
 
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 	 * @return stdClass
365 365
 	 */
366 366
 	public function get_supports_labels() {
367
-		if ( empty( $this->_supports_labels->template_pack ) || empty( $this->_supports_labels->template_variation) ) {
367
+		if (empty($this->_supports_labels->template_pack) || empty($this->_supports_labels->template_variation)) {
368 368
 			$this->_set_supports_labels_defaults();
369 369
 		}
370
-		return apply_filters( 'FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this );
370
+		return apply_filters('FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this);
371 371
 	}
372 372
 
373 373
 
@@ -387,10 +387,10 @@  discard block
 block discarded – undo
387 387
 	 *
388 388
 	 * @return string                    path or url for the requested variation.
389 389
 	 */
390
-	public function get_variation( EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE ) {
390
+	public function get_variation(EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE) {
391 391
 		$this->_tmp_pack = $pack;
392
-		$variation_path = apply_filters( 'EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters );
393
-		$variation_path = empty( $variation_path ) ? $this->_tmp_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters ) : $variation_path;
392
+		$variation_path = apply_filters('EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters);
393
+		$variation_path = empty($variation_path) ? $this->_tmp_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters) : $variation_path;
394 394
 		return $variation_path;
395 395
 
396 396
 	}
@@ -408,13 +408,13 @@  discard block
 block discarded – undo
408 408
 	 * @return array
409 409
 	 */
410 410
 	public function get_default_message_types() {
411
-		$class = get_class( $this );
411
+		$class = get_class($this);
412 412
 
413 413
 		//messenger specific filter
414
-		$default_types = apply_filters( 'FHEE__' . $class . '__get_default_message_types__default_types', $this->_default_message_types, $this );
414
+		$default_types = apply_filters('FHEE__'.$class.'__get_default_message_types__default_types', $this->_default_message_types, $this);
415 415
 
416 416
 		//all messengers filter
417
-		$default_types = apply_filters( 'FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this );
417
+		$default_types = apply_filters('FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this);
418 418
 		return $default_types;
419 419
 	}
420 420
 
@@ -429,14 +429,14 @@  discard block
 block discarded – undo
429 429
 	 * @return array
430 430
 	 */
431 431
 	public function get_valid_message_types() {
432
-		$class = get_class( $this );
432
+		$class = get_class($this);
433 433
 
434 434
 		//messenger specific filter
435 435
 		//messenger specific filter
436
-		$valid_types = apply_filters( 'FHEE__' . $class . '__get_valid_message_types__valid_types', $this->_valid_message_types, $this );
436
+		$valid_types = apply_filters('FHEE__'.$class.'__get_valid_message_types__valid_types', $this->_valid_message_types, $this);
437 437
 
438 438
 		//all messengers filter
439
-		$valid_types = apply_filters( 'FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this );
439
+		$valid_types = apply_filters('FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this);
440 440
 		return $valid_types;
441 441
 	}
442 442
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 	 * @access public
451 451
 	 * @param array $new_config Whatever is put in here will reset the _validator_config property
452 452
 	 */
453
-	public function set_validator_config( $new_config ) {
453
+	public function set_validator_config($new_config) {
454 454
 		$this->_validator_config = $new_config;
455 455
 	}
456 456
 
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 	public function get_validator_config() {
467 467
 		$class = get_class($this);
468 468
 
469
-		$config = apply_filters( 'FHEE__' . $class . '__get_validator_config', $this->_validator_config, $this );
470
-		$config = apply_filters( 'FHEE__EE_messenger__get_validator_config', $config, $this );
469
+		$config = apply_filters('FHEE__'.$class.'__get_validator_config', $this->_validator_config, $this);
470
+		$config = apply_filters('FHEE__EE_messenger__get_validator_config', $config, $this);
471 471
 		return $config;
472 472
 	}
473 473
 
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	 * @access public
485 485
 	 * @return string content for page
486 486
 	 */
487
-	public function get_messenger_admin_page_content( $page, $action = null, $extra = array(), $message_types = array() ) {
488
-		return $this->_get_admin_page_content( $page, $action, $extra, $message_types );
487
+	public function get_messenger_admin_page_content($page, $action = null, $extra = array(), $message_types = array()) {
488
+		return $this->_get_admin_page_content($page, $action, $extra, $message_types);
489 489
 	}
490 490
 
491 491
 
@@ -495,20 +495,20 @@  discard block
 block discarded – undo
495 495
 	 * @param array $extra
496 496
 	 * @return mixed|string
497 497
 	 */
498
-	protected function _get_admin_content_events_edit( $message_types, $extra ) {
498
+	protected function _get_admin_content_events_edit($message_types, $extra) {
499 499
 		//defaults
500 500
 		$template_args = array();
501 501
 		$selector_rows = '';
502 502
 
503 503
 		//we don't need message types here so we're just going to ignore. we do, however, expect the event id here. The event id is needed to provide a link to setup a custom template for this event.
504
-		$event_id = isset( $extra['event'] ) ? $extra['event'] : NULL;
504
+		$event_id = isset($extra['event']) ? $extra['event'] : NULL;
505 505
 
506
-		$template_wrapper_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
507
-		$template_row_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_row.template.php';
506
+		$template_wrapper_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
507
+		$template_row_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_row.template.php';
508 508
 
509 509
 		//array of template objects for global and custom (non-trashed) (but remember just for this messenger!)
510 510
 		$global_templates = EEM_Message_Template_Group::instance()->get_all(
511
-			array( array( 'MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true ) )
511
+			array(array('MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true))
512 512
 		);
513 513
 		$templates_for_event = EEM_Message_Template_Group::instance()->get_all_custom_templates_by_event(
514 514
 			$event_id,
@@ -517,55 +517,55 @@  discard block
 block discarded – undo
517 517
 				'MTP_is_active' => true
518 518
 			)
519 519
 		);
520
-		$templates_for_event = !empty( $templates_for_event ) ? $templates_for_event : array();
520
+		$templates_for_event = ! empty($templates_for_event) ? $templates_for_event : array();
521 521
 
522 522
 		//so we need to setup the rows for the selectors and we use the global mtpgs (cause those will the active message template groups)
523
-		foreach ( $global_templates as $mtpgID => $mtpg ) {
524
-			if ( $mtpg instanceof EE_Message_Template_Group ) {
523
+		foreach ($global_templates as $mtpgID => $mtpg) {
524
+			if ($mtpg instanceof EE_Message_Template_Group) {
525 525
 				//verify this message type is supposed to show on this page
526 526
 				$mtp_obj = $mtpg->message_type_obj();
527
-				if ( ! $mtp_obj instanceof EE_message_type ) {
527
+				if ( ! $mtp_obj instanceof EE_message_type) {
528 528
 					continue;
529 529
 				}
530
-				$mtp_obj->admin_registered_pages = (array)$mtp_obj->admin_registered_pages;
531
-				if ( ! in_array( 'events_edit', $mtp_obj->admin_registered_pages ) ) {
530
+				$mtp_obj->admin_registered_pages = (array) $mtp_obj->admin_registered_pages;
531
+				if ( ! in_array('events_edit', $mtp_obj->admin_registered_pages)) {
532 532
 					continue;
533 533
 				}
534 534
 				$select_values = array();
535
-				$select_values[ $mtpgID ] = __( 'Global', 'event_espresso' );
536
-				$default_value = array_key_exists( $mtpgID, $templates_for_event ) && ! $mtpg->get( 'MTP_is_override' ) ? $mtpgID : null;
535
+				$select_values[$mtpgID] = __('Global', 'event_espresso');
536
+				$default_value = array_key_exists($mtpgID, $templates_for_event) && ! $mtpg->get('MTP_is_override') ? $mtpgID : null;
537 537
 				//if the override has been set for the global template, then that means even if there are custom templates already created we ignore them because of the set override.
538
-				if ( ! $mtpg->get( 'MTP_is_override' ) ) {
538
+				if ( ! $mtpg->get('MTP_is_override')) {
539 539
 					//any custom templates for this message type?
540
-					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt( $this->name, $mtpg->message_type() );
541
-					foreach ( $custom_templates as $cmtpgID => $cmtpg ) {
542
-						$select_values[ $cmtpgID ] = $cmtpg->name();
543
-						$default_value = array_key_exists( $cmtpgID, $templates_for_event ) ? $cmtpgID : $default_value;
540
+					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt($this->name, $mtpg->message_type());
541
+					foreach ($custom_templates as $cmtpgID => $cmtpg) {
542
+						$select_values[$cmtpgID] = $cmtpg->name();
543
+						$default_value = array_key_exists($cmtpgID, $templates_for_event) ? $cmtpgID : $default_value;
544 544
 					}
545 545
 				}
546 546
 				//if there is no $default_value then we set it as the global
547
-				$default_value = empty( $default_value ) ? $mtpgID : $default_value;
548
-				$edit_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value ), admin_url( 'admin.php' ) );
549
-				$create_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value ), admin_url( 'admin.php' ) );
550
-				$st_args[ 'mt_name' ] = ucwords( $mtp_obj->label[ 'singular' ] );
551
-				$st_args[ 'mt_slug' ] = $mtpg->message_type();
552
-				$st_args[ 'messenger_slug' ] = $this->name;
553
-				$st_args[ 'selector' ] = EEH_Form_Fields::select_input( 'event_message_templates_relation[' . $mtpgID . ']', $select_values, $default_value, 'data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '"', 'message-template-selector' );
547
+				$default_value = empty($default_value) ? $mtpgID : $default_value;
548
+				$edit_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value), admin_url('admin.php'));
549
+				$create_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value), admin_url('admin.php'));
550
+				$st_args['mt_name'] = ucwords($mtp_obj->label['singular']);
551
+				$st_args['mt_slug'] = $mtpg->message_type();
552
+				$st_args['messenger_slug'] = $this->name;
553
+				$st_args['selector'] = EEH_Form_Fields::select_input('event_message_templates_relation['.$mtpgID.']', $select_values, $default_value, 'data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'"', 'message-template-selector');
554 554
 				//note that  message template group that has override_all_custom set will remove the ability to set a custom message template based off of the global (and that also in turn overrides any other custom templates).
555
-				$st_args[ 'create_button' ] = $mtpg->get( 'MTP_is_override' ) ? '' : '<a data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $create_url . '" class="button button-small create-mtpg-button">' . __( 'Create New Custom', 'event_espresso' ) . '</a>';
556
-				$st_args[ 'create_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ? $st_args[ 'create_button' ] : '';
557
-				$st_args[ 'edit_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID ) ? '<a data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $edit_url . '" class="button button-small edit-mtpg-button">' . __( 'Edit', 'event_espresso' ) . '</a>' : '';
558
-				$selector_rows .= EEH_Template::display_template( $template_row_path, $st_args, true );
555
+				$st_args['create_button'] = $mtpg->get('MTP_is_override') ? '' : '<a data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$create_url.'" class="button button-small create-mtpg-button">'.__('Create New Custom', 'event_espresso').'</a>';
556
+				$st_args['create_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template') ? $st_args['create_button'] : '';
557
+				$st_args['edit_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID) ? '<a data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$edit_url.'" class="button button-small edit-mtpg-button">'.__('Edit', 'event_espresso').'</a>' : '';
558
+				$selector_rows .= EEH_Template::display_template($template_row_path, $st_args, true);
559 559
 			}
560 560
 		}
561 561
 
562 562
 		//if no selectors present then get out.
563
-		if ( empty( $selector_rows ) ) {
563
+		if (empty($selector_rows)) {
564 564
 			return '';
565 565
 		}
566 566
 
567 567
 		$template_args['selector_rows'] = $selector_rows;
568
-		return EEH_Template::display_template( $template_wrapper_path, $template_args, TRUE );
568
+		return EEH_Template::display_template($template_wrapper_path, $template_args, TRUE);
569 569
 	}
570 570
 
571 571
 
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
 	 * @return array $this->_template_fields
581 581
 	 */
582 582
 	public function get_template_fields() {
583
-		$template_fields = apply_filters( 'FHEE__' . get_class($this) . '__get_template_fields', $this->_template_fields, $this );
584
-		$template_fields = apply_filters( 'FHEE__EE_messenger__get_template_fields', $template_fields, $this );
583
+		$template_fields = apply_filters('FHEE__'.get_class($this).'__get_template_fields', $this->_template_fields, $this);
584
+		$template_fields = apply_filters('FHEE__EE_messenger__get_template_fields', $template_fields, $this);
585 585
 		return $template_fields;
586 586
 	}
587 587
 
@@ -595,9 +595,9 @@  discard block
 block discarded – undo
595 595
 	 * @param mixed $value
596 596
 	 */
597 597
 	protected function _set_template_value($item, $value) {
598
-		if ( array_key_exists($item, $this->_template_fields) ) {
599
-			$prop = '_' . $item;
600
-			$this->{$prop}= $value;
598
+		if (array_key_exists($item, $this->_template_fields)) {
599
+			$prop = '_'.$item;
600
+			$this->{$prop} = $value;
601 601
 		}
602 602
 	}
603 603
 
@@ -615,18 +615,18 @@  discard block
 block discarded – undo
615 615
 	 *
616 616
 	 * @throws SendMessageException
617 617
 	 */
618
-	final public function send_message( $message, EE_message_type $message_type ) {
618
+	final public function send_message($message, EE_message_type $message_type) {
619 619
 		try {
620
-			$this->_validate_and_setup( $message );
620
+			$this->_validate_and_setup($message);
621 621
 			$this->_incoming_message_type = $message_type;
622 622
 			$response = $this->_send_message();
623
-			if ( $response instanceof WP_Error ) {
624
-				EE_Error::add_error( $response->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
623
+			if ($response instanceof WP_Error) {
624
+				EE_Error::add_error($response->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
625 625
 				$response = false;
626 626
 			}
627
-		} catch ( \Exception $e ) {
627
+		} catch (\Exception $e) {
628 628
 			//convert to an instance of SendMessageException
629
-			throw new SendMessageException( $e->getMessage() );
629
+			throw new SendMessageException($e->getMessage());
630 630
 		}
631 631
 		return $response;
632 632
 	}
@@ -640,28 +640,28 @@  discard block
 block discarded – undo
640 640
 	 * @param  bool   $send    true we will actually use the _send method (for test sends). FALSE we just return preview
641 641
 	 * @return string          return the message html content
642 642
 	 */
643
-	public function get_preview( EE_Message $message, EE_message_type $message_type, $send = false ) {
644
-		$this->_validate_and_setup( $message );
643
+	public function get_preview(EE_Message $message, EE_message_type $message_type, $send = false) {
644
+		$this->_validate_and_setup($message);
645 645
 
646 646
 		$this->_incoming_message_type = $message_type;
647 647
 
648
-		if ( $send ) {
648
+		if ($send) {
649 649
 			//are we overriding any existing template fields?
650 650
 			$settings = $this->get_existing_test_settings();
651
-			if ( ! empty( $settings ) ) {
652
-				foreach ( $settings as $field => $value ) {
653
-					$this->_set_template_value( $field, $value );
651
+			if ( ! empty($settings)) {
652
+				foreach ($settings as $field => $value) {
653
+					$this->_set_template_value($field, $value);
654 654
 				}
655 655
 			}
656 656
 		}
657 657
 
658 658
 		//enqueue preview js so that any links/buttons on the page are disabled.
659
-		if ( ! $send ) {
659
+		if ( ! $send) {
660 660
 			// the below may seem like duplication.  However, typically if a messenger enqueues scripts/styles,
661 661
 			// it deregisters all existing wp scripts and styles first.  So the second hook ensures our previewer still gets setup.
662
-			add_action( 'admin_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
663
-			add_action( 'wp_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
664
-			add_action( 'AHEE__EE_messenger__enqueue_scripts_styles', array( $this, 'add_preview_script' ), 10 );
662
+			add_action('admin_enqueue_scripts', array($this, 'add_preview_script'), 10);
663
+			add_action('wp_enqueue_scripts', array($this, 'add_preview_script'), 10);
664
+			add_action('AHEE__EE_messenger__enqueue_scripts_styles', array($this, 'add_preview_script'), 10);
665 665
 		}
666 666
 
667 667
 		return $send ? $this->_send_message() : $this->_preview();
@@ -679,10 +679,10 @@  discard block
 block discarded – undo
679 679
 	 */
680 680
 	public function add_preview_script() {
681 681
 		//error message
682
-		EE_Registry::$i18n_js_strings[ 'links_disabled' ] = __( 'All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso' );
683
-		wp_register_script( 'ee-messages-preview-js', EE_LIBRARIES_URL . 'messages/messenger/assets/js/ee-messages-preview.js', array( 'jquery' ), EVENT_ESPRESSO_VERSION, true );
684
-		wp_localize_script( 'ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings );
685
-		wp_enqueue_script( 'ee-messages-preview-js' );
682
+		EE_Registry::$i18n_js_strings['links_disabled'] = __('All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso');
683
+		wp_register_script('ee-messages-preview-js', EE_LIBRARIES_URL.'messages/messenger/assets/js/ee-messages-preview.js', array('jquery'), EVENT_ESPRESSO_VERSION, true);
684
+		wp_localize_script('ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings);
685
+		wp_enqueue_script('ee-messages-preview-js');
686 686
 	}
687 687
 
688 688
 
@@ -693,13 +693,13 @@  discard block
 block discarded – undo
693 693
 	 * @param  EE_Message $message
694 694
 	 * @throws EE_Error
695 695
 	 */
696
-	protected function _validate_and_setup( EE_Message $message ) {
696
+	protected function _validate_and_setup(EE_Message $message) {
697 697
 		$template_pack = $message->get_template_pack();
698 698
 		$variation = $message->get_template_pack_variation();
699 699
 
700 700
 		//verify we have the required template pack value on the $message object.
701
-		if ( ! $template_pack instanceof EE_Messages_Template_Pack ) {
702
-			throw new EE_Error( __('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso' ) );
701
+		if ( ! $template_pack instanceof EE_Messages_Template_Pack) {
702
+			throw new EE_Error(__('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso'));
703 703
 		}
704 704
 
705 705
 		$this->_tmp_pack = $template_pack;
@@ -708,11 +708,11 @@  discard block
 block discarded – undo
708 708
 
709 709
 		$template_fields = $this->get_template_fields();
710 710
 
711
-		foreach ( $template_fields as $template => $value ) {
712
-			if ( $template !== 'extra' ) {
713
-				$column_value = $message->get_field_or_extra_meta( 'MSG_' . $template );
711
+		foreach ($template_fields as $template => $value) {
712
+			if ($template !== 'extra') {
713
+				$column_value = $message->get_field_or_extra_meta('MSG_'.$template);
714 714
 				$message_template_value = $column_value ? $column_value : null;
715
-				$this->_set_template_value( $template, $message_template_value );
715
+				$this->_set_template_value($template, $message_template_value);
716 716
 			}
717 717
 		}
718 718
 	}
@@ -727,19 +727,19 @@  discard block
 block discarded – undo
727 727
 	 * @return string
728 728
 	 * @throws \EE_Error
729 729
 	 */
730
-	protected function _get_main_template( $preview = FALSE ) {
730
+	protected function _get_main_template($preview = FALSE) {
731 731
 		$type = $preview ? 'preview' : 'main';
732 732
 
733
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type );
733
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, $type);
734 734
 
735 735
 		//check file exists and is readable
736
-		if ( !is_readable( $wrapper_template ) )
737
-			throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) );
736
+		if ( ! is_readable($wrapper_template))
737
+			throw new EE_Error(sprintf(__('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso'), ucwords($this->label['singular']), $wrapper_template));
738 738
 
739 739
 		//add message type to template args
740 740
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
741 741
 
742
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE );
742
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE);
743 743
 	}
744 744
 
745 745
 
@@ -775,9 +775,9 @@  discard block
 block discarded – undo
775 775
 	 */
776 776
 	public function get_existing_test_settings() {
777 777
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
778
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
778
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
779 779
 		$settings = $Message_Resource_Manager->get_active_messengers_option();
780
-		return isset( $settings[ $this->name ]['test_settings'] ) ? $settings[ $this->name ]['test_settings'] : array();
780
+		return isset($settings[$this->name]['test_settings']) ? $settings[$this->name]['test_settings'] : array();
781 781
 	}
782 782
 
783 783
 
@@ -789,12 +789,12 @@  discard block
 block discarded – undo
789 789
 	 * @param $settings
790 790
 	 * @return bool success/fail
791 791
 	 */
792
-	public function set_existing_test_settings( $settings ) {
792
+	public function set_existing_test_settings($settings) {
793 793
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
794
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
794
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
795 795
 		$existing = $Message_Resource_Manager->get_active_messengers_option();
796
-		$existing[ $this->name ]['test_settings'] = $settings;
797
-		return $Message_Resource_Manager->update_active_messengers_option( $existing );
796
+		$existing[$this->name]['test_settings'] = $settings;
797
+		return $Message_Resource_Manager->update_active_messengers_option($existing);
798 798
 	}
799 799
 
800 800
 
@@ -807,21 +807,21 @@  discard block
 block discarded – undo
807 807
 	 * @param string $field The field to retrieve the label for
808 808
 	 * @return string        	  The label
809 809
 	 */
810
-	public function get_field_label( $field ) {
810
+	public function get_field_label($field) {
811 811
 		//first let's see if the field requests is in the top level array.
812
-		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) )
812
+		if (isset($this->_template_fields[$field]) && ! empty($this->_template_fields[$field]['label']))
813 813
 			return $this->_template[$field]['label'];
814 814
 
815 815
 		//nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index.
816
-		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  )
816
+		if (isset($this->_template_fields['extra']) && ! empty($this->_template_fields['extra'][$field]) && ! empty($this->_template_fields['extra'][$field]['main']['label']))
817 817
 			return $this->_template_fields['extra'][$field]['main']['label'];
818 818
 
819 819
 		//now it's possible this field may just be existing in any of the extra array items.
820
-		if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) {
821
-			foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) {
822
-				if ( !is_array( $subfields ) )
820
+		if ( ! empty($this->_template_fields['extra']) && is_array($this->_template_fields['extra'])) {
821
+			foreach ($this->_template_fields['extra'] as $main_field => $subfields) {
822
+				if ( ! is_array($subfields))
823 823
 					continue;
824
-				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) )
824
+				if (isset($subfields[$field]) && ! empty($subfields[$field]['label']))
825 825
 					return $subfields[$field]['label'];
826 826
 			}
827 827
 		}
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 	 *
843 843
 	 * @return void
844 844
 	 */
845
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
845
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
846 846
 		return;
847 847
 	}
848 848
 
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 	 * This just returns whatever is set as the _event object property
1322 1322
 	 *
1323 1323
 	 * //todo this will become obsolete once the models are in place
1324
-	 * @return object
1324
+	 * @return EE_Event
1325 1325
 	 */
1326 1326
 	public function get_event_object() {
1327 1327
 		return $this->_cpt_model_obj;
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
 
2199 2199
 
2200 2200
 	/**
2201
-	 * @return mixed
2201
+	 * @return string
2202 2202
 	 */
2203 2203
 	protected function _category_details_content() {
2204 2204
 		$editor_args['category_desc'] = array(
Please login to merge, or discard this patch.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -829,11 +829,11 @@  discard block
 block discarded – undo
829 829
 		if ( ! empty( $id ) ) {
830 830
 			$post = get_post( $id );
831 831
 			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'
832
-			           . esc_html__( 'Shortcode', 'event_espresso' )
833
-			           . '</a> ';
832
+					   . esc_html__( 'Shortcode', 'event_espresso' )
833
+					   . '</a> ';
834 834
 			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='
835
-			           . $post->ID
836
-			           . ']">';
835
+					   . $post->ID
836
+					   . ']">';
837 837
 		}
838 838
 		return $return;
839 839
 	}
@@ -1045,8 +1045,8 @@  discard block
 block discarded – undo
1045 1045
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
1046 1046
 			if ( ! empty( $dtt['DTT_ID'] ) ) {
1047 1047
 				$DTM = EE_Registry::instance()
1048
-				                  ->load_model( 'Datetime', array( $evtobj->get_timezone() ) )
1049
-				                  ->get_one_by_ID( $dtt['DTT_ID'] );
1048
+								  ->load_model( 'Datetime', array( $evtobj->get_timezone() ) )
1049
+								  ->get_one_by_ID( $dtt['DTT_ID'] );
1050 1050
 				$DTM->set_date_format( $incoming_date_formats[0] );
1051 1051
 				$DTM->set_time_format( $incoming_date_formats[1] );
1052 1052
 				foreach ( $datetime_values as $field => $value ) {
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 					) > 0 ? true : false;
1145 1145
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1146 1146
 					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' )
1147
-					                  && ! $TKT->get(
1147
+									  && ! $TKT->get(
1148 1148
 						'TKT_deleted'
1149 1149
 					) ? true : false;
1150 1150
 					$TKT->set_date_format( $incoming_date_formats[0] );
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 		$first_datetime = reset( $times );
1455 1455
 		//do we get related tickets?
1456 1456
 		if ( $first_datetime instanceof EE_Datetime
1457
-		     && $first_datetime->ID() !== 0
1457
+			 && $first_datetime->ID() !== 0
1458 1458
 		) {
1459 1459
 			$existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' );
1460 1460
 			$template_args['time'] = $first_datetime;
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1530 1530
 			'TKT_sold'            => $skeleton ? 0 : $ticket->get( 'TKT_sold' ),
1531 1531
 			'trash_icon'          => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) )
1532
-			                         && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 )
1532
+									 && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 )
1533 1533
 				? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1534 1534
 			'disabled'            => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? ''
1535 1535
 				: ' disabled=disabled',
@@ -1695,8 +1695,8 @@  discard block
 block discarded – undo
1695 1695
 			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1696 1696
 			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1697 1697
 			$end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) )
1698
-			                ->setTime( 23, 59, 59 )
1699
-			                ->format( implode( ' ', $start_formats ) );
1698
+							->setTime( 23, 59, 59 )
1699
+							->format( implode( ' ', $start_formats ) );
1700 1700
 			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1701 1701
 		}
1702 1702
 		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
 		}
1717 1717
 		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1718 1718
 			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id()
1719
-			     && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' )
1719
+				 && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' )
1720 1720
 			) {
1721 1721
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1722 1722
 			}
@@ -2213,13 +2213,13 @@  discard block
 block discarded – undo
2213 2213
 	protected function _template_settings() {
2214 2214
 		$this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' );
2215 2215
 		$this->_template_args['preview_img'] = '<img src="'
2216
-		                                       . EVENTS_ASSETS_URL
2217
-		                                       . DS
2218
-		                                       . 'images'
2219
-		                                       . DS
2220
-		                                       . 'caffeinated_template_features.jpg" alt="'
2221
-		                                       . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' )
2222
-		                                       . '" />';
2216
+											   . EVENTS_ASSETS_URL
2217
+											   . DS
2218
+											   . 'images'
2219
+											   . DS
2220
+											   . 'caffeinated_template_features.jpg" alt="'
2221
+											   . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' )
2222
+											   . '" />';
2223 2223
 		$this->_template_args['preview_text'] = '<strong>' . esc_html__(
2224 2224
 				'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.',
2225 2225
 				'event_espresso'
Please login to merge, or discard this patch.
Spacing   +591 added lines, -591 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'NO direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		);
64 64
 		add_action(
65 65
 			'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object',
66
-			array( $this, 'verify_event_edit' )
66
+			array($this, 'verify_event_edit')
67 67
 		);
68 68
 	}
69 69
 
@@ -79,22 +79,22 @@  discard block
 block discarded – undo
79 79
 		$this->_admin_page_title = EVENTS_LABEL;
80 80
 		$this->_labels = array(
81 81
 			'buttons'      => array(
82
-				'add'             => esc_html__( 'Add New Event', 'event_espresso' ),
83
-				'edit'            => esc_html__( 'Edit Event', 'event_espresso' ),
84
-				'delete'          => esc_html__( 'Delete Event', 'event_espresso' ),
85
-				'add_category'    => esc_html__( 'Add New Category', 'event_espresso' ),
86
-				'edit_category'   => esc_html__( 'Edit Category', 'event_espresso' ),
87
-				'delete_category' => esc_html__( 'Delete Category', 'event_espresso' ),
82
+				'add'             => esc_html__('Add New Event', 'event_espresso'),
83
+				'edit'            => esc_html__('Edit Event', 'event_espresso'),
84
+				'delete'          => esc_html__('Delete Event', 'event_espresso'),
85
+				'add_category'    => esc_html__('Add New Category', 'event_espresso'),
86
+				'edit_category'   => esc_html__('Edit Category', 'event_espresso'),
87
+				'delete_category' => esc_html__('Delete Category', 'event_espresso'),
88 88
 			),
89 89
 			'editor_title' => array(
90
-				'espresso_events' => esc_html__( 'Enter event title here', 'event_espresso' ),
90
+				'espresso_events' => esc_html__('Enter event title here', 'event_espresso'),
91 91
 			),
92 92
 			'publishbox'   => array(
93
-				'create_new'        => esc_html__( 'Save New Event', 'event_espresso' ),
94
-				'edit'              => esc_html__( 'Update Event', 'event_espresso' ),
95
-				'add_category'      => esc_html__( 'Save New Category', 'event_espresso' ),
96
-				'edit_category'     => esc_html__( 'Update Category', 'event_espresso' ),
97
-				'template_settings' => esc_html__( 'Update Settings', 'event_espresso' ),
93
+				'create_new'        => esc_html__('Save New Event', 'event_espresso'),
94
+				'edit'              => esc_html__('Update Event', 'event_espresso'),
95
+				'add_category'      => esc_html__('Save New Category', 'event_espresso'),
96
+				'edit_category'     => esc_html__('Update Category', 'event_espresso'),
97
+				'template_settings' => esc_html__('Update Settings', 'event_espresso'),
98 98
 			),
99 99
 		);
100 100
 	}
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 		//load formatter helper
106 106
 		//load field generator helper
107 107
 		//is there a evt_id in the request?
108
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] )
108
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID'])
109 109
 			? $this->_req_data['EVT_ID'] : 0;
110
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
110
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
111 111
 		$this->_page_routes = array(
112 112
 			'default'                       => array(
113 113
 				'func'       => '_events_overview_list_table',
@@ -130,27 +130,27 @@  discard block
 block discarded – undo
130 130
 			),
131 131
 			'trash_event'                   => array(
132 132
 				'func'       => '_trash_or_restore_event',
133
-				'args'       => array( 'event_status' => 'trash' ),
133
+				'args'       => array('event_status' => 'trash'),
134 134
 				'capability' => 'ee_delete_event',
135 135
 				'obj_id'     => $evt_id,
136 136
 				'noheader'   => true,
137 137
 			),
138 138
 			'trash_events'                  => array(
139 139
 				'func'       => '_trash_or_restore_events',
140
-				'args'       => array( 'event_status' => 'trash' ),
140
+				'args'       => array('event_status' => 'trash'),
141 141
 				'capability' => 'ee_delete_events',
142 142
 				'noheader'   => true,
143 143
 			),
144 144
 			'restore_event'                 => array(
145 145
 				'func'       => '_trash_or_restore_event',
146
-				'args'       => array( 'event_status' => 'draft' ),
146
+				'args'       => array('event_status' => 'draft'),
147 147
 				'capability' => 'ee_delete_event',
148 148
 				'obj_id'     => $evt_id,
149 149
 				'noheader'   => true,
150 150
 			),
151 151
 			'restore_events'                => array(
152 152
 				'func'       => '_trash_or_restore_events',
153
-				'args'       => array( 'event_status' => 'draft' ),
153
+				'args'       => array('event_status' => 'draft'),
154 154
 				'capability' => 'ee_delete_events',
155 155
 				'noheader'   => true,
156 156
 			),
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
 			'add_category'                  => array(
187 187
 				'func'       => '_category_details',
188 188
 				'capability' => 'ee_edit_event_category',
189
-				'args'       => array( 'add' ),
189
+				'args'       => array('add'),
190 190
 			),
191 191
 			'edit_category'                 => array(
192 192
 				'func'       => '_category_details',
193 193
 				'capability' => 'ee_edit_event_category',
194
-				'args'       => array( 'edit' ),
194
+				'args'       => array('edit'),
195 195
 			),
196 196
 			'delete_categories'             => array(
197 197
 				'func'       => '_delete_categories',
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
 			),
206 206
 			'insert_category' => array(
207 207
 				'func'       => '_insert_or_update_category',
208
-				'args'       => array( 'new_category' => true ),
208
+				'args'       => array('new_category' => true),
209 209
 				'capability' => 'ee_edit_event_category',
210 210
 				'noheader'   => true,
211 211
 			),
212 212
 			'update_category' => array(
213 213
 				'func'       => '_insert_or_update_category',
214
-				'args'       => array( 'new_category' => false ),
214
+				'args'       => array('new_category' => false),
215 215
 				'capability' => 'ee_edit_event_category',
216 216
 				'noheader'   => true,
217 217
 			),
@@ -228,29 +228,29 @@  discard block
 block discarded – undo
228 228
 		$this->_page_config = array(
229 229
 			'default'                => array(
230 230
 				'nav'           => array(
231
-					'label' => esc_html__( 'Overview', 'event_espresso' ),
231
+					'label' => esc_html__('Overview', 'event_espresso'),
232 232
 					'order' => 10,
233 233
 				),
234 234
 				'list_table'    => 'Events_Admin_List_Table',
235 235
 				'help_tabs'     => array(
236 236
 					'events_overview_help_tab'                       => array(
237
-						'title'    => esc_html__( 'Events Overview', 'event_espresso' ),
237
+						'title'    => esc_html__('Events Overview', 'event_espresso'),
238 238
 						'filename' => 'events_overview',
239 239
 					),
240 240
 					'events_overview_table_column_headings_help_tab' => array(
241
-						'title'    => esc_html__( 'Events Overview Table Column Headings', 'event_espresso' ),
241
+						'title'    => esc_html__('Events Overview Table Column Headings', 'event_espresso'),
242 242
 						'filename' => 'events_overview_table_column_headings',
243 243
 					),
244 244
 					'events_overview_filters_help_tab'               => array(
245
-						'title'    => esc_html__( 'Events Overview Filters', 'event_espresso' ),
245
+						'title'    => esc_html__('Events Overview Filters', 'event_espresso'),
246 246
 						'filename' => 'events_overview_filters',
247 247
 					),
248 248
 					'events_overview_view_help_tab'                  => array(
249
-						'title'    => esc_html__( 'Events Overview Views', 'event_espresso' ),
249
+						'title'    => esc_html__('Events Overview Views', 'event_espresso'),
250 250
 						'filename' => 'events_overview_views',
251 251
 					),
252 252
 					'events_overview_other_help_tab'                 => array(
253
-						'title'    => esc_html__( 'Events Overview Other', 'event_espresso' ),
253
+						'title'    => esc_html__('Events Overview Other', 'event_espresso'),
254 254
 						'filename' => 'events_overview_other',
255 255
 					),
256 256
 				),
@@ -265,218 +265,218 @@  discard block
 block discarded – undo
265 265
 			),
266 266
 			'create_new'             => array(
267 267
 				'nav'           => array(
268
-					'label'      => esc_html__( 'Add Event', 'event_espresso' ),
268
+					'label'      => esc_html__('Add Event', 'event_espresso'),
269 269
 					'order'      => 5,
270 270
 					'persistent' => false,
271 271
 				),
272
-				'metaboxes'     => array( '_register_event_editor_meta_boxes' ),
272
+				'metaboxes'     => array('_register_event_editor_meta_boxes'),
273 273
 				'help_tabs'     => array(
274 274
 					'event_editor_help_tab'                            => array(
275
-						'title'    => esc_html__( 'Event Editor', 'event_espresso' ),
275
+						'title'    => esc_html__('Event Editor', 'event_espresso'),
276 276
 						'filename' => 'event_editor',
277 277
 					),
278 278
 					'event_editor_title_richtexteditor_help_tab'       => array(
279
-						'title'    => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ),
279
+						'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
280 280
 						'filename' => 'event_editor_title_richtexteditor',
281 281
 					),
282 282
 					'event_editor_venue_details_help_tab'              => array(
283
-						'title'    => esc_html__( 'Event Venue Details', 'event_espresso' ),
283
+						'title'    => esc_html__('Event Venue Details', 'event_espresso'),
284 284
 						'filename' => 'event_editor_venue_details',
285 285
 					),
286 286
 					'event_editor_event_datetimes_help_tab'            => array(
287
-						'title'    => esc_html__( 'Event Datetimes', 'event_espresso' ),
287
+						'title'    => esc_html__('Event Datetimes', 'event_espresso'),
288 288
 						'filename' => 'event_editor_event_datetimes',
289 289
 					),
290 290
 					'event_editor_event_tickets_help_tab'              => array(
291
-						'title'    => esc_html__( 'Event Tickets', 'event_espresso' ),
291
+						'title'    => esc_html__('Event Tickets', 'event_espresso'),
292 292
 						'filename' => 'event_editor_event_tickets',
293 293
 					),
294 294
 					'event_editor_event_registration_options_help_tab' => array(
295
-						'title'    => esc_html__( 'Event Registration Options', 'event_espresso' ),
295
+						'title'    => esc_html__('Event Registration Options', 'event_espresso'),
296 296
 						'filename' => 'event_editor_event_registration_options',
297 297
 					),
298 298
 					'event_editor_tags_categories_help_tab'            => array(
299
-						'title'    => esc_html__( 'Event Tags & Categories', 'event_espresso' ),
299
+						'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
300 300
 						'filename' => 'event_editor_tags_categories',
301 301
 					),
302 302
 					'event_editor_questions_registrants_help_tab'      => array(
303
-						'title'    => esc_html__( 'Questions for Registrants', 'event_espresso' ),
303
+						'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
304 304
 						'filename' => 'event_editor_questions_registrants',
305 305
 					),
306 306
 					'event_editor_save_new_event_help_tab'             => array(
307
-						'title'    => esc_html__( 'Save New Event', 'event_espresso' ),
307
+						'title'    => esc_html__('Save New Event', 'event_espresso'),
308 308
 						'filename' => 'event_editor_save_new_event',
309 309
 					),
310 310
 					'event_editor_other_help_tab'                      => array(
311
-						'title'    => esc_html__( 'Event Other', 'event_espresso' ),
311
+						'title'    => esc_html__('Event Other', 'event_espresso'),
312 312
 						'filename' => 'event_editor_other',
313 313
 					),
314 314
 				),
315 315
 				'help_tour'     => array(
316 316
 					'Event_Editor_Help_Tour',
317 317
 				),
318
-				'qtips'         => array( 'EE_Event_Editor_Decaf_Tips' ),
318
+				'qtips'         => array('EE_Event_Editor_Decaf_Tips'),
319 319
 				'require_nonce' => false,
320 320
 			),
321 321
 			'edit'                   => array(
322 322
 				'nav'           => array(
323
-					'label'      => esc_html__( 'Edit Event', 'event_espresso' ),
323
+					'label'      => esc_html__('Edit Event', 'event_espresso'),
324 324
 					'order'      => 5,
325 325
 					'persistent' => false,
326
-					'url'        => isset( $this->_req_data['post'] )
326
+					'url'        => isset($this->_req_data['post'])
327 327
 						? EE_Admin_Page::add_query_args_and_nonce(
328
-							array( 'post' => $this->_req_data['post'], 'action' => 'edit' ),
328
+							array('post' => $this->_req_data['post'], 'action' => 'edit'),
329 329
 							$this->_current_page_view_url
330 330
 						)
331 331
 						: $this->_admin_base_url,
332 332
 				),
333
-				'metaboxes'     => array( '_register_event_editor_meta_boxes' ),
333
+				'metaboxes'     => array('_register_event_editor_meta_boxes'),
334 334
 				'help_tabs'     => array(
335 335
 					'event_editor_help_tab'                            => array(
336
-						'title'    => esc_html__( 'Event Editor', 'event_espresso' ),
336
+						'title'    => esc_html__('Event Editor', 'event_espresso'),
337 337
 						'filename' => 'event_editor',
338 338
 					),
339 339
 					'event_editor_title_richtexteditor_help_tab'       => array(
340
-						'title'    => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ),
340
+						'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
341 341
 						'filename' => 'event_editor_title_richtexteditor',
342 342
 					),
343 343
 					'event_editor_venue_details_help_tab'              => array(
344
-						'title'    => esc_html__( 'Event Venue Details', 'event_espresso' ),
344
+						'title'    => esc_html__('Event Venue Details', 'event_espresso'),
345 345
 						'filename' => 'event_editor_venue_details',
346 346
 					),
347 347
 					'event_editor_event_datetimes_help_tab'            => array(
348
-						'title'    => esc_html__( 'Event Datetimes', 'event_espresso' ),
348
+						'title'    => esc_html__('Event Datetimes', 'event_espresso'),
349 349
 						'filename' => 'event_editor_event_datetimes',
350 350
 					),
351 351
 					'event_editor_event_tickets_help_tab'              => array(
352
-						'title'    => esc_html__( 'Event Tickets', 'event_espresso' ),
352
+						'title'    => esc_html__('Event Tickets', 'event_espresso'),
353 353
 						'filename' => 'event_editor_event_tickets',
354 354
 					),
355 355
 					'event_editor_event_registration_options_help_tab' => array(
356
-						'title'    => esc_html__( 'Event Registration Options', 'event_espresso' ),
356
+						'title'    => esc_html__('Event Registration Options', 'event_espresso'),
357 357
 						'filename' => 'event_editor_event_registration_options',
358 358
 					),
359 359
 					'event_editor_tags_categories_help_tab'            => array(
360
-						'title'    => esc_html__( 'Event Tags & Categories', 'event_espresso' ),
360
+						'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
361 361
 						'filename' => 'event_editor_tags_categories',
362 362
 					),
363 363
 					'event_editor_questions_registrants_help_tab'      => array(
364
-						'title'    => esc_html__( 'Questions for Registrants', 'event_espresso' ),
364
+						'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
365 365
 						'filename' => 'event_editor_questions_registrants',
366 366
 					),
367 367
 					'event_editor_save_new_event_help_tab'             => array(
368
-						'title'    => esc_html__( 'Save New Event', 'event_espresso' ),
368
+						'title'    => esc_html__('Save New Event', 'event_espresso'),
369 369
 						'filename' => 'event_editor_save_new_event',
370 370
 					),
371 371
 					'event_editor_other_help_tab'                      => array(
372
-						'title'    => esc_html__( 'Event Other', 'event_espresso' ),
372
+						'title'    => esc_html__('Event Other', 'event_espresso'),
373 373
 						'filename' => 'event_editor_other',
374 374
 					),
375 375
 				),
376 376
 				/*'help_tour' => array(
377 377
 					'Event_Edit_Help_Tour'
378 378
 				),*/
379
-				'qtips'         => array( 'EE_Event_Editor_Decaf_Tips' ),
379
+				'qtips'         => array('EE_Event_Editor_Decaf_Tips'),
380 380
 				'require_nonce' => false,
381 381
 			),
382 382
 			'default_event_settings' => array(
383 383
 				'nav'           => array(
384
-					'label' => esc_html__( 'Default Settings', 'event_espresso' ),
384
+					'label' => esc_html__('Default Settings', 'event_espresso'),
385 385
 					'order' => 40,
386 386
 				),
387
-				'metaboxes'     => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
387
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
388 388
 				'labels'        => array(
389
-					'publishbox' => esc_html__( 'Update Settings', 'event_espresso' ),
389
+					'publishbox' => esc_html__('Update Settings', 'event_espresso'),
390 390
 				),
391 391
 				'help_tabs'     => array(
392 392
 					'default_settings_help_tab'        => array(
393
-						'title'    => esc_html__( 'Default Event Settings', 'event_espresso' ),
393
+						'title'    => esc_html__('Default Event Settings', 'event_espresso'),
394 394
 						'filename' => 'events_default_settings',
395 395
 					),
396 396
 					'default_settings_status_help_tab' => array(
397
-						'title'    => esc_html__( 'Default Registration Status', 'event_espresso' ),
397
+						'title'    => esc_html__('Default Registration Status', 'event_espresso'),
398 398
 						'filename' => 'events_default_settings_status',
399 399
 					),
400 400
 				),
401
-				'help_tour'     => array( 'Event_Default_Settings_Help_Tour' ),
401
+				'help_tour'     => array('Event_Default_Settings_Help_Tour'),
402 402
 				'require_nonce' => false,
403 403
 			),
404 404
 			//template settings
405 405
 			'template_settings'      => array(
406 406
 				'nav'           => array(
407
-					'label' => esc_html__( 'Templates', 'event_espresso' ),
407
+					'label' => esc_html__('Templates', 'event_espresso'),
408 408
 					'order' => 30,
409 409
 				),
410 410
 				'metaboxes'     => $this->_default_espresso_metaboxes,
411 411
 				'help_tabs'     => array(
412 412
 					'general_settings_templates_help_tab' => array(
413
-						'title'    => esc_html__( 'Templates', 'event_espresso' ),
413
+						'title'    => esc_html__('Templates', 'event_espresso'),
414 414
 						'filename' => 'general_settings_templates',
415 415
 					),
416 416
 				),
417
-				'help_tour'     => array( 'Templates_Help_Tour' ),
417
+				'help_tour'     => array('Templates_Help_Tour'),
418 418
 				'require_nonce' => false,
419 419
 			),
420 420
 			//event category stuff
421 421
 			'add_category'           => array(
422 422
 				'nav'           => array(
423
-					'label'      => esc_html__( 'Add Category', 'event_espresso' ),
423
+					'label'      => esc_html__('Add Category', 'event_espresso'),
424 424
 					'order'      => 15,
425 425
 					'persistent' => false,
426 426
 				),
427 427
 				'help_tabs'     => array(
428 428
 					'add_category_help_tab' => array(
429
-						'title'    => esc_html__( 'Add New Event Category', 'event_espresso' ),
429
+						'title'    => esc_html__('Add New Event Category', 'event_espresso'),
430 430
 						'filename' => 'events_add_category',
431 431
 					),
432 432
 				),
433
-				'help_tour'     => array( 'Event_Add_Category_Help_Tour' ),
434
-				'metaboxes'     => array( '_publish_post_box' ),
433
+				'help_tour'     => array('Event_Add_Category_Help_Tour'),
434
+				'metaboxes'     => array('_publish_post_box'),
435 435
 				'require_nonce' => false,
436 436
 			),
437 437
 			'edit_category'          => array(
438 438
 				'nav'           => array(
439
-					'label'      => esc_html__( 'Edit Category', 'event_espresso' ),
439
+					'label'      => esc_html__('Edit Category', 'event_espresso'),
440 440
 					'order'      => 15,
441 441
 					'persistent' => false,
442
-					'url'        => isset( $this->_req_data['EVT_CAT_ID'] )
442
+					'url'        => isset($this->_req_data['EVT_CAT_ID'])
443 443
 						? add_query_arg(
444
-							array( 'EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ),
444
+							array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']),
445 445
 							$this->_current_page_view_url
446 446
 						)
447 447
 						: $this->_admin_base_url,
448 448
 				),
449 449
 				'help_tabs'     => array(
450 450
 					'edit_category_help_tab' => array(
451
-						'title'    => esc_html__( 'Edit Event Category', 'event_espresso' ),
451
+						'title'    => esc_html__('Edit Event Category', 'event_espresso'),
452 452
 						'filename' => 'events_edit_category',
453 453
 					),
454 454
 				),
455 455
 				/*'help_tour' => array('Event_Edit_Category_Help_Tour'),*/
456
-				'metaboxes'     => array( '_publish_post_box' ),
456
+				'metaboxes'     => array('_publish_post_box'),
457 457
 				'require_nonce' => false,
458 458
 			),
459 459
 			'category_list'          => array(
460 460
 				'nav'           => array(
461
-					'label' => esc_html__( 'Categories', 'event_espresso' ),
461
+					'label' => esc_html__('Categories', 'event_espresso'),
462 462
 					'order' => 20,
463 463
 				),
464 464
 				'list_table'    => 'Event_Categories_Admin_List_Table',
465 465
 				'help_tabs'     => array(
466 466
 					'events_categories_help_tab'                       => array(
467
-						'title'    => esc_html__( 'Event Categories', 'event_espresso' ),
467
+						'title'    => esc_html__('Event Categories', 'event_espresso'),
468 468
 						'filename' => 'events_categories',
469 469
 					),
470 470
 					'events_categories_table_column_headings_help_tab' => array(
471
-						'title'    => esc_html__( 'Event Categories Table Column Headings', 'event_espresso' ),
471
+						'title'    => esc_html__('Event Categories Table Column Headings', 'event_espresso'),
472 472
 						'filename' => 'events_categories_table_column_headings',
473 473
 					),
474 474
 					'events_categories_view_help_tab'                  => array(
475
-						'title'    => esc_html__( 'Event Categories Views', 'event_espresso' ),
475
+						'title'    => esc_html__('Event Categories Views', 'event_espresso'),
476 476
 						'filename' => 'events_categories_views',
477 477
 					),
478 478
 					'events_categories_other_help_tab'                 => array(
479
-						'title'    => esc_html__( 'Event Categories Other', 'event_espresso' ),
479
+						'title'    => esc_html__('Event Categories Other', 'event_espresso'),
480 480
 						'filename' => 'events_categories_other',
481 481
 					),
482 482
 				),
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 
506 506
 	protected function _add_screen_options_category_list() {
507 507
 		$page_title = $this->_admin_page_title;
508
-		$this->_admin_page_title = esc_html__( 'Categories', 'event_espresso' );
508
+		$this->_admin_page_title = esc_html__('Categories', 'event_espresso');
509 509
 		$this->_per_page_screen_option();
510 510
 		$this->_admin_page_title = $page_title;
511 511
 	}
@@ -521,20 +521,20 @@  discard block
 block discarded – undo
521 521
 	public function load_scripts_styles() {
522 522
 		wp_register_style(
523 523
 			'events-admin-css',
524
-			EVENTS_ASSETS_URL . 'events-admin-page.css',
524
+			EVENTS_ASSETS_URL.'events-admin-page.css',
525 525
 			array(),
526 526
 			EVENT_ESPRESSO_VERSION
527 527
 		);
528
-		wp_register_style( 'ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
529
-		wp_enqueue_style( 'events-admin-css' );
530
-		wp_enqueue_style( 'ee-cat-admin' );
528
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
529
+		wp_enqueue_style('events-admin-css');
530
+		wp_enqueue_style('ee-cat-admin');
531 531
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
532 532
 		//registers for all views
533 533
 		//scripts
534 534
 		wp_register_script(
535 535
 			'event_editor_js',
536
-			EVENTS_ASSETS_URL . 'event_editor.js',
537
-			array( 'ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon' ),
536
+			EVENTS_ASSETS_URL.'event_editor.js',
537
+			array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'),
538 538
 			EVENT_ESPRESSO_VERSION,
539 539
 			true
540 540
 		);
@@ -560,22 +560,22 @@  discard block
 block discarded – undo
560 560
 	 */
561 561
 	public function load_scripts_styles_edit() {
562 562
 		//styles
563
-		wp_enqueue_style( 'espresso-ui-theme' );
563
+		wp_enqueue_style('espresso-ui-theme');
564 564
 		wp_register_style(
565 565
 			'event-editor-css',
566
-			EVENTS_ASSETS_URL . 'event-editor.css',
567
-			array( 'ee-admin-css' ),
566
+			EVENTS_ASSETS_URL.'event-editor.css',
567
+			array('ee-admin-css'),
568 568
 			EVENT_ESPRESSO_VERSION
569 569
 		);
570
-		wp_enqueue_style( 'event-editor-css' );
570
+		wp_enqueue_style('event-editor-css');
571 571
 		//scripts
572 572
 		wp_register_script(
573 573
 			'event-datetime-metabox',
574
-			EVENTS_ASSETS_URL . 'event-datetime-metabox.js',
575
-			array( 'event_editor_js', 'ee-datepicker' ),
574
+			EVENTS_ASSETS_URL.'event-datetime-metabox.js',
575
+			array('event_editor_js', 'ee-datepicker'),
576 576
 			EVENT_ESPRESSO_VERSION
577 577
 		);
578
-		wp_enqueue_script( 'event-datetime-metabox' );
578
+		wp_enqueue_script('event-datetime-metabox');
579 579
 	}
580 580
 
581 581
 
@@ -595,10 +595,10 @@  discard block
 block discarded – undo
595 595
 		$this->_views = array(
596 596
 			'all' => array(
597 597
 				'slug'        => 'all',
598
-				'label'       => esc_html__( 'All', 'event_espresso' ),
598
+				'label'       => esc_html__('All', 'event_espresso'),
599 599
 				'count'       => 0,
600 600
 				'bulk_action' => array(
601
-					'delete_categories' => esc_html__( 'Delete Permanently', 'event_espresso' ),
601
+					'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'),
602 602
 				),
603 603
 			),
604 604
 		);
@@ -634,14 +634,14 @@  discard block
 block discarded – undo
634 634
 	 * @access public
635 635
 	 * @return void
636 636
 	 */
637
-	public function verify_event_edit( $event = null ) {
637
+	public function verify_event_edit($event = null) {
638 638
 		// no event?
639
-		if ( empty( $event ) ) {
639
+		if (empty($event)) {
640 640
 			// set event
641 641
 			$event = $this->_cpt_model_obj;
642 642
 		}
643 643
 		// STILL no event?
644
-		if ( empty ( $event ) ) {
644
+		if (empty ($event)) {
645 645
 			return;
646 646
 		}
647 647
 		$orig_status = $event->status();
@@ -655,32 +655,32 @@  discard block
 block discarded – undo
655 655
 			return;
656 656
 		}
657 657
 		//made it here so it IS active... next check that any of the tickets are sold.
658
-		if ( $event->is_sold_out( true ) ) {
659
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
658
+		if ($event->is_sold_out(true)) {
659
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
660 660
 				EE_Error::add_attention(
661 661
 					sprintf(
662 662
 						esc_html__(
663 663
 							'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.',
664 664
 							'event_espresso'
665 665
 						),
666
-						EEH_Template::pretty_status( EEM_Event::sold_out, false, 'sentence' )
666
+						EEH_Template::pretty_status(EEM_Event::sold_out, false, 'sentence')
667 667
 					)
668 668
 				);
669 669
 			}
670 670
 			return;
671
-		} else if ( $orig_status === EEM_Event::sold_out ) {
671
+		} else if ($orig_status === EEM_Event::sold_out) {
672 672
 			EE_Error::add_attention(
673 673
 				sprintf(
674 674
 					esc_html__(
675 675
 						'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
676 676
 						'event_espresso'
677 677
 					),
678
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
678
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
679 679
 				)
680 680
 			);
681 681
 		}
682 682
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
683
-		if ( ! $event->tickets_on_sale() ) {
683
+		if ( ! $event->tickets_on_sale()) {
684 684
 			return;
685 685
 		}
686 686
 		//made it here so show warning
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 	 */
699 699
 	protected function _edit_event_warning() {
700 700
 		// we don't want to add warnings during these requests
701
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
701
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
702 702
 			return;
703 703
 		}
704 704
 		EE_Error::add_attention(
@@ -715,29 +715,29 @@  discard block
 block discarded – undo
715 715
 		$this->_views = array(
716 716
 			'all'   => array(
717 717
 				'slug'        => 'all',
718
-				'label'       => esc_html__( 'View All Events', 'event_espresso' ),
718
+				'label'       => esc_html__('View All Events', 'event_espresso'),
719 719
 				'count'       => 0,
720 720
 				'bulk_action' => array(
721
-					'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ),
721
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
722 722
 				),
723 723
 			),
724 724
 			'draft' => array(
725 725
 				'slug'        => 'draft',
726
-				'label'       => esc_html__( 'Draft', 'event_espresso' ),
726
+				'label'       => esc_html__('Draft', 'event_espresso'),
727 727
 				'count'       => 0,
728 728
 				'bulk_action' => array(
729
-					'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ),
729
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
730 730
 				),
731 731
 			),
732 732
 		);
733
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
733
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
734 734
 			$this->_views['trash'] = array(
735 735
 				'slug'        => 'trash',
736
-				'label'       => esc_html__( 'Trash', 'event_espresso' ),
736
+				'label'       => esc_html__('Trash', 'event_espresso'),
737 737
 				'count'       => 0,
738 738
 				'bulk_action' => array(
739
-					'restore_events' => esc_html__( 'Restore From Trash', 'event_espresso' ),
740
-					'delete_events'  => esc_html__( 'Delete Permanently', 'event_espresso' ),
739
+					'restore_events' => esc_html__('Restore From Trash', 'event_espresso'),
740
+					'delete_events'  => esc_html__('Delete Permanently', 'event_espresso'),
741 741
 				),
742 742
 			);
743 743
 		}
@@ -752,50 +752,50 @@  discard block
 block discarded – undo
752 752
 		$items = array(
753 753
 			'view_details'   => array(
754 754
 				'class' => 'dashicons dashicons-search',
755
-				'desc'  => esc_html__( 'View Event', 'event_espresso' ),
755
+				'desc'  => esc_html__('View Event', 'event_espresso'),
756 756
 			),
757 757
 			'edit_event'     => array(
758 758
 				'class' => 'ee-icon ee-icon-calendar-edit',
759
-				'desc'  => esc_html__( 'Edit Event Details', 'event_espresso' ),
759
+				'desc'  => esc_html__('Edit Event Details', 'event_espresso'),
760 760
 			),
761 761
 			'view_attendees' => array(
762 762
 				'class' => 'dashicons dashicons-groups',
763
-				'desc'  => esc_html__( 'View Registrations for Event', 'event_espresso' ),
763
+				'desc'  => esc_html__('View Registrations for Event', 'event_espresso'),
764 764
 			),
765 765
 		);
766
-		$items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
766
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
767 767
 		$statuses = array(
768 768
 			'sold_out_status'  => array(
769
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
770
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::sold_out, false, 'sentence' ),
769
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
770
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'),
771 771
 			),
772 772
 			'active_status'    => array(
773
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
774
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::active, false, 'sentence' ),
773
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
774
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'),
775 775
 			),
776 776
 			'upcoming_status'  => array(
777
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
778
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::upcoming, false, 'sentence' ),
777
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
778
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'),
779 779
 			),
780 780
 			'postponed_status' => array(
781
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
782
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::postponed, false, 'sentence' ),
781
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
782
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'),
783 783
 			),
784 784
 			'cancelled_status' => array(
785
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
786
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::cancelled, false, 'sentence' ),
785
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
786
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'),
787 787
 			),
788 788
 			'expired_status'   => array(
789
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
790
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::expired, false, 'sentence' ),
789
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
790
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'),
791 791
 			),
792 792
 			'inactive_status'  => array(
793
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
794
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::inactive, false, 'sentence' ),
793
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
794
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'),
795 795
 			),
796 796
 		);
797
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
798
-		return array_merge( $items, $statuses );
797
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
798
+		return array_merge($items, $statuses);
799 799
 	}
800 800
 
801 801
 
@@ -806,8 +806,8 @@  discard block
 block discarded – undo
806 806
 	 * @return EEM_Event
807 807
 	 */
808 808
 	private function _event_model() {
809
-		if ( ! $this->_event_model instanceof EEM_Event ) {
810
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
809
+		if ( ! $this->_event_model instanceof EEM_Event) {
810
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
811 811
 		}
812 812
 		return $this->_event_model;
813 813
 	}
@@ -824,12 +824,12 @@  discard block
 block discarded – undo
824 824
 	 * @param  string $new_slug  what the slug is
825 825
 	 * @return string            The new html string for the permalink area
826 826
 	 */
827
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
827
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
828 828
 		//make sure this is only when editing
829
-		if ( ! empty( $id ) ) {
830
-			$post = get_post( $id );
829
+		if ( ! empty($id)) {
830
+			$post = get_post($id);
831 831
 			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'
832
-			           . esc_html__( 'Shortcode', 'event_espresso' )
832
+			           . esc_html__('Shortcode', 'event_espresso')
833 833
 			           . '</a> ';
834 834
 			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='
835 835
 			           . $post->ID
@@ -848,14 +848,14 @@  discard block
 block discarded – undo
848 848
 	 * @return void
849 849
 	 */
850 850
 	protected function _events_overview_list_table() {
851
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
851
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
852 852
 		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(
853
-			get_post_type_archive_link( 'espresso_events' ),
854
-			esc_html__( "View Event Archive Page", "event_espresso" ),
853
+			get_post_type_archive_link('espresso_events'),
854
+			esc_html__("View Event Archive Page", "event_espresso"),
855 855
 			'button'
856 856
 		);
857
-		$this->_template_args['after_list_table'] .= $this->_display_legend( $this->_event_legend_items() );
858
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
857
+		$this->_template_args['after_list_table'] .= $this->_display_legend($this->_event_legend_items());
858
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
859 859
 				'create_new',
860 860
 				'add',
861 861
 				array(),
@@ -881,48 +881,48 @@  discard block
 block discarded – undo
881 881
 	 * @param string $post_id
882 882
 	 * @param object $post
883 883
 	 */
884
-	protected function _insert_update_cpt_item( $post_id, $post ) {
885
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
884
+	protected function _insert_update_cpt_item($post_id, $post) {
885
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
886 886
 			//get out we're not processing an event save.
887 887
 			return;
888 888
 		}
889 889
 		$event_values = array(
890
-			'EVT_display_desc'                => ! empty( $this->_req_data['display_desc'] ) ? 1 : 0,
891
-			'EVT_display_ticket_selector'     => ! empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
890
+			'EVT_display_desc'                => ! empty($this->_req_data['display_desc']) ? 1 : 0,
891
+			'EVT_display_ticket_selector'     => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
892 892
 			'EVT_additional_limit'            => min(
893
-				apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
894
-				! empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : null
893
+				apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
894
+				! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : null
895 895
 			),
896
-			'EVT_default_registration_status' => ! empty( $this->_req_data['EVT_default_registration_status'] )
896
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status'])
897 897
 				? $this->_req_data['EVT_default_registration_status']
898 898
 				: EE_Registry::instance()->CFG->registration->default_STS_ID,
899
-			'EVT_member_only'                 => ! empty( $this->_req_data['member_only'] ) ? 1 : 0,
900
-			'EVT_allow_overflow'              => ! empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
901
-			'EVT_timezone_string'             => ! empty( $this->_req_data['timezone_string'] )
899
+			'EVT_member_only'                 => ! empty($this->_req_data['member_only']) ? 1 : 0,
900
+			'EVT_allow_overflow'              => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
901
+			'EVT_timezone_string'             => ! empty($this->_req_data['timezone_string'])
902 902
 				? $this->_req_data['timezone_string'] : null,
903
-			'EVT_external_URL'                => ! empty( $this->_req_data['externalURL'] )
903
+			'EVT_external_URL'                => ! empty($this->_req_data['externalURL'])
904 904
 				? $this->_req_data['externalURL'] : null,
905
-			'EVT_phone'                       => ! empty( $this->_req_data['event_phone'] )
905
+			'EVT_phone'                       => ! empty($this->_req_data['event_phone'])
906 906
 				? $this->_req_data['event_phone'] : null,
907 907
 		);
908 908
 		//update event
909
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
909
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
910 910
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
911
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
912
-		$event = $this->_event_model()->get_one( array( $get_one_where ) );
911
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
912
+		$event = $this->_event_model()->get_one(array($get_one_where));
913 913
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
914 914
 		$event_update_callbacks = apply_filters(
915 915
 			'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
916
-			array( array( $this, '_default_venue_update' ), array( $this, '_default_tickets_update' ) )
916
+			array(array($this, '_default_venue_update'), array($this, '_default_tickets_update'))
917 917
 		);
918 918
 		$att_success = true;
919
-		foreach ( $event_update_callbacks as $e_callback ) {
920
-			$_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) );
919
+		foreach ($event_update_callbacks as $e_callback) {
920
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
921 921
 			$att_success = ! $att_success ? $att_success
922 922
 				: $_succ; //if ANY of these updates fail then we want the appropriate global error message
923 923
 		}
924 924
 		//any errors?
925
-		if ( $success && false === $att_success ) {
925
+		if ($success && false === $att_success) {
926 926
 			EE_Error::add_error(
927 927
 				esc_html__(
928 928
 					'Event Details saved successfully but something went wrong with saving attachments.',
@@ -932,9 +932,9 @@  discard block
 block discarded – undo
932 932
 				__FUNCTION__,
933 933
 				__LINE__
934 934
 			);
935
-		} else if ( $success === false ) {
935
+		} else if ($success === false) {
936 936
 			EE_Error::add_error(
937
-				esc_html__( 'Event Details did not save successfully.', 'event_espresso' ),
937
+				esc_html__('Event Details did not save successfully.', 'event_espresso'),
938 938
 				__FILE__,
939 939
 				__FUNCTION__,
940 940
 				__LINE__
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
 	 * @param int $post_id
950 950
 	 * @param int $revision_id
951 951
 	 */
952
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
952
+	protected function _restore_cpt_item($post_id, $revision_id) {
953 953
 		//copy existing event meta to new post
954
-		$post_evt = $this->_event_model()->get_one_by_ID( $post_id );
955
-		if ( $post_evt instanceof EE_Event ) {
954
+		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
955
+		if ($post_evt instanceof EE_Event) {
956 956
 			//meta revision restore
957
-			$post_evt->restore_revision( $revision_id );
957
+			$post_evt->restore_revision($revision_id);
958 958
 			//related objs restore
959
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
959
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
960 960
 		}
961 961
 	}
962 962
 
@@ -969,49 +969,49 @@  discard block
 block discarded – undo
969 969
 	 * @param  array     $data   The request data from the form
970 970
 	 * @return bool           Success or fail.
971 971
 	 */
972
-	protected function _default_venue_update( \EE_Event $evtobj, $data ) {
973
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
974
-		$venue_model = EE_Registry::instance()->load_model( 'Venue' );
972
+	protected function _default_venue_update(\EE_Event $evtobj, $data) {
973
+		require_once(EE_MODELS.'EEM_Venue.model.php');
974
+		$venue_model = EE_Registry::instance()->load_model('Venue');
975 975
 		$rows_affected = null;
976
-		$venue_id = ! empty( $data['venue_id'] ) ? $data['venue_id'] : null;
976
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null;
977 977
 		// very important.  If we don't have a venue name...
978 978
 		// then we'll get out because not necessary to create empty venue
979
-		if ( empty( $data['venue_title'] ) ) {
979
+		if (empty($data['venue_title'])) {
980 980
 			return false;
981 981
 		}
982 982
 		$venue_array = array(
983
-			'VNU_wp_user'         => $evtobj->get( 'EVT_wp_user' ),
984
-			'VNU_name'            => ! empty( $data['venue_title'] ) ? $data['venue_title'] : null,
985
-			'VNU_desc'            => ! empty( $data['venue_description'] ) ? $data['venue_description'] : null,
986
-			'VNU_identifier'      => ! empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : null,
987
-			'VNU_short_desc'      => ! empty( $data['venue_short_description'] ) ? $data['venue_short_description']
983
+			'VNU_wp_user'         => $evtobj->get('EVT_wp_user'),
984
+			'VNU_name'            => ! empty($data['venue_title']) ? $data['venue_title'] : null,
985
+			'VNU_desc'            => ! empty($data['venue_description']) ? $data['venue_description'] : null,
986
+			'VNU_identifier'      => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null,
987
+			'VNU_short_desc'      => ! empty($data['venue_short_description']) ? $data['venue_short_description']
988 988
 				: null,
989
-			'VNU_address'         => ! empty( $data['address'] ) ? $data['address'] : null,
990
-			'VNU_address2'        => ! empty( $data['address2'] ) ? $data['address2'] : null,
991
-			'VNU_city'            => ! empty( $data['city'] ) ? $data['city'] : null,
992
-			'STA_ID'              => ! empty( $data['state'] ) ? $data['state'] : null,
993
-			'CNT_ISO'             => ! empty( $data['countries'] ) ? $data['countries'] : null,
994
-			'VNU_zip'             => ! empty( $data['zip'] ) ? $data['zip'] : null,
995
-			'VNU_phone'           => ! empty( $data['venue_phone'] ) ? $data['venue_phone'] : null,
996
-			'VNU_capacity'        => ! empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : null,
997
-			'VNU_url'             => ! empty( $data['venue_url'] ) ? $data['venue_url'] : null,
998
-			'VNU_virtual_phone'   => ! empty( $data['virtual_phone'] ) ? $data['virtual_phone'] : null,
999
-			'VNU_virtual_url'     => ! empty( $data['virtual_url'] ) ? $data['virtual_url'] : null,
1000
-			'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
989
+			'VNU_address'         => ! empty($data['address']) ? $data['address'] : null,
990
+			'VNU_address2'        => ! empty($data['address2']) ? $data['address2'] : null,
991
+			'VNU_city'            => ! empty($data['city']) ? $data['city'] : null,
992
+			'STA_ID'              => ! empty($data['state']) ? $data['state'] : null,
993
+			'CNT_ISO'             => ! empty($data['countries']) ? $data['countries'] : null,
994
+			'VNU_zip'             => ! empty($data['zip']) ? $data['zip'] : null,
995
+			'VNU_phone'           => ! empty($data['venue_phone']) ? $data['venue_phone'] : null,
996
+			'VNU_capacity'        => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null,
997
+			'VNU_url'             => ! empty($data['venue_url']) ? $data['venue_url'] : null,
998
+			'VNU_virtual_phone'   => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null,
999
+			'VNU_virtual_url'     => ! empty($data['virtual_url']) ? $data['virtual_url'] : null,
1000
+			'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
1001 1001
 			'status'              => 'publish',
1002 1002
 		);
1003 1003
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
1004
-		if ( ! empty( $venue_id ) ) {
1005
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
1006
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
1004
+		if ( ! empty($venue_id)) {
1005
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
1006
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
1007 1007
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
1008
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
1008
+			$evtobj->_add_relation_to($venue_id, 'Venue');
1009 1009
 			return $rows_affected > 0 ? true : false;
1010 1010
 		} else {
1011 1011
 			//we insert the venue
1012
-			$venue_id = $venue_model->insert( $venue_array );
1013
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
1014
-			return ! empty( $venue_id ) ? true : false;
1012
+			$venue_id = $venue_model->insert($venue_array);
1013
+			$evtobj->_add_relation_to($venue_id, 'Venue');
1014
+			return ! empty($venue_id) ? true : false;
1015 1015
 		}
1016 1016
 		//when we have the ancestor come in it's already been handled by the revision save.
1017 1017
 	}
@@ -1025,51 +1025,51 @@  discard block
 block discarded – undo
1025 1025
 	 * @param  array    $data   The request data from the form
1026 1026
 	 * @return array
1027 1027
 	 */
1028
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
1028
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
1029 1029
 		$success = true;
1030 1030
 		$saved_dtt = null;
1031 1031
 		$saved_tickets = array();
1032
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1033
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
1032
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
1033
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
1034 1034
 			//trim all values to ensure any excess whitespace is removed.
1035
-			$dtt = array_map( 'trim', $dtt );
1036
-			$dtt['DTT_EVT_end'] = isset( $dtt['DTT_EVT_end'] ) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end']
1035
+			$dtt = array_map('trim', $dtt);
1036
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end']
1037 1037
 				: $dtt['DTT_EVT_start'];
1038 1038
 			$datetime_values = array(
1039
-				'DTT_ID'        => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : null,
1039
+				'DTT_ID'        => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null,
1040 1040
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
1041 1041
 				'DTT_EVT_end'   => $dtt['DTT_EVT_end'],
1042
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
1042
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
1043 1043
 				'DTT_order'     => $row,
1044 1044
 			);
1045 1045
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
1046
-			if ( ! empty( $dtt['DTT_ID'] ) ) {
1046
+			if ( ! empty($dtt['DTT_ID'])) {
1047 1047
 				$DTM = EE_Registry::instance()
1048
-				                  ->load_model( 'Datetime', array( $evtobj->get_timezone() ) )
1049
-				                  ->get_one_by_ID( $dtt['DTT_ID'] );
1050
-				$DTM->set_date_format( $incoming_date_formats[0] );
1051
-				$DTM->set_time_format( $incoming_date_formats[1] );
1052
-				foreach ( $datetime_values as $field => $value ) {
1053
-					$DTM->set( $field, $value );
1048
+				                  ->load_model('Datetime', array($evtobj->get_timezone()))
1049
+				                  ->get_one_by_ID($dtt['DTT_ID']);
1050
+				$DTM->set_date_format($incoming_date_formats[0]);
1051
+				$DTM->set_time_format($incoming_date_formats[1]);
1052
+				foreach ($datetime_values as $field => $value) {
1053
+					$DTM->set($field, $value);
1054 1054
 				}
1055 1055
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
1056
-				$saved_dtts[ $DTM->ID() ] = $DTM;
1056
+				$saved_dtts[$DTM->ID()] = $DTM;
1057 1057
 			} else {
1058
-				$DTM = EE_Registry::instance()->load_class( 'Datetime', array( $datetime_values ), false, false );
1059
-				$DTM->set_date_format( $incoming_date_formats[0] );
1060
-				$DTM->set_time_format( $incoming_date_formats[1] );
1061
-				$DTM->set_timezone( $evtobj->get_timezone() );
1062
-				foreach ( $datetime_values as $field => $value ) {
1063
-					$DTM->set( $field, $value );
1058
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), false, false);
1059
+				$DTM->set_date_format($incoming_date_formats[0]);
1060
+				$DTM->set_time_format($incoming_date_formats[1]);
1061
+				$DTM->set_timezone($evtobj->get_timezone());
1062
+				foreach ($datetime_values as $field => $value) {
1063
+					$DTM->set($field, $value);
1064 1064
 				}
1065 1065
 			}
1066 1066
 			$DTM->save();
1067
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
1067
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
1068 1068
 			//load DTT helper
1069 1069
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1070
-			if ( $DTT->get_raw( 'DTT_EVT_start' ) > $DTT->get_raw( 'DTT_EVT_end' ) ) {
1071
-				$DTT->set( 'DTT_EVT_end', $DTT->get( 'DTT_EVT_start' ) );
1072
-				$DTT = EEH_DTT_Helper::date_time_add( $DTT, 'DTT_EVT_end', 'days' );
1070
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
1071
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
1072
+				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
1073 1073
 				$DTT->save();
1074 1074
 			}
1075 1075
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
@@ -1080,20 +1080,20 @@  discard block
 block discarded – undo
1080 1080
 		}
1081 1081
 		//no dtts get deleted so we don't do any of that logic here.
1082 1082
 		//update tickets next
1083
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode( ',', $data['ticket_IDs'] ) : array();
1084
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1085
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1083
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1084
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1085
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1086 1086
 			$update_prices = false;
1087
-			$ticket_price = isset( $data['edit_prices'][ $row ][1]['PRC_amount'] )
1088
-				? $data['edit_prices'][ $row ][1]['PRC_amount'] : 0;
1087
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount'])
1088
+				? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1089 1089
 			// trim inputs to ensure any excess whitespace is removed.
1090
-			$tkt = array_map( 'trim', $tkt );
1091
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1090
+			$tkt = array_map('trim', $tkt);
1091
+			if (empty($tkt['TKT_start_date'])) {
1092 1092
 				//let's use now in the set timezone.
1093
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1094
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1093
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1094
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1095 1095
 			}
1096
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1096
+			if (empty($tkt['TKT_end_date'])) {
1097 1097
 				//use the start date of the first datetime
1098 1098
 				$dtt = $evtobj->first_datetime();
1099 1099
 				$tkt['TKT_end_date'] = $dtt->start_date_and_time(
@@ -1102,22 +1102,22 @@  discard block
 block discarded – undo
1102 1102
 				);
1103 1103
 			}
1104 1104
 			$TKT_values = array(
1105
-				'TKT_ID'          => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : null,
1106
-				'TTM_ID'          => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1107
-				'TKT_name'        => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1108
-				'TKT_description' => ! empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1105
+				'TKT_ID'          => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null,
1106
+				'TTM_ID'          => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1107
+				'TKT_name'        => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1108
+				'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1109 1109
 				'TKT_start_date'  => $tkt['TKT_start_date'],
1110 1110
 				'TKT_end_date'    => $tkt['TKT_end_date'],
1111
-				'TKT_qty'         => ! isset( $tkt['TKT_qty'] ) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1112
-				'TKT_uses'        => ! isset( $tkt['TKT_uses'] ) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1113
-				'TKT_min'         => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1114
-				'TKT_max'         => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1111
+				'TKT_qty'         => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1112
+				'TKT_uses'        => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1113
+				'TKT_min'         => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1114
+				'TKT_max'         => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1115 1115
 				'TKT_row'         => $row,
1116
-				'TKT_order'       => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1116
+				'TKT_order'       => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1117 1117
 				'TKT_price'       => $ticket_price,
1118 1118
 			);
1119 1119
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1120
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1120
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1121 1121
 				$TKT_values['TKT_ID'] = 0;
1122 1122
 				$TKT_values['TKT_is_default'] = 0;
1123 1123
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1126,110 +1126,110 @@  discard block
 block discarded – undo
1126 1126
 			//if we have a TKT_ID then we need to get that existing TKT_obj and update it
1127 1127
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1128 1128
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1129
-			if ( ! empty( $tkt['TKT_ID'] ) ) {
1129
+			if ( ! empty($tkt['TKT_ID'])) {
1130 1130
 				$TKT = EE_Registry::instance()
1131
-						->load_model( 'Ticket', array( $evtobj->get_timezone() ) )
1132
-						->get_one_by_ID( $tkt['TKT_ID'] );
1133
-				if ( $TKT instanceof EE_Ticket ) {
1131
+						->load_model('Ticket', array($evtobj->get_timezone()))
1132
+						->get_one_by_ID($tkt['TKT_ID']);
1133
+				if ($TKT instanceof EE_Ticket) {
1134 1134
 					$ticket_sold = $TKT->count_related(
1135 1135
 						'Registration',
1136 1136
 						array(
1137 1137
 							array(
1138 1138
 								'STS_ID' => array(
1139 1139
 									'NOT IN',
1140
-									array( EEM_Registration::status_id_incomplete ),
1140
+									array(EEM_Registration::status_id_incomplete),
1141 1141
 								),
1142 1142
 							),
1143 1143
 						)
1144 1144
 					) > 0 ? true : false;
1145 1145
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1146
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' )
1146
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price')
1147 1147
 					                  && ! $TKT->get(
1148 1148
 						'TKT_deleted'
1149 1149
 					) ? true : false;
1150
-					$TKT->set_date_format( $incoming_date_formats[0] );
1151
-					$TKT->set_time_format( $incoming_date_formats[1] );
1150
+					$TKT->set_date_format($incoming_date_formats[0]);
1151
+					$TKT->set_time_format($incoming_date_formats[1]);
1152 1152
 					//set new values
1153
-					foreach ( $TKT_values as $field => $value ) {
1154
-						if ( $field == 'TKT_qty' ) {
1155
-							$TKT->set_qty( $value );
1153
+					foreach ($TKT_values as $field => $value) {
1154
+						if ($field == 'TKT_qty') {
1155
+							$TKT->set_qty($value);
1156 1156
 						} else {
1157
-							$TKT->set( $field, $value );
1157
+							$TKT->set($field, $value);
1158 1158
 						}
1159 1159
 					}
1160 1160
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1161
-					if ( $create_new_TKT ) {
1161
+					if ($create_new_TKT) {
1162 1162
 						//archive the old ticket first
1163
-						$TKT->set( 'TKT_deleted', 1 );
1163
+						$TKT->set('TKT_deleted', 1);
1164 1164
 						$TKT->save();
1165 1165
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1166
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1166
+						$saved_tickets[$TKT->ID()] = $TKT;
1167 1167
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1168 1168
 						$TKT = clone $TKT;
1169
-						$TKT->set( 'TKT_ID', 0 );
1170
-						$TKT->set( 'TKT_deleted', 0 );
1171
-						$TKT->set( 'TKT_price', $ticket_price );
1172
-						$TKT->set( 'TKT_sold', 0 );
1169
+						$TKT->set('TKT_ID', 0);
1170
+						$TKT->set('TKT_deleted', 0);
1171
+						$TKT->set('TKT_price', $ticket_price);
1172
+						$TKT->set('TKT_sold', 0);
1173 1173
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1174 1174
 						$update_prices = true;
1175 1175
 					}
1176 1176
 					//make sure price is set if it hasn't been already
1177
-					$TKT->set( 'TKT_price', $ticket_price );
1177
+					$TKT->set('TKT_price', $ticket_price);
1178 1178
 				}
1179 1179
 			} else {
1180 1180
 				//no TKT_id so a new TKT
1181 1181
 				$TKT_values['TKT_price'] = $ticket_price;
1182
-				$TKT = EE_Registry::instance()->load_class( 'Ticket', array( $TKT_values ), false, false );
1183
-				if ( $TKT instanceof EE_Ticket ) {
1182
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), false, false);
1183
+				if ($TKT instanceof EE_Ticket) {
1184 1184
 					//need to reset values to properly account for the date formats
1185
-					$TKT->set_date_format( $incoming_date_formats[0] );
1186
-					$TKT->set_time_format( $incoming_date_formats[1] );
1187
-					$TKT->set_timezone( $evtobj->get_timezone() );
1185
+					$TKT->set_date_format($incoming_date_formats[0]);
1186
+					$TKT->set_time_format($incoming_date_formats[1]);
1187
+					$TKT->set_timezone($evtobj->get_timezone());
1188 1188
 					//set new values
1189
-					foreach ( $TKT_values as $field => $value ) {
1190
-						if ( $field == 'TKT_qty' ) {
1191
-							$TKT->set_qty( $value );
1189
+					foreach ($TKT_values as $field => $value) {
1190
+						if ($field == 'TKT_qty') {
1191
+							$TKT->set_qty($value);
1192 1192
 						} else {
1193
-							$TKT->set( $field, $value );
1193
+							$TKT->set($field, $value);
1194 1194
 						}
1195 1195
 					}
1196 1196
 					$update_prices = true;
1197 1197
 				}
1198 1198
 			}
1199 1199
 			// cap ticket qty by datetime reg limits
1200
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1200
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1201 1201
 			//update ticket.
1202 1202
 			$TKT->save();
1203 1203
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1204
-			if ( $TKT->get_raw( 'TKT_start_date' ) > $TKT->get_raw( 'TKT_end_date' ) ) {
1205
-				$TKT->set( 'TKT_end_date', $TKT->get( 'TKT_start_date' ) );
1206
-				$TKT = EEH_DTT_Helper::date_time_add( $TKT, 'TKT_end_date', 'days' );
1204
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1205
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1206
+				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1207 1207
 				$TKT->save();
1208 1208
 			}
1209 1209
 			//initially let's add the ticket to the dtt
1210
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1211
-			$saved_tickets[ $TKT->ID() ] = $TKT;
1210
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1211
+			$saved_tickets[$TKT->ID()] = $TKT;
1212 1212
 			//add prices to ticket
1213
-			$this->_add_prices_to_ticket( $data['edit_prices'][ $row ], $TKT, $update_prices );
1213
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1214 1214
 		}
1215 1215
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1216
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1217
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1218
-		foreach ( $tickets_removed as $id ) {
1219
-			$id = absint( $id );
1216
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1217
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1218
+		foreach ($tickets_removed as $id) {
1219
+			$id = absint($id);
1220 1220
 			//get the ticket for this id
1221
-			$tkt_to_remove = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $id );
1221
+			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
1222 1222
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1223
-			$dtts = $tkt_to_remove->get_many_related( 'Datetime' );
1224
-			foreach ( $dtts as $dtt ) {
1225
-				$tkt_to_remove->_remove_relation_to( $dtt, 'Datetime' );
1223
+			$dtts = $tkt_to_remove->get_many_related('Datetime');
1224
+			foreach ($dtts as $dtt) {
1225
+				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1226 1226
 			}
1227 1227
 			//need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
1228
-			$tkt_to_remove->delete_related_permanently( 'Price' );
1228
+			$tkt_to_remove->delete_related_permanently('Price');
1229 1229
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1230 1230
 			$tkt_to_remove->delete_permanently();
1231 1231
 		}
1232
-		return array( $saved_dtt, $saved_tickets );
1232
+		return array($saved_dtt, $saved_tickets);
1233 1233
 	}
1234 1234
 
1235 1235
 
@@ -1246,29 +1246,29 @@  discard block
 block discarded – undo
1246 1246
 	 * @param bool      $new_prices Whether attach existing incoming prices or create new ones.
1247 1247
 	 * @return  void
1248 1248
 	 */
1249
-	private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = false ) {
1250
-		foreach ( $prices as $row => $prc ) {
1249
+	private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = false) {
1250
+		foreach ($prices as $row => $prc) {
1251 1251
 			$PRC_values = array(
1252
-				'PRC_ID'         => ! empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : null,
1253
-				'PRT_ID'         => ! empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : null,
1254
-				'PRC_amount'     => ! empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1255
-				'PRC_name'       => ! empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1256
-				'PRC_desc'       => ! empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1252
+				'PRC_ID'         => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null,
1253
+				'PRT_ID'         => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null,
1254
+				'PRC_amount'     => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1255
+				'PRC_name'       => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1256
+				'PRC_desc'       => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1257 1257
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1258 1258
 				'PRC_order'      => $row,
1259 1259
 			);
1260
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1260
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1261 1261
 				$PRC_values['PRC_ID'] = 0;
1262
-				$PRC = EE_Registry::instance()->load_class( 'Price', array( $PRC_values ), false, false );
1262
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false);
1263 1263
 			} else {
1264
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1264
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1265 1265
 				//update this price with new values
1266
-				foreach ( $PRC_values as $field => $newprc ) {
1267
-					$PRC->set( $field, $newprc );
1266
+				foreach ($PRC_values as $field => $newprc) {
1267
+					$PRC->set($field, $newprc);
1268 1268
 				}
1269 1269
 				$PRC->save();
1270 1270
 			}
1271
-			$ticket->_add_relation_to( $PRC, 'Price' );
1271
+			$ticket->_add_relation_to($PRC, 'Price');
1272 1272
 		}
1273 1273
 	}
1274 1274
 
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
 	private function _generate_publish_box_extra_content() {
1301 1301
 		//load formatter helper
1302 1302
 		//args for getting related registrations
1303
-		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1303
+		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1304 1304
 		$not_approved_query_args = array(
1305 1305
 			array(
1306 1306
 				'REG_deleted' => 0,
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1372 1372
 		// load template
1373 1373
 		EEH_Template::display_template(
1374
-			EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php',
1374
+			EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php',
1375 1375
 			$publish_box_extra_args
1376 1376
 		);
1377 1377
 	}
@@ -1405,16 +1405,16 @@  discard block
 block discarded – undo
1405 1405
 		$this->verify_cpt_object();
1406 1406
 		add_meta_box(
1407 1407
 			'espresso_event_editor_tickets',
1408
-			esc_html__( 'Event Datetime & Ticket', 'event_espresso' ),
1409
-			array( $this, 'ticket_metabox' ),
1408
+			esc_html__('Event Datetime & Ticket', 'event_espresso'),
1409
+			array($this, 'ticket_metabox'),
1410 1410
 			$this->page_slug,
1411 1411
 			'normal',
1412 1412
 			'high'
1413 1413
 		);
1414 1414
 		add_meta_box(
1415 1415
 			'espresso_event_editor_event_options',
1416
-			esc_html__( 'Event Registration Options', 'event_espresso' ),
1417
-			array( $this, 'registration_options_meta_box' ),
1416
+			esc_html__('Event Registration Options', 'event_espresso'),
1417
+			array($this, 'registration_options_meta_box'),
1418 1418
 			$this->page_slug,
1419 1419
 			'side',
1420 1420
 			'default'
@@ -1442,65 +1442,65 @@  discard block
 block discarded – undo
1442 1442
 			'trash_icon'               => 'ee-lock-icon',
1443 1443
 			'disabled'                 => '',
1444 1444
 		);
1445
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : null;
1446
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1445
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null;
1446
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1447 1447
 		/**
1448 1448
 		 * 1. Start with retrieving Datetimes
1449 1449
 		 * 2. Fore each datetime get related tickets
1450 1450
 		 * 3. For each ticket get related prices
1451 1451
 		 */
1452
-		$times = EE_Registry::instance()->load_model( 'Datetime' )->get_all_event_dates( $event_id );
1452
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1453 1453
 		/** @type EE_Datetime $first_datetime */
1454
-		$first_datetime = reset( $times );
1454
+		$first_datetime = reset($times);
1455 1455
 		//do we get related tickets?
1456
-		if ( $first_datetime instanceof EE_Datetime
1456
+		if ($first_datetime instanceof EE_Datetime
1457 1457
 		     && $first_datetime->ID() !== 0
1458 1458
 		) {
1459
-			$existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' );
1459
+			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1460 1460
 			$template_args['time'] = $first_datetime;
1461 1461
 			$related_tickets = $first_datetime->tickets(
1462 1462
 				array(
1463
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1463
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1464 1464
 					'default_where_conditions' => 'none',
1465 1465
 				)
1466 1466
 			);
1467
-			if ( ! empty( $related_tickets ) ) {
1468
-				$template_args['total_ticket_rows'] = count( $related_tickets );
1467
+			if ( ! empty($related_tickets)) {
1468
+				$template_args['total_ticket_rows'] = count($related_tickets);
1469 1469
 				$row = 0;
1470
-				foreach ( $related_tickets as $ticket ) {
1471
-					$existing_ticket_ids[] = $ticket->get( 'TKT_ID' );
1472
-					$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket, false, $row );
1470
+				foreach ($related_tickets as $ticket) {
1471
+					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1472
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row);
1473 1473
 					$row++;
1474 1474
 				}
1475 1475
 			} else {
1476 1476
 				$template_args['total_ticket_rows'] = 1;
1477 1477
 				/** @type EE_Ticket $ticket */
1478
-				$ticket = EE_Registry::instance()->load_model( 'Ticket' )->create_default_object();
1479
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1478
+				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1479
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1480 1480
 			}
1481 1481
 		} else {
1482 1482
 			$template_args['time'] = $times[0];
1483 1483
 			/** @type EE_Ticket $ticket */
1484
-			$ticket = EE_Registry::instance()->load_model( 'Ticket' )->get_all_default_tickets();
1485
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1484
+			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1485
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1486 1486
 			// NOTE: we're just sending the first default row
1487 1487
 			// (decaf can't manage default tickets so this should be sufficient);
1488 1488
 		}
1489 1489
 		$template_args['event_datetime_help_link'] = $this->_get_help_tab_link(
1490 1490
 			'event_editor_event_datetimes_help_tab'
1491 1491
 		);
1492
-		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link( 'ticket_options_info' );
1493
-		$template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
1494
-		$template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
1492
+		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1493
+		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1494
+		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1495 1495
 		$template_args['ticket_js_structure'] = $this->_get_ticket_row(
1496
-			EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(),
1496
+			EE_Registry::instance()->load_model('Ticket')->create_default_object(),
1497 1497
 			true
1498 1498
 		);
1499 1499
 		$template = apply_filters(
1500 1500
 			'FHEE__Events_Admin_Page__ticket_metabox__template',
1501
-			EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'
1501
+			EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'
1502 1502
 		);
1503
-		EEH_Template::display_template( $template, $template_args );
1503
+		EEH_Template::display_template($template, $template_args);
1504 1504
 	}
1505 1505
 
1506 1506
 
@@ -1514,74 +1514,74 @@  discard block
 block discarded – undo
1514 1514
 	 * @param int        $row
1515 1515
 	 * @return string generated html for the ticket row.
1516 1516
 	 */
1517
-	private function _get_ticket_row( $ticket, $skeleton = false, $row = 0 ) {
1517
+	private function _get_ticket_row($ticket, $skeleton = false, $row = 0) {
1518 1518
 		$template_args = array(
1519
-			'tkt_status_class'    => ' tkt-status-' . $ticket->ticket_status(),
1519
+			'tkt_status_class'    => ' tkt-status-'.$ticket->ticket_status(),
1520 1520
 			'tkt_archive_class'   => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived'
1521 1521
 				: '',
1522 1522
 			'ticketrow'           => $skeleton ? 'TICKETNUM' : $row,
1523
-			'TKT_ID'              => $ticket->get( 'TKT_ID' ),
1524
-			'TKT_name'            => $ticket->get( 'TKT_name' ),
1525
-			'TKT_start_date'      => $skeleton ? '' : $ticket->get_date( 'TKT_start_date', 'Y-m-d h:i a' ),
1526
-			'TKT_end_date'        => $skeleton ? '' : $ticket->get_date( 'TKT_end_date', 'Y-m-d h:i a' ),
1527
-			'TKT_is_default'      => $ticket->get( 'TKT_is_default' ),
1528
-			'TKT_qty'             => $ticket->get_pretty( 'TKT_qty', 'input' ),
1523
+			'TKT_ID'              => $ticket->get('TKT_ID'),
1524
+			'TKT_name'            => $ticket->get('TKT_name'),
1525
+			'TKT_start_date'      => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1526
+			'TKT_end_date'        => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1527
+			'TKT_is_default'      => $ticket->get('TKT_is_default'),
1528
+			'TKT_qty'             => $ticket->get_pretty('TKT_qty', 'input'),
1529 1529
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1530
-			'TKT_sold'            => $skeleton ? 0 : $ticket->get( 'TKT_sold' ),
1531
-			'trash_icon'          => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) )
1532
-			                         && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 )
1530
+			'TKT_sold'            => $skeleton ? 0 : $ticket->get('TKT_sold'),
1531
+			'trash_icon'          => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')))
1532
+			                         && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0)
1533 1533
 				? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1534
-			'disabled'            => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? ''
1534
+			'disabled'            => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? ''
1535 1535
 				: ' disabled=disabled',
1536 1536
 		);
1537 1537
 		$price = $ticket->ID() !== 0
1538
-			? $ticket->get_first_related( 'Price', array( 'default_where_conditions' => 'none' ) )
1539
-			: EE_Registry::instance()->load_model( 'Price' )->create_default_object();
1538
+			? $ticket->get_first_related('Price', array('default_where_conditions' => 'none'))
1539
+			: EE_Registry::instance()->load_model('Price')->create_default_object();
1540 1540
 		$price_args = array(
1541 1541
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1542
-			'PRC_amount'            => $price->get( 'PRC_amount' ),
1543
-			'PRT_ID'                => $price->get( 'PRT_ID' ),
1544
-			'PRC_ID'                => $price->get( 'PRC_ID' ),
1545
-			'PRC_is_default'        => $price->get( 'PRC_is_default' ),
1542
+			'PRC_amount'            => $price->get('PRC_amount'),
1543
+			'PRT_ID'                => $price->get('PRT_ID'),
1544
+			'PRC_ID'                => $price->get('PRC_ID'),
1545
+			'PRC_is_default'        => $price->get('PRC_is_default'),
1546 1546
 		);
1547 1547
 		//make sure we have default start and end dates if skeleton
1548 1548
 		//handle rows that should NOT be empty
1549
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1549
+		if (empty($template_args['TKT_start_date'])) {
1550 1550
 			//if empty then the start date will be now.
1551
-			$template_args['TKT_start_date'] = date( 'Y-m-d h:i a', current_time( 'timestamp' ) );
1551
+			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1552 1552
 		}
1553
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1553
+		if (empty($template_args['TKT_end_date'])) {
1554 1554
 			//get the earliest datetime (if present);
1555 1555
 			$earliest_dtt = $this->_cpt_model_obj->ID() > 0
1556 1556
 				? $this->_cpt_model_obj->get_first_related(
1557 1557
 					'Datetime',
1558
-					array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) )
1558
+					array('order_by' => array('DTT_EVT_start' => 'ASC'))
1559 1559
 				)
1560 1560
 				: null;
1561
-			if ( ! empty( $earliest_dtt ) ) {
1562
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime( 'DTT_EVT_start', 'Y-m-d', 'h:i a' );
1561
+			if ( ! empty($earliest_dtt)) {
1562
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1563 1563
 			} else {
1564 1564
 				$template_args['TKT_end_date'] = date(
1565 1565
 					'Y-m-d h:i a',
1566
-					mktime( 0, 0, 0, date( "m" ), date( "d" ) + 7, date( "Y" ) )
1566
+					mktime(0, 0, 0, date("m"), date("d") + 7, date("Y"))
1567 1567
 				);
1568 1568
 			}
1569 1569
 		}
1570
-		$template_args = array_merge( $template_args, $price_args );
1570
+		$template_args = array_merge($template_args, $price_args);
1571 1571
 		$template = apply_filters(
1572 1572
 			'FHEE__Events_Admin_Page__get_ticket_row__template',
1573
-			EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php',
1573
+			EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php',
1574 1574
 			$ticket
1575 1575
 		);
1576
-		return EEH_Template::display_template( $template, $template_args, true );
1576
+		return EEH_Template::display_template($template, $template_args, true);
1577 1577
 	}
1578 1578
 
1579 1579
 
1580 1580
 
1581 1581
 	public function registration_options_meta_box() {
1582 1582
 		$yes_no_values = array(
1583
-			array( 'id' => true, 'text' => esc_html__( 'Yes', 'event_espresso' ) ),
1584
-			array( 'id' => false, 'text' => esc_html__( 'No', 'event_espresso' ) ),
1583
+			array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')),
1584
+			array('id' => false, 'text' => esc_html__('No', 'event_espresso')),
1585 1585
 		);
1586 1586
 		$default_reg_status_values = EEM_Registration::reg_status_array(
1587 1587
 			array(
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
 		);
1594 1594
 		//$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active());
1595 1595
 		$template_args['_event'] = $this->_cpt_model_obj;
1596
-		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status( false );
1596
+		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false);
1597 1597
 		$template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
1598 1598
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input(
1599 1599
 			'default_reg_status',
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 			$default_reg_status_values
1622 1622
 		);
1623 1623
 		EEH_Template::display_template(
1624
-			EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php',
1624
+			EVENTS_TEMPLATE_PATH.'event_registration_options.template.php',
1625 1625
 			$template_args
1626 1626
 		);
1627 1627
 	}
@@ -1640,97 +1640,97 @@  discard block
 block discarded – undo
1640 1640
 	 *                           that match the given _view and paging parameters.
1641 1641
 	 * @return array an array of event objects.
1642 1642
 	 */
1643
-	public function get_events( $per_page = 10, $current_page = 1, $count = false ) {
1643
+	public function get_events($per_page = 10, $current_page = 1, $count = false) {
1644 1644
 		$EEME = $this->_event_model();
1645
-		$offset = ( $current_page - 1 ) * $per_page;
1646
-		$limit = $count ? null : $offset . ',' . $per_page;
1647
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'EVT_ID';
1648
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : "DESC";
1649
-		if ( isset( $this->_req_data['month_range'] ) ) {
1650
-			$pieces = explode( ' ', $this->_req_data['month_range'], 3 );
1651
-			$month_r = ! empty( $pieces[0] ) ? date( 'm', strtotime( $pieces[0] ) ) : '';
1652
-			$year_r = ! empty( $pieces[1] ) ? $pieces[1] : '';
1645
+		$offset = ($current_page - 1) * $per_page;
1646
+		$limit = $count ? null : $offset.','.$per_page;
1647
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1648
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1649
+		if (isset($this->_req_data['month_range'])) {
1650
+			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1651
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1652
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1653 1653
 		}
1654 1654
 		$where = array();
1655
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null;
1655
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
1656 1656
 		//determine what post_status our condition will have for the query.
1657
-		switch ( $status ) {
1657
+		switch ($status) {
1658 1658
 			case 'month' :
1659 1659
 			case 'today' :
1660 1660
 			case null :
1661 1661
 			case 'all' :
1662 1662
 				break;
1663 1663
 			case 'draft' :
1664
-				$where['status'] = array( 'IN', array( 'draft', 'auto-draft' ) );
1664
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1665 1665
 				break;
1666 1666
 			default :
1667 1667
 				$where['status'] = $status;
1668 1668
 		}
1669 1669
 		//categories?
1670
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0
1670
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0
1671 1671
 			? $this->_req_data['EVT_CAT'] : null;
1672
-		if ( ! empty ( $category ) ) {
1672
+		if ( ! empty ($category)) {
1673 1673
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1674 1674
 			$where['Term_Taxonomy.term_id'] = $category;
1675 1675
 		}
1676 1676
 		//date where conditions
1677
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1678
-		if ( isset( $this->_req_data['month_range'] ) && $this->_req_data['month_range'] != '' ) {
1677
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1678
+		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1679 1679
 			$DateTime = new DateTime(
1680
-				$year_r . '-' . $month_r . '-01 00:00:00',
1681
-				new DateTimeZone( EEM_Datetime::instance()->get_timezone() )
1680
+				$year_r.'-'.$month_r.'-01 00:00:00',
1681
+				new DateTimeZone(EEM_Datetime::instance()->get_timezone())
1682 1682
 			);
1683
-			$start = $DateTime->format( implode( ' ', $start_formats ) );
1684
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format( 't' ) )->setTime( 23, 59, 59 )->format(
1685
-				implode( ' ', $start_formats )
1683
+			$start = $DateTime->format(implode(' ', $start_formats));
1684
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(
1685
+				implode(' ', $start_formats)
1686 1686
 			);
1687
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1688
-		} else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ) {
1689
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1690
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1691
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1692
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1693
-		} else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ) {
1694
-			$now = date( 'Y-m-01' );
1695
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1696
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1697
-			$end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) )
1698
-			                ->setTime( 23, 59, 59 )
1699
-			                ->format( implode( ' ', $start_formats ) );
1700
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1687
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1688
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1689
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1690
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1691
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1692
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1693
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1694
+			$now = date('Y-m-01');
1695
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1696
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1697
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))
1698
+			                ->setTime(23, 59, 59)
1699
+			                ->format(implode(' ', $start_formats));
1700
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1701 1701
 		}
1702
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1702
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1703 1703
 			$where['EVT_wp_user'] = get_current_user_id();
1704 1704
 		} else {
1705
-			if ( ! isset( $where['status'] ) ) {
1706
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1705
+			if ( ! isset($where['status'])) {
1706
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1707 1707
 					$where['OR'] = array(
1708
-						'status*restrict_private' => array( '!=', 'private' ),
1708
+						'status*restrict_private' => array('!=', 'private'),
1709 1709
 						'AND'                     => array(
1710
-							'status*inclusive' => array( '=', 'private' ),
1710
+							'status*inclusive' => array('=', 'private'),
1711 1711
 							'EVT_wp_user'      => get_current_user_id(),
1712 1712
 						),
1713 1713
 					);
1714 1714
 				}
1715 1715
 			}
1716 1716
 		}
1717
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1718
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id()
1719
-			     && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' )
1717
+		if (isset($this->_req_data['EVT_wp_user'])) {
1718
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id()
1719
+			     && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')
1720 1720
 			) {
1721 1721
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1722 1722
 			}
1723 1723
 		}
1724 1724
 		//search query handling
1725
-		if ( isset( $this->_req_data['s'] ) ) {
1726
-			$search_string = '%' . $this->_req_data['s'] . '%';
1725
+		if (isset($this->_req_data['s'])) {
1726
+			$search_string = '%'.$this->_req_data['s'].'%';
1727 1727
 			$where['OR'] = array(
1728
-				'EVT_name'       => array( 'LIKE', $search_string ),
1729
-				'EVT_desc'       => array( 'LIKE', $search_string ),
1730
-				'EVT_short_desc' => array( 'LIKE', $search_string ),
1728
+				'EVT_name'       => array('LIKE', $search_string),
1729
+				'EVT_desc'       => array('LIKE', $search_string),
1730
+				'EVT_short_desc' => array('LIKE', $search_string),
1731 1731
 			);
1732 1732
 		}
1733
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1733
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1734 1734
 		$query_params = apply_filters(
1735 1735
 			'FHEE__Events_Admin_Page__get_events__query_params',
1736 1736
 			array(
@@ -1743,23 +1743,23 @@  discard block
 block discarded – undo
1743 1743
 			$this->_req_data
1744 1744
 		);
1745 1745
 		//let's first check if we have special requests coming in.
1746
-		if ( isset( $this->_req_data['active_status'] ) ) {
1747
-			switch ( $this->_req_data['active_status'] ) {
1746
+		if (isset($this->_req_data['active_status'])) {
1747
+			switch ($this->_req_data['active_status']) {
1748 1748
 				case 'upcoming' :
1749
-					return $EEME->get_upcoming_events( $query_params, $count );
1749
+					return $EEME->get_upcoming_events($query_params, $count);
1750 1750
 					break;
1751 1751
 				case 'expired' :
1752
-					return $EEME->get_expired_events( $query_params, $count );
1752
+					return $EEME->get_expired_events($query_params, $count);
1753 1753
 					break;
1754 1754
 				case 'active' :
1755
-					return $EEME->get_active_events( $query_params, $count );
1755
+					return $EEME->get_active_events($query_params, $count);
1756 1756
 					break;
1757 1757
 				case 'inactive' :
1758
-					return $EEME->get_inactive_events( $query_params, $count );
1758
+					return $EEME->get_inactive_events($query_params, $count);
1759 1759
 					break;
1760 1760
 			}
1761 1761
 		}
1762
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1762
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1763 1763
 		return $events;
1764 1764
 	}
1765 1765
 
@@ -1770,9 +1770,9 @@  discard block
 block discarded – undo
1770 1770
 	 *
1771 1771
 	 * @param string $post_id
1772 1772
 	 */
1773
-	public function trash_cpt_item( $post_id ) {
1773
+	public function trash_cpt_item($post_id) {
1774 1774
 		$this->_req_data['EVT_ID'] = $post_id;
1775
-		$this->_trash_or_restore_event( 'trash', false );
1775
+		$this->_trash_or_restore_event('trash', false);
1776 1776
 	}
1777 1777
 
1778 1778
 
@@ -1780,9 +1780,9 @@  discard block
 block discarded – undo
1780 1780
 	/**
1781 1781
 	 * @param string $post_id
1782 1782
 	 */
1783
-	public function restore_cpt_item( $post_id ) {
1783
+	public function restore_cpt_item($post_id) {
1784 1784
 		$this->_req_data['EVT_ID'] = $post_id;
1785
-		$this->_trash_or_restore_event( 'draft', false );
1785
+		$this->_trash_or_restore_event('draft', false);
1786 1786
 	}
1787 1787
 
1788 1788
 
@@ -1790,9 +1790,9 @@  discard block
 block discarded – undo
1790 1790
 	/**
1791 1791
 	 * @param string $post_id
1792 1792
 	 */
1793
-	public function delete_cpt_item( $post_id ) {
1793
+	public function delete_cpt_item($post_id) {
1794 1794
 		$this->_req_data['EVT_ID'] = $post_id;
1795
-		$this->_delete_event( false );
1795
+		$this->_delete_event(false);
1796 1796
 	}
1797 1797
 
1798 1798
 
@@ -1804,23 +1804,23 @@  discard block
 block discarded – undo
1804 1804
 	 * @param  string $event_status
1805 1805
 	 * @param bool    $redirect_after
1806 1806
 	 */
1807
-	protected function _trash_or_restore_event( $event_status = 'trash', $redirect_after = true ) {
1807
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true) {
1808 1808
 		//determine the event id and set to array.
1809
-		$EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : false;
1809
+		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : false;
1810 1810
 		// loop thru events
1811
-		if ( $EVT_ID ) {
1811
+		if ($EVT_ID) {
1812 1812
 			// clean status
1813
-			$event_status = sanitize_key( $event_status );
1813
+			$event_status = sanitize_key($event_status);
1814 1814
 			// grab status
1815
-			if ( ! empty( $event_status ) ) {
1816
-				$success = $this->_change_event_status( $EVT_ID, $event_status );
1815
+			if ( ! empty($event_status)) {
1816
+				$success = $this->_change_event_status($EVT_ID, $event_status);
1817 1817
 			} else {
1818 1818
 				$success = false;
1819 1819
 				$msg = esc_html__(
1820 1820
 					'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
1821 1821
 					'event_espresso'
1822 1822
 				);
1823
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1823
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1824 1824
 			}
1825 1825
 		} else {
1826 1826
 			$success = false;
@@ -1828,11 +1828,11 @@  discard block
 block discarded – undo
1828 1828
 				'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.',
1829 1829
 				'event_espresso'
1830 1830
 			);
1831
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1831
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1832 1832
 		}
1833 1833
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1834
-		if ( $redirect_after ) {
1835
-			$this->_redirect_after_action( $success, 'Event', $action, array( 'action' => 'default' ) );
1834
+		if ($redirect_after) {
1835
+			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1836 1836
 		}
1837 1837
 	}
1838 1838
 
@@ -1845,18 +1845,18 @@  discard block
 block discarded – undo
1845 1845
 	 * @param  string $event_status
1846 1846
 	 * @return void
1847 1847
 	 */
1848
-	protected function _trash_or_restore_events( $event_status = 'trash' ) {
1848
+	protected function _trash_or_restore_events($event_status = 'trash') {
1849 1849
 		// clean status
1850
-		$event_status = sanitize_key( $event_status );
1850
+		$event_status = sanitize_key($event_status);
1851 1851
 		// grab status
1852
-		if ( ! empty( $event_status ) ) {
1852
+		if ( ! empty($event_status)) {
1853 1853
 			$success = true;
1854 1854
 			//determine the event id and set to array.
1855
-			$EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array();
1855
+			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1856 1856
 			// loop thru events
1857
-			foreach ( $EVT_IDs as $EVT_ID ) {
1858
-				if ( $EVT_ID = absint( $EVT_ID ) ) {
1859
-					$results = $this->_change_event_status( $EVT_ID, $event_status );
1857
+			foreach ($EVT_IDs as $EVT_ID) {
1858
+				if ($EVT_ID = absint($EVT_ID)) {
1859
+					$results = $this->_change_event_status($EVT_ID, $event_status);
1860 1860
 					$success = $results !== false ? $success : false;
1861 1861
 				} else {
1862 1862
 					$msg = sprintf(
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
 						),
1867 1867
 						$EVT_ID
1868 1868
 					);
1869
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1869
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1870 1870
 					$success = false;
1871 1871
 				}
1872 1872
 			}
@@ -1876,12 +1876,12 @@  discard block
 block discarded – undo
1876 1876
 				'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
1877 1877
 				'event_espresso'
1878 1878
 			);
1879
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1879
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1880 1880
 		}
1881 1881
 		// in order to force a pluralized result message we need to send back a success status greater than 1
1882 1882
 		$success = $success ? 2 : false;
1883 1883
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1884
-		$this->_redirect_after_action( $success, 'Events', $action, array( 'action' => 'default' ) );
1884
+		$this->_redirect_after_action($success, 'Events', $action, array('action' => 'default'));
1885 1885
 	}
1886 1886
 
1887 1887
 
@@ -1894,30 +1894,30 @@  discard block
 block discarded – undo
1894 1894
 	 * @param  string $event_status
1895 1895
 	 * @return bool
1896 1896
 	 */
1897
-	private function _change_event_status( $EVT_ID = 0, $event_status = '' ) {
1897
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1898 1898
 		// grab event id
1899
-		if ( ! $EVT_ID ) {
1899
+		if ( ! $EVT_ID) {
1900 1900
 			$msg = esc_html__(
1901 1901
 				'An error occurred. No Event ID or an invalid Event ID was received.',
1902 1902
 				'event_espresso'
1903 1903
 			);
1904
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1904
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1905 1905
 			return false;
1906 1906
 		}
1907
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1907
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1908 1908
 		// clean status
1909
-		$event_status = sanitize_key( $event_status );
1909
+		$event_status = sanitize_key($event_status);
1910 1910
 		// grab status
1911
-		if ( empty( $event_status ) ) {
1911
+		if (empty($event_status)) {
1912 1912
 			$msg = esc_html__(
1913 1913
 				'An error occurred. No Event Status or an invalid Event Status was received.',
1914 1914
 				'event_espresso'
1915 1915
 			);
1916
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1916
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1917 1917
 			return false;
1918 1918
 		}
1919 1919
 		// was event trashed or restored ?
1920
-		switch ( $event_status ) {
1920
+		switch ($event_status) {
1921 1921
 			case 'draft' :
1922 1922
 				$action = 'restored from the trash';
1923 1923
 				$hook = 'AHEE_event_restored_from_trash';
@@ -1931,15 +1931,15 @@  discard block
 block discarded – undo
1931 1931
 				$hook = false;
1932 1932
 		}
1933 1933
 		//use class to change status
1934
-		$this->_cpt_model_obj->set_status( $event_status );
1934
+		$this->_cpt_model_obj->set_status($event_status);
1935 1935
 		$success = $this->_cpt_model_obj->save();
1936
-		if ( $success === false ) {
1937
-			$msg = sprintf( esc_html__( 'An error occurred. The event could not be %s.', 'event_espresso' ), $action );
1938
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1936
+		if ($success === false) {
1937
+			$msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action);
1938
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1939 1939
 			return false;
1940 1940
 		}
1941
-		if ( $hook ) {
1942
-			do_action( $hook );
1941
+		if ($hook) {
1942
+			do_action($hook);
1943 1943
 		}
1944 1944
 		return true;
1945 1945
 	}
@@ -1952,34 +1952,34 @@  discard block
 block discarded – undo
1952 1952
 	 * @access protected
1953 1953
 	 * @param bool $redirect_after
1954 1954
 	 */
1955
-	protected function _delete_event( $redirect_after = true ) {
1955
+	protected function _delete_event($redirect_after = true) {
1956 1956
 		//determine the event id and set to array.
1957
-		$EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : null;
1958
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1957
+		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : null;
1958
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1959 1959
 		// loop thru events
1960
-		if ( $EVT_ID ) {
1961
-			$success = $this->_permanently_delete_event( $EVT_ID );
1960
+		if ($EVT_ID) {
1961
+			$success = $this->_permanently_delete_event($EVT_ID);
1962 1962
 			// get list of events with no prices
1963
-			$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() );
1963
+			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1964 1964
 			// remove this event from the list of events with no prices
1965
-			if ( isset( $espresso_no_ticket_prices[ $EVT_ID ] ) ) {
1966
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1965
+			if (isset($espresso_no_ticket_prices[$EVT_ID])) {
1966
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1967 1967
 			}
1968
-			update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices );
1968
+			update_option('ee_no_ticket_prices', $espresso_no_ticket_prices);
1969 1969
 		} else {
1970 1970
 			$success = false;
1971 1971
 			$msg = esc_html__(
1972 1972
 				'An error occurred. An event could not be deleted because a valid event ID was not not supplied.',
1973 1973
 				'event_espresso'
1974 1974
 			);
1975
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1975
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1976 1976
 		}
1977
-		if ( $redirect_after ) {
1977
+		if ($redirect_after) {
1978 1978
 			$this->_redirect_after_action(
1979 1979
 				$success,
1980 1980
 				'Event',
1981 1981
 				'deleted',
1982
-				array( 'action' => 'default', 'status' => 'trash' )
1982
+				array('action' => 'default', 'status' => 'trash')
1983 1983
 			);
1984 1984
 		}
1985 1985
 	}
@@ -1995,30 +1995,30 @@  discard block
 block discarded – undo
1995 1995
 	protected function _delete_events() {
1996 1996
 		$success = true;
1997 1997
 		// get list of events with no prices
1998
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() );
1998
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1999 1999
 		//determine the event id and set to array.
2000
-		$EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array();
2000
+		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
2001 2001
 		// loop thru events
2002
-		foreach ( $EVT_IDs as $EVT_ID ) {
2003
-			$EVT_ID = absint( $EVT_ID );
2004
-			if ( $EVT_ID ) {
2005
-				$results = $this->_permanently_delete_event( $EVT_ID );
2002
+		foreach ($EVT_IDs as $EVT_ID) {
2003
+			$EVT_ID = absint($EVT_ID);
2004
+			if ($EVT_ID) {
2005
+				$results = $this->_permanently_delete_event($EVT_ID);
2006 2006
 				$success = $results !== false ? $success : false;
2007 2007
 				// remove this event from the list of events with no prices
2008
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
2008
+				unset($espresso_no_ticket_prices[$EVT_ID]);
2009 2009
 			} else {
2010 2010
 				$success = false;
2011 2011
 				$msg = esc_html__(
2012 2012
 					'An error occurred. An event could not be deleted because a valid event ID was not not supplied.',
2013 2013
 					'event_espresso'
2014 2014
 				);
2015
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2015
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2016 2016
 			}
2017 2017
 		}
2018
-		update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices );
2018
+		update_option('ee_no_ticket_prices', $espresso_no_ticket_prices);
2019 2019
 		// in order to force a pluralized result message we need to send back a success status greater than 1
2020 2020
 		$success = $success ? 2 : false;
2021
-		$this->_redirect_after_action( $success, 'Events', 'deleted', array( 'action' => 'default' ) );
2021
+		$this->_redirect_after_action($success, 'Events', 'deleted', array('action' => 'default'));
2022 2022
 	}
2023 2023
 
2024 2024
 
@@ -2030,70 +2030,70 @@  discard block
 block discarded – undo
2030 2030
 	 * @param  int $EVT_ID
2031 2031
 	 * @return bool
2032 2032
 	 */
2033
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
2033
+	private function _permanently_delete_event($EVT_ID = 0) {
2034 2034
 		// grab event id
2035
-		if ( ! $EVT_ID ) {
2035
+		if ( ! $EVT_ID) {
2036 2036
 			$msg = esc_html__(
2037 2037
 				'An error occurred. No Event ID or an invalid Event ID was received.',
2038 2038
 				'event_espresso'
2039 2039
 			);
2040
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2040
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2041 2041
 			return false;
2042 2042
 		}
2043 2043
 		if (
2044 2044
 			! $this->_cpt_model_obj instanceof EE_Event
2045 2045
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
2046 2046
 		) {
2047
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
2047
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
2048 2048
 		}
2049
-		if ( ! $this->_cpt_model_obj instanceof EE_Event ) {
2049
+		if ( ! $this->_cpt_model_obj instanceof EE_Event) {
2050 2050
 			return false;
2051 2051
 		}
2052 2052
 		//need to delete related tickets and prices first.
2053
-		$datetimes = $this->_cpt_model_obj->get_many_related( 'Datetime' );
2054
-		foreach ( $datetimes as $datetime ) {
2055
-			$this->_cpt_model_obj->_remove_relation_to( $datetime, 'Datetime' );
2056
-			$tickets = $datetime->get_many_related( 'Ticket' );
2057
-			foreach ( $tickets as $ticket ) {
2058
-				$ticket->_remove_relation_to( $datetime, 'Datetime' );
2059
-				$ticket->delete_related_permanently( 'Price' );
2053
+		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
2054
+		foreach ($datetimes as $datetime) {
2055
+			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
2056
+			$tickets = $datetime->get_many_related('Ticket');
2057
+			foreach ($tickets as $ticket) {
2058
+				$ticket->_remove_relation_to($datetime, 'Datetime');
2059
+				$ticket->delete_related_permanently('Price');
2060 2060
 				$ticket->delete_permanently();
2061 2061
 			}
2062 2062
 			$datetime->delete();
2063 2063
 		}
2064 2064
 		//what about related venues or terms?
2065
-		$venues = $this->_cpt_model_obj->get_many_related( 'Venue' );
2066
-		foreach ( $venues as $venue ) {
2067
-			$this->_cpt_model_obj->_remove_relation_to( $venue, 'Venue' );
2065
+		$venues = $this->_cpt_model_obj->get_many_related('Venue');
2066
+		foreach ($venues as $venue) {
2067
+			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
2068 2068
 		}
2069 2069
 		//any attached question groups?
2070
-		$question_groups = $this->_cpt_model_obj->get_many_related( 'Question_Group' );
2071
-		if ( ! empty( $question_groups ) ) {
2072
-			foreach ( $question_groups as $question_group ) {
2073
-				$this->_cpt_model_obj->_remove_relation_to( $question_group, 'Question_Group' );
2070
+		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
2071
+		if ( ! empty($question_groups)) {
2072
+			foreach ($question_groups as $question_group) {
2073
+				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
2074 2074
 			}
2075 2075
 		}
2076 2076
 		//Message Template Groups
2077
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
2077
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
2078 2078
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
2079 2079
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
2080
-		foreach ( $term_taxonomies as $term_taxonomy ) {
2081
-			$this->_cpt_model_obj->remove_relation_to_term_taxonomy( $term_taxonomy );
2080
+		foreach ($term_taxonomies as $term_taxonomy) {
2081
+			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
2082 2082
 		}
2083 2083
 		$success = $this->_cpt_model_obj->delete_permanently();
2084 2084
 		// did it all go as planned ?
2085
-		if ( $success ) {
2086
-			$msg = sprintf( esc_html__( 'Event ID # %d has been deleted.', 'event_espresso' ), $EVT_ID );
2087
-			EE_Error::add_success( $msg );
2085
+		if ($success) {
2086
+			$msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID);
2087
+			EE_Error::add_success($msg);
2088 2088
 		} else {
2089 2089
 			$msg = sprintf(
2090
-				esc_html__( 'An error occurred. Event ID # %d could not be deleted.', 'event_espresso' ),
2090
+				esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'),
2091 2091
 				$EVT_ID
2092 2092
 			);
2093
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2093
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2094 2094
 			return false;
2095 2095
 		}
2096
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
2096
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
2097 2097
 		return true;
2098 2098
 	}
2099 2099
 
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 	 * @return int
2107 2107
 	 */
2108 2108
 	public function total_events() {
2109
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
2109
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
2110 2110
 		return $count;
2111 2111
 	}
2112 2112
 
@@ -2120,9 +2120,9 @@  discard block
 block discarded – undo
2120 2120
 	 */
2121 2121
 	public function total_events_draft() {
2122 2122
 		$where = array(
2123
-			'status' => array( 'IN', array( 'draft', 'auto-draft' ) ),
2123
+			'status' => array('IN', array('draft', 'auto-draft')),
2124 2124
 		);
2125
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2125
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2126 2126
 		return $count;
2127 2127
 	}
2128 2128
 
@@ -2138,7 +2138,7 @@  discard block
 block discarded – undo
2138 2138
 		$where = array(
2139 2139
 			'status' => 'trash',
2140 2140
 		);
2141
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2141
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2142 2142
 		return $count;
2143 2143
 	}
2144 2144
 
@@ -2169,12 +2169,12 @@  discard block
 block discarded – undo
2169 2169
 			EE_Registry::instance()->CFG->registration->default_STS_ID,
2170 2170
 			$this->_template_args['reg_status_array']
2171 2171
 		)
2172
-			? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID )
2172
+			? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID)
2173 2173
 			: EEM_Registration::status_id_pending_payment;
2174
-		$this->_set_add_edit_form_tags( 'update_default_event_settings' );
2175
-		$this->_set_publish_post_box_vars( null, false, false, null, false );
2174
+		$this->_set_add_edit_form_tags('update_default_event_settings');
2175
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
2176 2176
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2177
-			EVENTS_TEMPLATE_PATH . 'event_settings.template.php',
2177
+			EVENTS_TEMPLATE_PATH.'event_settings.template.php',
2178 2178
 			$this->_template_args,
2179 2179
 			true
2180 2180
 		);
@@ -2190,8 +2190,8 @@  discard block
 block discarded – undo
2190 2190
 	 * @return void
2191 2191
 	 */
2192 2192
 	protected function _update_default_event_settings() {
2193
-		EE_Config::instance()->registration->default_STS_ID = isset( $this->_req_data['default_reg_status'] )
2194
-			? sanitize_text_field( $this->_req_data['default_reg_status'] )
2193
+		EE_Config::instance()->registration->default_STS_ID = isset($this->_req_data['default_reg_status'])
2194
+			? sanitize_text_field($this->_req_data['default_reg_status'])
2195 2195
 			: EEM_Registration::status_id_pending_payment;
2196 2196
 		$what = 'Default Event Settings';
2197 2197
 		$success = $this->_update_espresso_configuration(
@@ -2201,7 +2201,7 @@  discard block
 block discarded – undo
2201 2201
 			__FUNCTION__,
2202 2202
 			__LINE__
2203 2203
 		);
2204
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default_event_settings' ) );
2204
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default_event_settings'));
2205 2205
 	}
2206 2206
 
2207 2207
 
@@ -2211,20 +2211,20 @@  discard block
 block discarded – undo
2211 2211
 
2212 2212
 
2213 2213
 	protected function _template_settings() {
2214
-		$this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' );
2214
+		$this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso');
2215 2215
 		$this->_template_args['preview_img'] = '<img src="'
2216 2216
 		                                       . EVENTS_ASSETS_URL
2217 2217
 		                                       . DS
2218 2218
 		                                       . 'images'
2219 2219
 		                                       . DS
2220 2220
 		                                       . 'caffeinated_template_features.jpg" alt="'
2221
-		                                       . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' )
2221
+		                                       . esc_attr__('Template Settings Preview screenshot', 'event_espresso')
2222 2222
 		                                       . '" />';
2223
-		$this->_template_args['preview_text'] = '<strong>' . esc_html__(
2223
+		$this->_template_args['preview_text'] = '<strong>'.esc_html__(
2224 2224
 				'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.',
2225 2225
 				'event_espresso'
2226
-			) . '</strong>';
2227
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2226
+			).'</strong>';
2227
+		$this->display_admin_caf_preview_page('template_settings_tab');
2228 2228
 	}
2229 2229
 
2230 2230
 
@@ -2236,18 +2236,18 @@  discard block
 block discarded – undo
2236 2236
 	 * @return void
2237 2237
 	 */
2238 2238
 	private function _set_category_object() {
2239
-		if ( isset( $this->_category->id ) && ! empty( $this->_category->id ) ) {
2239
+		if (isset($this->_category->id) && ! empty($this->_category->id)) {
2240 2240
 			return;
2241 2241
 		} //already have the category object so get out.
2242 2242
 		//set default category object
2243 2243
 		$this->_set_empty_category_object();
2244 2244
 		//only set if we've got an id
2245
-		if ( ! isset( $this->_req_data['EVT_CAT_ID'] ) ) {
2245
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2246 2246
 			return;
2247 2247
 		}
2248
-		$category_id = absint( $this->_req_data['EVT_CAT_ID'] );
2249
-		$term = get_term( $category_id, 'espresso_event_categories' );
2250
-		if ( ! empty( $term ) ) {
2248
+		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2249
+		$term = get_term($category_id, 'espresso_event_categories');
2250
+		if ( ! empty($term)) {
2251 2251
 			$this->_category->category_name = $term->name;
2252 2252
 			$this->_category->category_identifier = $term->slug;
2253 2253
 			$this->_category->category_desc = $term->description;
@@ -2267,9 +2267,9 @@  discard block
 block discarded – undo
2267 2267
 
2268 2268
 
2269 2269
 	protected function _category_list_table() {
2270
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2271
-		$this->_search_btn_label = esc_html__( 'Categories', 'event_espresso' );
2272
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
2270
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2271
+		$this->_search_btn_label = esc_html__('Categories', 'event_espresso');
2272
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
2273 2273
 				'add_category',
2274 2274
 				'add_category',
2275 2275
 				array(),
@@ -2283,20 +2283,20 @@  discard block
 block discarded – undo
2283 2283
 	/**
2284 2284
 	 * @param $view
2285 2285
 	 */
2286
-	protected function _category_details( $view ) {
2286
+	protected function _category_details($view) {
2287 2287
 		//load formatter helper
2288 2288
 		//load field generator helper
2289 2289
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
2290
-		$this->_set_add_edit_form_tags( $route );
2290
+		$this->_set_add_edit_form_tags($route);
2291 2291
 		$this->_set_category_object();
2292
-		$id = ! empty( $this->_category->id ) ? $this->_category->id : '';
2292
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2293 2293
 		$delete_action = 'delete_category';
2294 2294
 		//custom redirect
2295 2295
 		$redirect = EE_Admin_Page::add_query_args_and_nonce(
2296
-			array( 'action' => 'category_list' ),
2296
+			array('action' => 'category_list'),
2297 2297
 			$this->_admin_base_url
2298 2298
 		);
2299
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2299
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2300 2300
 		//take care of contents
2301 2301
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
2302 2302
 		$this->display_admin_page_with_sidebar();
@@ -2310,21 +2310,21 @@  discard block
 block discarded – undo
2310 2310
 	protected function _category_details_content() {
2311 2311
 		$editor_args['category_desc'] = array(
2312 2312
 			'type'          => 'wp_editor',
2313
-			'value'         => EEH_Formatter::admin_format_content( $this->_category->category_desc ),
2313
+			'value'         => EEH_Formatter::admin_format_content($this->_category->category_desc),
2314 2314
 			'class'         => 'my_editor_custom',
2315
-			'wpeditor_args' => array( 'media_buttons' => false ),
2315
+			'wpeditor_args' => array('media_buttons' => false),
2316 2316
 		);
2317
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2317
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2318 2318
 		$all_terms = get_terms(
2319
-			array( 'espresso_event_categories' ),
2320
-			array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) )
2319
+			array('espresso_event_categories'),
2320
+			array('hide_empty' => 0, 'exclude' => array($this->_category->id))
2321 2321
 		);
2322 2322
 		//setup category select for term parents.
2323 2323
 		$category_select_values[] = array(
2324
-			'text' => esc_html__( 'No Parent', 'event_espresso' ),
2324
+			'text' => esc_html__('No Parent', 'event_espresso'),
2325 2325
 			'id'   => 0,
2326 2326
 		);
2327
-		foreach ( $all_terms as $term ) {
2327
+		foreach ($all_terms as $term) {
2328 2328
 			$category_select_values[] = array(
2329 2329
 				'text' => $term->name,
2330 2330
 				'id'   => $term->term_id,
@@ -2338,28 +2338,28 @@  discard block
 block discarded – undo
2338 2338
 		$template_args = array(
2339 2339
 			'category'                 => $this->_category,
2340 2340
 			'category_select'          => $category_select,
2341
-			'unique_id_info_help_link' => $this->_get_help_tab_link( 'unique_id_info' ),
2341
+			'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'),
2342 2342
 			'category_desc_editor'     => $_wp_editor['category_desc']['field'],
2343 2343
 			'disable'                  => '',
2344 2344
 			'disabled_message'         => false,
2345 2345
 		);
2346
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2347
-		return EEH_Template::display_template( $template, $template_args, true );
2346
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2347
+		return EEH_Template::display_template($template, $template_args, true);
2348 2348
 	}
2349 2349
 
2350 2350
 
2351 2351
 
2352 2352
 	protected function _delete_categories() {
2353
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID']
2353
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID']
2354 2354
 			: (array) $this->_req_data['category_id'];
2355
-		foreach ( $cat_ids as $cat_id ) {
2356
-			$this->_delete_category( $cat_id );
2355
+		foreach ($cat_ids as $cat_id) {
2356
+			$this->_delete_category($cat_id);
2357 2357
 		}
2358 2358
 		//doesn't matter what page we're coming from... we're going to the same place after delete.
2359 2359
 		$query_args = array(
2360 2360
 			'action' => 'category_list',
2361 2361
 		);
2362
-		$this->_redirect_after_action( 0, '', '', $query_args );
2362
+		$this->_redirect_after_action(0, '', '', $query_args);
2363 2363
 	}
2364 2364
 
2365 2365
 
@@ -2367,9 +2367,9 @@  discard block
 block discarded – undo
2367 2367
 	/**
2368 2368
 	 * @param $cat_id
2369 2369
 	 */
2370
-	protected function _delete_category( $cat_id ) {
2371
-		$cat_id = absint( $cat_id );
2372
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2370
+	protected function _delete_category($cat_id) {
2371
+		$cat_id = absint($cat_id);
2372
+		wp_delete_term($cat_id, 'espresso_event_categories');
2373 2373
 	}
2374 2374
 
2375 2375
 
@@ -2377,18 +2377,18 @@  discard block
 block discarded – undo
2377 2377
 	/**
2378 2378
 	 * @param $new_category
2379 2379
 	 */
2380
-	protected function _insert_or_update_category( $new_category ) {
2381
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( true );
2380
+	protected function _insert_or_update_category($new_category) {
2381
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true);
2382 2382
 		$success = 0; //we already have a success message so lets not send another.
2383
-		if ( $cat_id ) {
2383
+		if ($cat_id) {
2384 2384
 			$query_args = array(
2385 2385
 				'action'     => 'edit_category',
2386 2386
 				'EVT_CAT_ID' => $cat_id,
2387 2387
 			);
2388 2388
 		} else {
2389
-			$query_args = array( 'action' => 'add_category' );
2389
+			$query_args = array('action' => 'add_category');
2390 2390
 		}
2391
-		$this->_redirect_after_action( $success, '', '', $query_args, true );
2391
+		$this->_redirect_after_action($success, '', '', $query_args, true);
2392 2392
 	}
2393 2393
 
2394 2394
 
@@ -2397,14 +2397,14 @@  discard block
 block discarded – undo
2397 2397
 	 * @param bool $update
2398 2398
 	 * @return bool|mixed|string
2399 2399
 	 */
2400
-	private function _insert_category( $update = false ) {
2400
+	private function _insert_category($update = false) {
2401 2401
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2402
-		$category_name = isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2403
-		$category_desc = isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2404
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2405
-		if ( empty( $category_name ) ) {
2406
-			$msg = esc_html__( 'You must add a name for the category.', 'event_espresso' );
2407
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2402
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2403
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2404
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2405
+		if (empty($category_name)) {
2406
+			$msg = esc_html__('You must add a name for the category.', 'event_espresso');
2407
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2408 2408
 			return false;
2409 2409
 		}
2410 2410
 		$term_args = array(
@@ -2413,22 +2413,22 @@  discard block
 block discarded – undo
2413 2413
 			'parent'      => $category_parent,
2414 2414
 		);
2415 2415
 		//was the category_identifier input disabled?
2416
-		if ( isset( $this->_req_data['category_identifier'] ) ) {
2416
+		if (isset($this->_req_data['category_identifier'])) {
2417 2417
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2418 2418
 		}
2419 2419
 		$insert_ids = $update
2420
-			? wp_update_term( $cat_id, 'espresso_event_categories', $term_args )
2421
-			: wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2422
-		if ( ! is_array( $insert_ids ) ) {
2420
+			? wp_update_term($cat_id, 'espresso_event_categories', $term_args)
2421
+			: wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2422
+		if ( ! is_array($insert_ids)) {
2423 2423
 			$msg = esc_html__(
2424 2424
 				'An error occurred and the category has not been saved to the database.',
2425 2425
 				'event_espresso'
2426 2426
 			);
2427
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2427
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2428 2428
 		} else {
2429 2429
 			$cat_id = $insert_ids['term_id'];
2430
-			$msg = sprintf( esc_html__( 'The category %s was successfully saved', 'event_espresso' ), $category_name );
2431
-			EE_Error::add_success( $msg );
2430
+			$msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name);
2431
+			EE_Error::add_success($msg);
2432 2432
 		}
2433 2433
 		return $cat_id;
2434 2434
 	}
@@ -2441,28 +2441,28 @@  discard block
 block discarded – undo
2441 2441
 	 * @param bool $count
2442 2442
 	 * @return \EE_Base_Class[]|int
2443 2443
 	 */
2444
-	public function get_categories( $per_page = 10, $current_page = 1, $count = false ) {
2444
+	public function get_categories($per_page = 10, $current_page = 1, $count = false) {
2445 2445
 		//testing term stuff
2446
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2447
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2448
-		$limit = ( $current_page - 1 ) * $per_page;
2449
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2450
-		if ( isset( $this->_req_data['s'] ) ) {
2451
-			$sstr = '%' . $this->_req_data['s'] . '%';
2446
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2447
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2448
+		$limit = ($current_page - 1) * $per_page;
2449
+		$where = array('taxonomy' => 'espresso_event_categories');
2450
+		if (isset($this->_req_data['s'])) {
2451
+			$sstr = '%'.$this->_req_data['s'].'%';
2452 2452
 			$where['OR'] = array(
2453
-				'Term.name'   => array( 'LIKE', $sstr ),
2454
-				'description' => array( 'LIKE', $sstr ),
2453
+				'Term.name'   => array('LIKE', $sstr),
2454
+				'description' => array('LIKE', $sstr),
2455 2455
 			);
2456 2456
 		}
2457 2457
 		$query_params = array(
2458 2458
 			$where,
2459
-			'order_by'   => array( $orderby => $order ),
2460
-			'limit'      => $limit . ',' . $per_page,
2461
-			'force_join' => array( 'Term' ),
2459
+			'order_by'   => array($orderby => $order),
2460
+			'limit'      => $limit.','.$per_page,
2461
+			'force_join' => array('Term'),
2462 2462
 		);
2463 2463
 		$categories = $count
2464
-			? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' )
2465
-			: EEM_Term_Taxonomy::instance()->get_all( $query_params );
2464
+			? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id')
2465
+			: EEM_Term_Taxonomy::instance()->get_all($query_params);
2466 2466
 		return $categories;
2467 2467
 	}
2468 2468
 
Please login to merge, or discard this patch.
caffeinated/admin/extend/events/Extend_Events_Admin_Page.core.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	/**
56 56
 	 * @param EE_Line_Item $line_item
57 57
 	 * @param array        $options
58
-	 * @return mixed
58
+	 * @return string
59 59
 	 */
60 60
 	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
61 61
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @param EE_Line_Item $line_item
137 137
 	 * @param array        $options
138
-	 * @return mixed
138
+	 * @return string
139 139
 	 */
140 140
 	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
141 141
 		// start of row
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @param EE_Line_Item $line_item
180 180
 	 * @param array        $options
181
-	 * @return mixed
181
+	 * @return string
182 182
 	 */
183 183
 	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
184 184
 		// start of row
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -284,12 +284,12 @@  discard block
 block discarded – undo
284 284
 			);
285 285
 			$title = esc_attr__( 'Duplicate Event', 'event_espresso' );
286 286
 			$return .= '<a href="'
287
-			           . $href
288
-			           . '" title="'
289
-			           . $title
290
-			           . '" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">'
291
-			           . $title
292
-			           . '</button>';
287
+					   . $href
288
+					   . '" title="'
289
+					   . $title
290
+					   . '" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">'
291
+					   . $title
292
+					   . '</button>';
293 293
 		}
294 294
 		return $return;
295 295
 	}
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 			);
451 451
 			$reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL );
452 452
 			$action_links[] = '<a href="'
453
-			                  . $reports_link
454
-			                  . '" title="'
455
-			                  . esc_attr__( 'View Report', 'event_espresso' )
456
-			                  . '"><div class="dashicons dashicons-chart-bar"></div></a>'
457
-			                  . "\n\t";
453
+							  . $reports_link
454
+							  . '" title="'
455
+							  . esc_attr__( 'View Report', 'event_espresso' )
456
+							  . '"><div class="dashicons dashicons-chart-bar"></div></a>'
457
+							  . "\n\t";
458 458
 		}
459 459
 		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
460 460
 			EE_Registry::instance()->load_helper( 'MSG_Template' );
Please login to merge, or discard this patch.
Spacing   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'NO direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -21,26 +21,26 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param bool $routing
23 23
 	 */
24
-	public function __construct( $routing = true ) {
25
-		parent::__construct( $routing );
26
-		if ( ! defined( 'EVENTS_CAF_TEMPLATE_PATH' ) ) {
27
-			define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/' );
28
-			define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/' );
29
-			define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/' );
24
+	public function __construct($routing = true) {
25
+		parent::__construct($routing);
26
+		if ( ! defined('EVENTS_CAF_TEMPLATE_PATH')) {
27
+			define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/');
28
+			define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/');
29
+			define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/');
30 30
 		}
31 31
 	}
32 32
 
33 33
 
34 34
 
35 35
 	protected function _extend_page_config() {
36
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events';
36
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events';
37 37
 		//is there a evt_id in the request?
38
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] )
38
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID'])
39 39
 			? $this->_req_data['EVT_ID']
40 40
 			: 0;
41
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
41
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
42 42
 		//tkt_id?
43
-		$tkt_id = ! empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] )
43
+		$tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID'])
44 44
 			? $this->_req_data['TKT_ID']
45 45
 			: 0;
46 46
 		$new_page_routes = array(
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 				'capability' => 'ee_delete_default_ticket',
60 60
 				'obj_id'     => $tkt_id,
61 61
 				'noheader'   => true,
62
-				'args'       => array( 'trash' => true ),
62
+				'args'       => array('trash' => true),
63 63
 			),
64 64
 			'trash_tickets'            => array(
65 65
 				'func'       => '_trash_or_restore_ticket',
66 66
 				'capability' => 'ee_delete_default_tickets',
67 67
 				'noheader'   => true,
68
-				'args'       => array( 'trash' => true ),
68
+				'args'       => array('trash' => true),
69 69
 			),
70 70
 			'restore_ticket'           => array(
71 71
 				'func'       => '_trash_or_restore_ticket',
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				'noheader'   => true,
125 125
 			),
126 126
 		);
127
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
127
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
128 128
 		//partial route/config override
129 129
 		$this->_page_config['import_events']['metaboxes'] = $this->_default_espresso_metaboxes;
130 130
 		$this->_page_config['create_new']['metaboxes'][] = '_premium_event_editor_meta_boxes';
@@ -134,15 +134,15 @@  discard block
 block discarded – undo
134 134
 		$this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table';
135 135
 		//add tickets tab but only if there are more than one default ticket!
136 136
 		$tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(
137
-			array( array( 'TKT_is_default' => 1 ) ),
137
+			array(array('TKT_is_default' => 1)),
138 138
 			'TKT_ID',
139 139
 			true
140 140
 		);
141
-		if ( $tkt_count > 1 ) {
141
+		if ($tkt_count > 1) {
142 142
 			$new_page_config = array(
143 143
 				'ticket_list_table' => array(
144 144
 					'nav'           => array(
145
-						'label' => esc_html__( 'Default Tickets', 'event_espresso' ),
145
+						'label' => esc_html__('Default Tickets', 'event_espresso'),
146 146
 						'order' => 60,
147 147
 					),
148 148
 					'list_table'    => 'Tickets_List_Table',
@@ -153,53 +153,53 @@  discard block
 block discarded – undo
153 153
 		//template settings
154 154
 		$new_page_config['template_settings'] = array(
155 155
 			'nav'           => array(
156
-				'label' => esc_html__( 'Templates', 'event_espresso' ),
156
+				'label' => esc_html__('Templates', 'event_espresso'),
157 157
 				'order' => 30,
158 158
 			),
159
-			'metaboxes'     => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
159
+			'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
160 160
 			'help_tabs'     => array(
161 161
 				'general_settings_templates_help_tab' => array(
162
-					'title'    => esc_html__( 'Templates', 'event_espresso' ),
162
+					'title'    => esc_html__('Templates', 'event_espresso'),
163 163
 					'filename' => 'general_settings_templates',
164 164
 				),
165 165
 			),
166
-			'help_tour'     => array( 'Templates_Help_Tour' ),
166
+			'help_tour'     => array('Templates_Help_Tour'),
167 167
 			'require_nonce' => false,
168 168
 		);
169
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
169
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
170 170
 		//add filters and actions
171 171
 		//modifying _views
172 172
 		add_filter(
173 173
 			'FHEE_event_datetime_metabox_add_additional_date_time_template',
174
-			array( $this, 'add_additional_datetime_button' ),
174
+			array($this, 'add_additional_datetime_button'),
175 175
 			10,
176 176
 			2
177 177
 		);
178 178
 		add_filter(
179 179
 			'FHEE_event_datetime_metabox_clone_button_template',
180
-			array( $this, 'add_datetime_clone_button' ),
180
+			array($this, 'add_datetime_clone_button'),
181 181
 			10,
182 182
 			2
183 183
 		);
184 184
 		add_filter(
185 185
 			'FHEE_event_datetime_metabox_timezones_template',
186
-			array( $this, 'datetime_timezones_template' ),
186
+			array($this, 'datetime_timezones_template'),
187 187
 			10,
188 188
 			2
189 189
 		);
190 190
 		//filters for event list table
191
-		add_filter( 'FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters' ), 10, 2 );
191
+		add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2);
192 192
 		add_filter(
193 193
 			'FHEE__Events_Admin_List_Table__column_actions__action_links',
194
-			array( $this, 'extra_list_table_actions' ),
194
+			array($this, 'extra_list_table_actions'),
195 195
 			10,
196 196
 			2
197 197
 		);
198 198
 		//legend item
199
-		add_filter( 'FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items' ) );
200
-		add_action( 'admin_init', array( $this, 'admin_init' ) );
199
+		add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items'));
200
+		add_action('admin_init', array($this, 'admin_init'));
201 201
 		//heartbeat stuff
202
-		add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 );
202
+		add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2);
203 203
 	}
204 204
 
205 205
 
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 					'Do you really want to delete this image? Please remember to update your event to complete the removal.',
216 216
 					'event_espresso'
217 217
 				),
218
-				'event_starts_on'        => esc_html__( 'Event Starts on', 'event_espresso' ),
219
-				'event_ends_on'          => esc_html__( 'Event Ends on', 'event_espresso' ),
220
-				'event_datetime_actions' => esc_html__( 'Actions', 'event_espresso' ),
221
-				'event_clone_dt_msg'     => esc_html__( 'Clone this Event Date and Time', 'event_espresso' ),
222
-				'remove_event_dt_msg'    => esc_html__( 'Remove this Event Time', 'event_espresso' ),
218
+				'event_starts_on'        => esc_html__('Event Starts on', 'event_espresso'),
219
+				'event_ends_on'          => esc_html__('Event Ends on', 'event_espresso'),
220
+				'event_datetime_actions' => esc_html__('Actions', 'event_espresso'),
221
+				'event_clone_dt_msg'     => esc_html__('Clone this Event Date and Time', 'event_espresso'),
222
+				'remove_event_dt_msg'    => esc_html__('Remove this Event Time', 'event_espresso'),
223 223
 			)
224 224
 		);
225 225
 	}
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 	 * @param array $data     The incoming data package.
235 235
 	 * @return array  possibly appended response.
236 236
 	 */
237
-	public function heartbeat_response( $response, $data ) {
237
+	public function heartbeat_response($response, $data) {
238 238
 		/**
239 239
 		 * check whether count of tickets is approaching the potential
240 240
 		 * limits for the server.
241 241
 		 */
242
-		if ( ! empty( $data['input_count'] ) ) {
242
+		if ( ! empty($data['input_count'])) {
243 243
 			$response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check(
244 244
 				$data['input_count']
245 245
 			);
@@ -262,15 +262,15 @@  discard block
 block discarded – undo
262 262
 	 * @param string $new_slug
263 263
 	 * @return string
264 264
 	 */
265
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
266
-		$return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug );
265
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
266
+		$return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug);
267 267
 		//make sure this is only when editing
268
-		if ( ! empty( $id ) ) {
268
+		if ( ! empty($id)) {
269 269
 			$href = EE_Admin_Page::add_query_args_and_nonce(
270
-				array( 'action' => 'duplicate_event', 'EVT_ID' => $id ),
270
+				array('action' => 'duplicate_event', 'EVT_ID' => $id),
271 271
 				$this->_admin_base_url
272 272
 			);
273
-			$title = esc_attr__( 'Duplicate Event', 'event_espresso' );
273
+			$title = esc_attr__('Duplicate Event', 'event_espresso');
274 274
 			$return .= '<a href="'
275 275
 			           . $href
276 276
 			           . '" title="'
@@ -288,19 +288,19 @@  discard block
 block discarded – undo
288 288
 		$this->_views = array(
289 289
 			'all'     => array(
290 290
 				'slug'        => 'all',
291
-				'label'       => esc_html__( 'All', 'event_espresso' ),
291
+				'label'       => esc_html__('All', 'event_espresso'),
292 292
 				'count'       => 0,
293 293
 				'bulk_action' => array(
294
-					'trash_tickets' => esc_html__( 'Move to Trash', 'event_espresso' ),
294
+					'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'),
295 295
 				),
296 296
 			),
297 297
 			'trashed' => array(
298 298
 				'slug'        => 'trashed',
299
-				'label'       => esc_html__( 'Trash', 'event_espresso' ),
299
+				'label'       => esc_html__('Trash', 'event_espresso'),
300 300
 				'count'       => 0,
301 301
 				'bulk_action' => array(
302
-					'restore_tickets' => esc_html__( 'Restore from Trash', 'event_espresso' ),
303
-					'delete_tickets'  => esc_html__( 'Delete Permanently', 'event_espresso' ),
302
+					'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'),
303
+					'delete_tickets'  => esc_html__('Delete Permanently', 'event_espresso'),
304 304
 				),
305 305
 			),
306 306
 		);
@@ -311,19 +311,19 @@  discard block
 block discarded – undo
311 311
 	public function load_scripts_styles_edit() {
312 312
 		wp_register_script(
313 313
 			'ee-event-editor-heartbeat',
314
-			EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js',
315
-			array( 'ee_admin_js', 'heartbeat' ),
314
+			EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js',
315
+			array('ee_admin_js', 'heartbeat'),
316 316
 			EVENT_ESPRESSO_VERSION,
317 317
 			true
318 318
 		);
319 319
 		/**
320 320
 		 * load accounting js.
321 321
 		 */
322
-		add_filter( 'FHEE_load_accounting_js', '__return_true' );
322
+		add_filter('FHEE_load_accounting_js', '__return_true');
323 323
 		//styles
324
-		wp_enqueue_style( 'espresso-ui-theme' );
325
-		wp_enqueue_script( 'event_editor_js' );
326
-		wp_enqueue_script( 'ee-event-editor-heartbeat' );
324
+		wp_enqueue_style('espresso-ui-theme');
325
+		wp_enqueue_script('event_editor_js');
326
+		wp_enqueue_script('ee-event-editor-heartbeat');
327 327
 	}
328 328
 
329 329
 
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
 	 * @param $template_args
334 334
 	 * @return mixed
335 335
 	 */
336
-	public function add_additional_datetime_button( $template, $template_args ) {
336
+	public function add_additional_datetime_button($template, $template_args) {
337 337
 		return EEH_Template::display_template(
338
-			EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php',
338
+			EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php',
339 339
 			$template_args,
340 340
 			true
341 341
 		);
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 	 * @param $template_args
349 349
 	 * @return mixed
350 350
 	 */
351
-	public function add_datetime_clone_button( $template, $template_args ) {
351
+	public function add_datetime_clone_button($template, $template_args) {
352 352
 		return EEH_Template::display_template(
353
-			EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php',
353
+			EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php',
354 354
 			$template_args,
355 355
 			true
356 356
 		);
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
 	 * @param $template_args
364 364
 	 * @return mixed
365 365
 	 */
366
-	public function datetime_timezones_template( $template, $template_args ) {
366
+	public function datetime_timezones_template($template, $template_args) {
367 367
 		return EEH_Template::display_template(
368
-			EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php',
368
+			EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php',
369 369
 			$template_args,
370 370
 			true
371 371
 		);
@@ -378,22 +378,22 @@  discard block
 block discarded – undo
378 378
 		$new_views = array(
379 379
 			'today' => array(
380 380
 				'slug'        => 'today',
381
-				'label'       => esc_html__( 'Today', 'event_espresso' ),
381
+				'label'       => esc_html__('Today', 'event_espresso'),
382 382
 				'count'       => $this->total_events_today(),
383 383
 				'bulk_action' => array(
384
-					'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ),
384
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
385 385
 				),
386 386
 			),
387 387
 			'month' => array(
388 388
 				'slug'        => 'month',
389
-				'label'       => esc_html__( 'This Month', 'event_espresso' ),
389
+				'label'       => esc_html__('This Month', 'event_espresso'),
390 390
 				'count'       => $this->total_events_this_month(),
391 391
 				'bulk_action' => array(
392
-					'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ),
392
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
393 393
 				),
394 394
 			),
395 395
 		);
396
-		$this->_views = array_merge( $this->_views, $new_views );
396
+		$this->_views = array_merge($this->_views, $new_views);
397 397
 	}
398 398
 
399 399
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	 * @param \EE_Event $event
404 404
 	 * @return array
405 405
 	 */
406
-	public function extra_list_table_actions( array $action_links, \EE_Event $event ) {
406
+	public function extra_list_table_actions(array $action_links, \EE_Event $event) {
407 407
 		if (
408 408
 			EE_Registry::instance()->CAP->current_user_can(
409 409
 				'ee_read_registrations',
@@ -415,20 +415,20 @@  discard block
 block discarded – undo
415 415
 				'action' => 'reports',
416 416
 				'EVT_ID' => $event->ID(),
417 417
 			);
418
-			$reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL );
418
+			$reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL);
419 419
 			$action_links[] = '<a href="'
420 420
 			                  . $reports_link
421 421
 			                  . '" title="'
422
-			                  . esc_attr__( 'View Report', 'event_espresso' )
422
+			                  . esc_attr__('View Report', 'event_espresso')
423 423
 			                  . '"><div class="dashicons dashicons-chart-bar"></div></a>'
424 424
 			                  . "\n\t";
425 425
 		}
426
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
427
-			EE_Registry::instance()->load_helper( 'MSG_Template' );
426
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
427
+			EE_Registry::instance()->load_helper('MSG_Template');
428 428
 			$action_links[] = EEH_MSG_Template::get_message_action_link(
429 429
 				'see_notifications_for',
430 430
 				null,
431
-				array( 'EVT_ID' => $event->ID() )
431
+				array('EVT_ID' => $event->ID())
432 432
 			);
433 433
 		}
434 434
 		return $action_links;
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @param $items
441 441
 	 * @return mixed
442 442
 	 */
443
-	public function additional_legend_items( $items ) {
443
+	public function additional_legend_items($items) {
444 444
 		if (
445 445
 			EE_Registry::instance()->CAP->current_user_can(
446 446
 				'ee_read_registrations',
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
 		) {
450 450
 			$items['reports'] = array(
451 451
 				'class' => 'dashicons dashicons-chart-bar',
452
-				'desc'  => esc_html__( 'Event Reports', 'event_espresso' ),
452
+				'desc'  => esc_html__('Event Reports', 'event_espresso'),
453 453
 			);
454 454
 		}
455
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
456
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
457
-			if ( isset( $related_for_icon['css_class'] ) && isset( $related_for_icon['label'] ) ) {
455
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
456
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
457
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
458 458
 				$items['view_related_messages'] = array(
459 459
 					'class' => $related_for_icon['css_class'],
460 460
 					'desc'  => $related_for_icon['label'],
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 	protected function _duplicate_event() {
481 481
 		// first make sure the ID for the event is in the request.
482 482
 		//  If it isn't then we need to bail and redirect back to overview list table (cause how did we get here?)
483
-		if ( ! isset( $this->_req_data['EVT_ID'] ) ) {
483
+		if ( ! isset($this->_req_data['EVT_ID'])) {
484 484
 			EE_Error::add_error(
485 485
 				esc_html__(
486 486
 					'In order to duplicate an event an Event ID is required.  None was given.',
@@ -490,15 +490,15 @@  discard block
 block discarded – undo
490 490
 				__FUNCTION__,
491 491
 				__LINE__
492 492
 			);
493
-			$this->_redirect_after_action( false, '', '', array(), true );
493
+			$this->_redirect_after_action(false, '', '', array(), true);
494 494
 			return;
495 495
 		}
496 496
 		//k we've got EVT_ID so let's use that to get the event we'll duplicate
497
-		$orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] );
498
-		if ( ! $orig_event instanceof EE_Event ) {
497
+		$orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']);
498
+		if ( ! $orig_event instanceof EE_Event) {
499 499
 			throw new EE_Error(
500 500
 				sprintf(
501
-					esc_html__( 'An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso' ),
501
+					esc_html__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'),
502 502
 					$this->_req_data['EVT_ID']
503 503
 				)
504 504
 			);
@@ -506,56 +506,56 @@  discard block
 block discarded – undo
506 506
 		//k now let's clone the $orig_event before getting relations
507 507
 		$new_event = clone $orig_event;
508 508
 		//original datetimes
509
-		$orig_datetimes = $orig_event->get_many_related( 'Datetime' );
509
+		$orig_datetimes = $orig_event->get_many_related('Datetime');
510 510
 		//other original relations
511
-		$orig_ven = $orig_event->get_many_related( 'Venue' );
511
+		$orig_ven = $orig_event->get_many_related('Venue');
512 512
 		//reset the ID and modify other details to make it clear this is a dupe
513
-		$new_event->set( 'EVT_ID', 0 );
514
-		$new_name = $new_event->name() . ' ' . esc_html__( '**DUPLICATE**', 'event_espresso' );
515
-		$new_event->set( 'EVT_name', $new_name );
513
+		$new_event->set('EVT_ID', 0);
514
+		$new_name = $new_event->name().' '.esc_html__('**DUPLICATE**', 'event_espresso');
515
+		$new_event->set('EVT_name', $new_name);
516 516
 		$new_event->set(
517 517
 			'EVT_slug',
518 518
 			wp_unique_post_slug(
519
-				sanitize_title( $orig_event->name() ),
519
+				sanitize_title($orig_event->name()),
520 520
 				0,
521 521
 				'publish',
522 522
 				'espresso_events',
523 523
 				0
524 524
 			)
525 525
 		);
526
-		$new_event->set( 'status', 'draft' );
526
+		$new_event->set('status', 'draft');
527 527
 		//duplicate discussion settings
528
-		$new_event->set( 'comment_status', $orig_event->get( 'comment_status' ) );
529
-		$new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) );
528
+		$new_event->set('comment_status', $orig_event->get('comment_status'));
529
+		$new_event->set('ping_status', $orig_event->get('ping_status'));
530 530
 		//save the new event
531 531
 		$new_event->save();
532 532
 		//venues
533
-		foreach ( $orig_ven as $ven ) {
534
-			$new_event->_add_relation_to( $ven, 'Venue' );
533
+		foreach ($orig_ven as $ven) {
534
+			$new_event->_add_relation_to($ven, 'Venue');
535 535
 		}
536 536
 		$new_event->save();
537 537
 		//now we need to get the question group relations and handle that
538 538
 		//first primary question groups
539 539
 		$orig_primary_qgs = $orig_event->get_many_related(
540 540
 			'Question_Group',
541
-			array( array( 'Event_Question_Group.EQG_primary' => 1 ) )
541
+			array(array('Event_Question_Group.EQG_primary' => 1))
542 542
 		);
543
-		if ( ! empty( $orig_primary_qgs ) ) {
544
-			foreach ( $orig_primary_qgs as $id => $obj ) {
545
-				if ( $obj instanceof EE_Question_Group ) {
546
-					$new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) );
543
+		if ( ! empty($orig_primary_qgs)) {
544
+			foreach ($orig_primary_qgs as $id => $obj) {
545
+				if ($obj instanceof EE_Question_Group) {
546
+					$new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1));
547 547
 				}
548 548
 			}
549 549
 		}
550 550
 		//next additional attendee question groups
551 551
 		$orig_additional_qgs = $orig_event->get_many_related(
552 552
 			'Question_Group',
553
-			array( array( 'Event_Question_Group.EQG_primary' => 0 ) )
553
+			array(array('Event_Question_Group.EQG_primary' => 0))
554 554
 		);
555
-		if ( ! empty( $orig_additional_qgs ) ) {
556
-			foreach ( $orig_additional_qgs as $id => $obj ) {
557
-				if ( $obj instanceof EE_Question_Group ) {
558
-					$new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) );
555
+		if ( ! empty($orig_additional_qgs)) {
556
+			foreach ($orig_additional_qgs as $id => $obj) {
557
+				if ($obj instanceof EE_Question_Group) {
558
+					$new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0));
559 559
 				}
560 560
 			}
561 561
 		}
@@ -563,70 +563,70 @@  discard block
 block discarded – undo
563 563
 		$new_event->save();
564 564
 		//k now that we have the new event saved we can loop through the datetimes and start adding relations.
565 565
 		$cloned_tickets = array();
566
-		foreach ( $orig_datetimes as $orig_dtt ) {
567
-			if ( ! $orig_dtt instanceof EE_Datetime ) {
566
+		foreach ($orig_datetimes as $orig_dtt) {
567
+			if ( ! $orig_dtt instanceof EE_Datetime) {
568 568
 				continue;
569 569
 			}
570 570
 			$new_dtt = clone $orig_dtt;
571 571
 			$orig_tkts = $orig_dtt->tickets();
572 572
 			//save new dtt then add to event
573
-			$new_dtt->set( 'DTT_ID', 0 );
574
-			$new_dtt->set( 'DTT_sold', 0 );
573
+			$new_dtt->set('DTT_ID', 0);
574
+			$new_dtt->set('DTT_sold', 0);
575 575
 			$new_dtt->save();
576
-			$new_event->_add_relation_to( $new_dtt, 'Datetime' );
576
+			$new_event->_add_relation_to($new_dtt, 'Datetime');
577 577
 			$new_event->save();
578 578
 			//now let's get the ticket relations setup.
579
-			foreach ( (array) $orig_tkts as $orig_tkt ) {
579
+			foreach ((array) $orig_tkts as $orig_tkt) {
580 580
 				//it's possible a datetime will have no tickets so let's verify we HAVE a ticket first.
581
-				if ( ! $orig_tkt instanceof EE_Ticket ) {
581
+				if ( ! $orig_tkt instanceof EE_Ticket) {
582 582
 					continue;
583 583
 				}
584 584
 				//is this ticket archived?  If it is then let's skip
585
-				if ( $orig_tkt->get( 'TKT_deleted' ) ) {
585
+				if ($orig_tkt->get('TKT_deleted')) {
586 586
 					continue;
587 587
 				}
588 588
 				// does this original ticket already exist in the clone_tickets cache?
589 589
 				//  If so we'll just use the new ticket from it.
590
-				if ( isset( $cloned_tickets[ $orig_tkt->ID() ] ) ) {
591
-					$new_tkt = $cloned_tickets[ $orig_tkt->ID() ];
590
+				if (isset($cloned_tickets[$orig_tkt->ID()])) {
591
+					$new_tkt = $cloned_tickets[$orig_tkt->ID()];
592 592
 				} else {
593 593
 					$new_tkt = clone $orig_tkt;
594 594
 					//get relations on the $orig_tkt that we need to setup.
595 595
 					$orig_prices = $orig_tkt->prices();
596
-					$new_tkt->set( 'TKT_ID', 0 );
597
-					$new_tkt->set( 'TKT_sold', 0 );
596
+					$new_tkt->set('TKT_ID', 0);
597
+					$new_tkt->set('TKT_sold', 0);
598 598
 					$new_tkt->save(); //make sure new ticket has ID.
599 599
 					//price relations on new ticket need to be setup.
600
-					foreach ( $orig_prices as $orig_price ) {
600
+					foreach ($orig_prices as $orig_price) {
601 601
 						$new_price = clone $orig_price;
602
-						$new_price->set( 'PRC_ID', 0 );
602
+						$new_price->set('PRC_ID', 0);
603 603
 						$new_price->save();
604
-						$new_tkt->_add_relation_to( $new_price, 'Price' );
604
+						$new_tkt->_add_relation_to($new_price, 'Price');
605 605
 						$new_tkt->save();
606 606
 					}
607 607
 				}
608 608
 				// k now we can add the new ticket as a relation to the new datetime
609 609
 				// and make sure its added to our cached $cloned_tickets array
610 610
 				// for use with later datetimes that have the same ticket.
611
-				$new_dtt->_add_relation_to( $new_tkt, 'Ticket' );
611
+				$new_dtt->_add_relation_to($new_tkt, 'Ticket');
612 612
 				$new_dtt->save();
613
-				$cloned_tickets[ $orig_tkt->ID() ] = $new_tkt;
613
+				$cloned_tickets[$orig_tkt->ID()] = $new_tkt;
614 614
 			}
615 615
 		}
616 616
 		//clone taxonomy information
617 617
 		$taxonomies_to_clone_with = apply_filters(
618 618
 			'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone',
619
-			array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' )
619
+			array('espresso_event_categories', 'espresso_event_type', 'post_tag')
620 620
 		);
621 621
 		//get terms for original event (notice)
622
-		$orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with );
622
+		$orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with);
623 623
 		//loop through terms and add them to new event.
624
-		foreach ( $orig_terms as $term ) {
625
-			wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true );
624
+		foreach ($orig_terms as $term) {
625
+			wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true);
626 626
 		}
627
-		do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event );
627
+		do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event);
628 628
 		//now let's redirect to the edit page for this duplicated event if we have a new event id.
629
-		if ( $new_event->ID() ) {
629
+		if ($new_event->ID()) {
630 630
 			$redirect_args = array(
631 631
 				'post'   => $new_event->ID(),
632 632
 				'action' => 'edit',
@@ -642,19 +642,19 @@  discard block
 block discarded – undo
642 642
 				'action' => 'default',
643 643
 			);
644 644
 			EE_Error::add_error(
645
-				esc_html__( 'Not able to duplicate event.  Something went wrong.', 'event_espresso' ),
645
+				esc_html__('Not able to duplicate event.  Something went wrong.', 'event_espresso'),
646 646
 				__FILE__,
647 647
 				__FUNCTION__,
648 648
 				__LINE__
649 649
 			);
650 650
 		}
651
-		$this->_redirect_after_action( false, '', '', $redirect_args, true );
651
+		$this->_redirect_after_action(false, '', '', $redirect_args, true);
652 652
 	}
653 653
 
654 654
 
655 655
 
656 656
 	protected function _import_page() {
657
-		$title = esc_html__( 'Import', 'event_espresso' );
657
+		$title = esc_html__('Import', 'event_espresso');
658 658
 		$intro = esc_html__(
659 659
 			'If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ',
660 660
 			'event_espresso'
@@ -662,13 +662,13 @@  discard block
 block discarded – undo
662 662
 		$form_url = EVENTS_ADMIN_URL;
663 663
 		$action = 'import_events';
664 664
 		$type = 'csv';
665
-		$this->_template_args['form'] = EE_Import::instance()->upload_form( $title, $intro, $form_url, $action, $type );
665
+		$this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type);
666 666
 		$this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(
667
-			array( 'action' => 'sample_export_file' ),
667
+			array('action' => 'sample_export_file'),
668 668
 			$this->_admin_base_url
669 669
 		);
670 670
 		$content = EEH_Template::display_template(
671
-			EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',
671
+			EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php',
672 672
 			$this->_template_args,
673 673
 			true
674 674
 		);
@@ -685,9 +685,9 @@  discard block
 block discarded – undo
685 685
 	 * @return void
686 686
 	 */
687 687
 	protected function _import_events() {
688
-		require_once( EE_CLASSES . 'EE_Import.class.php' );
688
+		require_once(EE_CLASSES.'EE_Import.class.php');
689 689
 		$success = EE_Import::instance()->import();
690
-		$this->_redirect_after_action( $success, 'Import File', 'ran', array( 'action' => 'import_page' ), true );
690
+		$this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true);
691 691
 	}
692 692
 
693 693
 
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
 	 * @return void
701 701
 	 */
702 702
 	protected function _events_export() {
703
-		if ( isset( $this->_req_data['EVT_ID'] ) ) {
703
+		if (isset($this->_req_data['EVT_ID'])) {
704 704
 			$event_ids = $this->_req_data['EVT_ID'];
705
-		} elseif ( isset( $this->_req_data['EVT_IDs'] ) ) {
705
+		} elseif (isset($this->_req_data['EVT_IDs'])) {
706 706
 			$event_ids = $this->_req_data['EVT_IDs'];
707 707
 		} else {
708 708
 			$event_ids = null;
@@ -713,10 +713,10 @@  discard block
 block discarded – undo
713 713
 			'action' => 'all_event_data',
714 714
 			'EVT_ID' => $event_ids,
715 715
 		);
716
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
717
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php' ) ) {
718
-			require_once( EE_CLASSES . 'EE_Export.class.php' );
719
-			$EE_Export = EE_Export::instance( $this->_req_data );
716
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
717
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
718
+			require_once(EE_CLASSES.'EE_Export.class.php');
719
+			$EE_Export = EE_Export::instance($this->_req_data);
720 720
 			$EE_Export->export();
721 721
 		}
722 722
 	}
@@ -735,10 +735,10 @@  discard block
 block discarded – undo
735 735
 			'action'       => 'categories',
736 736
 			'category_ids' => $this->_req_data['EVT_CAT_ID'],
737 737
 		);
738
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
739
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php' ) ) {
740
-			require_once( EE_CLASSES . 'EE_Export.class.php' );
741
-			$EE_Export = EE_Export::instance( $this->_req_data );
738
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
739
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
740
+			require_once(EE_CLASSES.'EE_Export.class.php');
741
+			$EE_Export = EE_Export::instance($this->_req_data);
742 742
 			$EE_Export->export();
743 743
 		}
744 744
 	}
@@ -766,10 +766,10 @@  discard block
 block discarded – undo
766 766
 			'FHEE__General_Settings_Admin_Page__template_settings__template_args',
767 767
 			$this->_template_args
768 768
 		);
769
-		$this->_set_add_edit_form_tags( 'update_template_settings' );
770
-		$this->_set_publish_post_box_vars( null, false, false, null, false );
769
+		$this->_set_add_edit_form_tags('update_template_settings');
770
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
771 771
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
772
-			EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php',
772
+			EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php',
773 773
 			$this->_template_args,
774 774
 			true
775 775
 		);
@@ -790,9 +790,9 @@  discard block
 block discarded – undo
790 790
 		);
791 791
 		//update custom post type slugs and detect if we need to flush rewrite rules
792 792
 		$old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug;
793
-		EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] )
793
+		EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug'])
794 794
 			? EE_Registry::instance()->CFG->core->event_cpt_slug
795
-			: sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] );
795
+			: sanitize_title_with_dashes($this->_req_data['event_cpt_slug']);
796 796
 		$what = 'Template Settings';
797 797
 		$success = $this->_update_espresso_configuration(
798 798
 			$what,
@@ -801,10 +801,10 @@  discard block
 block discarded – undo
801 801
 			__FUNCTION__,
802 802
 			__LINE__
803 803
 		);
804
-		if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) {
805
-			update_option( 'ee_flush_rewrite_rules', true );
804
+		if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) {
805
+			update_option('ee_flush_rewrite_rules', true);
806 806
 		}
807
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) );
807
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings'));
808 808
 	}
809 809
 
810 810
 
@@ -820,8 +820,8 @@  discard block
 block discarded – undo
820 820
 		$this->verify_cpt_object();
821 821
 		add_meta_box(
822 822
 			'espresso_event_editor_event_options',
823
-			esc_html__( 'Event Registration Options', 'event_espresso' ),
824
-			array( $this, 'registration_options_meta_box' ),
823
+			esc_html__('Event Registration Options', 'event_espresso'),
824
+			array($this, 'registration_options_meta_box'),
825 825
 			$this->page_slug,
826 826
 			'side',
827 827
 			'core'
@@ -837,8 +837,8 @@  discard block
 block discarded – undo
837 837
 	 */
838 838
 	public function registration_options_meta_box() {
839 839
 		$yes_no_values = array(
840
-			array( 'id' => true, 'text' => esc_html__( 'Yes', 'event_espresso' ) ),
841
-			array( 'id' => false, 'text' => esc_html__( 'No', 'event_espresso' ) ),
840
+			array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')),
841
+			array('id' => false, 'text' => esc_html__('No', 'event_espresso')),
842 842
 		);
843 843
 		$default_reg_status_values = EEM_Registration::reg_status_array(
844 844
 			array(
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 			),
850 850
 			true
851 851
 		);
852
-		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status( false );
852
+		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false);
853 853
 		$template_args['_event'] = $this->_cpt_model_obj;
854 854
 		$template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
855 855
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input(
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 			$default_reg_status_values
884 884
 		);
885 885
 		EEH_Template::display_template(
886
-			EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php',
886
+			EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php',
887 887
 			$template_args
888 888
 		);
889 889
 	}
@@ -901,20 +901,20 @@  discard block
 block discarded – undo
901 901
 	 * @param  array $list_table_obj the list table object
902 902
 	 * @return array                  new filters
903 903
 	 */
904
-	public function list_table_filters( $old_filters, $list_table_obj ) {
904
+	public function list_table_filters($old_filters, $list_table_obj) {
905 905
 		$filters = array();
906 906
 		//first month/year filters
907 907
 		$filters[] = $this->espresso_event_months_dropdown();
908
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null;
908
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
909 909
 		//active status dropdown
910
-		if ( $status !== 'draft' ) {
910
+		if ($status !== 'draft') {
911 911
 			$filter[] = $this->active_status_dropdown(
912
-				isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : ''
912
+				isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : ''
913 913
 			);
914 914
 		}
915 915
 		//category filter
916 916
 		$filters[] = $this->category_dropdown();
917
-		return array_merge( $old_filters, $filters );
917
+		return array_merge($old_filters, $filters);
918 918
 	}
919 919
 
920 920
 
@@ -928,15 +928,15 @@  discard block
 block discarded – undo
928 928
 	public function espresso_event_months_dropdown() {
929 929
 		// what we need to do is get all PRIMARY datetimes for all events to filter on.
930 930
 		// Note we need to include any other filters that are set!
931
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null;
931
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
932 932
 		//categories?
933
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0
933
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0
934 934
 			? $this->_req_data['EVT_CAT']
935 935
 			: null;
936 936
 		//active status?
937
-		$active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : null;
938
-		$cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : '';
939
-		return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status );
937
+		$active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : null;
938
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
939
+		return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status);
940 940
 	}
941 941
 
942 942
 
@@ -947,18 +947,18 @@  discard block
 block discarded – undo
947 947
 	 * @param  string $current_value whatever the current active status is
948 948
 	 * @return string
949 949
 	 */
950
-	public function active_status_dropdown( $current_value = '' ) {
950
+	public function active_status_dropdown($current_value = '') {
951 951
 		$select_name = 'active_status';
952 952
 		$values = array(
953
-			'none'     => esc_html__( 'Show Active/Inactive', 'event_espresso' ),
954
-			'active'   => esc_html__( 'Active', 'event_espresso' ),
955
-			'upcoming' => esc_html__( 'Upcoming', 'event_espresso' ),
956
-			'expired'  => esc_html__( 'Expired', 'event_espresso' ),
957
-			'inactive' => esc_html__( 'Inactive', 'event_espresso' ),
953
+			'none'     => esc_html__('Show Active/Inactive', 'event_espresso'),
954
+			'active'   => esc_html__('Active', 'event_espresso'),
955
+			'upcoming' => esc_html__('Upcoming', 'event_espresso'),
956
+			'expired'  => esc_html__('Expired', 'event_espresso'),
957
+			'inactive' => esc_html__('Inactive', 'event_espresso'),
958 958
 		);
959 959
 		$id = 'id="espresso-active-status-dropdown-filter"';
960 960
 		$class = 'wide';
961
-		return EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class );
961
+		return EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class);
962 962
 	}
963 963
 
964 964
 
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
 	 * @return string html
971 971
 	 */
972 972
 	public function category_dropdown() {
973
-		$cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
974
-		return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat );
973
+		$cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
974
+		return EEH_Form_Fields::generate_event_category_dropdown($cur_cat);
975 975
 	}
976 976
 
977 977
 
@@ -985,20 +985,20 @@  discard block
 block discarded – undo
985 985
 	public function total_events_today() {
986 986
 		$start = EEM_Datetime::instance()->convert_datetime_for_query(
987 987
 			'DTT_EVT_start',
988
-			date( 'Y-m-d' ) . ' 00:00:00',
988
+			date('Y-m-d').' 00:00:00',
989 989
 			'Y-m-d H:i:s',
990 990
 			'UTC'
991 991
 		);
992 992
 		$end = EEM_Datetime::instance()->convert_datetime_for_query(
993 993
 			'DTT_EVT_start',
994
-			date( 'Y-m-d' ) . ' 23:59:59',
994
+			date('Y-m-d').' 23:59:59',
995 995
 			'Y-m-d H:i:s',
996 996
 			'UTC'
997 997
 		);
998 998
 		$where = array(
999
-			'Datetime.DTT_EVT_start' => array( 'BETWEEN', array( $start, $end ) ),
999
+			'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)),
1000 1000
 		);
1001
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1001
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1002 1002
 		return $count;
1003 1003
 	}
1004 1004
 
@@ -1012,25 +1012,25 @@  discard block
 block discarded – undo
1012 1012
 	 */
1013 1013
 	public function total_events_this_month() {
1014 1014
 		//Dates
1015
-		$this_year_r = date( 'Y' );
1016
-		$this_month_r = date( 'm' );
1017
-		$days_this_month = date( 't' );
1015
+		$this_year_r = date('Y');
1016
+		$this_month_r = date('m');
1017
+		$days_this_month = date('t');
1018 1018
 		$start = EEM_Datetime::instance()->convert_datetime_for_query(
1019 1019
 			'DTT_EVT_start',
1020
-			$this_year_r . '-' . $this_month_r . '-01 00:00:00',
1020
+			$this_year_r.'-'.$this_month_r.'-01 00:00:00',
1021 1021
 			'Y-m-d H:i:s',
1022 1022
 			'UTC'
1023 1023
 		);
1024 1024
 		$end = EEM_Datetime::instance()->convert_datetime_for_query(
1025 1025
 			'DTT_EVT_start',
1026
-			$this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59',
1026
+			$this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59',
1027 1027
 			'Y-m-d H:i:s',
1028 1028
 			'UTC'
1029 1029
 		);
1030 1030
 		$where = array(
1031
-			'Datetime.DTT_EVT_start' => array( 'BETWEEN', array( $start, $end ) ),
1031
+			'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)),
1032 1032
 		);
1033
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1033
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1034 1034
 		return $count;
1035 1035
 	}
1036 1036
 
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 
1039 1039
 	/** DEFAULT TICKETS STUFF **/
1040 1040
 	public function _tickets_overview_list_table() {
1041
-		$this->_search_btn_label = esc_html__( 'Tickets', 'event_espresso' );
1041
+		$this->_search_btn_label = esc_html__('Tickets', 'event_espresso');
1042 1042
 		$this->display_admin_list_table_page_with_no_sidebar();
1043 1043
 	}
1044 1044
 
@@ -1050,46 +1050,46 @@  discard block
 block discarded – undo
1050 1050
 	 * @param bool $trashed
1051 1051
 	 * @return \EE_Soft_Delete_Base_Class[]|int
1052 1052
 	 */
1053
-	public function get_default_tickets( $per_page = 10, $count = false, $trashed = false ) {
1054
-		$orderby = empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby'];
1055
-		$order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order'];
1056
-		switch ( $orderby ) {
1053
+	public function get_default_tickets($per_page = 10, $count = false, $trashed = false) {
1054
+		$orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby'];
1055
+		$order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order'];
1056
+		switch ($orderby) {
1057 1057
 			case 'TKT_name' :
1058
-				$orderby = array( 'TKT_name' => $order );
1058
+				$orderby = array('TKT_name' => $order);
1059 1059
 				break;
1060 1060
 			case 'TKT_price' :
1061
-				$orderby = array( 'TKT_price' => $order );
1061
+				$orderby = array('TKT_price' => $order);
1062 1062
 				break;
1063 1063
 			case 'TKT_uses' :
1064
-				$orderby = array( 'TKT_uses' => $order );
1064
+				$orderby = array('TKT_uses' => $order);
1065 1065
 				break;
1066 1066
 			case 'TKT_min' :
1067
-				$orderby = array( 'TKT_min' => $order );
1067
+				$orderby = array('TKT_min' => $order);
1068 1068
 				break;
1069 1069
 			case 'TKT_max' :
1070
-				$orderby = array( 'TKT_max' => $order );
1070
+				$orderby = array('TKT_max' => $order);
1071 1071
 				break;
1072 1072
 			case 'TKT_qty' :
1073
-				$orderby = array( 'TKT_qty' => $order );
1073
+				$orderby = array('TKT_qty' => $order);
1074 1074
 				break;
1075 1075
 		}
1076
-		$current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] )
1076
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
1077 1077
 			? $this->_req_data['paged']
1078 1078
 			: 1;
1079
-		$per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] )
1079
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
1080 1080
 			? $this->_req_data['perpage']
1081 1081
 			: $per_page;
1082 1082
 		$_where = array(
1083 1083
 			'TKT_is_default' => 1,
1084 1084
 			'TKT_deleted'    => $trashed,
1085 1085
 		);
1086
-		$offset = ( $current_page - 1 ) * $per_page;
1087
-		$limit = array( $offset, $per_page );
1088
-		if ( isset( $this->_req_data['s'] ) ) {
1089
-			$sstr = '%' . $this->_req_data['s'] . '%';
1086
+		$offset = ($current_page - 1) * $per_page;
1087
+		$limit = array($offset, $per_page);
1088
+		if (isset($this->_req_data['s'])) {
1089
+			$sstr = '%'.$this->_req_data['s'].'%';
1090 1090
 			$_where['OR'] = array(
1091
-				'TKT_name'        => array( 'LIKE', $sstr ),
1092
-				'TKT_description' => array( 'LIKE', $sstr ),
1091
+				'TKT_name'        => array('LIKE', $sstr),
1092
+				'TKT_description' => array('LIKE', $sstr),
1093 1093
 			);
1094 1094
 		}
1095 1095
 		$query_params = array(
@@ -1098,10 +1098,10 @@  discard block
 block discarded – undo
1098 1098
 			'limit'    => $limit,
1099 1099
 			'group_by' => 'TKT_ID',
1100 1100
 		);
1101
-		if ( $count ) {
1102
-			return EEM_Ticket::instance()->count_deleted_and_undeleted( array( $_where ) );
1101
+		if ($count) {
1102
+			return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where));
1103 1103
 		} else {
1104
-			return EEM_Ticket::instance()->get_all_deleted_and_undeleted( $query_params );
1104
+			return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
1105 1105
 		}
1106 1106
 	}
1107 1107
 
@@ -1110,34 +1110,34 @@  discard block
 block discarded – undo
1110 1110
 	/**
1111 1111
 	 * @param bool $trash
1112 1112
 	 */
1113
-	protected function _trash_or_restore_ticket( $trash = false ) {
1113
+	protected function _trash_or_restore_ticket($trash = false) {
1114 1114
 		$success = 1;
1115 1115
 		$TKT = EEM_Ticket::instance();
1116 1116
 		//checkboxes?
1117
-		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
1117
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1118 1118
 			//if array has more than one element then success message should be plural
1119
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1119
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1120 1120
 			//cycle thru the boxes
1121
-			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1122
-				if ( $trash ) {
1123
-					if ( ! $TKT->delete_by_ID( $TKT_ID ) ) {
1121
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1122
+				if ($trash) {
1123
+					if ( ! $TKT->delete_by_ID($TKT_ID)) {
1124 1124
 						$success = 0;
1125 1125
 					}
1126 1126
 				} else {
1127
-					if ( ! $TKT->restore_by_ID( $TKT_ID ) ) {
1127
+					if ( ! $TKT->restore_by_ID($TKT_ID)) {
1128 1128
 						$success = 0;
1129 1129
 					}
1130 1130
 				}
1131 1131
 			}
1132 1132
 		} else {
1133 1133
 			//grab single id and trash
1134
-			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1135
-			if ( $trash ) {
1136
-				if ( ! $TKT->delete_by_ID( $TKT_ID ) ) {
1134
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1135
+			if ($trash) {
1136
+				if ( ! $TKT->delete_by_ID($TKT_ID)) {
1137 1137
 					$success = 0;
1138 1138
 				}
1139 1139
 			} else {
1140
-				if ( ! $TKT->restore_by_ID( $TKT_ID ) ) {
1140
+				if ( ! $TKT->restore_by_ID($TKT_ID)) {
1141 1141
 					$success = 0;
1142 1142
 				}
1143 1143
 			}
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 			'action' => 'ticket_list_table',
1148 1148
 			'status' => $trash ? '' : 'trashed',
1149 1149
 		);
1150
-		$this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args );
1150
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1151 1151
 	}
1152 1152
 
1153 1153
 
@@ -1155,20 +1155,20 @@  discard block
 block discarded – undo
1155 1155
 	protected function _delete_ticket() {
1156 1156
 		$success = 1;
1157 1157
 		//checkboxes?
1158
-		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
1158
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1159 1159
 			//if array has more than one element then success message should be plural
1160
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1160
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1161 1161
 			//cycle thru the boxes
1162
-			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1162
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1163 1163
 				//delete
1164
-				if ( ! $this->_delete_the_ticket( $TKT_ID ) ) {
1164
+				if ( ! $this->_delete_the_ticket($TKT_ID)) {
1165 1165
 					$success = 0;
1166 1166
 				}
1167 1167
 			}
1168 1168
 		} else {
1169 1169
 			//grab single id and trash
1170
-			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1171
-			if ( ! $this->_delete_the_ticket( $TKT_ID ) ) {
1170
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1171
+			if ( ! $this->_delete_the_ticket($TKT_ID)) {
1172 1172
 				$success = 0;
1173 1173
 			}
1174 1174
 		}
@@ -1178,15 +1178,15 @@  discard block
 block discarded – undo
1178 1178
 			'status' => 'trashed',
1179 1179
 		);
1180 1180
 		//fail safe.  If the default ticket count === 1 then we need to redirect to event overview.
1181
-		if ( EEM_Ticket::instance()->count_deleted_and_undeleted(
1182
-			array( array( 'TKT_is_default' => 1 ) ),
1181
+		if (EEM_Ticket::instance()->count_deleted_and_undeleted(
1182
+			array(array('TKT_is_default' => 1)),
1183 1183
 			'TKT_ID',
1184 1184
 			true
1185 1185
 		)
1186 1186
 		) {
1187 1187
 			$query_args = array();
1188 1188
 		}
1189
-		$this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args );
1189
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1190 1190
 	}
1191 1191
 
1192 1192
 
@@ -1195,11 +1195,11 @@  discard block
 block discarded – undo
1195 1195
 	 * @param int $TKT_ID
1196 1196
 	 * @return bool|int
1197 1197
 	 */
1198
-	protected function _delete_the_ticket( $TKT_ID ) {
1199
-		$tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID );
1200
-		$tkt->_remove_relations( 'Datetime' );
1198
+	protected function _delete_the_ticket($TKT_ID) {
1199
+		$tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
1200
+		$tkt->_remove_relations('Datetime');
1201 1201
 		//delete all related prices first
1202
-		$tkt->delete_related_permanently( 'Price' );
1202
+		$tkt->delete_related_permanently('Price');
1203 1203
 		return $tkt->delete_permanently();
1204 1204
 	}
1205 1205
 
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_Checkout.class.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
 	/**
278 278
 	 * @param $REG_ID
279
-	 * @param $reg_status
279
+	 * @param boolean $reg_status
280 280
 	 */
281 281
 	public function set_reg_status_updated( $REG_ID, $reg_status ) {
282 282
 		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
@@ -1110,6 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 	 *
1111 1111
 	 * @param    string | int    $reg_cache_ID
1112 1112
 	 * @param    EE_Registration $registration
1113
+	 * @param integer $reg_cache_ID
1113 1114
 	 * @return void
1114 1115
 	 * @throws \EE_Error
1115 1116
 	 */
Please login to merge, or discard this patch.
Spacing   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 		$this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url();
242 242
 		$this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url();
243 243
 		$this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url();
244
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE );
244
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE);
245 245
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax;
246
-		$this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' ));
246
+		$this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC'));
247 247
 	}
248 248
 
249 249
 
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 	 * @return boolean
255 255
 	 */
256 256
 	public function any_reg_status_updated() {
257
-		foreach ( $this->reg_status_updated as $reg_status ) {
258
-			if ( $reg_status ) {
257
+		foreach ($this->reg_status_updated as $reg_status) {
258
+			if ($reg_status) {
259 259
 				return true;
260 260
 			}
261 261
 		}
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 	 * @param $REG_ID
269 269
 	 * @return boolean
270 270
 	 */
271
-	public function reg_status_updated( $REG_ID ) {
272
-		return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false;
271
+	public function reg_status_updated($REG_ID) {
272
+		return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false;
273 273
 	}
274 274
 
275 275
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 	 * @param $REG_ID
279 279
 	 * @param $reg_status
280 280
 	 */
281
-	public function set_reg_status_updated( $REG_ID, $reg_status ) {
282
-		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
281
+	public function set_reg_status_updated($REG_ID, $reg_status) {
282
+		$this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN);
283 283
 	}
284 284
 
285 285
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * can ONLY be set by the  Finalize_Registration reg step
301 301
 	 */
302 302
 	public function set_exit_spco() {
303
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
303
+		if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
304 304
 			$this->exit_spco = true;
305 305
 		}
306 306
 	}
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public function reset_for_current_request() {
319 319
 		$this->process_form_submission = FALSE;
320
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true );
320
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true);
321 321
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax;
322 322
 		$this->continue_reg = true;
323 323
 		$this->redirect = false;
324 324
 		// don't reset the cached redirect form if we're about to be asked to display it !!!
325
-		if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) {
325
+		if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') {
326 326
 			$this->redirect_form = '';
327 327
 		}
328 328
 		$this->redirect_url = '';
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 	 * @param EE_SPCO_Reg_Step $reg_step_obj
340 340
 	 * @return    void
341 341
 	 */
342
-	public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) {
343
-		$this->reg_steps[ $reg_step_obj->slug()  ] = $reg_step_obj;
342
+	public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) {
343
+		$this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj;
344 344
 	}
345 345
 
346 346
 
@@ -356,22 +356,22 @@  discard block
 block discarded – undo
356 356
 	 * @return    void
357 357
 	 * @throws \EE_Error
358 358
 	 */
359
-	public function skip_reg_step( $reg_step_slug = '' ) {
360
-		$step_to_skip = $this->find_reg_step( $reg_step_slug );
361
-		if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) {
362
-			$step_to_skip->set_is_current_step( false );
359
+	public function skip_reg_step($reg_step_slug = '') {
360
+		$step_to_skip = $this->find_reg_step($reg_step_slug);
361
+		if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) {
362
+			$step_to_skip->set_is_current_step(false);
363 363
 			$step_to_skip->set_completed();
364 364
 			// advance to the next step
365
-			$this->set_current_step( $this->next_step->slug() );
365
+			$this->set_current_step($this->next_step->slug());
366 366
 			// also reset the step param in the request in case any other code references that directly
367
-			EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() );
367
+			EE_Registry::instance()->REQ->set('step', $this->current_step->slug());
368 368
 			// since we are skipping a step and setting the current step to be what was previously the next step,
369 369
 			// we need to check that the next step is now correct, and not still set to the current step.
370
-			if ( $this->current_step->slug() === $this->next_step->slug() ) {
370
+			if ($this->current_step->slug() === $this->next_step->slug()) {
371 371
 				// correctly setup the next step
372 372
 				$this->set_next_step();
373 373
 			}
374
-			$this->set_reg_step_initiated( $this->current_step );
374
+			$this->set_reg_step_initiated($this->current_step);
375 375
 		}
376 376
 	}
377 377
 
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
 	 * @param bool   $reset whether to reset reg steps after removal
386 386
 	 * @throws EE_Error
387 387
 	 */
388
-	public function remove_reg_step( $reg_step_slug = '', $reset = true ) {
389
-		unset( $this->reg_steps[ $reg_step_slug  ] );
390
-		if ( $this->transaction instanceof EE_Transaction ) {
388
+	public function remove_reg_step($reg_step_slug = '', $reset = true) {
389
+		unset($this->reg_steps[$reg_step_slug]);
390
+		if ($this->transaction instanceof EE_Transaction) {
391 391
 			// now remove reg step from TXN and save
392
-			$this->transaction->remove_reg_step( $reg_step_slug );
392
+			$this->transaction->remove_reg_step($reg_step_slug);
393 393
 			$this->transaction->save();
394 394
 		}
395
-		if ( $reset ) {
395
+		if ($reset) {
396 396
 			$this->reset_reg_steps();
397 397
 		}
398 398
 	}
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 	 * @param int    $order
408 408
 	 * @return    void
409 409
 	 */
410
-	public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) {
411
-		if ( isset( $this->reg_steps[ $reg_step_slug  ] )) {
412
-			$this->reg_steps[ $reg_step_slug ]->set_order( $order );
410
+	public function set_reg_step_order($reg_step_slug = '', $order = 100) {
411
+		if (isset($this->reg_steps[$reg_step_slug])) {
412
+			$this->reg_steps[$reg_step_slug]->set_order($order);
413 413
 		}
414 414
 	}
415 415
 
@@ -422,25 +422,25 @@  discard block
 block discarded – undo
422 422
 	 * @param string $current_step
423 423
 	 * @return    void
424 424
 	 */
425
-	public function set_current_step( $current_step ) {
425
+	public function set_current_step($current_step) {
426 426
 		// grab what step we're on
427
-		$this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps );
427
+		$this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps);
428 428
 		// verify instance
429
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step ) {
429
+		if ($this->current_step instanceof EE_SPCO_Reg_Step) {
430 430
 			// we don't want to repeat completed steps if this is the first time through SPCO
431
-			if ( $this->continue_reg && ! $this->revisit && $this->current_step->completed() ) {
431
+			if ($this->continue_reg && ! $this->revisit && $this->current_step->completed()) {
432 432
 				// so advance to the next step
433 433
 				$this->set_next_step();
434
-				if ( $this->next_step instanceof EE_SPCO_Reg_Step ) {
434
+				if ($this->next_step instanceof EE_SPCO_Reg_Step) {
435 435
 					// and attempt to set it as the current step
436
-					$this->set_current_step( $this->next_step->slug() );
436
+					$this->set_current_step($this->next_step->slug());
437 437
 				}
438 438
 				return;
439 439
 			}
440
-			$this->current_step->set_is_current_step( TRUE );
440
+			$this->current_step->set_is_current_step(TRUE);
441 441
 		} else {
442 442
 			EE_Error::add_error(
443
-				__( 'The current step could not be set.', 'event_espresso' ),
443
+				__('The current step could not be set.', 'event_espresso'),
444 444
 				__FILE__, __FUNCTION__, __LINE__
445 445
 			);
446 446
 		}
@@ -457,20 +457,20 @@  discard block
 block discarded – undo
457 457
 	 */
458 458
 	public function set_next_step() {
459 459
 		// set pointer to start of array
460
-		reset( $this->reg_steps );
460
+		reset($this->reg_steps);
461 461
 		// if there is more than one step
462
-		if ( count( $this->reg_steps ) > 1 ) {
462
+		if (count($this->reg_steps) > 1) {
463 463
 			// advance to the current step and set pointer
464
-			while ( key( $this->reg_steps ) !== $this->current_step->slug() && key( $this->reg_steps ) !== '' ) {
465
-				next( $this->reg_steps );
464
+			while (key($this->reg_steps) !== $this->current_step->slug() && key($this->reg_steps) !== '') {
465
+				next($this->reg_steps);
466 466
 			}
467 467
 		}
468 468
 		// advance one more spot ( if it exists )
469
-		$this->next_step = next( $this->reg_steps );
469
+		$this->next_step = next($this->reg_steps);
470 470
 		// verify instance
471
-		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step  : NULL;
471
+		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL;
472 472
 		// then back to current step to reset
473
-		prev( $this->reg_steps );
473
+		prev($this->reg_steps);
474 474
 	}
475 475
 
476 476
 
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	 *  @return 	EE_SPCO_Reg_Step | null
485 485
 	 */
486 486
 	public function get_next_reg_step() {
487
-		$next = next( $this->reg_steps );
488
-		prev( $this->reg_steps );
487
+		$next = next($this->reg_steps);
488
+		prev($this->reg_steps);
489 489
 		return $next instanceof EE_SPCO_Reg_Step ? $next : null;
490 490
 	}
491 491
 
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 	 *  @return 	EE_SPCO_Reg_Step | null
501 501
 	 */
502 502
 	public function get_prev_reg_step() {
503
-		$prev = prev( $this->reg_steps );
504
-		next( $this->reg_steps );
503
+		$prev = prev($this->reg_steps);
504
+		next($this->reg_steps);
505 505
 		return $prev instanceof EE_SPCO_Reg_Step ? $prev : null;
506 506
 	}
507 507
 
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 	 * @return void
515 515
 	 */
516 516
 	public function sort_reg_steps() {
517
-		$reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' );
518
-		uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback ));
517
+		$reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback');
518
+		uasort($this->reg_steps, array($this, $reg_step_sorting_callback));
519 519
 	}
520 520
 
521 521
 
@@ -528,19 +528,19 @@  discard block
 block discarded – undo
528 528
 	 * @param string $reg_step_slug
529 529
 	 * @return EE_SPCO_Reg_Step|null
530 530
 	 */
531
-	public function find_reg_step( $reg_step_slug = '' ) {
532
-		if ( ! empty( $reg_step_slug ) ) {
531
+	public function find_reg_step($reg_step_slug = '') {
532
+		if ( ! empty($reg_step_slug)) {
533 533
 			// copy reg step array
534 534
 			$reg_steps = $this->reg_steps;
535 535
 			// set pointer to start of array
536
-			reset( $reg_steps );
536
+			reset($reg_steps);
537 537
 			// if there is more than one step
538
-			if ( count( $reg_steps ) > 1 ) {
538
+			if (count($reg_steps) > 1) {
539 539
 				// advance to the current step and set pointer
540
-				while ( key( $reg_steps ) !== $reg_step_slug && key( $reg_steps ) !== '' ) {
541
-					next( $reg_steps );
540
+				while (key($reg_steps) !== $reg_step_slug && key($reg_steps) !== '') {
541
+					next($reg_steps);
542 542
 				}
543
-				return current( $reg_steps );
543
+				return current($reg_steps);
544 544
 			}
545 545
 		}
546 546
 		return null;
@@ -556,17 +556,17 @@  discard block
 block discarded – undo
556 556
 	 * @param EE_SPCO_Reg_Step $reg_step_B
557 557
 	 * @return int
558 558
 	 */
559
-	public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) {
559
+	public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) {
560 560
 		// send finalize_registration step to the end of the array
561
-		if ( $reg_step_A->slug() === 'finalize_registration' ) {
561
+		if ($reg_step_A->slug() === 'finalize_registration') {
562 562
 			return 1;
563
-		} else if ( $reg_step_B->slug() === 'finalize_registration' ) {
563
+		} else if ($reg_step_B->slug() === 'finalize_registration') {
564 564
 			return -1;
565 565
 		}
566
-		if ( $reg_step_A->order() === $reg_step_B->order() ) {
566
+		if ($reg_step_A->order() === $reg_step_B->order()) {
567 567
 			return 0;
568 568
 		}
569
-		return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1;
569
+		return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1;
570 570
 	}
571 571
 
572 572
 
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 	 * @param    EE_SPCO_Reg_Step $reg_step
579 579
 	 * @throws \EE_Error
580 580
 	 */
581
-	public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) {
581
+	public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) {
582 582
 		// call set_reg_step_initiated ???
583 583
 		if (
584 584
 			// first time visiting SPCO ?
@@ -591,11 +591,11 @@  discard block
 block discarded – undo
591 591
 			)
592 592
 		) {
593 593
 			// set the start time for this reg step
594
-			if ( ! $this->transaction->set_reg_step_initiated( $reg_step->slug() ) ) {
595
-				if ( WP_DEBUG ) {
594
+			if ( ! $this->transaction->set_reg_step_initiated($reg_step->slug())) {
595
+				if (WP_DEBUG) {
596 596
 					EE_Error::add_error(
597 597
 						sprintf(
598
-							__( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ),
598
+							__('The "%1$s" registration step was not initialized properly.', 'event_espresso'),
599 599
 							$reg_step->name()
600 600
 						),
601 601
 						__FILE__, __FUNCTION__, __LINE__
@@ -614,10 +614,10 @@  discard block
 block discarded – undo
614 614
 	 * 	@return 	void
615 615
 	 */
616 616
 	public function set_reg_step_JSON_info() {
617
-		EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array();
617
+		EE_Registry::$i18n_js_strings['reg_steps'] = array();
618 618
 		// pass basic reg step data to JS
619
-		foreach ( $this->reg_steps as $reg_step ) {
620
-			EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug();
619
+		foreach ($this->reg_steps as $reg_step) {
620
+			EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug();
621 621
 		}
622 622
 		// reset reg step html
623 623
 //		$this->json_response->set_reg_step_html( '' );
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	 */
634 634
 	public function reset_reg_steps() {
635 635
 		$this->sort_reg_steps();
636
-		$this->set_current_step( EE_Registry::instance()->REQ->get( 'step' ));
636
+		$this->set_current_step(EE_Registry::instance()->REQ->get('step'));
637 637
 		$this->set_next_step();
638 638
 		// the text that appears on the reg step form submit button
639 639
 		$this->current_step->set_submit_button_text();
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 	 */
651 651
 	public function get_registration_time_limit() {
652 652
 
653
-		$registration_time_limit = (float)( EE_Registry::instance()	->SSN->expiration() - time() );
653
+		$registration_time_limit = (float) (EE_Registry::instance()	->SSN->expiration() - time());
654 654
 		$time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s';
655
-		$registration_time_limit = gmdate( $time_limit_format, $registration_time_limit );
655
+		$registration_time_limit = gmdate($time_limit_format, $registration_time_limit);
656 656
 		return apply_filters(
657 657
 			'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit',
658 658
 			$registration_time_limit
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 		//		overpaid TXN
673 673
 		//		free TXN ( total = 0.00 )
674 674
 		// then payment required is TRUE
675
-		return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE;
675
+		return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE;
676 676
 	}
677 677
 
678 678
 
@@ -684,12 +684,12 @@  discard block
 block discarded – undo
684 684
 	 * @param EE_Transaction $transaction
685 685
 	 * @return EE_Cart
686 686
 	 */
687
-	public function get_cart_for_transaction( $transaction ) {
688
-		$session = EE_Registry::instance()->load_core( 'Session' );
689
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction, $session ) : null;
687
+	public function get_cart_for_transaction($transaction) {
688
+		$session = EE_Registry::instance()->load_core('Session');
689
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction, $session) : null;
690 690
 		// verify cart
691
-		if ( ! $cart instanceof EE_Cart ) {
692
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
691
+		if ( ! $cart instanceof EE_Cart) {
692
+			$cart = EE_Registry::instance()->load_core('Cart');
693 693
 		}
694 694
 
695 695
 		return $cart;
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
 	 */
706 706
 	public function initialize_txn_reg_steps_array() {
707 707
 		$txn_reg_steps_array = array();
708
-		foreach ( $this->reg_steps as $reg_step ) {
709
-			$txn_reg_steps_array[ $reg_step->slug() ] = FALSE;
708
+		foreach ($this->reg_steps as $reg_step) {
709
+			$txn_reg_steps_array[$reg_step->slug()] = FALSE;
710 710
 		}
711 711
 		return $txn_reg_steps_array;
712 712
 	}
@@ -722,14 +722,14 @@  discard block
 block discarded – undo
722 722
 	 */
723 723
 	public function update_txn_reg_steps_array() {
724 724
 		$updated = false;
725
-		foreach ( $this->reg_steps as $reg_step ) {
726
-			if ( $reg_step->completed() ) {
727
-				$updated = $this->transaction->set_reg_step_completed( $reg_step->slug() )
725
+		foreach ($this->reg_steps as $reg_step) {
726
+			if ($reg_step->completed()) {
727
+				$updated = $this->transaction->set_reg_step_completed($reg_step->slug())
728 728
 					? true
729 729
 					: $updated;
730 730
 			}
731 731
 		}
732
-		if ( $updated ) {
732
+		if ($updated) {
733 733
 			$this->transaction->save();
734 734
 		}
735 735
 		return $updated;
@@ -745,14 +745,14 @@  discard block
 block discarded – undo
745 745
 	 * @throws \EE_Error
746 746
 	 */
747 747
 	public function stash_transaction_and_checkout() {
748
-		if ( ! $this->revisit ) {
748
+		if ( ! $this->revisit) {
749 749
 			$this->update_txn_reg_steps_array();
750 750
 		}
751 751
 		$this->track_transaction_and_registration_status_updates();
752 752
 		// save all data to the db, but suppress errors
753 753
 		//$this->save_all_data( FALSE );
754 754
 		// cache the checkout in the session
755
-		EE_Registry::instance()->SSN->set_checkout( $this );
755
+		EE_Registry::instance()->SSN->set_checkout($this);
756 756
 	}
757 757
 
758 758
 
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
 	 */
768 768
 	public function track_transaction_and_registration_status_updates() {
769 769
 		// verify the transaction
770
-		if ( $this->transaction instanceof EE_Transaction ) {
770
+		if ($this->transaction instanceof EE_Transaction) {
771 771
 			// has there been a TXN status change during this checkout?
772 772
 			$this->txn_status_updated = $this->transaction->txn_status_updated();
773 773
 			/** @type EE_Registration_Processor $registration_processor */
774
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
774
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
775 775
 			// grab the saved registrations from the transaction
776
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) {
777
-				if ( $registration_processor->reg_status_updated( $registration->ID() ) ) {
778
-					$this->set_reg_status_updated( $registration->ID(), true );
776
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) {
777
+				if ($registration_processor->reg_status_updated($registration->ID())) {
778
+					$this->set_reg_status_updated($registration->ID(), true);
779 779
 				}
780 780
 			}
781 781
 		}
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 	 * @return    bool
797 797
 	 * @throws \EE_Error
798 798
 	 */
799
-	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
799
+	public function visit_allows_processing_of_this_registration(EE_Registration $registration) {
800 800
 		return ! $this->revisit
801 801
 		       || $this->primary_revisit
802 802
 		       || (
@@ -829,18 +829,18 @@  discard block
 block discarded – undo
829 829
 	 * @return bool
830 830
 	 * @throws \EE_Error
831 831
 	 */
832
-	public function save_all_data( $show_errors = TRUE ) {
832
+	public function save_all_data($show_errors = TRUE) {
833 833
 		// verify the transaction
834
-		if ( $this->transaction instanceof EE_Transaction ) {
834
+		if ($this->transaction instanceof EE_Transaction) {
835 835
 			// save to ensure that TXN has ID
836 836
 			$this->transaction->save();
837 837
 			// grab the saved registrations from the transaction
838
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as  $registration ) {
839
-				$this->_save_registration( $registration, $show_errors );
838
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as  $registration) {
839
+				$this->_save_registration($registration, $show_errors);
840 840
 			}
841 841
 		} else {
842
-			if ( $show_errors ) {
843
-				EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
842
+			if ($show_errors) {
843
+				EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
844 844
 			}
845 845
 			return FALSE;
846 846
 		}
@@ -857,32 +857,32 @@  discard block
 block discarded – undo
857 857
 	 * @return void
858 858
 	 * @throws \EE_Error
859 859
 	 */
860
-	private function _save_registration( $registration, $show_errors = TRUE  ) {
860
+	private function _save_registration($registration, $show_errors = TRUE) {
861 861
 		// verify object
862
-		if ( $registration instanceof EE_Registration ) {
862
+		if ($registration instanceof EE_Registration) {
863 863
 			// should this registration be processed during this visit ?
864
-			if ( $this->visit_allows_processing_of_this_registration( $registration ) ) {
864
+			if ($this->visit_allows_processing_of_this_registration($registration)) {
865 865
 				//set TXN ID
866
-				if ( ! $registration->transaction_ID() ) {
867
-					$registration->set_transaction_id( $this->transaction->ID() );
866
+				if ( ! $registration->transaction_ID()) {
867
+					$registration->set_transaction_id($this->transaction->ID());
868 868
 				}
869 869
 				// verify and save the attendee
870
-				$this->_save_registration_attendee( $registration, $show_errors );
870
+				$this->_save_registration_attendee($registration, $show_errors);
871 871
 				// save answers to reg form questions
872
-				$this->_save_registration_answers( $registration, $show_errors );
872
+				$this->_save_registration_answers($registration, $show_errors);
873 873
 				// save changes
874 874
 				$registration->save();
875 875
 				// update txn cache
876
-				if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) {
877
-					if ( $show_errors ) {
878
-						EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
876
+				if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) {
877
+					if ($show_errors) {
878
+						EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
879 879
 					}
880 880
 				}
881 881
 			}
882 882
 		} else {
883
-			if ( $show_errors ) {
883
+			if ($show_errors) {
884 884
 				EE_Error::add_error(
885
-					__( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ),
885
+					__('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'),
886 886
 					__FILE__, __FUNCTION__, __LINE__
887 887
 				);
888 888
 			}
@@ -899,25 +899,25 @@  discard block
 block discarded – undo
899 899
 	 * @return void
900 900
 	 * @throws \EE_Error
901 901
 	 */
902
-	private function _save_registration_attendee( $registration, $show_errors = TRUE ) {
903
-		if ( $registration->attendee() instanceof EE_Attendee ) {
902
+	private function _save_registration_attendee($registration, $show_errors = TRUE) {
903
+		if ($registration->attendee() instanceof EE_Attendee) {
904 904
 			// save so that ATT has ID
905 905
 			$registration->attendee()->save();
906
-			if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() ) ) {
907
-				if ( $show_errors ) {
906
+			if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) {
907
+				if ($show_errors) {
908 908
 					EE_Error::add_error(
909
-						__( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ),
909
+						__('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'),
910 910
 						__FILE__, __FUNCTION__, __LINE__
911 911
 					);
912 912
 				}
913 913
 			}
914 914
 		} else {
915
-			if ( $show_errors ) {
915
+			if ($show_errors) {
916 916
 				EE_Error::add_error(
917 917
 					sprintf(
918 918
 						'%1$s||%1$s $attendee = %2$s',
919
-						__( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ),
920
-						var_export( $registration->attendee(), true )
919
+						__('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'),
920
+						var_export($registration->attendee(), true)
921 921
 					),
922 922
 					__FILE__, __FUNCTION__, __LINE__
923 923
 				);
@@ -935,25 +935,25 @@  discard block
 block discarded – undo
935 935
 	 * @return void
936 936
 	 * @throws \EE_Error
937 937
 	 */
938
-	private function _save_registration_answers( $registration, $show_errors = TRUE ) {
938
+	private function _save_registration_answers($registration, $show_errors = TRUE) {
939 939
 		// now save the answers
940
-		foreach ( $registration->answers() as $cache_key => $answer ) {
940
+		foreach ($registration->answers() as $cache_key => $answer) {
941 941
 			// verify object
942
-			if ( $answer instanceof EE_Answer ) {
943
-				$answer->set_registration( $registration->ID() );
942
+			if ($answer instanceof EE_Answer) {
943
+				$answer->set_registration($registration->ID());
944 944
 				$answer->save();
945
-				if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) {
946
-					if ( $show_errors ) {
945
+				if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) {
946
+					if ($show_errors) {
947 947
 						EE_Error::add_error(
948
-							__( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ),
948
+							__('The newly saved Answer object could not be cached on the registration.', 'event_espresso'),
949 949
 							__FILE__, __FUNCTION__, __LINE__
950 950
 						);
951 951
 					}
952 952
 				}
953 953
 			} else {
954
-				if ( $show_errors ) {
954
+				if ($show_errors) {
955 955
 					EE_Error::add_error(
956
-						__( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ),
956
+						__('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'),
957 957
 						__FILE__, __FUNCTION__, __LINE__
958 958
 					);
959 959
 				}
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 	 * @return bool
973 973
 	 * @throws \EE_Error
974 974
 	 */
975
-	public function refresh_all_entities( $from_db = false ) {
975
+	public function refresh_all_entities($from_db = false) {
976 976
 		$from_db = $this->current_step->is_final_step() || $this->action === 'process_gateway_response'
977 977
 			? true
978 978
 			: $from_db;
@@ -996,11 +996,11 @@  discard block
 block discarded – undo
996 996
 	 */
997 997
 	protected function refresh_from_db() {
998 998
 		// verify the transaction
999
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
999
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1000 1000
 			// pull fresh TXN data from the db
1001
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() );
1001
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID());
1002 1002
 			// update EE_Checkout's cached primary_attendee object
1003
-			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction );
1003
+			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction);
1004 1004
 			// update EE_Checkout's cached payment object
1005 1005
 			$payment = $this->transaction->last_payment();
1006 1006
 			$this->payment = $payment instanceof EE_Payment ? $payment : $this->payment;
@@ -1008,9 +1008,9 @@  discard block
 block discarded – undo
1008 1008
 			$payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null;
1009 1009
 			$this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method;
1010 1010
 			//now refresh the cart, based on the TXN
1011
-			$this->cart = $this->get_cart_for_transaction( $this->transaction );
1011
+			$this->cart = $this->get_cart_for_transaction($this->transaction);
1012 1012
 		} else {
1013
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1013
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1014 1014
 			return FALSE;
1015 1015
 		}
1016 1016
 		return TRUE;
@@ -1025,21 +1025,21 @@  discard block
 block discarded – undo
1025 1025
 	 * @return  EE_Attendee | null
1026 1026
 	 * @throws \EE_Error
1027 1027
 	 */
1028
-	protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) {
1028
+	protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) {
1029 1029
 
1030 1030
 		$primary_attendee_obj = null;
1031 1031
 		// grab the saved registrations from the transaction
1032
-		foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) {
1032
+		foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) {
1033 1033
 			// verify object
1034
-			if ( $registration instanceof EE_Registration ) {
1034
+			if ($registration instanceof EE_Registration) {
1035 1035
 				$attendee = $registration->attendee();
1036 1036
 				// verify object && maybe cache primary_attendee_obj ?
1037
-				if ( $attendee instanceof EE_Attendee&& $registration->is_primary_registrant() ) {
1037
+				if ($attendee instanceof EE_Attendee && $registration->is_primary_registrant()) {
1038 1038
 					$primary_attendee_obj = $attendee;
1039 1039
 				}
1040 1040
 			} else {
1041 1041
 				EE_Error::add_error(
1042
-						__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1042
+						__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1043 1043
 						__FILE__, __FUNCTION__, __LINE__
1044 1044
 				);
1045 1045
 			}
@@ -1060,43 +1060,43 @@  discard block
 block discarded – undo
1060 1060
 	 */
1061 1061
 	protected function refresh_entity_map() {
1062 1062
 		// verify the transaction
1063
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1063
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1064 1064
 			// never cache payment info
1065
-			$this->transaction->clear_cache( 'Payment' );
1065
+			$this->transaction->clear_cache('Payment');
1066 1066
 			// is the Payment Options Reg Step completed ?
1067
-			if ( $this->transaction->reg_step_completed( 'payment_options' ) ) {
1067
+			if ($this->transaction->reg_step_completed('payment_options')) {
1068 1068
 				// then check for payments and update TXN accordingly
1069 1069
 				/** @type EE_Transaction_Payments $transaction_payments */
1070
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1071
-				$transaction_payments->calculate_total_payments_and_update_status( $this->transaction );
1070
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1071
+				$transaction_payments->calculate_total_payments_and_update_status($this->transaction);
1072 1072
 			}
1073 1073
 			// grab the saved registrations from the transaction
1074 1074
 			foreach (
1075
-				$this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration
1075
+				$this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration
1076 1076
 			) {
1077
-				$this->_refresh_registration( $reg_cache_ID, $registration );
1077
+				$this->_refresh_registration($reg_cache_ID, $registration);
1078 1078
 			}
1079 1079
 			// make sure our cached TXN is added to the model entity mapper
1080
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction );
1080
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction);
1081 1081
 
1082 1082
 		} else {
1083
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1083
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1084 1084
 			return FALSE;
1085 1085
 		}
1086 1086
 		// verify and update the cart because inaccurate totals are not so much fun
1087
-		if ( $this->cart instanceof EE_Cart ) {
1087
+		if ($this->cart instanceof EE_Cart) {
1088 1088
 			$grand_total = $this->cart->get_grand_total();
1089
-			if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) {
1089
+			if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) {
1090 1090
 				$grand_total->recalculate_total_including_taxes();
1091 1091
 				$grand_total = $grand_total->get_model()->refresh_entity_map_with(
1092 1092
 					$this->cart->get_grand_total()->ID(),
1093 1093
 					$this->cart->get_grand_total()
1094 1094
 				);
1095 1095
 			}
1096
-			if ( $grand_total instanceof EE_Line_Item ) {
1097
-				$this->cart = EE_Cart::instance( $grand_total );
1096
+			if ($grand_total instanceof EE_Line_Item) {
1097
+				$this->cart = EE_Cart::instance($grand_total);
1098 1098
 			} else {
1099
-				EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1099
+				EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1100 1100
 				return false;
1101 1101
 			}
1102 1102
 		}
@@ -1113,19 +1113,19 @@  discard block
 block discarded – undo
1113 1113
 	 * @return void
1114 1114
 	 * @throws \EE_Error
1115 1115
 	 */
1116
-	protected function _refresh_registration( $reg_cache_ID, $registration ) {
1116
+	protected function _refresh_registration($reg_cache_ID, $registration) {
1117 1117
 
1118 1118
 		// verify object
1119
-		if ( $registration instanceof EE_Registration ) {
1119
+		if ($registration instanceof EE_Registration) {
1120 1120
 			// update the entity mapper attendee
1121
-			$this->_refresh_registration_attendee( $registration );
1121
+			$this->_refresh_registration_attendee($registration);
1122 1122
 			// update the entity mapper answers for reg form questions
1123
-			$this->_refresh_registration_answers( $registration );
1123
+			$this->_refresh_registration_answers($registration);
1124 1124
 			// make sure the cached registration is added to the model entity mapper
1125
-			$registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration );
1125
+			$registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration);
1126 1126
 		} else {
1127 1127
 			EE_Error::add_error(
1128
-				__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1128
+				__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1129 1129
 				__FILE__, __FUNCTION__, __LINE__
1130 1130
 			);
1131 1131
 		}
@@ -1140,15 +1140,15 @@  discard block
 block discarded – undo
1140 1140
 	 * @return void
1141 1141
 	 * @throws \EE_Error
1142 1142
 	 */
1143
-	protected function _refresh_registration_attendee( $registration ) {
1143
+	protected function _refresh_registration_attendee($registration) {
1144 1144
 
1145 1145
 		$attendee = $registration->attendee();
1146 1146
 		// verify object
1147
-		if ( $attendee instanceof EE_Attendee && $attendee->ID() ) {
1147
+		if ($attendee instanceof EE_Attendee && $attendee->ID()) {
1148 1148
 			// make sure the cached attendee is added to the model entity mapper
1149
-			$registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee );
1149
+			$registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee);
1150 1150
 			// maybe cache primary_attendee_obj ?
1151
-			if ( $registration->is_primary_registrant() ) {
1151
+			if ($registration->is_primary_registrant()) {
1152 1152
 				$this->primary_attendee_obj = $attendee;
1153 1153
 			}
1154 1154
 		}
@@ -1163,19 +1163,19 @@  discard block
 block discarded – undo
1163 1163
 	 * @return void
1164 1164
 	 * @throws \EE_Error
1165 1165
 	 */
1166
-	protected function _refresh_registration_answers( $registration ) {
1166
+	protected function _refresh_registration_answers($registration) {
1167 1167
 
1168 1168
 		// now update the answers
1169
-		foreach ( $registration->answers() as $cache_key => $answer ) {
1169
+		foreach ($registration->answers() as $cache_key => $answer) {
1170 1170
 			// verify object
1171
-			if ( $answer instanceof EE_Answer ) {
1172
-				if ( $answer->ID() ) {
1171
+			if ($answer instanceof EE_Answer) {
1172
+				if ($answer->ID()) {
1173 1173
 					// make sure the cached answer is added to the model entity mapper
1174
-					$answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer );
1174
+					$answer->get_model()->refresh_entity_map_with($answer->ID(), $answer);
1175 1175
 				}
1176 1176
 			} else {
1177 1177
 				EE_Error::add_error(
1178
-					__( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1178
+					__('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1179 1179
 					__FILE__, __FUNCTION__, __LINE__
1180 1180
 				);
1181 1181
 			}
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 	 * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object
1191 1191
 	 */
1192 1192
 	public function __wakeup() {
1193
-		foreach ( $this->reg_steps as $reg_step ) {
1193
+		foreach ($this->reg_steps as $reg_step) {
1194 1194
 			$reg_step->checkout = $this;
1195 1195
 		}
1196 1196
 	}
@@ -1207,12 +1207,12 @@  discard block
 block discarded – undo
1207 1207
 	 * @param bool   $display_request
1208 1208
 	 * @throws \EE_Error
1209 1209
 	 */
1210
-	public function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) {
1210
+	public function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) {
1211 1211
 		$disabled = true;
1212
-		if ( WP_DEBUG && ! $disabled ) {
1213
-			$debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() );
1212
+		if (WP_DEBUG && ! $disabled) {
1213
+			$debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array());
1214 1214
 			$default_data = array(
1215
-				$class 		=> $func . '() : ' . $line,
1215
+				$class 		=> $func.'() : '.$line,
1216 1216
 				'request->step' 		=> $this->step,
1217 1217
 				'request->action' 	=> $this->action,
1218 1218
 				'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ?
@@ -1224,24 +1224,24 @@  discard block
 block discarded – undo
1224 1224
 				'reg_url_link' => $this->reg_url_link,
1225 1225
 				'REQ' => $display_request ? $_REQUEST : '',
1226 1226
 			);
1227
-			if ( $this->transaction instanceof EE_Transaction ) {
1228
-				$default_data[ 'TXN_status' ] 		= $this->transaction->status_ID();
1229
-				$default_data[ 'TXN_reg_steps' ] 	= $this->transaction->reg_steps();
1230
-				foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) {
1231
-					$default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID();
1227
+			if ($this->transaction instanceof EE_Transaction) {
1228
+				$default_data['TXN_status'] = $this->transaction->status_ID();
1229
+				$default_data['TXN_reg_steps'] = $this->transaction->reg_steps();
1230
+				foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) {
1231
+					$default_data['registrations'][$REG_ID] = $registration->status_ID();
1232 1232
 				}
1233
-				if ( $this->transaction->ID() ) {
1234
-					$TXN_ID = 'EE_Transaction: ' . $this->transaction->ID();
1233
+				if ($this->transaction->ID()) {
1234
+					$TXN_ID = 'EE_Transaction: '.$this->transaction->ID();
1235 1235
 					// don't serialize objects
1236
-					$info = $this->_strip_objects( $info );
1237
-					if ( ! isset( $debug_data[ $TXN_ID ] ) ) {
1238
-						$debug_data[ $TXN_ID ] = array();
1236
+					$info = $this->_strip_objects($info);
1237
+					if ( ! isset($debug_data[$TXN_ID])) {
1238
+						$debug_data[$TXN_ID] = array();
1239 1239
 					}
1240
-					$debug_data[ $TXN_ID ][ microtime() ] = array_merge(
1240
+					$debug_data[$TXN_ID][microtime()] = array_merge(
1241 1241
 						$default_data,
1242 1242
 						$info
1243 1243
 					);
1244
-					update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data );
1244
+					update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data);
1245 1245
 				}
1246 1246
 			}
1247 1247
 		}
@@ -1254,23 +1254,23 @@  discard block
 block discarded – undo
1254 1254
 	 * @param array $info
1255 1255
 	 * @return array
1256 1256
 	 */
1257
-	public function _strip_objects( $info = array() ) {
1258
-		foreach ( (array)$info as $key => $value ) {
1259
-			if ( is_array( $value )) {
1260
-				$info[ $key ] = $this->_strip_objects( $value );
1261
-			} else if ( is_object( $value ) ) {
1262
-				$object_class = get_class( $value );
1263
-				$info[ $object_class ] = array();
1264
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0;
1265
-				if ( method_exists( $value, 'status' ) ) {
1266
-					$info[ $object_class ][ 'status' ] = $value->status();
1267
-				} else if ( method_exists( $value, 'status_ID' ) ) {
1268
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
1257
+	public function _strip_objects($info = array()) {
1258
+		foreach ((array) $info as $key => $value) {
1259
+			if (is_array($value)) {
1260
+				$info[$key] = $this->_strip_objects($value);
1261
+			} else if (is_object($value)) {
1262
+				$object_class = get_class($value);
1263
+				$info[$object_class] = array();
1264
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0;
1265
+				if (method_exists($value, 'status')) {
1266
+					$info[$object_class]['status'] = $value->status();
1267
+				} else if (method_exists($value, 'status_ID')) {
1268
+					$info[$object_class]['status'] = $value->status_ID();
1269 1269
 				}
1270
-				unset( $info[ $key ] );
1270
+				unset($info[$key]);
1271 1271
 			}
1272 1272
 		}
1273
-		return (array)$info;
1273
+		return (array) $info;
1274 1274
 	}
1275 1275
 
1276 1276
 
Please login to merge, or discard this patch.
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -91,6 +91,7 @@
 block discarded – undo
91 91
 	 * @param EE_Registration $registration
92 92
 	 * @param EE_Question     $question
93 93
 	 * @param mixed EE_Answer|NULL      $answer
94
+	 * @param EE_Answer $answer
94 95
 	 * @return EE_Form_Input_Base
95 96
 	 */
96 97
 	public function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
Please login to merge, or discard this patch.
Spacing   +229 added lines, -230 removed lines patch added patch discarded remove patch
@@ -41,21 +41,21 @@  discard block
 block discarded – undo
41 41
 	 * @access    public
42 42
 	 * @param    EE_Checkout $checkout
43 43
 	 */
44
-	public function __construct( EE_Checkout $checkout ) {
44
+	public function __construct(EE_Checkout $checkout) {
45 45
 		$this->_slug = 'attendee_information';
46 46
 		$this->_name = __('Attendee Information', 'event_espresso');
47
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
47
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
48 48
 		$this->checkout = $checkout;
49 49
 		$this->_reset_success_message();
50 50
 		$this->set_instructions(
51
-			__( 'Please answer the following registration questions before proceeding.', 'event_espresso' )
51
+			__('Please answer the following registration questions before proceeding.', 'event_espresso')
52 52
 		);
53 53
 	}
54 54
 
55 55
 
56 56
 
57 57
 	public function translate_js_strings() {
58
-		EE_Registry::$i18n_js_strings['required_field'] = __( ' is a required question.', 'event_espresso' );
58
+		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
59 59
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(
60 60
 			' is a required question. Please enter a value for at least one of the options.',
61 61
 			'event_espresso'
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		// calculate taxes
116 116
 		$Line_Item_Display->display_line_item(
117 117
 			$this->checkout->cart->get_grand_total(),
118
-			array( 'set_tax_rate' => true )
118
+			array('set_tax_rate' => true)
119 119
 		);
120 120
 		/** @var $subsections EE_Form_Section_Proper[] */
121 121
 		$subsections = array(
@@ -127,51 +127,51 @@  discard block
 block discarded – undo
127 127
 			'ticket_count' 	=> array()
128 128
 		);
129 129
 		// grab the saved registrations from the transaction
130
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
131
-		if ( $registrations ) {
132
-			foreach ( $registrations as $registration ) {
130
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
131
+		if ($registrations) {
132
+			foreach ($registrations as $registration) {
133 133
 				// can this registration be processed during this visit ?
134 134
 				if (
135 135
 					$registration instanceof EE_Registration
136
-					&& $this->checkout->visit_allows_processing_of_this_registration( $registration )
136
+					&& $this->checkout->visit_allows_processing_of_this_registration($registration)
137 137
 				) {
138
-					$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
139
-					if ( ! $this->checkout->admin_request ) {
140
-						$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
141
-						$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset(
142
-							$template_args['ticket_count'][ $registration->ticket()->ID() ]
138
+					$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
139
+					if ( ! $this->checkout->admin_request) {
140
+						$template_args['registrations'][$registration->reg_url_link()] = $registration;
141
+						$template_args['ticket_count'][$registration->ticket()->ID()] = isset(
142
+							$template_args['ticket_count'][$registration->ticket()->ID()]
143 143
 						)
144
-							? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1
144
+							? $template_args['ticket_count'][$registration->ticket()->ID()] + 1
145 145
 							: 1;
146 146
 						$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs(
147 147
 							$this->checkout->cart->get_grand_total(),
148 148
 							'Ticket',
149
-							array( $registration->ticket()->ID() )
149
+							array($registration->ticket()->ID())
150 150
 						);
151
-						$ticket_line_item = is_array( $ticket_line_item )
152
-							? reset( $ticket_line_item )
151
+						$ticket_line_item = is_array($ticket_line_item)
152
+							? reset($ticket_line_item)
153 153
 							: $ticket_line_item;
154
-						$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item(
154
+						$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item(
155 155
 							$ticket_line_item
156 156
 						);
157 157
 					}
158
-					if ( $registration->is_primary_registrant() ) {
158
+					if ($registration->is_primary_registrant()) {
159 159
 						$primary_registrant = $registration->reg_url_link();
160 160
 					}
161 161
 				}
162 162
 			}
163 163
 			// print_copy_info ?
164
-			if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) {
164
+			if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) {
165 165
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
166 166
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info
167 167
 					? $this->_copy_attendee_info_form()
168 168
 					: $this->_auto_copy_attendee_info();
169 169
 				// generate hidden input
170 170
 				if (
171
-					isset( $subsections[ $primary_registrant ] )
172
-				     && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
171
+					isset($subsections[$primary_registrant])
172
+				     && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper
173 173
 				) {
174
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
174
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
175 175
 				}
176 176
 			}
177 177
 
@@ -183,8 +183,7 @@  discard block
 block discarded – undo
183 183
 				'html_id' 					=> $this->reg_form_name(),
184 184
 				'subsections' 			=> $subsections,
185 185
 				'layout_strategy'		=> $this->checkout->admin_request ?
186
-					new EE_Div_Per_Section_Layout() :
187
-					new EE_Template_Layout(
186
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
188 187
 						array(
189 188
 							'layout_template_file' 	=> $this->_template, // layout_template
190 189
 							'template_args' 				=> $template_args
@@ -202,11 +201,11 @@  discard block
 block discarded – undo
202 201
 	 * @return EE_Form_Section_Proper
203 202
 	 * @throws \EE_Error
204 203
 	 */
205
-	private function _registrations_reg_form( EE_Registration $registration ) {
204
+	private function _registrations_reg_form(EE_Registration $registration) {
206 205
 		static $attendee_nmbr = 1;
207 206
 		// array of params to pass to parent constructor
208 207
 		$form_args = array(
209
-			'html_id'         => 'ee-registration-' . $registration->reg_url_link(),
208
+			'html_id'         => 'ee-registration-'.$registration->reg_url_link(),
210 209
 			'html_class'      => 'ee-reg-form-attendee-dv',
211 210
 			'html_style'      => $this->checkout->admin_request
212 211
 				? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'
@@ -215,24 +214,24 @@  discard block
 block discarded – undo
215 214
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
216 215
 				array(
217 216
 					'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text',
218
-					'legend_text'  => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
217
+					'legend_text'  => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
219 218
 				)
220 219
 			)
221 220
 		);
222 221
 		// verify that registration has valid event
223
-		if ( $registration->event() instanceof EE_Event ) {
222
+		if ($registration->event() instanceof EE_Event) {
224 223
 			$query_params = array(
225 224
 				array(
226 225
 					'Event.EVT_ID' => $registration->event()->ID(),
227 226
 					'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false
228 227
 				),
229
-				'order_by'=>array( 'QSG_order'=>'ASC' )
228
+				'order_by'=>array('QSG_order'=>'ASC')
230 229
 			);
231
-			$question_groups = $registration->event()->question_groups( $query_params );
232
-			if ( $question_groups ) {
233
-				foreach ( $question_groups as $question_group ) {
234
-					if ( $question_group instanceof EE_Question_Group ) {
235
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form(
230
+			$question_groups = $registration->event()->question_groups($query_params);
231
+			if ($question_groups) {
232
+				foreach ($question_groups as $question_group) {
233
+					if ($question_group instanceof EE_Question_Group) {
234
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form(
236 235
 							$registration,
237 236
 							$question_group
238 237
 						);
@@ -245,10 +244,10 @@  discard block
 block discarded – undo
245 244
 				// if we have question groups for additional attendees, then display the copy options
246 245
 				$this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info;
247 246
 			} else {
248
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link(
249
-				) ] = new EE_Form_Section_HTML(
247
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link(
248
+				)] = new EE_Form_Section_HTML(
250 249
 					EEH_Template::locate_template(
251
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
250
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
252 251
 						apply_filters(
253 252
 							'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args',
254 253
 							array()
@@ -267,12 +266,12 @@  discard block
 block discarded – undo
267 266
 
268 267
 			}
269 268
 		}
270
-		if ( $registration->is_primary_registrant() ) {
269
+		if ($registration->is_primary_registrant()) {
271 270
 			// generate hidden input
272
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
271
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
273 272
 		}
274 273
 		$attendee_nmbr++;
275
-		return new EE_Form_Section_Proper( $form_args );
274
+		return new EE_Form_Section_Proper($form_args);
276 275
 	}
277 276
 
278 277
 
@@ -293,7 +292,7 @@  discard block
 block discarded – undo
293 292
 		// generate hidden input
294 293
 		return new EE_Hidden_Input(
295 294
 			array(
296
-				'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),
295
+				'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(),
297 296
 				'default' => $additional_attendee_reg_info
298 297
 			)
299 298
 		);
@@ -307,26 +306,26 @@  discard block
 block discarded – undo
307 306
 	 * @return EE_Form_Section_Proper
308 307
 	 * @throws \EE_Error
309 308
 	 */
310
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
309
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
311 310
 		// array of params to pass to parent constructor
312 311
 		$form_args = array(
313
-			'html_id'         => 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
312
+			'html_id'         => 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
314 313
 			'html_class'      => $this->checkout->admin_request
315 314
 				? 'form-table ee-reg-form-qstn-grp-dv'
316 315
 				: 'ee-reg-form-qstn-grp-dv',
317
-			'html_label_id'   => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
316
+			'html_label_id'   => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
318 317
 			'subsections'     => array(
319
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
318
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
320 319
 			),
321 320
 			'layout_strategy' => $this->checkout->admin_request
322 321
 				? new EE_Admin_Two_Column_Layout()
323 322
 				: new EE_Div_Per_Section_Layout()
324 323
 		);
325 324
 		// where params
326
-		$query_params = array( 'QST_deleted' => 0 );
325
+		$query_params = array('QST_deleted' => 0);
327 326
 		// don't load admin only questions on the frontend
328
-		if ( ! $this->checkout->admin_request ) {
329
-			$query_params['QST_admin_only'] = array( '!=', true );
327
+		if ( ! $this->checkout->admin_request) {
328
+			$query_params['QST_admin_only'] = array('!=', true);
330 329
 		}
331 330
 		$questions = $question_group->get_many_related(
332 331
 			'Question',
@@ -348,10 +347,10 @@  discard block
 block discarded – undo
348 347
 			)
349 348
 		);
350 349
 		// loop thru questions
351
-		foreach ( $questions as $question ) {
352
-			if( $question instanceof EE_Question ){
350
+		foreach ($questions as $question) {
351
+			if ($question instanceof EE_Question) {
353 352
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
354
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
353
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
355 354
 			}
356 355
 		}
357 356
 		$form_args['subsections'] = apply_filters(
@@ -372,7 +371,7 @@  discard block
 block discarded – undo
372 371
 			)
373 372
 		);
374 373
 //		d( $form_args );
375
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
374
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
376 375
 		return apply_filters(
377 376
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',
378 377
 			$question_group_reg_form,
@@ -389,11 +388,11 @@  discard block
 block discarded – undo
389 388
 	 * @param EE_Question_Group $question_group
390 389
 	 * @return 	EE_Form_Section_HTML
391 390
 	 */
392
-	private function _question_group_header( EE_Question_Group $question_group ){
391
+	private function _question_group_header(EE_Question_Group $question_group) {
393 392
 		$html = '';
394 393
 		// group_name
395
-		if ( $question_group->show_group_name() && $question_group->name() !== '' ) {
396
-			if ( $this->checkout->admin_request ) {
394
+		if ($question_group->show_group_name() && $question_group->name() !== '') {
395
+			if ($this->checkout->admin_request) {
397 396
 				$html .= EEH_HTML::br();
398 397
 				$html .= EEH_HTML::h3(
399 398
 					$question_group->name(),
@@ -407,7 +406,7 @@  discard block
 block discarded – undo
407 406
 			}
408 407
 		}
409 408
 		// group_desc
410
-		if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) {
409
+		if ($question_group->show_group_desc() && $question_group->desc() !== '') {
411 410
 			$html .= EEH_HTML::p(
412 411
 				$question_group->desc(),
413 412
 				'',
@@ -417,7 +416,7 @@  discard block
 block discarded – undo
417 416
 			);
418 417
 
419 418
 		}
420
-		return new EE_Form_Section_HTML( $html );
419
+		return new EE_Form_Section_HTML($html);
421 420
 	}
422 421
 
423 422
 
@@ -427,7 +426,7 @@  discard block
 block discarded – undo
427 426
 	 * @return    EE_Form_Section_Proper
428 427
 	 * @throws \EE_Error
429 428
 	 */
430
-	private function _copy_attendee_info_form(){
429
+	private function _copy_attendee_info_form() {
431 430
 		// array of params to pass to parent constructor
432 431
 		return new EE_Form_Section_Proper(
433 432
 			array(
@@ -456,7 +455,7 @@  discard block
 block discarded – undo
456 455
 	private function _auto_copy_attendee_info() {
457 456
 		return new EE_Form_Section_HTML(
458 457
 			EEH_Template::locate_template(
459
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
458
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
460 459
 				apply_filters(
461 460
 					'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',
462 461
 					array()
@@ -480,32 +479,32 @@  discard block
 block discarded – undo
480 479
 		$copy_attendee_info_inputs = array();
481 480
 		$prev_ticket = NULL;
482 481
 		// grab the saved registrations from the transaction
483
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
484
-		foreach ( $registrations as $registration ) {
482
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
483
+		foreach ($registrations as $registration) {
485 484
 			// for all  attendees other than the primary attendee
486
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
485
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
487 486
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
488
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
487
+				if ($registration->ticket()->ID() !== $prev_ticket) {
489 488
 					$item_name = $registration->ticket()->name();
490 489
 					$item_name .= $registration->ticket()->description() !== ''
491
-						? ' - ' . $registration->ticket()->description()
490
+						? ' - '.$registration->ticket()->description()
492 491
 						: '';
493
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
494
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
492
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
493
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
495 494
 					);
496 495
 					$prev_ticket = $registration->ticket()->ID();
497 496
 				}
498 497
 
499
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
498
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
500 499
 				EE_Checkbox_Multi_Input(
501 500
 					array(
502 501
 						$registration->ID() => sprintf(
503
-							__( 'Attendee #%s', 'event_espresso' ),
502
+							__('Attendee #%s', 'event_espresso'),
504 503
 							$registration->count()
505 504
 						)
506 505
 					),
507 506
 					array(
508
-						'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
507
+						'html_id'                 => 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
509 508
 						'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
510 509
 						'display_html_label_text' => false
511 510
 					)
@@ -525,7 +524,7 @@  discard block
 block discarded – undo
525 524
 	 * @return    EE_Form_Input_Base
526 525
 	 * @throws \EE_Error
527 526
 	 */
528
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
527
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
529 528
 		// generate hidden input
530 529
 		return new EE_Hidden_Input(
531 530
 			array(
@@ -544,7 +543,7 @@  discard block
 block discarded – undo
544 543
 	 * @return    EE_Form_Input_Base
545 544
 	 * @throws \EE_Error
546 545
 	 */
547
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
546
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
548 547
 
549 548
 		// if this question was for an attendee detail, then check for that answer
550 549
 		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value(
@@ -553,32 +552,32 @@  discard block
 block discarded – undo
553 552
 		);
554 553
 		$answer = $answer_value === null
555 554
 			? EEM_Answer::instance()->get_one(
556
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
555
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
557 556
 			)
558 557
 			: null;
559 558
 		// if NOT returning to edit an existing registration
560 559
 		// OR if this question is for an attendee property
561 560
 		// OR we still don't have an EE_Answer object
562
-		if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) {
561
+		if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) {
563 562
 			// create an EE_Answer object for storing everything in
564
-			$answer = EE_Answer::new_instance ( array(
563
+			$answer = EE_Answer::new_instance(array(
565 564
 				'QST_ID'=> $question->ID(),
566 565
 				'REG_ID'=> $registration->ID()
567 566
 			));
568 567
 		}
569 568
 		// verify instance
570
-		if( $answer instanceof EE_Answer ){
571
-			if ( ! empty( $answer_value )) {
572
-				$answer->set( 'ANS_value', $answer_value );
569
+		if ($answer instanceof EE_Answer) {
570
+			if ( ! empty($answer_value)) {
571
+				$answer->set('ANS_value', $answer_value);
573 572
 			}
574
-			$answer->cache( 'Question', $question );
573
+			$answer->cache('Question', $question);
575 574
 			//remember system ID had a bug where sometimes it could be null
576
-			$answer_cache_id =$question->is_system_question()
577
-				? $question->system_ID() . '-' . $registration->reg_url_link()
578
-				: $question->ID() . '-' . $registration->reg_url_link();
579
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
575
+			$answer_cache_id = $question->is_system_question()
576
+				? $question->system_ID().'-'.$registration->reg_url_link()
577
+				: $question->ID().'-'.$registration->reg_url_link();
578
+			$registration->cache('Answer', $answer, $answer_cache_id);
580 579
 		}
581
-		return $this->_generate_question_input( $registration, $question, $answer );
580
+		return $this->_generate_question_input($registration, $question, $answer);
582 581
 
583 582
 	}
584 583
 
@@ -591,46 +590,46 @@  discard block
 block discarded – undo
591 590
 	 * @return EE_Form_Input_Base
592 591
 	 * @throws \EE_Error
593 592
 	 */
594
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
593
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
595 594
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
596
-		$this->_required_questions[ $identifier ] = $question->required() ? true : false;
595
+		$this->_required_questions[$identifier] = $question->required() ? true : false;
597 596
 		add_filter(
598 597
 			'FHEE__EE_Question__generate_form_input__country_options',
599
-			array( $this, 'use_cached_countries_for_form_input' ),
598
+			array($this, 'use_cached_countries_for_form_input'),
600 599
 			10,
601 600
 			4
602 601
 		);
603 602
 		add_filter(
604 603
 			'FHEE__EE_Question__generate_form_input__state_options',
605
-			array( $this, 'use_cached_states_for_form_input' ),
604
+			array($this, 'use_cached_states_for_form_input'),
606 605
 			10,
607 606
 			4
608 607
 		);
609 608
 		$input_constructor_args = array(
610
-			'html_name'     => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
611
-			'html_id'       => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
612
-			'html_class'    => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
613
-			'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
609
+			'html_name'     => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
610
+			'html_id'       => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
611
+			'html_class'    => 'ee-reg-qstn ee-reg-qstn-'.$identifier,
612
+			'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
614 613
 			'html_label_class'	=> 'ee-reg-qstn',
615 614
 		);
616
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
617
-		if ( $answer instanceof EE_Answer && $answer->ID() ) {
618
-			$input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']';
619
-			$input_constructor_args[ 'html_id' ] .= '-' . $answer->ID();
620
-			$input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID();
615
+		$input_constructor_args['html_label_id'] .= '-lbl';
616
+		if ($answer instanceof EE_Answer && $answer->ID()) {
617
+			$input_constructor_args['html_name'] .= '['.$answer->ID().']';
618
+			$input_constructor_args['html_id'] .= '-'.$answer->ID();
619
+			$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
621 620
 		}
622
-		$form_input =  $question->generate_form_input(
621
+		$form_input = $question->generate_form_input(
623 622
 			$registration,
624 623
 			$answer,
625 624
 			$input_constructor_args
626 625
 		);
627 626
 		remove_filter(
628 627
 			'FHEE__EE_Question__generate_form_input__country_options',
629
-			array( $this, 'use_cached_countries_for_form_input' )
628
+			array($this, 'use_cached_countries_for_form_input')
630 629
 		);
631 630
 		remove_filter(
632 631
 			'FHEE__EE_Question__generate_form_input__state_options',
633
-			array( $this, 'use_cached_states_for_form_input' )
632
+			array($this, 'use_cached_states_for_form_input')
634 633
 		);
635 634
 		return $form_input;
636 635
 	}
@@ -652,22 +651,22 @@  discard block
 block discarded – undo
652 651
 		\EE_Registration $registration = null,
653 652
 		\EE_Answer $answer = null
654 653
 	) {
655
-		$country_options = array( '' => '' );
654
+		$country_options = array('' => '');
656 655
 		// get possibly cached list of countries
657 656
 		$countries = $this->checkout->action === 'process_reg_step'
658 657
 			? EEM_Country::instance()->get_all_countries()
659 658
 			: EEM_Country::instance()->get_all_active_countries();
660
-		if ( ! empty( $countries )) {
661
-			foreach( $countries as $country ){
662
-				if ( $country instanceof EE_Country ) {
663
-					$country_options[ $country->ID() ] = $country->name();
659
+		if ( ! empty($countries)) {
660
+			foreach ($countries as $country) {
661
+				if ($country instanceof EE_Country) {
662
+					$country_options[$country->ID()] = $country->name();
664 663
 				}
665 664
 			}
666 665
 		}
667
-		if( $question instanceof EE_Question
668
-			&& $registration instanceof EE_Registration ) {
666
+		if ($question instanceof EE_Question
667
+			&& $registration instanceof EE_Registration) {
669 668
 			$answer = EEM_Answer::instance()->get_one(
670
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
669
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
671 670
 			);
672 671
 		} else {
673 672
 			$answer = EE_Answer::new_instance();
@@ -700,14 +699,14 @@  discard block
 block discarded – undo
700 699
 		\EE_Registration $registration = null,
701 700
 		\EE_Answer $answer = null
702 701
 	) {
703
-		$state_options = array( '' => array( '' => ''));
702
+		$state_options = array('' => array('' => ''));
704 703
 		$states = $this->checkout->action === 'process_reg_step'
705 704
 			? EEM_State::instance()->get_all_states()
706 705
 			: EEM_State::instance()->get_all_active_states();
707
-		if ( ! empty( $states )) {
708
-			foreach( $states as $state ){
709
-				if ( $state instanceof EE_State ) {
710
-					$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
706
+		if ( ! empty($states)) {
707
+			foreach ($states as $state) {
708
+				if ($state instanceof EE_State) {
709
+					$state_options[$state->country()->name()][$state->ID()] = $state->name();
711 710
 				}
712 711
 			}
713 712
 		}
@@ -735,24 +734,24 @@  discard block
 block discarded – undo
735 734
 	 * @throws \EE_Error
736 735
 	 */
737 736
 	public function process_reg_step() {
738
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
737
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
739 738
 		// grab validated data from form
740 739
 		$valid_data = $this->checkout->current_step->valid_data();
741 740
 		// EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
742 741
 		// EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
743 742
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
744
-		if ( empty( $valid_data ))  {
743
+		if (empty($valid_data)) {
745 744
 			EE_Error::add_error(
746
-				__( 'No valid question responses were received.', 'event_espresso' ),
745
+				__('No valid question responses were received.', 'event_espresso'),
747 746
 				__FILE__,
748 747
 				__FUNCTION__,
749 748
 				__LINE__
750 749
 			);
751 750
 			return false;
752 751
 		}
753
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
752
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
754 753
 			EE_Error::add_error(
755
-				__( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ),
754
+				__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'),
756 755
 				__FILE__,
757 756
 				__FUNCTION__,
758 757
 				__LINE__
@@ -760,11 +759,11 @@  discard block
 block discarded – undo
760 759
 			return false;
761 760
 		}
762 761
 		// get cached registrations
763
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
762
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
764 763
 		// verify we got the goods
765
-		if ( empty( $registrations )) {
764
+		if (empty($registrations)) {
766 765
 			EE_Error::add_error(
767
-				__( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ),
766
+				__('Your form data could not be applied to any valid registrations.', 'event_espresso'),
768 767
 				__FILE__,
769 768
 				__FUNCTION__,
770 769
 				__LINE__
@@ -772,15 +771,15 @@  discard block
 block discarded – undo
772 771
 			return false;
773 772
 		}
774 773
 		// extract attendee info from form data and save to model objects
775
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
774
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
776 775
 		// if first pass thru SPCO,
777 776
 		// then let's check processed registrations against the total number of tickets in the cart
778
-		if ( $registrations_processed === false ) {
777
+		if ($registrations_processed === false) {
779 778
 			// but return immediately if the previous step exited early due to errors
780 779
 			return false;
781
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
780
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
782 781
 			// generate a correctly translated string for all possible singular/plural combinations
783
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
782
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
784 783
 				$error_msg = sprintf(
785 784
 					__(
786 785
 						'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed',
@@ -789,7 +788,7 @@  discard block
 block discarded – undo
789 788
 					$this->checkout->total_ticket_count,
790 789
 					$registrations_processed
791 790
 				);
792
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
791
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
793 792
 				$error_msg = sprintf(
794 793
 					__(
795 794
 						'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed',
@@ -808,17 +807,17 @@  discard block
 block discarded – undo
808 807
 					$registrations_processed
809 808
 				);
810 809
 			}
811
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
810
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
812 811
 			return false;
813 812
 		}
814 813
 		// mark this reg step as completed
815 814
 		$this->set_completed();
816 815
 		$this->_set_success_message(
817
-			__( 'The Attendee Information Step has been successfully completed.', 'event_espresso' )
816
+			__('The Attendee Information Step has been successfully completed.', 'event_espresso')
818 817
 		);
819 818
 		//do action in case a plugin wants to do something with the data submitted in step 1.
820 819
 		//passes EE_Single_Page_Checkout, and it's posted data
821
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
820
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
822 821
 		return true;
823 822
 	}
824 823
 
@@ -832,9 +831,9 @@  discard block
 block discarded – undo
832 831
 	 * @return boolean | int
833 832
 	 * @throws \EE_Error
834 833
 	 */
835
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
834
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
836 835
 		// load resources and set some defaults
837
-		EE_Registry::instance()->load_model( 'Attendee' );
836
+		EE_Registry::instance()->load_model('Attendee');
838 837
 		// holder for primary registrant attendee object
839 838
 		$this->checkout->primary_attendee_obj = NULL;
840 839
 		// array for tracking reg form data for the primary registrant
@@ -851,9 +850,9 @@  discard block
 block discarded – undo
851 850
 		// attendee counter
852 851
 		$att_nmbr = 0;
853 852
 		// grab the saved registrations from the transaction
854
-		foreach ( $registrations  as $registration ) {
853
+		foreach ($registrations  as $registration) {
855 854
 			// verify EE_Registration object
856
-			if ( ! $registration instanceof EE_Registration ) {
855
+			if ( ! $registration instanceof EE_Registration) {
857 856
 				EE_Error::add_error(
858 857
 					__(
859 858
 						'An invalid Registration object was discovered when attempting to process your registration information.',
@@ -868,12 +867,12 @@  discard block
 block discarded – undo
868 867
 			/** @var string $reg_url_link */
869 868
 			$reg_url_link = $registration->reg_url_link();
870 869
 			// reg_url_link exists ?
871
-			if ( ! empty( $reg_url_link ) ) {
870
+			if ( ! empty($reg_url_link)) {
872 871
 				// should this registration be processed during this visit ?
873
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
872
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
874 873
 					// if NOT revisiting, then let's save the registration now,
875 874
 					// so that we have a REG_ID to use when generating other objects
876
-					if ( ! $this->checkout->revisit ) {
875
+					if ( ! $this->checkout->revisit) {
877 876
 						$registration->save();
878 877
 					}
879 878
 					/**
@@ -883,7 +882,7 @@  discard block
 block discarded – undo
883 882
 					 * @var bool   if true is returned by the plugin then the
884 883
 					 *      		registration processing is halted.
885 884
 					 */
886
-					if ( apply_filters(
885
+					if (apply_filters(
887 886
 						'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process',
888 887
 						false,
889 888
 						$att_nmbr,
@@ -891,38 +890,38 @@  discard block
 block discarded – undo
891 890
 						$registrations,
892 891
 						$valid_data,
893 892
 						$this
894
-					) ) {
893
+					)) {
895 894
 						return false;
896 895
 					}
897 896
 
898 897
 					// Houston, we have a registration!
899 898
 					$att_nmbr++;
900
-					$this->_attendee_data[ $reg_url_link ] = array();
899
+					$this->_attendee_data[$reg_url_link] = array();
901 900
 					// grab any existing related answer objects
902 901
 					$this->_registration_answers = $registration->answers();
903 902
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
904
-					if ( isset( $valid_data[ $reg_url_link ] ) ) {
903
+					if (isset($valid_data[$reg_url_link])) {
905 904
 						// do we need to copy basic info from primary attendee ?
906
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] )
907
-						                && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0
905
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info'])
906
+						                && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0
908 907
 							? true
909 908
 							: false;
910 909
 						// filter form input data for this registration
911
-						$valid_data[ $reg_url_link ] = (array)apply_filters(
910
+						$valid_data[$reg_url_link] = (array) apply_filters(
912 911
 							'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',
913
-							$valid_data[ $reg_url_link ]
912
+							$valid_data[$reg_url_link]
914 913
 						);
915 914
 						// EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
916
-						if ( isset( $valid_data['primary_attendee'] )) {
917
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] )
915
+						if (isset($valid_data['primary_attendee'])) {
916
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])
918 917
 								? $valid_data['primary_attendee']
919 918
 								: false;
920
-							unset( $valid_data['primary_attendee'] );
919
+							unset($valid_data['primary_attendee']);
921 920
 						}
922 921
 						// now loop through our array of valid post data && process attendee reg forms
923
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
924
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
925
-								foreach ( $form_inputs as $form_input => $input_value ) {
922
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
923
+							if ( ! in_array($form_section, $non_input_form_sections)) {
924
+								foreach ($form_inputs as $form_input => $input_value) {
926 925
 									// \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ );
927 926
 									// check for critical inputs
928 927
 									if (
@@ -936,16 +935,16 @@  discard block
 block discarded – undo
936 935
 									// store a bit of data about the primary attendee
937 936
 									if (
938 937
 										$att_nmbr === 1
939
-										&& ! empty( $input_value )
938
+										&& ! empty($input_value)
940 939
 										&& $reg_url_link === $primary_registrant['line_item_id']
941 940
 									) {
942
-										$primary_registrant[ $form_input ] = $input_value;
941
+										$primary_registrant[$form_input] = $input_value;
943 942
 									} else if (
944 943
 										$copy_primary
945 944
 										&& $input_value === null
946
-										&& isset( $primary_registrant[ $form_input ] )
945
+										&& isset($primary_registrant[$form_input])
947 946
 									) {
948
-										$input_value = $primary_registrant[ $form_input ];
947
+										$input_value = $primary_registrant[$form_input];
949 948
 									}
950 949
 									// now attempt to save the input data
951 950
 									if (
@@ -987,55 +986,55 @@  discard block
 block discarded – undo
987 986
 						// have we met before?
988 987
 						$attendee = $this->_find_existing_attendee(
989 988
 							$registration,
990
-							$this->_attendee_data[ $reg_url_link ]
989
+							$this->_attendee_data[$reg_url_link]
991 990
 						);
992 991
 						// did we find an already existing record for this attendee ?
993
-						if ( $attendee instanceof EE_Attendee ) {
992
+						if ($attendee instanceof EE_Attendee) {
994 993
 							$attendee = $this->_update_existing_attendee_data(
995 994
 								$attendee,
996
-								$this->_attendee_data[ $reg_url_link ]
995
+								$this->_attendee_data[$reg_url_link]
997 996
 							);
998 997
 						} else {
999 998
 							// ensure critical details are set for additional attendees
1000
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1
999
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1
1001 1000
 								? $this->_copy_critical_attendee_details_from_primary_registrant(
1002
-									$this->_attendee_data[ $reg_url_link ]
1001
+									$this->_attendee_data[$reg_url_link]
1003 1002
 								)
1004
-								: $this->_attendee_data[ $reg_url_link ];
1003
+								: $this->_attendee_data[$reg_url_link];
1005 1004
 							$attendee = $this->_create_new_attendee(
1006 1005
 								$registration,
1007
-								$this->_attendee_data[ $reg_url_link ]
1006
+								$this->_attendee_data[$reg_url_link]
1008 1007
 							);
1009 1008
 						}
1010 1009
 						// who's #1 ?
1011
-						if ( $att_nmbr === 1 ) {
1010
+						if ($att_nmbr === 1) {
1012 1011
 							$this->checkout->primary_attendee_obj = $attendee;
1013 1012
 						}
1014 1013
 					}
1015 1014
 					// EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
1016 1015
 					// add relation to registration, set attendee ID, and cache attendee
1017
-					$this->_associate_attendee_with_registration( $registration, $attendee );
1016
+					$this->_associate_attendee_with_registration($registration, $attendee);
1018 1017
 					// \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ );
1019
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
1020
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
1018
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
1019
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
1021 1020
 						return false;
1022 1021
 					}
1023 1022
 					/** @type EE_Registration_Processor $registration_processor */
1024
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1023
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1025 1024
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1026
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, false );
1025
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, false);
1027 1026
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1028 1027
 					$this->checkout->transaction->toggle_failed_transaction_status();
1029 1028
 					// if we've gotten this far, then let's save what we have
1030 1029
 					$registration->save();
1031 1030
 					// add relation between TXN and registration
1032
-					$this->_associate_registration_with_transaction( $registration );
1031
+					$this->_associate_registration_with_transaction($registration);
1033 1032
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
1034 1033
 
1035
-			}  else {
1036
-				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1034
+			} else {
1035
+				EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1037 1036
 				// remove malformed data
1038
-				unset( $valid_data[ $reg_url_link ] );
1037
+				unset($valid_data[$reg_url_link]);
1039 1038
 				return false;
1040 1039
 			}
1041 1040
 
@@ -1064,26 +1063,26 @@  discard block
 block discarded – undo
1064 1063
 		// \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
1065 1064
 		// allow for plugins to hook in and do their own processing of the form input.
1066 1065
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
1067
-		if ( apply_filters(
1066
+		if (apply_filters(
1068 1067
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input',
1069 1068
 			false,
1070 1069
 			$registration,
1071 1070
 			$form_input,
1072 1071
 			$input_value,
1073 1072
 			$this
1074
-		) ) {
1073
+		)) {
1075 1074
 			return true;
1076 1075
 		}
1077 1076
 		// $answer_cache_id is the key used to find the EE_Answer we want
1078 1077
 		$answer_cache_id = $this->checkout->reg_url_link
1079 1078
 			? $form_input
1080
-			: $form_input . '-' . $registration->reg_url_link();
1081
-		$answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] )
1082
-		                 && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer
1079
+			: $form_input.'-'.$registration->reg_url_link();
1080
+		$answer_is_obj = isset($this->_registration_answers[$answer_cache_id])
1081
+		                 && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer
1083 1082
 			? true
1084 1083
 			: false;
1085 1084
 		//rename form_inputs if they are EE_Attendee properties
1086
-		switch( (string)$form_input ) {
1085
+		switch ((string) $form_input) {
1087 1086
 
1088 1087
 			case 'state' :
1089 1088
 			case 'STA_ID' :
@@ -1098,32 +1097,32 @@  discard block
 block discarded – undo
1098 1097
 				break;
1099 1098
 
1100 1099
 			default :
1101
-				$ATT_input = 'ATT_' . $form_input;
1100
+				$ATT_input = 'ATT_'.$form_input;
1102 1101
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
1103
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false;
1104
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
1102
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false;
1103
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
1105 1104
 		}
1106 1105
 		// EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
1107 1106
 		// EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
1108 1107
 		// EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
1109 1108
 		// if this form input has a corresponding attendee property
1110
-		if ( $attendee_property ) {
1111
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
1112
-			if ( $answer_is_obj ) {
1109
+		if ($attendee_property) {
1110
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
1111
+			if ($answer_is_obj) {
1113 1112
 				// and delete the corresponding answer since we won't be storing this data in that object
1114
-				$registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' );
1115
-				$this->_registration_answers[ $answer_cache_id ]->delete_permanently();
1113
+				$registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer');
1114
+				$this->_registration_answers[$answer_cache_id]->delete_permanently();
1116 1115
 			}
1117 1116
 			return true;
1118
-		} elseif ( $answer_is_obj ) {
1117
+		} elseif ($answer_is_obj) {
1119 1118
 			// save this data to the answer object
1120
-			$this->_registration_answers[ $answer_cache_id ]->set_value( $input_value );
1121
-			$result = $this->_registration_answers[ $answer_cache_id ]->save();
1119
+			$this->_registration_answers[$answer_cache_id]->set_value($input_value);
1120
+			$result = $this->_registration_answers[$answer_cache_id]->save();
1122 1121
 			return $result !== false ? true : false;
1123 1122
 		} else {
1124
-			foreach ( $this->_registration_answers as $answer ) {
1125
-				if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) {
1126
-					$answer->set_value( $input_value );
1123
+			foreach ($this->_registration_answers as $answer) {
1124
+				if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) {
1125
+					$answer->set_value($input_value);
1127 1126
 					$result = $answer->save();
1128 1127
 					return $result !== false ? true : false;
1129 1128
 				}
@@ -1145,15 +1144,15 @@  discard block
 block discarded – undo
1145 1144
 		$form_input = '',
1146 1145
 		$input_value = ''
1147 1146
 	) {
1148
-		if ( empty( $input_value ) ) {
1147
+		if (empty($input_value)) {
1149 1148
 			// if the form input isn't marked as being required, then just return
1150
-			if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) {
1149
+			if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
1151 1150
 				return true;
1152 1151
 			}
1153
-			switch ( $form_input ) {
1152
+			switch ($form_input) {
1154 1153
 				case 'fname' :
1155 1154
 					EE_Error::add_error(
1156
-						__( 'First Name is a required value.', 'event_espresso' ),
1155
+						__('First Name is a required value.', 'event_espresso'),
1157 1156
 						__FILE__,
1158 1157
 						__FUNCTION__,
1159 1158
 						__LINE__
@@ -1162,7 +1161,7 @@  discard block
 block discarded – undo
1162 1161
 					break;
1163 1162
 				case 'lname' :
1164 1163
 					EE_Error::add_error(
1165
-						__( 'Last Name is a required value.', 'event_espresso' ),
1164
+						__('Last Name is a required value.', 'event_espresso'),
1166 1165
 						__FILE__,
1167 1166
 						__FUNCTION__,
1168 1167
 						__LINE__
@@ -1171,7 +1170,7 @@  discard block
 block discarded – undo
1171 1170
 					break;
1172 1171
 				case 'email' :
1173 1172
 					EE_Error::add_error(
1174
-						__( 'Please enter a valid email address.', 'event_espresso' ),
1173
+						__('Please enter a valid email address.', 'event_espresso'),
1175 1174
 						__FILE__,
1176 1175
 						__FUNCTION__,
1177 1176
 						__LINE__
@@ -1204,21 +1203,21 @@  discard block
 block discarded – undo
1204 1203
 	 * @param array           $attendee_data
1205 1204
 	 * @return boolean
1206 1205
 	 */
1207
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
1206
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
1208 1207
 		$existing_attendee = null;
1209 1208
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1210
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] )
1209
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname'])
1211 1210
 			? $attendee_data['ATT_fname']
1212 1211
 			: '';
1213
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] )
1212
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname'])
1214 1213
 			? $attendee_data['ATT_lname']
1215 1214
 			: '';
1216
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] )
1215
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email'])
1217 1216
 			? $attendee_data['ATT_email']
1218 1217
 			: '';
1219 1218
 		// but only if those have values
1220
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
1221
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1219
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
1220
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1222 1221
 				'ATT_fname' => $ATT_fname,
1223 1222
 				'ATT_lname' => $ATT_lname,
1224 1223
 				'ATT_email' => $ATT_email
@@ -1242,13 +1241,13 @@  discard block
 block discarded – undo
1242 1241
 	 * @return \EE_Attendee
1243 1242
 	 * @throws \EE_Error
1244 1243
 	 */
1245
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
1244
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
1246 1245
 		// first remove fname, lname, and email from attendee data
1247
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1246
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
1248 1247
 		// now loop thru what's left and add to attendee CPT
1249
-		foreach ( $attendee_data as $property_name => $property_value ) {
1250
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
1251
-				$existing_attendee->set( $property_name, $property_value );
1248
+		foreach ($attendee_data as $property_name => $property_value) {
1249
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
1250
+				$existing_attendee->set($property_name, $property_value);
1252 1251
 			}
1253 1252
 		}
1254 1253
 		// better save that now
@@ -1266,11 +1265,11 @@  discard block
 block discarded – undo
1266 1265
 	 * @return void
1267 1266
 	 * @throws \EE_Error
1268 1267
 	 */
1269
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
1268
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
1270 1269
 		// add relation to attendee
1271
-		$registration->_add_relation_to( $attendee, 'Attendee' );
1272
-		$registration->set_attendee_id( $attendee->ID() );
1273
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
1270
+		$registration->_add_relation_to($attendee, 'Attendee');
1271
+		$registration->set_attendee_id($attendee->ID());
1272
+		$registration->update_cache_after_object_save('Attendee', $attendee);
1274 1273
 	}
1275 1274
 
1276 1275
 
@@ -1282,10 +1281,10 @@  discard block
 block discarded – undo
1282 1281
 	 * @return void
1283 1282
 	 * @throws \EE_Error
1284 1283
 	 */
1285
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
1284
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
1286 1285
 		// add relation to attendee
1287
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
1288
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
1286
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1287
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1289 1288
 	}
1290 1289
 
1291 1290
 
@@ -1298,14 +1297,14 @@  discard block
 block discarded – undo
1298 1297
 	 * @return array
1299 1298
 	 * @throws \EE_Error
1300 1299
 	 */
1301
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1300
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1302 1301
 		// bare minimum critical details include first name, last name, email address
1303
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1302
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1304 1303
 		// add address info to critical details?
1305
-		if ( apply_filters(
1304
+		if (apply_filters(
1306 1305
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details',
1307 1306
 			false
1308
-		) ) {
1307
+		)) {
1309 1308
 			$address_details = array(
1310 1309
 				'ATT_address',
1311 1310
 				'ATT_address2',
@@ -1315,13 +1314,13 @@  discard block
 block discarded – undo
1315 1314
 				'ATT_zip',
1316 1315
 				'ATT_phone'
1317 1316
 			);
1318
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1317
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1319 1318
 		}
1320
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1321
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] )
1322
-			     || empty( $attendee_data[ $critical_attendee_detail ] )
1319
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1320
+			if ( ! isset($attendee_data[$critical_attendee_detail])
1321
+			     || empty($attendee_data[$critical_attendee_detail])
1323 1322
 			) {
1324
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(
1323
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get(
1325 1324
 					$critical_attendee_detail
1326 1325
 				);
1327 1326
 			}
@@ -1339,11 +1338,11 @@  discard block
 block discarded – undo
1339 1338
 	 * @return \EE_Attendee
1340 1339
 	 * @throws \EE_Error
1341 1340
 	 */
1342
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1341
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1343 1342
 		// create new attendee object
1344
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1343
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1345 1344
 		// set author to event creator
1346
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1345
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1347 1346
 		$new_attendee->save();
1348 1347
 		return $new_attendee;
1349 1348
 	}
@@ -1360,7 +1359,7 @@  discard block
 block discarded – undo
1360 1359
 	 */
1361 1360
 	public function update_reg_step() {
1362 1361
 		// save everything
1363
-		if ( $this->process_reg_step() ) {
1362
+		if ($this->process_reg_step()) {
1364 1363
 			$this->checkout->redirect = true;
1365 1364
 			$this->checkout->redirect_url = add_query_arg(
1366 1365
 				array(
@@ -1369,7 +1368,7 @@  discard block
 block discarded – undo
1369 1368
 				),
1370 1369
 				$this->checkout->thank_you_page_url
1371 1370
 			);
1372
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1371
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1373 1372
 			return true;
1374 1373
 		}
1375 1374
 		return false;
Please login to merge, or discard this patch.
core/EE_Payment_Processor.core.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 /**
4 4
  *
5 5
  * EE_Payment_Processor
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function instance() {
29 29
 		// check if class object is instantiated
30
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
30
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
31 31
 			self::$_instance = new self();
32 32
 		}
33 33
 		return self::$_instance;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 *@access private
42 42
 	 */
43 43
 	private function __construct() {
44
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
44
+		do_action('AHEE__EE_Payment_Processor__construct');
45 45
 	}
46 46
 
47 47
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		$update_txn = true,
81 81
 		$cancel_url = ''
82 82
 	) {
83
-		if( (float)$amount < 0 ) {
83
+		if ((float) $amount < 0) {
84 84
 			throw new EE_Error(
85 85
 				sprintf(
86 86
 					__(
@@ -93,33 +93,33 @@  discard block
 block discarded – undo
93 93
 			);
94 94
 		}
95 95
 		// verify payment method
96
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
96
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
97 97
 		// verify transaction
98
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
99
-		$transaction->set_payment_method_ID( $payment_method->ID() );
98
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
99
+		$transaction->set_payment_method_ID($payment_method->ID());
100 100
 		// verify payment method type
101
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
101
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
102 102
 			$payment = $payment_method->type_obj()->process_payment(
103 103
 				$transaction,
104
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
104
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
105 105
 				$billing_form,
106 106
 				$return_url,
107
-				add_query_arg( array( 'ee_cancel_payment' => true ), $cancel_url ),
107
+				add_query_arg(array('ee_cancel_payment' => true), $cancel_url),
108 108
 				$method,
109 109
 				$by_admin
110 110
 			);
111 111
 			// check if payment method uses an off-site gateway
112
-			if ( $payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite ) {
112
+			if ($payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite) {
113 113
 				// don't process payments for off-site gateways yet because no payment has occurred yet
114
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
114
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
115 115
 			}
116 116
 			return $payment;
117 117
 		} else {
118 118
 			EE_Error::add_error(
119 119
 				sprintf(
120
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
120
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
121 121
 					'<br/>',
122
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
122
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
123 123
 				), __FILE__, __FUNCTION__, __LINE__
124 124
 			);
125 125
 			return NULL;
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 	 * @throws EE_Error
136 136
 	 * @return string
137 137
 	 */
138
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
138
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
139 139
 		/** @type \EE_Transaction $transaction */
140
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
140
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
141 141
 		$primary_reg = $transaction->primary_registration();
142
-		if( ! $primary_reg instanceof EE_Registration ){
142
+		if ( ! $primary_reg instanceof EE_Registration) {
143 143
 			throw new EE_Error(
144 144
 				sprintf(
145 145
 					__(
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 				)
151 151
 			);
152 152
 		}
153
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
153
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
154 154
 		$url = add_query_arg(
155 155
 			array(
156 156
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -187,92 +187,92 @@  discard block
 block discarded – undo
187 187
 		$update_txn = true,
188 188
 		$separate_IPN_request = true
189 189
 	) {
190
-		EE_Registry::instance()->load_model( 'Change_Log' );
191
-		$_req_data = $this->_remove_unusable_characters_from_array( (array)$_req_data );
192
-		EE_Processor_Base::set_IPN( $separate_IPN_request );
190
+		EE_Registry::instance()->load_model('Change_Log');
191
+		$_req_data = $this->_remove_unusable_characters_from_array((array) $_req_data);
192
+		EE_Processor_Base::set_IPN($separate_IPN_request);
193 193
 		$obj_for_log = null;
194
-		if( $transaction instanceof EE_Transaction ){
194
+		if ($transaction instanceof EE_Transaction) {
195 195
 			$obj_for_log = $transaction;
196
-			if( $payment_method instanceof EE_Payment_Method ) {
196
+			if ($payment_method instanceof EE_Payment_Method) {
197 197
 				$obj_for_log = EEM_Payment::instance()->get_one(
198 198
 					array(
199
-						array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ),
200
-						'order_by' => array( 'PAY_timestamp' => 'desc' )
199
+						array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()),
200
+						'order_by' => array('PAY_timestamp' => 'desc')
201 201
 					)
202 202
 				);
203 203
 			}
204
-		} else if( $payment_method instanceof EE_Payment ) {
204
+		} else if ($payment_method instanceof EE_Payment) {
205 205
 			$obj_for_log = $payment_method;
206 206
 		}
207 207
 		$log = EEM_Change_Log::instance()->log(
208 208
 			EEM_Change_Log::type_gateway,
209
-			array( 'IPN data received' => $_req_data ),
209
+			array('IPN data received' => $_req_data),
210 210
 			$obj_for_log
211 211
 		);
212
-		try{
212
+		try {
213 213
 			/**
214 214
 			 * @var EE_Payment $payment
215 215
 			 */
216 216
 			$payment = NULL;
217
-			if($transaction && $payment_method){
217
+			if ($transaction && $payment_method) {
218 218
 				/** @type EE_Transaction $transaction */
219 219
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
220 220
 				/** @type EE_Payment_Method $payment_method */
221 221
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
222
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
223
-						$payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction );
222
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
223
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
224 224
 						$log->set_object($payment);
225 225
 				} else {
226 226
 					// not a payment
227 227
 					EE_Error::add_error(
228 228
 						sprintf(
229
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
229
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
230 230
 							'<br/>',
231
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
231
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
232 232
 						),
233 233
 						__FILE__, __FUNCTION__, __LINE__
234 234
 					);
235 235
 				}
236
-			}else{
236
+			} else {
237 237
 				//that's actually pretty ok. The IPN just wasn't able
238 238
 				//to identify which transaction or payment method this was for
239 239
 				// give all active payment methods a chance to claim it
240 240
 				$active_payment_methods = EEM_Payment_Method::instance()->get_all_active();
241
-				foreach( $active_payment_methods as $active_payment_method ){
242
-					try{
243
-						$payment = $active_payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
241
+				foreach ($active_payment_methods as $active_payment_method) {
242
+					try {
243
+						$payment = $active_payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
244 244
 						$payment_method = $active_payment_method;
245 245
 						EEM_Change_Log::instance()->log(
246 246
 							EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment
247 247
 						);
248 248
 						break;
249
-					} catch( EE_Error $e ) {
249
+					} catch (EE_Error $e) {
250 250
 						//that's fine- it apparently couldn't handle the IPN
251 251
 					}
252 252
 				}
253 253
 
254 254
 			}
255 255
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
256
-			if( $payment instanceof EE_Payment){
256
+			if ($payment instanceof EE_Payment) {
257 257
 				$payment->save();
258 258
 				//  update the TXN
259
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
260
-			}else{
259
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request);
260
+			} else {
261 261
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
262
-				if($payment_method){
262
+				if ($payment_method) {
263 263
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
264
-				}elseif($transaction){
264
+				}elseif ($transaction) {
265 265
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
266 266
 				}
267 267
 			}
268 268
 			return $payment;
269 269
 
270
-		} catch( EE_Error $e ) {
270
+		} catch (EE_Error $e) {
271 271
 			do_action(
272 272
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
273
-					__( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ),
274
-					print_r( $transaction, TRUE ),
275
-					print_r( $_req_data, TRUE ),
273
+					__('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'),
274
+					print_r($transaction, TRUE),
275
+					print_r($_req_data, TRUE),
276 276
 					$e->getMessage()
277 277
 				)
278 278
 			);
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 	 * @param  array $request_data
288 288
 	 * @return array
289 289
 	 */
290
-	protected function _remove_unusable_characters_from_array( array $request_data ) {
290
+	protected function _remove_unusable_characters_from_array(array $request_data) {
291 291
 		$return_data = array();
292
-		foreach( $request_data as $key => $value ) {
293
-			$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
292
+		foreach ($request_data as $key => $value) {
293
+			$return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value);
294 294
 		}
295 295
 		return $return_data;
296 296
 	}
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 	 * @param string $request_data
303 303
 	 * @return string
304 304
 	 */
305
-	protected function _remove_unusable_characters( $request_data ) {
306
-		return preg_replace( '/[^[:print:]]/', '', $request_data );
305
+	protected function _remove_unusable_characters($request_data) {
306
+		return preg_replace('/[^[:print:]]/', '', $request_data);
307 307
 	}
308 308
 
309 309
 
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
 	 * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO,
326 326
 	 *                                      to call handle_ipn() for offsite gateways that don't receive separate IPNs
327 327
 	 */
328
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
328
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
329 329
 		/** @var $transaction EE_Transaction */
330
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
330
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
331 331
 		$last_payment_method = $transaction->payment_method();
332
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
333
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
334
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
332
+		if ($last_payment_method instanceof EE_Payment_Method) {
333
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
334
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
335 335
 			return $payment;
336 336
 		} else {
337 337
 			return NULL;
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 		EE_Payment $payment_to_refund,
355 355
 		$refund_info = array()
356 356
 	) {
357
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) {
358
-			$payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info );
359
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
357
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) {
358
+			$payment_method->type_obj()->process_refund($payment_to_refund, $refund_info);
359
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
360 360
 		}
361 361
 		return $payment_to_refund;
362 362
 	}
@@ -397,12 +397,12 @@  discard block
 block discarded – undo
397 397
 	 *                        TXN is locked before updating
398 398
 	 * @throws \EE_Error
399 399
 	 */
400
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
400
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
401 401
 		$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful';
402 402
 		/** @type EE_Transaction $transaction */
403
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
403
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
404 404
 		// can we freely update the TXN at this moment?
405
-		if ( $IPN && $transaction->is_locked() ) {
405
+		if ($IPN && $transaction->is_locked()) {
406 406
 			// don't update the transaction at this exact moment
407 407
 			// because the TXN is active in another request
408 408
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -412,38 +412,38 @@  discard block
 block discarded – undo
412 412
 			);
413 413
 		} else {
414 414
 			// verify payment and that it has been saved
415
-			if ( $payment instanceof EE_Payment && $payment->ID() ) {
416
-				if(
415
+			if ($payment instanceof EE_Payment && $payment->ID()) {
416
+				if (
417 417
 					$payment->payment_method() instanceof EE_Payment_Method
418 418
 					&& $payment->payment_method()->type_obj() instanceof EE_PMT_Base
419
-				){
420
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
419
+				) {
420
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
421 421
 					// update TXN registrations with payment info
422
-					$this->process_registration_payments( $transaction, $payment );
422
+					$this->process_registration_payments($transaction, $payment);
423 423
 				}
424 424
 				$do_action = $payment->just_approved()
425 425
 					? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful'
426 426
 					: $do_action;
427 427
 			} else {
428 428
 				// send out notifications
429
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
429
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
430 430
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
431 431
 			}
432
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
432
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
433 433
 				/** @type EE_Transaction_Payments $transaction_payments */
434
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
434
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
435 435
 				// set new value for total paid
436
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
436
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
437 437
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
438
-				if ( $update_txn ) {
439
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
438
+				if ($update_txn) {
439
+					$this->_post_payment_processing($transaction, $payment, $IPN);
440 440
 				}
441 441
 			}
442 442
 			// granular hook for others to use.
443
-			do_action( $do_action, $transaction, $payment );
444
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' );
443
+			do_action($do_action, $transaction, $payment);
444
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action');
445 445
 			//global hook for others to use.
446
-			do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment );
446
+			do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment);
447 447
 		}
448 448
 	}
449 449
 
@@ -463,25 +463,25 @@  discard block
 block discarded – undo
463 463
 		$registrations = array()
464 464
 	) {
465 465
 		// only process if payment was successful
466
-		if ( $payment->status() !== EEM_Payment::status_id_approved ) {
466
+		if ($payment->status() !== EEM_Payment::status_id_approved) {
467 467
 			return;
468 468
 		}
469 469
 		//EEM_Registration::instance()->show_next_x_db_queries();
470
-		if ( empty( $registrations )) {
470
+		if (empty($registrations)) {
471 471
 			// find registrations with monies owing that can receive a payment
472 472
 			$registrations = $transaction->registrations(
473 473
 				array(
474 474
 					array(
475 475
 						// only these reg statuses can receive payments
476
-						'STS_ID'           => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ),
477
-						'REG_final_price'  => array( '!=', 0 ),
478
-						'REG_final_price*' => array( '!=', 'REG_paid', true ),
476
+						'STS_ID'           => array('IN', EEM_Registration::reg_statuses_that_allow_payment()),
477
+						'REG_final_price'  => array('!=', 0),
478
+						'REG_final_price*' => array('!=', 'REG_paid', true),
479 479
 					)
480 480
 				)
481 481
 			);
482 482
 		}
483 483
 		// still nothing ??!??
484
-		if ( empty( $registrations )) {
484
+		if (empty($registrations)) {
485 485
 			return;
486 486
 		}
487 487
 		// todo: break out the following logic into a separate strategy class
@@ -493,28 +493,28 @@  discard block
 block discarded – undo
493 493
 
494 494
 		$refund = $payment->is_a_refund();
495 495
 		// how much is available to apply to registrations?
496
-		$available_payment_amount = abs( $payment->amount() );
497
-		foreach ( $registrations as $registration ) {
498
-			if ( $registration instanceof EE_Registration ) {
496
+		$available_payment_amount = abs($payment->amount());
497
+		foreach ($registrations as $registration) {
498
+			if ($registration instanceof EE_Registration) {
499 499
 				// nothing left?
500
-				if ( $available_payment_amount <= 0 ) {
500
+				if ($available_payment_amount <= 0) {
501 501
 					break;
502 502
 				}
503
-				if ( $refund ) {
504
-					$available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount );
503
+				if ($refund) {
504
+					$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
505 505
 				} else {
506
-					$available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount );
506
+					$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
507 507
 				}
508 508
 			}
509 509
 		}
510
-		if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) {
510
+		if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) {
511 511
 			EE_Error::add_attention(
512 512
 				sprintf(
513
-					__( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ),
514
-					EEH_Template::format_currency( $available_payment_amount ),
515
-					implode( ', ',  array_keys( $registrations ) ),
513
+					__('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'),
514
+					EEH_Template::format_currency($available_payment_amount),
515
+					implode(', ', array_keys($registrations)),
516 516
 					'<br/>',
517
-					EEH_Template::format_currency( $payment->amount() )
517
+					EEH_Template::format_currency($payment->amount())
518 518
 				),
519 519
 				__FILE__, __FUNCTION__, __LINE__
520 520
 			);
@@ -532,17 +532,17 @@  discard block
 block discarded – undo
532 532
 	 * @return float
533 533
 	 * @throws \EE_Error
534 534
 	 */
535
-	public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) {
535
+	public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) {
536 536
 		$owing = $registration->final_price() - $registration->paid();
537
-		if ( $owing > 0 ) {
537
+		if ($owing > 0) {
538 538
 			// don't allow payment amount to exceed the available payment amount, OR the amount owing
539
-			$payment_amount = min( $available_payment_amount, $owing );
539
+			$payment_amount = min($available_payment_amount, $owing);
540 540
 			// update $available_payment_amount
541 541
 			$available_payment_amount -= $payment_amount;
542 542
 			//calculate and set new REG_paid
543
-			$registration->set_paid( $registration->paid() + $payment_amount );
543
+			$registration->set_paid($registration->paid() + $payment_amount);
544 544
 			// now save it
545
-			$this->_apply_registration_payment( $registration, $payment, $payment_amount );
545
+			$this->_apply_registration_payment($registration, $payment, $payment_amount);
546 546
 		}
547 547
 		return $available_payment_amount;
548 548
 	}
@@ -558,19 +558,19 @@  discard block
 block discarded – undo
558 558
 	 * @return void
559 559
 	 * @throws \EE_Error
560 560
 	 */
561
-	protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) {
561
+	protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) {
562 562
 		// find any existing reg payment records for this registration and payment
563 563
 		$existing_reg_payment = EEM_Registration_Payment::instance()->get_one(
564
-			array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) )
564
+			array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID()))
565 565
 		);
566 566
 		// if existing registration payment exists
567
-		if ( $existing_reg_payment instanceof EE_Registration_Payment ) {
567
+		if ($existing_reg_payment instanceof EE_Registration_Payment) {
568 568
 			// then update that record
569
-			$existing_reg_payment->set_amount( $payment_amount );
569
+			$existing_reg_payment->set_amount($payment_amount);
570 570
 			$existing_reg_payment->save();
571 571
 		} else {
572 572
 			// or add new relation between registration and payment and set amount
573
-			$registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) );
573
+			$registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount));
574 574
 			// make it stick
575 575
 			$registration->save();
576 576
 		}
@@ -587,21 +587,21 @@  discard block
 block discarded – undo
587 587
 	 * @return float
588 588
 	 * @throws \EE_Error
589 589
 	 */
590
-	public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) {
590
+	public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) {
591 591
 		//EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ );
592
-		if ( $registration->paid() > 0 ) {
592
+		if ($registration->paid() > 0) {
593 593
 			// ensure $available_refund_amount is NOT negative
594
-			$available_refund_amount = (float)abs( $available_refund_amount );
594
+			$available_refund_amount = (float) abs($available_refund_amount);
595 595
 			// don't allow refund amount to exceed the available payment amount, OR the amount paid
596
-			$refund_amount = min( $available_refund_amount, (float)$registration->paid() );
596
+			$refund_amount = min($available_refund_amount, (float) $registration->paid());
597 597
 			// update $available_payment_amount
598 598
 			$available_refund_amount -= $refund_amount;
599 599
 			//calculate and set new REG_paid
600
-			$registration->set_paid( $registration->paid() - $refund_amount );
600
+			$registration->set_paid($registration->paid() - $refund_amount);
601 601
 			// convert payment amount back to a negative value for storage in the db
602
-			$refund_amount = (float)abs( $refund_amount ) * -1;
602
+			$refund_amount = (float) abs($refund_amount) * -1;
603 603
 			// now save it
604
-			$this->_apply_registration_payment( $registration, $payment, $refund_amount );
604
+			$this->_apply_registration_payment($registration, $payment, $refund_amount);
605 605
 		}
606 606
 		return $available_refund_amount;
607 607
 	}
@@ -620,53 +620,53 @@  discard block
 block discarded – undo
620 620
 	 * @param bool           $IPN
621 621
 	 * @throws \EE_Error
622 622
 	 */
623
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
623
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
624 624
 
625 625
 		/** @type EE_Transaction_Processor $transaction_processor */
626
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
626
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
627 627
 		// is the Payment Options Reg Step completed ?
628
-		$payment_options_step_completed = $transaction->reg_step_completed( 'payment_options' );
628
+		$payment_options_step_completed = $transaction->reg_step_completed('payment_options');
629 629
 		// if the Payment Options Reg Step is completed...
630 630
 		$revisit = $payment_options_step_completed === true ? true : false;
631 631
 		// then this is kinda sorta a revisit with regards to payments at least
632
-		$transaction_processor->set_revisit( $revisit );
632
+		$transaction_processor->set_revisit($revisit);
633 633
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
634 634
 		if (
635 635
 			$IPN &&
636 636
 			$payment_options_step_completed !== true &&
637
-			( $payment->is_approved() || $payment->is_pending() )
637
+			($payment->is_approved() || $payment->is_pending())
638 638
 		) {
639 639
 			$payment_options_step_completed = $transaction->set_reg_step_completed(
640 640
 				'payment_options'
641 641
 			);
642 642
 		}
643 643
 		// maybe update status, but don't save transaction just yet
644
-		$transaction->update_status_based_on_total_paid( false );
644
+		$transaction->update_status_based_on_total_paid(false);
645 645
 		// check if 'finalize_registration' step has been completed...
646
-		$finalized = $transaction->reg_step_completed( 'finalize_registration' );
646
+		$finalized = $transaction->reg_step_completed('finalize_registration');
647 647
 		//  if this is an IPN and the final step has not been initiated
648
-		if ( $IPN && $payment_options_step_completed && $finalized === false ) {
648
+		if ($IPN && $payment_options_step_completed && $finalized === false) {
649 649
 			// and if it hasn't already been set as being started...
650
-			$finalized = $transaction->set_reg_step_initiated( 'finalize_registration' );
650
+			$finalized = $transaction->set_reg_step_initiated('finalize_registration');
651 651
 		}
652 652
 		$transaction->save();
653 653
 		// because the above will return false if the final step was not fully completed, we need to check again...
654
-		if ( $IPN && $finalized !== false ) {
654
+		if ($IPN && $finalized !== false) {
655 655
 			// and if we are all good to go, then send out notifications
656
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
656
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
657 657
 			//ok, now process the transaction according to the payment
658
-			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
658
+			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
659 659
 		}
660 660
 		// DEBUG LOG
661 661
 		$payment_method = $payment->payment_method();
662
-		if ( $payment_method instanceof EE_Payment_Method ) {
662
+		if ($payment_method instanceof EE_Payment_Method) {
663 663
 			$payment_method_type_obj = $payment_method->type_obj();
664
-			if ( $payment_method_type_obj instanceof EE_PMT_Base ) {
664
+			if ($payment_method_type_obj instanceof EE_PMT_Base) {
665 665
 				$gateway = $payment_method_type_obj->get_gateway();
666
-				if ( $gateway instanceof EE_Gateway ){
666
+				if ($gateway instanceof EE_Gateway) {
667 667
 					$gateway->log(
668 668
 						array(
669
-							'message'               => __( 'Post Payment Transaction Details', 'event_espresso' ),
669
+							'message'               => __('Post Payment Transaction Details', 'event_espresso'),
670 670
 							'transaction'           => $transaction->model_field_array(),
671 671
 							'finalized'             => $finalized,
672 672
 							'IPN'                   => $IPN,
Please login to merge, or discard this patch.
core/business/EE_Transaction_Processor.class.php 1 patch
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 
4 4
 /**
5 5
  * Class EE_Transaction_Processor
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 	 * @param array $registration_query_params
51 51
 	 *@return EE_Transaction_Processor instance
52 52
 	 */
53
-	public static function instance( $registration_query_params = array() ) {
53
+	public static function instance($registration_query_params = array()) {
54 54
 		// check if class object is instantiated
55
-		if ( ! self::$_instance instanceof EE_Transaction_Processor ) {
56
-			self::$_instance = new self( $registration_query_params );
55
+		if ( ! self::$_instance instanceof EE_Transaction_Processor) {
56
+			self::$_instance = new self($registration_query_params);
57 57
 		}
58 58
 		return self::$_instance;
59 59
 	}
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	/**
64 64
 	 * @param array $registration_query_params
65 65
 	 */
66
-	private function __construct( $registration_query_params = array() ) {
66
+	private function __construct($registration_query_params = array()) {
67 67
 		// make sure some query params are set for retrieving registrations
68
-		$this->_set_registration_query_params( $registration_query_params );
68
+		$this->_set_registration_query_params($registration_query_params);
69 69
 	}
70 70
 
71 71
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 * @access private
75 75
 	 * @param array $registration_query_params
76 76
 	 */
77
-	private function _set_registration_query_params( $registration_query_params ) {
78
-		$this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' ));
77
+	private function _set_registration_query_params($registration_query_params) {
78
+		$this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC'));
79 79
 	}
80 80
 
81 81
 
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 		);
105 105
 		// send messages
106 106
 		/** @type EE_Registration_Processor $registration_processor */
107
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
107
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
108 108
 		$registration_processor->trigger_registration_update_notifications(
109 109
 			$transaction->primary_registration(),
110
-			array( 'manually_updated' 	=> true )
110
+			array('manually_updated' 	=> true)
111 111
 		);
112 112
 		do_action(
113 113
 			'AHEE__EE_Transaction_Processor__manually_update_registration_statuses',
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
 		$registration_query_params = array()
195 195
 	) {
196 196
 		// make sure some query params are set for retrieving registrations
197
-		$this->_set_registration_query_params( $registration_query_params );
197
+		$this->_set_registration_query_params($registration_query_params);
198 198
 		// get final reg step status
199 199
 		$finalized = $transaction->final_reg_step_completed();
200 200
 		// if the 'finalize_registration' step has been initiated (has a timestamp)
201 201
 		// but has not yet been fully completed (TRUE)
202
-		if ( is_int( $finalized ) && $finalized !== false && $finalized !== true ) {
203
-			$transaction->set_reg_step_completed( 'finalize_registration' );
202
+		if (is_int($finalized) && $finalized !== false && $finalized !== true) {
203
+			$transaction->set_reg_step_completed('finalize_registration');
204 204
 			$finalized = true;
205 205
 		}
206 206
 		$transaction->save();
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
 		// send messages
225 225
 		/** @type EE_Registration_Processor $registration_processor */
226
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
226
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
227 227
 		$registration_processor->trigger_registration_update_notifications(
228 228
 			$transaction->primary_registration(),
229 229
 			$update_params
@@ -254,22 +254,22 @@  discard block
 block discarded – undo
254 254
 		$update_txn = true
255 255
 	) {
256 256
 		// these reg statuses should not be considered in any calculations involving monies owing
257
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
258
-		if ( in_array( $registration->status_ID(), $closed_reg_statuses ) ) {
257
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
258
+		if (in_array($registration->status_ID(), $closed_reg_statuses)) {
259 259
 			return false;
260 260
 		}
261 261
 		try {
262
-			$transaction = $this->get_transaction_for_registration( $registration );
262
+			$transaction = $this->get_transaction_for_registration($registration);
263 263
 			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration(
264 264
 				$transaction,
265 265
 				$registration
266 266
 			);
267 267
 			// un-cancel the ticket
268
-			$success = EEH_Line_Item::reinstate_canceled_ticket_line_item( $ticket_line_item );
269
-		} catch ( EE_Error $e ) {
268
+			$success = EEH_Line_Item::reinstate_canceled_ticket_line_item($ticket_line_item);
269
+		} catch (EE_Error $e) {
270 270
 			EE_Error::add_error(
271 271
 				sprintf(
272
-					__( 'The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso' ),
272
+					__('The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso'),
273 273
 					$registration->ID(),
274 274
 					'<br />',
275 275
 					$e->getMessage()
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			);
279 279
 			return false;
280 280
 		}
281
-		if ( $update_txn ) {
281
+		if ($update_txn) {
282 282
 			return $transaction->save() ? $success : false;
283 283
 		}
284 284
 		return $success;
@@ -302,18 +302,18 @@  discard block
 block discarded – undo
302 302
 		$update_txn = true
303 303
 	) {
304 304
 		// these reg statuses should not be considered in any calculations involving monies owing
305
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
306
-		if ( ! in_array( $registration->status_ID(), $closed_reg_statuses ) ) {
305
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
306
+		if ( ! in_array($registration->status_ID(), $closed_reg_statuses)) {
307 307
 			return false;
308 308
 		}
309 309
 		try {
310
-			$transaction = $this->get_transaction_for_registration( $registration );
311
-			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( $transaction, $registration );
312
-			EEH_Line_Item::cancel_ticket_line_item( $ticket_line_item );
313
-		} catch ( EE_Error $e ) {
310
+			$transaction = $this->get_transaction_for_registration($registration);
311
+			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration($transaction, $registration);
312
+			EEH_Line_Item::cancel_ticket_line_item($ticket_line_item);
313
+		} catch (EE_Error $e) {
314 314
 			EE_Error::add_error(
315 315
 				sprintf(
316
-					__( 'The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso' ),
316
+					__('The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso'),
317 317
 					$registration->ID(),
318 318
 					'<br />',
319 319
 					$e->getMessage()
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 			);
323 323
 			return false;
324 324
 		}
325
-		if ( $update_txn ) {
325
+		if ($update_txn) {
326 326
 			return $transaction->save() ? true : false;
327 327
 		}
328 328
 		return true;
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
 	 * @return 	EE_Transaction
339 339
 	 * @throws 	EE_Error
340 340
 	 */
341
-	public function get_transaction_for_registration( EE_Registration $registration ) {
341
+	public function get_transaction_for_registration(EE_Registration $registration) {
342 342
 		$transaction = $registration->transaction();
343
-		if ( ! $transaction instanceof EE_Transaction ) {
343
+		if ( ! $transaction instanceof EE_Transaction) {
344 344
 			throw new EE_Error(
345 345
 				sprintf(
346
-					__( 'The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso' ),
346
+					__('The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso'),
347 347
 					$registration->ID()
348 348
 				)
349 349
 			);
@@ -366,16 +366,16 @@  discard block
 block discarded – undo
366 366
 		EE_Transaction $transaction,
367 367
 		EE_Registration $registration
368 368
 	) {
369
-		EE_Registry::instance()->load_helper( 'Line_Item' );
369
+		EE_Registry::instance()->load_helper('Line_Item');
370 370
 		$ticket_line_item = EEM_Line_Item::instance()->get_ticket_line_item_for_transaction(
371 371
 			$transaction->ID(),
372 372
 			$registration->ticket_ID()
373 373
 		);
374
-		if ( ! $ticket_line_item instanceof EE_Line_Item ) {
374
+		if ( ! $ticket_line_item instanceof EE_Line_Item) {
375 375
 			throw new EE_Error(
376 376
 				sprintf(
377
-					__( 'The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.',
378
-						'event_espresso' ),
377
+					__('The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.',
378
+						'event_espresso'),
379 379
 					$transaction->ID(),
380 380
 					$registration->ticket_ID()
381 381
 				)
@@ -408,22 +408,22 @@  discard block
 block discarded – undo
408 408
 		$update_txn = true
409 409
 	) {
410 410
 		// make sure some query params are set for retrieving registrations
411
-		$this->_set_registration_query_params( $registration_query_params );
411
+		$this->_set_registration_query_params($registration_query_params);
412 412
 		// these reg statuses should not be considered in any calculations involving monies owing
413
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
413
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
414 414
 		// loop through cached registrations
415
-		foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) {
415
+		foreach ($transaction->registrations($this->_registration_query_params) as $registration) {
416 416
 			if (
417 417
 				$registration instanceof EE_Registration
418
-				&& ! in_array( $registration->status_ID(), $closed_reg_statuses )
418
+				&& ! in_array($registration->status_ID(), $closed_reg_statuses)
419 419
 			) {
420 420
 				return false;
421 421
 			}
422 422
 		}
423
-		if ( in_array( $new_TXN_status, EEM_Transaction::txn_status_array() ) ) {
424
-			$transaction->set_status( $new_TXN_status );
423
+		if (in_array($new_TXN_status, EEM_Transaction::txn_status_array())) {
424
+			$transaction->set_status($new_TXN_status);
425 425
 		}
426
-		if ( $update_txn ) {
426
+		if ($update_txn) {
427 427
 			return $transaction->save() ? true : false;
428 428
 		}
429 429
 		return true;
@@ -452,22 +452,22 @@  discard block
 block discarded – undo
452 452
 	) {
453 453
 		$response = false;
454 454
 		/** @type EE_Registration_Processor $registration_processor */
455
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
455
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
456 456
 		// check that method exists
457
-		if ( ! method_exists( $registration_processor, $method_name )) {
458
-			throw new EE_Error( __( 'Method does not exist.', 'event_espresso' ));
457
+		if ( ! method_exists($registration_processor, $method_name)) {
458
+			throw new EE_Error(__('Method does not exist.', 'event_espresso'));
459 459
 		}
460 460
 		// make sure some query params are set for retrieving registrations
461
-		$this->_set_registration_query_params( $registration_query_params );
461
+		$this->_set_registration_query_params($registration_query_params);
462 462
 		// loop through cached registrations
463
-		foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) {
464
-			if ( $registration instanceof EE_Registration ) {
465
-				if ( $additional_param ) {
466
-					$response = $registration_processor->{$method_name}( $registration, $additional_param )
463
+		foreach ($transaction->registrations($this->_registration_query_params) as $registration) {
464
+			if ($registration instanceof EE_Registration) {
465
+				if ($additional_param) {
466
+					$response = $registration_processor->{$method_name}($registration, $additional_param)
467 467
 						? true
468 468
 						: $response;
469 469
 				} else {
470
-					$response = $registration_processor->{$method_name}( $registration )
470
+					$response = $registration_processor->{$method_name}($registration)
471 471
 						? true
472 472
 						: $response;
473 473
 				}
@@ -494,28 +494,28 @@  discard block
 block discarded – undo
494 494
 	public function set_transaction_payment_method_based_on_registration_statuses(
495 495
 		EE_Registration $edited_registration
496 496
 	) {
497
-		if ( $edited_registration instanceof EE_Registration ) {
497
+		if ($edited_registration instanceof EE_Registration) {
498 498
 			$transaction = $edited_registration->transaction();
499
-			if ( $transaction instanceof EE_Transaction ) {
499
+			if ($transaction instanceof EE_Transaction) {
500 500
 				$all_not_approved = true;
501
-				foreach ( $transaction->registrations() as $registration ) {
502
-					if ( $registration instanceof EE_Registration ) {
501
+				foreach ($transaction->registrations() as $registration) {
502
+					if ($registration instanceof EE_Registration) {
503 503
 						// if any REG != "Not Approved" then toggle to false
504 504
 						$all_not_approved = $registration->is_not_approved() ? $all_not_approved : false;
505 505
 					}
506 506
 				}
507 507
 				// if ALL Registrations are "Not Approved"
508
-				if ( $all_not_approved ) {
509
-					$transaction->set_payment_method_ID( null );
508
+				if ($all_not_approved) {
509
+					$transaction->set_payment_method_ID(null);
510 510
 					$transaction->save();
511 511
 				} else {
512 512
 					$available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
513 513
 						$transaction,
514 514
 						EEM_Payment_Method::scope_cart
515 515
 					);
516
-					if ( ! empty( $available_payment_methods ) ) {
516
+					if ( ! empty($available_payment_methods)) {
517 517
 						$PMD_ID = 0;
518
-						foreach ( $available_payment_methods as $available_payment_method ) {
518
+						foreach ($available_payment_methods as $available_payment_method) {
519 519
 							if (
520 520
 								$available_payment_method instanceof EE_Payment_Method
521 521
 							    && $available_payment_method->open_by_default()
@@ -524,22 +524,22 @@  discard block
 block discarded – undo
524 524
 								break;
525 525
 							}
526 526
 						}
527
-						if ( ! $PMD_ID ) {
528
-							$first_payment_method = reset( $available_payment_methods );
529
-							if ( $first_payment_method instanceof EE_Payment_Method ) {
527
+						if ( ! $PMD_ID) {
528
+							$first_payment_method = reset($available_payment_methods);
529
+							if ($first_payment_method instanceof EE_Payment_Method) {
530 530
 								$PMD_ID = $first_payment_method->ID();
531 531
 							} else {
532 532
 								EE_Error::add_error(
533
-									__( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ),
533
+									__('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'),
534 534
 									__FILE__, __LINE__, __FUNCTION__
535 535
 								);
536 536
 							}
537 537
 						}
538
-						$transaction->set_payment_method_ID( $PMD_ID );
538
+						$transaction->set_payment_method_ID($PMD_ID);
539 539
 						$transaction->save();
540 540
 					} else {
541 541
 						EE_Error::add_error(
542
-							__( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ),
542
+							__('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'),
543 543
 							__FILE__, __LINE__, __FUNCTION__
544 544
 						);
545 545
 					}
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	 * @deprecated 4.9.12
577 577
 	 * @param string $old_txn_status
578 578
 	 */
579
-	public function set_old_txn_status( $old_txn_status ) {
579
+	public function set_old_txn_status($old_txn_status) {
580 580
 		EE_Error::doing_it_wrong(
581 581
 			__METHOD__,
582 582
 			esc_html__(
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 			'4.9.12'
587 587
 		);
588 588
 		// only set the first time
589
-		if ( $this->_old_txn_status === null ) {
589
+		if ($this->_old_txn_status === null) {
590 590
 			$this->_old_txn_status = $old_txn_status;
591 591
 		}
592 592
 	}
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @deprecated 4.9.12
616 616
 	 * @param string $new_txn_status
617 617
 	 */
618
-	public function set_new_txn_status( $new_txn_status ) {
618
+	public function set_new_txn_status($new_txn_status) {
619 619
 		EE_Error::doing_it_wrong(
620 620
 			__METHOD__,
621 621
 			esc_html__(
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 	 * @param EE_Transaction $transaction
660 660
 	 * @return boolean
661 661
 	 */
662
-	public function all_reg_steps_completed( EE_Transaction $transaction ) {
662
+	public function all_reg_steps_completed(EE_Transaction $transaction) {
663 663
 		EE_Error::doing_it_wrong(
664 664
 			__METHOD__,
665 665
 			esc_html__(
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	 * @param string         $exception
687 687
 	 * @return boolean
688 688
 	 */
689
-	public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) {
689
+	public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') {
690 690
 		EE_Error::doing_it_wrong(
691 691
 			__METHOD__,
692 692
 			esc_html__(
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 			'4.9.12',
697 697
 			'5.0.0'
698 698
 		);
699
-		return $transaction->all_reg_steps_completed_except( $exception );
699
+		return $transaction->all_reg_steps_completed_except($exception);
700 700
 	}
701 701
 
702 702
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	 * @param EE_Transaction $transaction
713 713
 	 * @return boolean
714 714
 	 */
715
-	public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) {
715
+	public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) {
716 716
 		EE_Error::doing_it_wrong(
717 717
 			__METHOD__,
718 718
 			esc_html__(
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 	 * @param string         $reg_step_slug
740 740
 	 * @return boolean | int
741 741
 	 */
742
-	public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
742
+	public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
743 743
 		EE_Error::doing_it_wrong(
744 744
 			__METHOD__,
745 745
 			esc_html__(
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 			'4.9.12',
750 750
 			'5.0.0'
751 751
 		);
752
-		return $transaction->reg_step_completed( $reg_step_slug );
752
+		return $transaction->reg_step_completed($reg_step_slug);
753 753
 	}
754 754
 
755 755
 
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 	 * @param EE_Transaction $transaction
766 766
 	 * @return boolean | int
767 767
 	 */
768
-	public function final_reg_step_completed( EE_Transaction $transaction ) {
768
+	public function final_reg_step_completed(EE_Transaction $transaction) {
769 769
 		EE_Error::doing_it_wrong(
770 770
 			__METHOD__,
771 771
 			esc_html__(
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 * @return boolean
792 792
 	 * @throws \EE_Error
793 793
 	 */
794
-	public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) {
794
+	public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) {
795 795
 		EE_Error::doing_it_wrong(
796 796
 			__METHOD__,
797 797
 			esc_html__(
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 			'4.9.12',
802 802
 			'5.0.0'
803 803
 		);
804
-		return $transaction->set_reg_step_initiated( $reg_step_slug );
804
+		return $transaction->set_reg_step_initiated($reg_step_slug);
805 805
 	}
806 806
 
807 807
 
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 	 * @return boolean
818 818
 	 * @throws \EE_Error
819 819
 	 */
820
-	public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
820
+	public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
821 821
 		EE_Error::doing_it_wrong(
822 822
 			__METHOD__,
823 823
 			esc_html__(
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 			'4.9.12',
828 828
 			'5.0.0'
829 829
 		);
830
-		return $transaction->set_reg_step_completed( $reg_step_slug );
830
+		return $transaction->set_reg_step_completed($reg_step_slug);
831 831
 	}
832 832
 
833 833
 
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 	 * @return boolean
844 844
 	 * @throws \EE_Error
845 845
 	 */
846
-	public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) {
846
+	public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) {
847 847
 		EE_Error::doing_it_wrong(
848 848
 			__METHOD__,
849 849
 			esc_html__(
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 			'4.9.12',
854 854
 			'5.0.0'
855 855
 		);
856
-		return $transaction->set_reg_step_not_completed( $reg_step_slug );
856
+		return $transaction->set_reg_step_not_completed($reg_step_slug);
857 857
 	}
858 858
 
859 859
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 	 * @param string          $reg_step_slug
871 871
 	 * @return void
872 872
 	 */
873
-	public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) {
873
+	public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) {
874 874
 		EE_Error::doing_it_wrong(
875 875
 			__METHOD__,
876 876
 			esc_html__(
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 			'4.9.12',
881 881
 			'5.0.0'
882 882
 		);
883
-		$transaction->remove_reg_step( $reg_step_slug );
883
+		$transaction->remove_reg_step($reg_step_slug);
884 884
 	}
885 885
 
886 886
 
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 	 * @return    boolean
897 897
 	 * @throws \EE_Error
898 898
 	 */
899
-	public function toggle_failed_transaction_status( EE_Transaction $transaction ) {
899
+	public function toggle_failed_transaction_status(EE_Transaction $transaction) {
900 900
 		EE_Error::doing_it_wrong(
901 901
 			__METHOD__,
902 902
 			esc_html__(
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 	 * @param  EE_Transaction $transaction
921 921
 	 * @return boolean
922 922
 	 */
923
-	public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) {
923
+	public function toggle_abandoned_transaction_status(EE_Transaction $transaction) {
924 924
 		EE_Error::doing_it_wrong(
925 925
 			__METHOD__,
926 926
 			esc_html__(
Please login to merge, or discard this patch.
core/db_classes/EE_Registration.class.php 1 patch
Spacing   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\EntityNotFoundException;
2 2
 
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 /**
7 7
  * EE_Registration class
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 *                             		    date_format and the second value is the time format
44 44
 	 * @return EE_Registration
45 45
 	 */
46
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
47
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
48
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
46
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
47
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
48
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
49 49
 	}
50 50
 
51 51
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 *                          		the website will be used.
57 57
 	 * @return EE_Registration
58 58
 	 */
59
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
60
-		return new self( $props_n_values, TRUE, $timezone );
59
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
60
+		return new self($props_n_values, TRUE, $timezone);
61 61
 	}
62 62
 
63 63
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @access        public
69 69
 	 * @param        int $EVT_ID Event ID
70 70
 	 */
71
-	public function set_event( $EVT_ID = 0 ) {
72
-		$this->set( 'EVT_ID', $EVT_ID );
71
+	public function set_event($EVT_ID = 0) {
72
+		$this->set('EVT_ID', $EVT_ID);
73 73
 	}
74 74
 
75 75
 
@@ -80,18 +80,18 @@  discard block
 block discarded – undo
80 80
 	 * @param mixed  $field_value
81 81
 	 * @param bool   $use_default
82 82
 	 */
83
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
84
-		switch( $field_name ) {
83
+	public function set($field_name, $field_value, $use_default = FALSE) {
84
+		switch ($field_name) {
85 85
 			case 'REG_code' :
86
-				if ( ! empty( $field_value ) && $this->reg_code() == '' ) {
87
-					$this->set_reg_code( $field_value, $use_default );
86
+				if ( ! empty($field_value) && $this->reg_code() == '') {
87
+					$this->set_reg_code($field_value, $use_default);
88 88
 				}
89 89
 				break;
90 90
 			case 'STS_ID' :
91
-				$this->set_status( $field_value, $use_default );
91
+				$this->set_status($field_value, $use_default);
92 92
 				break;
93 93
 			default :
94
-				parent::set( $field_name, $field_value, $use_default );
94
+				parent::set($field_name, $field_value, $use_default);
95 95
 		}
96 96
 	}
97 97
 
@@ -109,42 +109,42 @@  discard block
 block discarded – undo
109 109
 	 * @return bool
110 110
 	 * @throws \EE_Error
111 111
 	 */
112
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
112
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
113 113
 		// get current REG_Status
114 114
 		$old_STS_ID = $this->status_ID();
115 115
 		// if status has changed
116 116
 		if (
117 117
 			$this->ID() // ensure registration is in the db
118 118
 			&& $old_STS_ID != $new_STS_ID // and that status has actually changed
119
-			&& ! empty( $old_STS_ID ) // and that old status is actually set
120
-			&& ! empty( $new_STS_ID ) // as well as the new status
119
+			&& ! empty($old_STS_ID) // and that old status is actually set
120
+			&& ! empty($new_STS_ID) // as well as the new status
121 121
 		) {
122 122
 			// TO approved
123
-			if ( $new_STS_ID === EEM_Registration::status_id_approved ) {
123
+			if ($new_STS_ID === EEM_Registration::status_id_approved) {
124 124
 				// reserve a space by incrementing ticket and datetime sold values
125 125
 				$this->_reserve_registration_space();
126
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
126
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
127 127
 			// OR FROM  approved
128
-			} else if ( $old_STS_ID === EEM_Registration::status_id_approved ) {
128
+			} else if ($old_STS_ID === EEM_Registration::status_id_approved) {
129 129
 				// release a space by decrementing ticket and datetime sold values
130 130
 				$this->_release_registration_space();
131
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
131
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
132 132
 			}
133 133
 			// update status
134
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
134
+			parent::set('STS_ID', $new_STS_ID, $use_default);
135 135
 			/** @type EE_Registration_Processor $registration_processor */
136
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
136
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
137 137
 			/** @type EE_Transaction_Processor $transaction_processor */
138
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
138
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
139 139
 			/** @type EE_Transaction_Payments $transaction_payments */
140
-			$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
140
+			$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
141 141
 			// these reg statuses should not be considered in any calculations involving monies owing
142
-			$closed_reg_statuses = ! empty( $closed_reg_statuses )
142
+			$closed_reg_statuses = ! empty($closed_reg_statuses)
143 143
 				? $closed_reg_statuses
144 144
 				: EEM_Registration::closed_reg_statuses();
145 145
 			if (
146
-				in_array( $new_STS_ID, $closed_reg_statuses )
147
-				&& ! in_array( $old_STS_ID, $closed_reg_statuses )
146
+				in_array($new_STS_ID, $closed_reg_statuses)
147
+				&& ! in_array($old_STS_ID, $closed_reg_statuses)
148 148
 			) {
149 149
 				// cancelled or declined registration
150 150
 				$registration_processor->update_registration_after_being_canceled_or_declined(
@@ -157,24 +157,24 @@  discard block
 block discarded – undo
157 157
 					false
158 158
 				);
159 159
 			} else if (
160
-				in_array( $old_STS_ID, $closed_reg_statuses )
161
-				&& ! in_array( $new_STS_ID, $closed_reg_statuses )
160
+				in_array($old_STS_ID, $closed_reg_statuses)
161
+				&& ! in_array($new_STS_ID, $closed_reg_statuses)
162 162
 			) {
163 163
 				// reinstating cancelled or declined registration
164 164
 				$registration_processor->update_canceled_or_declined_registration_after_being_reinstated(
165 165
 					$this,
166 166
 					$closed_reg_statuses
167 167
 				);
168
-				$transaction_processor->update_transaction_after_reinstating_canceled_registration( $this );
168
+				$transaction_processor->update_transaction_after_reinstating_canceled_registration($this);
169 169
 			}
170
-			$transaction_payments->recalculate_transaction_total( $this->transaction(), false );
171
-			$this->transaction()->update_status_based_on_total_paid( true );
172
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
170
+			$transaction_payments->recalculate_transaction_total($this->transaction(), false);
171
+			$this->transaction()->update_status_based_on_total_paid(true);
172
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
173 173
 			return TRUE;
174 174
 		} else {
175 175
 			//even though the old value matches the new value, it's still good to
176 176
 			//allow the parent set method to have a say
177
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
177
+			parent::set('STS_ID', $new_STS_ID, $use_default);
178 178
 			return TRUE;
179 179
 		}
180 180
 	}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @access        public
187 187
 	 */
188 188
 	public function status_ID() {
189
-		return $this->get( 'STS_ID' );
189
+		return $this->get('STS_ID');
190 190
 	}
191 191
 
192 192
 
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
 	 * @param boolean $include_archived whether to include archived tickets or not.
212 212
 	 * @return EE_Ticket
213 213
 	 */
214
-	public function ticket( $include_archived = TRUE ) {
214
+	public function ticket($include_archived = TRUE) {
215 215
 		$query_params = array();
216
-		if ( $include_archived ) {
217
-			$query_params[ 'default_where_conditions' ] = 'none';
216
+		if ($include_archived) {
217
+			$query_params['default_where_conditions'] = 'none';
218 218
 		}
219
-		return $this->get_first_related( 'Ticket', $query_params );
219
+		return $this->get_first_related('Ticket', $query_params);
220 220
 	}
221 221
 
222 222
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function wp_user() {
246 246
 		$event = $this->event();
247
-		if ( $event instanceof EE_Event ) {
247
+		if ($event instanceof EE_Event) {
248 248
 			return $event->wp_user();
249 249
 		}
250 250
 		return 0;
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 * @access        public
271 271
 	 * @param        int $ATT_ID Attendee ID
272 272
 	 */
273
-	public function set_attendee_id( $ATT_ID = 0 ) {
274
-		$this->set( 'ATT_ID', $ATT_ID );
273
+	public function set_attendee_id($ATT_ID = 0) {
274
+		$this->set('ATT_ID', $ATT_ID);
275 275
 	}
276 276
 
277 277
 
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 	 * @access        public
283 283
 	 * @param        int $TXN_ID Transaction ID
284 284
 	 */
285
-	public function set_transaction_id( $TXN_ID = 0 ) {
286
-		$this->set( 'TXN_ID', $TXN_ID );
285
+	public function set_transaction_id($TXN_ID = 0) {
286
+		$this->set('TXN_ID', $TXN_ID);
287 287
 	}
288 288
 
289 289
 
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
 	 * @access    public
295 295
 	 * @param    string $REG_session PHP Session ID
296 296
 	 */
297
-	public function set_session( $REG_session = '' ) {
298
-		$this->set( 'REG_session', $REG_session );
297
+	public function set_session($REG_session = '') {
298
+		$this->set('REG_session', $REG_session);
299 299
 	}
300 300
 
301 301
 
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
 	 * @access    public
307 307
 	 * @param    string $REG_url_link Registration URL Link
308 308
 	 */
309
-	public function set_reg_url_link( $REG_url_link = '' ) {
310
-		$this->set( 'REG_url_link', $REG_url_link );
309
+	public function set_reg_url_link($REG_url_link = '') {
310
+		$this->set('REG_url_link', $REG_url_link);
311 311
 	}
312 312
 
313 313
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 	 * @access        public
319 319
 	 * @param        int $REG_count Primary Attendee
320 320
 	 */
321
-	public function set_count( $REG_count = 1 ) {
322
-		$this->set( 'REG_count', $REG_count );
321
+	public function set_count($REG_count = 1) {
322
+		$this->set('REG_count', $REG_count);
323 323
 	}
324 324
 
325 325
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	 * @access        public
331 331
 	 * @param        boolean $REG_group_size Group Registration
332 332
 	 */
333
-	public function set_group_size( $REG_group_size = FALSE ) {
334
-		$this->set( 'REG_group_size', $REG_group_size );
333
+	public function set_group_size($REG_group_size = FALSE) {
334
+		$this->set('REG_group_size', $REG_group_size);
335 335
 	}
336 336
 
337 337
 
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 	 * @access        public
415 415
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
416 416
 	 */
417
-	public function set_reg_date( $REG_date = FALSE ) {
418
-		$this->set( 'REG_date', $REG_date );
417
+	public function set_reg_date($REG_date = FALSE) {
418
+		$this->set('REG_date', $REG_date);
419 419
 	}
420 420
 
421 421
 
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 	 * @access    public
427 427
 	 * @param    float $REG_final_price
428 428
 	 */
429
-	public function set_final_price( $REG_final_price = 0.00 ) {
430
-		$this->set( 'REG_final_price', $REG_final_price );
429
+	public function set_final_price($REG_final_price = 0.00) {
430
+		$this->set('REG_final_price', $REG_final_price);
431 431
 	}
432 432
 
433 433
 
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 	 * @access    public
439 439
 	 * @param    float $REG_paid
440 440
 	 */
441
-	public function set_paid( $REG_paid = 0.00 ) {
442
-		$this->set( 'REG_paid', $REG_paid );
441
+	public function set_paid($REG_paid = 0.00) {
442
+		$this->set('REG_paid', $REG_paid);
443 443
 	}
444 444
 
445 445
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 	 * @access        public
451 451
 	 * @param        boolean $REG_att_is_going Attendee Is Going
452 452
 	 */
453
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
454
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
453
+	public function set_att_is_going($REG_att_is_going = FALSE) {
454
+		$this->set('REG_att_is_going', $REG_att_is_going);
455 455
 	}
456 456
 
457 457
 
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	 * @return EE_Attendee
462 462
 	 */
463 463
 	public function attendee() {
464
-		return $this->get_first_related( 'Attendee' );
464
+		return $this->get_first_related('Attendee');
465 465
 	}
466 466
 
467 467
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 * @access        public
472 472
 	 */
473 473
 	public function event_ID() {
474
-		return $this->get( 'EVT_ID' );
474
+		return $this->get('EVT_ID');
475 475
 	}
476 476
 
477 477
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	 */
483 483
 	public function event_name() {
484 484
 		$event = $this->event_obj();
485
-		if ( $event ) {
485
+		if ($event) {
486 486
 			return $event->name();
487 487
 		} else {
488 488
 			return NULL;
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 * @return EE_Event
497 497
 	 */
498 498
 	public function event_obj() {
499
-		return $this->get_first_related( 'Event' );
499
+		return $this->get_first_related('Event');
500 500
 	}
501 501
 
502 502
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	 * @access        public
507 507
 	 */
508 508
 	public function attendee_ID() {
509
-		return $this->get( 'ATT_ID' );
509
+		return $this->get('ATT_ID');
510 510
 	}
511 511
 
512 512
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	 * @access        public
517 517
 	 */
518 518
 	public function session_ID() {
519
-		return $this->get( 'REG_session' );
519
+		return $this->get('REG_session');
520 520
 	}
521 521
 
522 522
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
527 527
 	 * @return string
528 528
 	 */
529
-	public function receipt_url( $messenger = 'html' ) {
529
+	public function receipt_url($messenger = 'html') {
530 530
 
531 531
 		/**
532 532
 		 * The below will be deprecated one version after this.  We check first if there is a custom receipt template already in use on old system.  If there is then we just return the standard url for it.
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
 		 * @since 4.5.0
535 535
 		 */
536 536
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
537
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
537
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
538 538
 
539
-		if ( $has_custom ) {
540
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
539
+		if ($has_custom) {
540
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
541 541
 		}
542
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
542
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
543 543
 	}
544 544
 
545 545
 
@@ -550,28 +550,28 @@  discard block
 block discarded – undo
550 550
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
551 551
 	 * @return string
552 552
 	 */
553
-	public function invoice_url( $messenger = 'html' ) {
553
+	public function invoice_url($messenger = 'html') {
554 554
 		/**
555 555
 		 * The below will be deprecated one version after this.  We check first if there is a custom invoice template already in use on old system.  If there is then we just return the standard url for it.
556 556
 		 *
557 557
 		 * @since 4.5.0
558 558
 		 */
559 559
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
560
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
560
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
561 561
 
562
-		if ( $has_custom ) {
563
-			if ( $messenger == 'html' ) {
564
-				return $this->invoice_url( 'launch' );
562
+		if ($has_custom) {
563
+			if ($messenger == 'html') {
564
+				return $this->invoice_url('launch');
565 565
 			}
566 566
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
567 567
 
568
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
569
-			if ( $messenger == 'html' ) {
568
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
569
+			if ($messenger == 'html') {
570 570
 				$query_args['html'] = TRUE;
571 571
 			}
572
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
572
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
573 573
 		}
574
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
574
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
575 575
 	}
576 576
 
577 577
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 	 * @throws \EE_Error
585 585
 	 */
586 586
 	public function reg_url_link() {
587
-		return (string)$this->get( 'REG_url_link' );
587
+		return (string) $this->get('REG_url_link');
588 588
 	}
589 589
 
590 590
 
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
595 595
 	 * @return void
596 596
 	 */
597
-	public function e_invoice_url( $type = 'launch' ) {
598
-		echo $this->invoice_url( $type );
597
+	public function e_invoice_url($type = 'launch') {
598
+		echo $this->invoice_url($type);
599 599
 	}
600 600
 
601 601
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @return string
616 616
 	 */
617 617
 	public function payment_overview_url() {
618
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
618
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
619 619
 	}
620 620
 
621 621
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 	 * @return string
627 627
 	 */
628 628
 	public function edit_attendee_information_url() {
629
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
629
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
630 630
 	}
631 631
 
632 632
 
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 	 * @return string
637 637
 	 */
638 638
 	public function get_admin_edit_url() {
639
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
639
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
640 640
 	}
641 641
 
642 642
 
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 * @access        public
647 647
 	 */
648 648
 	public function is_primary_registrant() {
649
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
649
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
650 650
 	}
651 651
 
652 652
 
@@ -655,12 +655,12 @@  discard block
 block discarded – undo
655 655
 	 * This returns the primary registration object for this registration group (which may be this object).
656 656
 	 * @return EE_Registration
657 657
 	 */
658
-	public function get_primary_registration()  {
659
-		if ( $this->is_primary_registrant() )
658
+	public function get_primary_registration() {
659
+		if ($this->is_primary_registrant())
660 660
 			return $this;
661 661
 
662 662
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
663
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
663
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
664 664
 		return $primary_registrant;
665 665
 	}
666 666
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	* 		@access		public
672 672
 	*/
673 673
 	public function count() {
674
-		return $this->get( 'REG_count' );
674
+		return $this->get('REG_count');
675 675
 	}
676 676
 
677 677
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 * @access        public
682 682
 	 */
683 683
 	public function group_size() {
684
-		return $this->get( 'REG_group_size' );
684
+		return $this->get('REG_group_size');
685 685
 	}
686 686
 
687 687
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 * @access        public
692 692
 	 */
693 693
 	public function date() {
694
-		return $this->get( 'REG_date' );
694
+		return $this->get('REG_date');
695 695
 	}
696 696
 
697 697
 
@@ -702,8 +702,8 @@  discard block
 block discarded – undo
702 702
 	 * @param string $time_format
703 703
 	 * @return string
704 704
 	 */
705
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
706
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
705
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
706
+		return $this->get_datetime('REG_date', $date_format, $time_format);
707 707
 	}
708 708
 
709 709
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 	 * @return    float
717 717
 	 */
718 718
 	public function final_price() {
719
-		return $this->get( 'REG_final_price' );
719
+		return $this->get('REG_final_price');
720 720
 	}
721 721
 
722 722
 
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	 * @return string
728 728
 	 */
729 729
 	public function pretty_final_price() {
730
-		return $this->get_pretty( 'REG_final_price' );
730
+		return $this->get_pretty('REG_final_price');
731 731
 	}
732 732
 
733 733
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 	 * @return 	float
739 739
 	 */
740 740
 	public function paid() {
741
-		return $this->get( 'REG_paid' );
741
+		return $this->get('REG_paid');
742 742
 	}
743 743
 
744 744
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	 * @return 	float
750 750
 	 */
751 751
 	public function pretty_paid() {
752
-		return $this->get_pretty( 'REG_paid' );
752
+		return $this->get_pretty('REG_paid');
753 753
 	}
754 754
 
755 755
 
@@ -761,11 +761,11 @@  discard block
 block discarded – undo
761 761
 	 * @param array $requires_payment
762 762
 	 * @return bool
763 763
 	 */
764
-	public function owes_monies_and_can_pay( $requires_payment = array()) {
764
+	public function owes_monies_and_can_pay($requires_payment = array()) {
765 765
 		// these reg statuses require payment (if event is not free)
766
-		$requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
766
+		$requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
767 767
 		if (
768
-			in_array( $this->status_ID(), $requires_payment ) &&
768
+			in_array($this->status_ID(), $requires_payment) &&
769 769
 			$this->final_price() != 0 &&
770 770
 			$this->final_price() != $this->paid()
771 771
 		) {
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
 	 * @param bool $show_icons
783 783
 	 * @return void
784 784
 	 */
785
-	public function e_pretty_status( $show_icons = FALSE ) {
786
-		echo $this->pretty_status( $show_icons );
785
+	public function e_pretty_status($show_icons = FALSE) {
786
+		echo $this->pretty_status($show_icons);
787 787
 	}
788 788
 
789 789
 
@@ -794,10 +794,10 @@  discard block
 block discarded – undo
794 794
 	 * @param bool $show_icons
795 795
 	 * @return string
796 796
 	 */
797
-	public function pretty_status( $show_icons = FALSE ) {
798
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
797
+	public function pretty_status($show_icons = FALSE) {
798
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
799 799
 		$icon = '';
800
-		switch ( $this->status_ID() ) {
800
+		switch ($this->status_ID()) {
801 801
 			case EEM_Registration::status_id_approved:
802 802
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
803 803
 				break;
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 				$icon = $show_icons ? '<span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>' : '';
821 821
 				break;
822 822
 		}
823
-		return $icon . $status[ $this->status_ID() ];
823
+		return $icon.$status[$this->status_ID()];
824 824
 	}
825 825
 
826 826
 
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 	 * @access        public
831 831
 	 */
832 832
 	public function att_is_going() {
833
-		return $this->get( 'REG_att_is_going' );
833
+		return $this->get('REG_att_is_going');
834 834
 	}
835 835
 
836 836
 
@@ -840,8 +840,8 @@  discard block
 block discarded – undo
840 840
 	 * @param array $query_params like EEM_Base::get_all
841 841
 	 * @return EE_Answer[]
842 842
 	 */
843
-	public function answers( $query_params = NULL ) {
844
-		return $this->get_many_related( 'Answer', $query_params );
843
+	public function answers($query_params = NULL) {
844
+		return $this->get_many_related('Answer', $query_params);
845 845
 	}
846 846
 
847 847
 
@@ -855,9 +855,9 @@  discard block
 block discarded – undo
855 855
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
856 856
 	 * will convert it into some kind of string)
857 857
 	 */
858
-	public function answer_value_to_question( $question, $pretty_value=true ) {
858
+	public function answer_value_to_question($question, $pretty_value = true) {
859 859
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
860
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
860
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
861 861
 	}
862 862
 
863 863
 
@@ -870,13 +870,13 @@  discard block
 block discarded – undo
870 870
 	 */
871 871
 	public function question_groups() {
872 872
 		$question_groups = array();
873
-		if ( $this->event() instanceof EE_Event ) {
873
+		if ($this->event() instanceof EE_Event) {
874 874
 			$question_groups = $this->event()->question_groups(
875 875
 				array(
876 876
 					array(
877 877
 						'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false
878 878
 					),
879
-					'order_by' => array( 'QSG_order' => 'ASC' )
879
+					'order_by' => array('QSG_order' => 'ASC')
880 880
 				)
881 881
 			);
882 882
 		}
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 	 */
894 894
 	public function count_question_groups() {
895 895
 		$qg_count = 0;
896
-		if ( $this->event() instanceof EE_Event ) {
896
+		if ($this->event() instanceof EE_Event) {
897 897
 			$qg_count = $this->event()->count_related(
898 898
 				'Question_Group',
899 899
 				array(
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 	 * @return string
915 915
 	 */
916 916
 	public function reg_date() {
917
-		return $this->get_datetime( 'REG_date' );
917
+		return $this->get_datetime('REG_date');
918 918
 	}
919 919
 
920 920
 
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 	 * @return EE_Datetime_Ticket
927 927
 	 */
928 928
 	public function datetime_ticket() {
929
-		return $this->get_first_related( 'Datetime_Ticket' );
929
+		return $this->get_first_related('Datetime_Ticket');
930 930
 	}
931 931
 
932 932
 
@@ -936,15 +936,15 @@  discard block
 block discarded – undo
936 936
 	 * @param EE_Datetime_Ticket $datetime_ticket
937 937
 	 * @return EE_Datetime_Ticket
938 938
 	 */
939
-	public function set_datetime_ticket( $datetime_ticket ) {
940
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
939
+	public function set_datetime_ticket($datetime_ticket) {
940
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
941 941
 	}
942 942
 	/**
943 943
 	 * Gets deleted
944 944
 	 * @return boolean
945 945
 	 */
946 946
 	public function deleted() {
947
-		return $this->get( 'REG_deleted' );
947
+		return $this->get('REG_deleted');
948 948
 	}
949 949
 
950 950
 	/**
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 	 * @return boolean
954 954
 	 */
955 955
 	public function set_deleted($deleted) {
956
-		$this->set( 'REG_deleted', $deleted );
956
+		$this->set('REG_deleted', $deleted);
957 957
 	}
958 958
 
959 959
 
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 	 * @return EE_Status
964 964
 	 */
965 965
 	public function status_obj() {
966
-		return $this->get_first_related( 'Status' );
966
+		return $this->get_first_related('Status');
967 967
 	}
968 968
 
969 969
 
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 	 * @return int
975 975
 	 */
976 976
 	public function count_checkins() {
977
-		return $this->get_model()->count_related( $this, 'Checkin' );
977
+		return $this->get_model()->count_related($this, 'Checkin');
978 978
 	}
979 979
 
980 980
 
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 	 * @return int
985 985
 	 */
986 986
 	public function count_checkins_not_checkedout() {
987
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
987
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
988 988
 	}
989 989
 
990 990
 
@@ -997,20 +997,20 @@  discard block
 block discarded – undo
997 997
 	 *
998 998
 	 * @return bool
999 999
 	 */
1000
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
1001
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
1000
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
1001
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
1002 1002
 
1003 1003
 		//first check registration status
1004
-		if (  ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) {
1004
+		if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) {
1005 1005
 			return false;
1006 1006
 		}
1007 1007
 		//is there a datetime ticket that matches this dtt_ID?
1008
-		if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) {
1008
+		if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) {
1009 1009
 			return false;
1010 1010
 		}
1011 1011
 
1012 1012
 		//final check is against TKT_uses
1013
-		return $this->verify_can_checkin_against_TKT_uses( $DTT_ID );
1013
+		return $this->verify_can_checkin_against_TKT_uses($DTT_ID);
1014 1014
 	}
1015 1015
 
1016 1016
 
@@ -1023,10 +1023,10 @@  discard block
 block discarded – undo
1023 1023
 	 * @param int | EE_Datetime  $DTT_OR_ID  The datetime the registration is being checked against
1024 1024
 	 * @return bool   true means can checkin.  false means cannot checkin.
1025 1025
 	 */
1026
-	public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) {
1027
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
1026
+	public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) {
1027
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
1028 1028
 
1029
-		if ( ! $DTT_ID ) {
1029
+		if ( ! $DTT_ID) {
1030 1030
 			return false;
1031 1031
 		}
1032 1032
 
@@ -1034,23 +1034,23 @@  discard block
 block discarded – undo
1034 1034
 
1035 1035
 		// if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in
1036 1036
 		// or not.
1037
-		if ( ! $max_uses || $max_uses === EE_INF ) {
1037
+		if ( ! $max_uses || $max_uses === EE_INF) {
1038 1038
 			return true;
1039 1039
 		}
1040 1040
 
1041 1041
 		//does this datetime have a checkin record?  If so, then the dtt count has already been verified so we can just
1042 1042
 		//go ahead and toggle.
1043
-		if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) {
1043
+		if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) {
1044 1044
 			return true;
1045 1045
 		}
1046 1046
 
1047 1047
 		//made it here so the last check is whether the number of checkins per unique datetime on this registration
1048 1048
 		//disallows further check-ins.
1049
-		$count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true );
1049
+		$count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true);
1050 1050
 		// checkins have already reached their max number of uses
1051 1051
 		// so registrant can NOT checkin
1052
-		if ( $count_unique_dtt_checkins >= $max_uses ) {
1053
-			EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1052
+		if ($count_unique_dtt_checkins >= $max_uses) {
1053
+			EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1054 1054
 			return false;
1055 1055
 		}
1056 1056
 		return true;
@@ -1071,15 +1071,15 @@  discard block
 block discarded – undo
1071 1071
 	 * @param  bool $verify  If true then can_checkin() is used to verify whether the person can be checked in or not.  Otherwise this forces change in checkin status.
1072 1072
 	 * @return int|BOOL            the chk_in status toggled to OR false if nothing got changed.
1073 1073
 	 */
1074
-	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1075
-		if ( empty( $DTT_ID ) ) {
1074
+	public function toggle_checkin_status($DTT_ID = null, $verify = false) {
1075
+		if (empty($DTT_ID)) {
1076 1076
 			$datetime = $this->get_related_primary_datetime();
1077 1077
 			$DTT_ID = $datetime->ID();
1078 1078
 		// verify the registration can checkin for the given DTT_ID
1079
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
1079
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
1080 1080
 			EE_Error::add_error(
1081 1081
 					sprintf(
1082
-						__( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1082
+						__('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1083 1083
 						$this->ID(),
1084 1084
 						$DTT_ID
1085 1085
 					),
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
 			EE_Registration::checkin_status_out => EE_Registration::checkin_status_in
1094 1094
 		);
1095 1095
 		//start by getting the current status so we know what status we'll be changing to.
1096
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
1097
-		$status_to = $status_paths[ $cur_status ];
1096
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
1097
+		$status_to = $status_paths[$cur_status];
1098 1098
 		// database only records true for checked IN or false for checked OUT
1099 1099
 		// no record ( null ) means checked in NEVER, but we obviously don't save that
1100 1100
 		$new_status = $status_to == EE_Registration::checkin_status_in ? true : false;
@@ -1102,24 +1102,24 @@  discard block
 block discarded – undo
1102 1102
 		// because we are keeping track of Check-ins over time.
1103 1103
 		// Eventually we'll probably want to show a list table
1104 1104
 		// for the individual Check-ins so that they can be managed.
1105
-		$checkin = EE_Checkin::new_instance( array(
1105
+		$checkin = EE_Checkin::new_instance(array(
1106 1106
 				'REG_ID' => $this->ID(),
1107 1107
 				'DTT_ID' => $DTT_ID,
1108 1108
 				'CHK_in' => $new_status
1109
-		) );
1109
+		));
1110 1110
 		// if the record could not be saved then return false
1111
-		if ( $checkin->save() === 0 ) {
1112
-			if ( WP_DEBUG ) {
1111
+		if ($checkin->save() === 0) {
1112
+			if (WP_DEBUG) {
1113 1113
 				global $wpdb;
1114 1114
 				$error = sprintf(
1115
-					__( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ),
1115
+					__('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'),
1116 1116
 					'<br />',
1117 1117
 					$wpdb->last_error
1118 1118
 				);
1119 1119
 			} else {
1120
-				$error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' );
1120
+				$error = __('Registration check in update failed because of an unknown database error', 'event_espresso');
1121 1121
 			}
1122
-			EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
1122
+			EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
1123 1123
 			return false;
1124 1124
 		}
1125 1125
 		return $status_to;
@@ -1143,19 +1143,19 @@  discard block
 block discarded – undo
1143 1143
 	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1144 1144
 	 * @return int            Integer representing Check-in status.
1145 1145
 	 */
1146
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) {
1147
-		if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) {
1146
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) {
1147
+		if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) {
1148 1148
 			$datetime = $this->get_related_primary_datetime();
1149
-			if ( ! $datetime instanceof EE_Datetime ) {
1149
+			if ( ! $datetime instanceof EE_Datetime) {
1150 1150
 				return 0;
1151 1151
 			}
1152 1152
 			$DTT_ID = $datetime->ID();
1153 1153
 		//verify the registration can checkin for the given DTT_ID
1154 1154
 		}
1155 1155
 		//get checkin object (if exists)
1156
-		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) );
1157
-		if ( $checkin instanceof EE_Checkin ) {
1158
-			if ( $checkin->get( 'CHK_in' ) ) {
1156
+		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC')));
1157
+		if ($checkin instanceof EE_Checkin) {
1158
+			if ($checkin->get('CHK_in')) {
1159 1159
 				return EE_Registration::checkin_status_in; //checked in
1160 1160
 			} else {
1161 1161
 				return EE_Registration::checkin_status_out; //had checked in but is now checked out.
@@ -1173,28 +1173,28 @@  discard block
 block discarded – undo
1173 1173
 	 * @param bool $error  This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name.
1174 1174
 	 * @return string         internationalized message
1175 1175
 	 */
1176
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
1176
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
1177 1177
 		//let's get the attendee first so we can include the name of the attendee
1178
-		$attendee = $this->get_first_related( 'Attendee' );
1179
-		if ( $attendee instanceof EE_Attendee ) {
1180
-			if ( $error ) {
1181
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
1178
+		$attendee = $this->get_first_related('Attendee');
1179
+		if ($attendee instanceof EE_Attendee) {
1180
+			if ($error) {
1181
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
1182 1182
 			}
1183
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
1183
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
1184 1184
 			//what is the status message going to be?
1185
-			switch ( $cur_status ) {
1185
+			switch ($cur_status) {
1186 1186
 				case EE_Registration::checkin_status_never :
1187
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
1187
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
1188 1188
 					break;
1189 1189
 				case EE_Registration::checkin_status_in :
1190
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
1190
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
1191 1191
 					break;
1192 1192
 				case EE_Registration::checkin_status_out :
1193
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
1193
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
1194 1194
 					break;
1195 1195
 			}
1196 1196
 		}
1197
-		return __( "The check-in status could not be determined.", "event_espresso" );
1197
+		return __("The check-in status could not be determined.", "event_espresso");
1198 1198
 	}
1199 1199
 
1200 1200
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 	 * @access        public
1220 1220
 	 */
1221 1221
 	public function reg_code() {
1222
-		return $this->get( 'REG_code' );
1222
+		return $this->get('REG_code');
1223 1223
 	}
1224 1224
 
1225 1225
 
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 	 * @access        public
1230 1230
 	 */
1231 1231
 	public function transaction_ID() {
1232
-		return $this->get( 'TXN_ID' );
1232
+		return $this->get('TXN_ID');
1233 1233
 	}
1234 1234
 
1235 1235
 
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 	 * @return int
1239 1239
 	 */
1240 1240
 	public function ticket_ID() {
1241
-		return $this->get( 'TKT_ID' );
1241
+		return $this->get('TKT_ID');
1242 1242
 	}
1243 1243
 
1244 1244
 
@@ -1250,17 +1250,17 @@  discard block
 block discarded – undo
1250 1250
 	 * @param    string $REG_code Registration Code
1251 1251
 	 * @param	boolean $use_default
1252 1252
 	 */
1253
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1254
-		if ( empty( $REG_code )) {
1255
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1253
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1254
+		if (empty($REG_code)) {
1255
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1256 1256
 			return;
1257 1257
 		}
1258
-		if ( ! $this->reg_code() ) {
1259
-			parent::set( 'REG_code', $REG_code, $use_default );
1258
+		if ( ! $this->reg_code()) {
1259
+			parent::set('REG_code', $REG_code, $use_default);
1260 1260
 		} else {
1261 1261
 			EE_Error::doing_it_wrong(
1262
-				__CLASS__ . '::' . __FUNCTION__,
1263
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1262
+				__CLASS__.'::'.__FUNCTION__,
1263
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1264 1264
 				'4.6.0'
1265 1265
 			);
1266 1266
 		}
@@ -1280,17 +1280,17 @@  discard block
 block discarded – undo
1280 1280
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1281 1281
 	 */
1282 1282
 	public function get_all_other_registrations_in_group() {
1283
-		if ( $this->group_size() < 2 ) {
1283
+		if ($this->group_size() < 2) {
1284 1284
 			return array();
1285 1285
 		}
1286 1286
 
1287 1287
 		$query[0] = array(
1288 1288
 			'TXN_ID' => $this->transaction_ID(),
1289
-			'REG_ID' => array( '!=', $this->ID() ),
1289
+			'REG_ID' => array('!=', $this->ID()),
1290 1290
 			'TKT_ID' => $this->ticket_ID()
1291 1291
 			);
1292 1292
 
1293
-		$registrations = $this->get_model()->get_all( $query );
1293
+		$registrations = $this->get_model()->get_all($query);
1294 1294
 		return $registrations;
1295 1295
 	}
1296 1296
 
@@ -1299,14 +1299,14 @@  discard block
 block discarded – undo
1299 1299
 	 * @return string
1300 1300
 	 */
1301 1301
 	public function get_admin_details_link() {
1302
-		EE_Registry::instance()->load_helper( 'URL' );
1302
+		EE_Registry::instance()->load_helper('URL');
1303 1303
 		return EEH_URL::add_query_args_and_nonce(
1304 1304
 			array(
1305 1305
 				'page' => 'espresso_registrations',
1306 1306
 				'action' => 'view_registration',
1307 1307
 				'_REG_ID' => $this->ID()
1308 1308
 			),
1309
-			admin_url( 'admin.php' )
1309
+			admin_url('admin.php')
1310 1310
 		);
1311 1311
 	}
1312 1312
 
@@ -1331,12 +1331,12 @@  discard block
 block discarded – undo
1331 1331
 	 * @return string
1332 1332
 	 */
1333 1333
 	public function get_admin_overview_link() {
1334
-		EE_Registry::instance()->load_helper( 'URL' );
1334
+		EE_Registry::instance()->load_helper('URL');
1335 1335
 		return EEH_URL::add_query_args_and_nonce(
1336 1336
 			array(
1337 1337
 				'page' => 'espresso_registrations'
1338 1338
 			),
1339
-			admin_url( 'admin.php' )
1339
+			admin_url('admin.php')
1340 1340
 		);
1341 1341
 	}
1342 1342
 
@@ -1347,8 +1347,8 @@  discard block
 block discarded – undo
1347 1347
 	 * @return \EE_Registration[]
1348 1348
 	 * @throws \EE_Error
1349 1349
 	 */
1350
-	public function payments( $query_params = array() ) {
1351
-		return $this->get_many_related( 'Payment', $query_params );
1350
+	public function payments($query_params = array()) {
1351
+		return $this->get_many_related('Payment', $query_params);
1352 1352
 	}
1353 1353
 
1354 1354
 
@@ -1358,8 +1358,8 @@  discard block
 block discarded – undo
1358 1358
 	 * @return \EE_Registration_Payment[]
1359 1359
 	 * @throws \EE_Error
1360 1360
 	 */
1361
-	public function registration_payments( $query_params = array() ) {
1362
-		return $this->get_many_related( 'Registration_Payment', $query_params );
1361
+	public function registration_payments($query_params = array()) {
1362
+		return $this->get_many_related('Registration_Payment', $query_params);
1363 1363
 	}
1364 1364
 
1365 1365
 
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
 	 * @return EE_Payment_Method|null
1373 1373
 	 */
1374 1374
 	public function payment_method() {
1375
-		return EEM_Payment_Method::instance()->get_last_used_for_registration( $this );
1375
+		return EEM_Payment_Method::instance()->get_last_used_for_registration($this);
1376 1376
 	}
1377 1377
 
1378 1378
 
Please login to merge, or discard this patch.
core/db_classes/EE_Transaction.class.php 1 patch
Spacing   +157 added lines, -157 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_Transaction class
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 	 * @return EE_Transaction
35 35
 	 * @throws \EE_Error
36 36
 	 */
37
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
38
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
37
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
38
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
39 39
 		$txn = $has_object
40 40
 			? $has_object
41
-			: new self( $props_n_values, false, $timezone, $date_formats );
42
-		if ( ! $has_object ) {
43
-			$txn->set_old_txn_status( $txn->status_ID() );
41
+			: new self($props_n_values, false, $timezone, $date_formats);
42
+		if ( ! $has_object) {
43
+			$txn->set_old_txn_status($txn->status_ID());
44 44
 		}
45 45
 		return $txn;
46 46
 	}
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 * @return EE_Transaction
55 55
 	 * @throws \EE_Error
56 56
 	 */
57
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
58
-		$txn = new self( $props_n_values, TRUE, $timezone );
59
-		$txn->set_old_txn_status( $txn->status_ID() );
57
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
58
+		$txn = new self($props_n_values, TRUE, $timezone);
59
+		$txn->set_old_txn_status($txn->status_ID());
60 60
 		return $txn;
61 61
 	}
62 62
 
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function lock() {
75 75
 		// attempt to set lock, but if that fails...
76
-		if ( ! $this->add_extra_meta( 'lock', time(), true )  ) {
76
+		if ( ! $this->add_extra_meta('lock', time(), true)) {
77 77
 			// then attempt to remove the lock in case it is expired
78
-			if ( $this->_remove_expired_lock() ) {
78
+			if ($this->_remove_expired_lock()) {
79 79
 				// if removal was successful, then try setting lock again
80 80
 				$this->lock();
81 81
 			} else {
82 82
 				// but if the lock can not be removed, then throw an exception
83 83
 				throw new EE_Error(
84 84
 					sprintf(
85
-						__( 'Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso' ),
85
+						__('Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso'),
86 86
 						$this->ID()
87 87
 					)
88 88
 				);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @throws \EE_Error
102 102
 	 */
103 103
 	public function unlock() {
104
-		return $this->delete_extra_meta( 'lock' );
104
+		return $this->delete_extra_meta('lock');
105 105
 	}
106 106
 
107 107
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function is_locked() {
124 124
 		// if TXN is not locked, then return false immediately
125
-		if ( ! $this->_get_lock() ) {
125
+		if ( ! $this->_get_lock()) {
126 126
 			return false;
127 127
 		}
128 128
 		// if not, then let's try and remove the lock in case it's expired...
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @throws \EE_Error
144 144
 	 */
145 145
 	protected function _get_lock() {
146
-		return (int)$this->get_extra_meta( 'lock', true, 0 );
146
+		return (int) $this->get_extra_meta('lock', true, 0);
147 147
 	}
148 148
 
149 149
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	protected function _remove_expired_lock() {
160 160
 		$locked = $this->_get_lock();
161
-		if ( $locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked ) {
161
+		if ($locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked) {
162 162
 			return $this->unlock();
163 163
 		}
164 164
 		return 0;
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param        float $total total value of transaction
174 174
 	 * @throws \EE_Error
175 175
 	 */
176
-	public function set_total( $total = 0.00 ) {
177
-		$this->set( 'TXN_total', (float)$total );
176
+	public function set_total($total = 0.00) {
177
+		$this->set('TXN_total', (float) $total);
178 178
 	}
179 179
 
180 180
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 * @param        float $total_paid total amount paid to date (sum of all payments)
187 187
 	 * @throws \EE_Error
188 188
 	 */
189
-	public function set_paid( $total_paid = 0.00 ) {
190
-		$this->set( 'TXN_paid', (float)$total_paid );
189
+	public function set_paid($total_paid = 0.00) {
190
+		$this->set('TXN_paid', (float) $total_paid);
191 191
 	}
192 192
 
193 193
 
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
 	 * @param        string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set
200 200
 	 * @throws \EE_Error
201 201
 	 */
202
-	public function set_status( $status = '' ) {
203
-		$this->set( 'STS_ID', $status );
202
+	public function set_status($status = '') {
203
+		$this->set('STS_ID', $status);
204 204
 	}
205 205
 
206 206
 
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 	 * @param        string $hash_salt required for some payment gateways
213 213
 	 * @throws \EE_Error
214 214
 	 */
215
-	public function set_hash_salt( $hash_salt = '' ) {
216
-		$this->set( 'TXN_hash_salt', $hash_salt );
215
+	public function set_hash_salt($hash_salt = '') {
216
+		$this->set('TXN_hash_salt', $hash_salt);
217 217
 	}
218 218
 
219 219
 
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 	 * @param array $txn_reg_steps
225 225
 	 * @throws \EE_Error
226 226
 	 */
227
-	public function set_reg_steps( array $txn_reg_steps ) {
228
-		$this->set( 'TXN_reg_steps', $txn_reg_steps );
227
+	public function set_reg_steps(array $txn_reg_steps) {
228
+		$this->set('TXN_reg_steps', $txn_reg_steps);
229 229
 	}
230 230
 
231 231
 
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 * @throws \EE_Error
238 238
 	 */
239 239
 	public function reg_steps() {
240
-		$TXN_reg_steps = $this->get( 'TXN_reg_steps' );
241
-		return is_array( $TXN_reg_steps ) ? (array)$TXN_reg_steps : array();
240
+		$TXN_reg_steps = $this->get('TXN_reg_steps');
241
+		return is_array($TXN_reg_steps) ? (array) $TXN_reg_steps : array();
242 242
 	}
243 243
 
244 244
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 * @throws \EE_Error
249 249
 	 */
250 250
 	public function pretty_total() {
251
-		return $this->get_pretty( 'TXN_total' );
251
+		return $this->get_pretty('TXN_total');
252 252
 	}
253 253
 
254 254
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @throws \EE_Error
261 261
 	 */
262 262
 	public function pretty_paid() {
263
-		return $this->get_pretty( 'TXN_paid' );
263
+		return $this->get_pretty('TXN_paid');
264 264
 	}
265 265
 
266 266
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @throws \EE_Error
274 274
 	 */
275 275
 	public function remaining() {
276
-		return (float)( $this->total() - $this->paid() );
276
+		return (float) ($this->total() - $this->paid());
277 277
 	}
278 278
 
279 279
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 * @throws \EE_Error
287 287
 	 */
288 288
 	public function total() {
289
-		return (float)$this->get( 'TXN_total' );
289
+		return (float) $this->get('TXN_total');
290 290
 	}
291 291
 
292 292
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @throws \EE_Error
300 300
 	 */
301 301
 	public function paid() {
302
-		return (float)$this->get( 'TXN_paid' );
302
+		return (float) $this->get('TXN_paid');
303 303
 	}
304 304
 
305 305
 
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 	 * @throws \EE_Error
312 312
 	 */
313 313
 	public function get_cart_session() {
314
-		$session_data = (array)$this->get( 'TXN_session_data' );
315
-		return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart
316
-			? $session_data[ 'cart' ]
314
+		$session_data = (array) $this->get('TXN_session_data');
315
+		return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart
316
+			? $session_data['cart']
317 317
 			: null;
318 318
 	}
319 319
 
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 	 * @throws \EE_Error
327 327
 	 */
328 328
 	public function session_data() {
329
-		$session_data = $this->get( 'TXN_session_data' );
330
-		if ( empty( $session_data ) ) {
329
+		$session_data = $this->get('TXN_session_data');
330
+		if (empty($session_data)) {
331 331
 			$session_data = array(
332 332
 				'id'            => null,
333 333
 				'user_id'       => null,
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 	 * @param        EE_Session|array $session_data
351 351
 	 * @throws \EE_Error
352 352
 	 */
353
-	public function set_txn_session_data( $session_data ) {
354
-		if ( $session_data instanceof EE_Session ) {
355
-			$this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE ));
353
+	public function set_txn_session_data($session_data) {
354
+		if ($session_data instanceof EE_Session) {
355
+			$this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE));
356 356
 		} else {
357
-			$this->set( 'TXN_session_data', $session_data );
357
+			$this->set('TXN_session_data', $session_data);
358 358
 		}
359 359
 	}
360 360
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	 * @throws \EE_Error
368 368
 	 */
369 369
 	public function hash_salt_() {
370
-		return $this->get( 'TXN_hash_salt' );
370
+		return $this->get('TXN_hash_salt');
371 371
 	}
372 372
 
373 373
 
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 	 * @return    string | int
388 388
 	 * @throws \EE_Error
389 389
 	 */
390
-	public function datetime( $format = FALSE, $gmt = FALSE ) {
391
-		if ( $format ) {
392
-			return $this->get_pretty( 'TXN_timestamp' );
393
-		} else if ( $gmt ) {
394
-			return $this->get_raw( 'TXN_timestamp' );
390
+	public function datetime($format = FALSE, $gmt = FALSE) {
391
+		if ($format) {
392
+			return $this->get_pretty('TXN_timestamp');
393
+		} else if ($gmt) {
394
+			return $this->get_raw('TXN_timestamp');
395 395
 		} else {
396
-			return $this->get( 'TXN_timestamp' );
396
+			return $this->get('TXN_timestamp');
397 397
 		}
398 398
 	}
399 399
 
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 	 * @return EE_Registration[]
408 408
 	 * @throws \EE_Error
409 409
 	 */
410
-	public function registrations( $query_params = array(), $get_cached = FALSE ) {
411
-		$query_params = ( empty( $query_params ) || ! is_array( $query_params ) )
410
+	public function registrations($query_params = array(), $get_cached = FALSE) {
411
+		$query_params = (empty($query_params) || ! is_array($query_params))
412 412
 			? array(
413 413
 				'order_by' => array(
414 414
 					'Event.EVT_name' => 'ASC',
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 			)
419 419
 			: $query_params;
420 420
 		$query_params = $get_cached ? array() : $query_params;
421
-		return $this->get_many_related( 'Registration', $query_params );
421
+		return $this->get_many_related('Registration', $query_params);
422 422
 	}
423 423
 
424 424
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * @throws \EE_Error
432 432
 	 */
433 433
 	public function attendees() {
434
-		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
434
+		return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID())));
435 435
 	}
436 436
 
437 437
 
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 	 * @return EE_Payment[]
444 444
 	 * @throws \EE_Error
445 445
 	 */
446
-	public function payments( $query_params = array() ) {
447
-		return $this->get_many_related( 'Payment', $query_params );
446
+	public function payments($query_params = array()) {
447
+		return $this->get_many_related('Payment', $query_params);
448 448
 	}
449 449
 
450 450
 
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
 	 * @throws \EE_Error
457 457
 	 */
458 458
 	public function approved_payments() {
459
-		EE_Registry::instance()->load_model( 'Payment' );
460
-		return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) );
459
+		EE_Registry::instance()->load_model('Payment');
460
+		return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC')));
461 461
 	}
462 462
 
463 463
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 	 * @return string
470 470
 	 * @throws \EE_Error
471 471
 	 */
472
-	public function e_pretty_status( $show_icons = FALSE ) {
473
-		echo $this->pretty_status( $show_icons );
472
+	public function e_pretty_status($show_icons = FALSE) {
473
+		echo $this->pretty_status($show_icons);
474 474
 	}
475 475
 
476 476
 
@@ -482,10 +482,10 @@  discard block
 block discarded – undo
482 482
 	 * @return string
483 483
 	 * @throws \EE_Error
484 484
 	 */
485
-	public function pretty_status( $show_icons = FALSE ) {
486
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
485
+	public function pretty_status($show_icons = FALSE) {
486
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
487 487
 		$icon = '';
488
-		switch ( $this->status_ID() ) {
488
+		switch ($this->status_ID()) {
489 489
 			case EEM_Transaction::complete_status_code:
490 490
 				$icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : '';
491 491
 				break;
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 				$icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : '';
503 503
 				break;
504 504
 		}
505
-		return $icon . $status[ $this->status_ID() ];
505
+		return $icon.$status[$this->status_ID()];
506 506
 	}
507 507
 
508 508
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 	 * @throws \EE_Error
515 515
 	 */
516 516
 	public function status_ID() {
517
-		return $this->get( 'STS_ID' );
517
+		return $this->get('STS_ID');
518 518
 	}
519 519
 
520 520
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 * @throws \EE_Error
527 527
 	 */
528 528
 	public function is_free() {
529
-		return EEH_Money::compare_floats( $this->get( 'TXN_total' ), 0, '==' );
529
+		return EEH_Money::compare_floats($this->get('TXN_total'), 0, '==');
530 530
 	}
531 531
 
532 532
 
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
 	 * @return string
607 607
 	 * @throws \EE_Error
608 608
 	 */
609
-	public function invoice_url( $type = 'html' ) {
609
+	public function invoice_url($type = 'html') {
610 610
 		$REG = $this->primary_registration();
611
-		if ( ! $REG instanceof EE_Registration ) {
611
+		if ( ! $REG instanceof EE_Registration) {
612 612
 			return '';
613 613
 		}
614
-		return $REG->invoice_url( $type );
614
+		return $REG->invoice_url($type);
615 615
 	}
616 616
 
617 617
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	 * @throws \EE_Error
624 624
 	 */
625 625
 	public function primary_registration() {
626
-		return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) );
626
+		return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
627 627
 	}
628 628
 
629 629
 
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
 	 * @return string
636 636
 	 * @throws \EE_Error
637 637
 	 */
638
-	public function receipt_url( $type = 'html' ) {
638
+	public function receipt_url($type = 'html') {
639 639
 		$REG = $this->primary_registration();
640
-		if ( ! $REG instanceof EE_Registration ) {
640
+		if ( ! $REG instanceof EE_Registration) {
641 641
 			return '';
642 642
 		}
643
-		return $REG->receipt_url( $type );
643
+		return $REG->receipt_url($type);
644 644
 	}
645 645
 
646 646
 
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 	 * @throws \EE_Error
666 666
 	 */
667 667
 	public function gateway_response_on_transaction() {
668
-		$payment = $this->get_first_related( 'Payment' );
668
+		$payment = $this->get_first_related('Payment');
669 669
 		return $payment instanceof EE_Payment ? $payment->gateway_response() : '';
670 670
 	}
671 671
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 	 * @throws \EE_Error
679 679
 	 */
680 680
 	public function status_obj() {
681
-		return $this->get_first_related( 'Status' );
681
+		return $this->get_first_related('Status');
682 682
 	}
683 683
 
684 684
 
@@ -690,8 +690,8 @@  discard block
 block discarded – undo
690 690
 	 * @return EE_Extra_Meta
691 691
 	 * @throws \EE_Error
692 692
 	 */
693
-	public function extra_meta( $query_params = array() ) {
694
-		return $this->get_many_related( 'Extra_Meta', $query_params );
693
+	public function extra_meta($query_params = array()) {
694
+		return $this->get_many_related('Extra_Meta', $query_params);
695 695
 	}
696 696
 
697 697
 
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
 	 * @return EE_Base_Class the relation was added to
704 704
 	 * @throws \EE_Error
705 705
 	 */
706
-	public function add_registration( EE_Registration $registration ) {
707
-		return $this->_add_relation_to( $registration, 'Registration' );
706
+	public function add_registration(EE_Registration $registration) {
707
+		return $this->_add_relation_to($registration, 'Registration');
708 708
 	}
709 709
 
710 710
 
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
 	 * @return EE_Base_Class that was removed from being related
718 718
 	 * @throws \EE_Error
719 719
 	 */
720
-	public function remove_registration_with_id( $registration_or_id ) {
721
-		return $this->_remove_relation_to( $registration_or_id, 'Registration' );
720
+	public function remove_registration_with_id($registration_or_id) {
721
+		return $this->_remove_relation_to($registration_or_id, 'Registration');
722 722
 	}
723 723
 
724 724
 
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	 * @throws \EE_Error
731 731
 	 */
732 732
 	public function items_purchased() {
733
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) );
733
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item)));
734 734
 	}
735 735
 
736 736
 
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
 	 * @return EE_Base_Class the relation was added to
743 743
 	 * @throws \EE_Error
744 744
 	 */
745
-	public function add_line_item( EE_Line_Item $line_item ) {
746
-		return $this->_add_relation_to( $line_item, 'Line_Item' );
745
+	public function add_line_item(EE_Line_Item $line_item) {
746
+		return $this->_add_relation_to($line_item, 'Line_Item');
747 747
 	}
748 748
 
749 749
 
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
 	 * @return EE_Line_Item[]
756 756
 	 * @throws \EE_Error
757 757
 	 */
758
-	public function line_items( $query_params = array() ) {
759
-		return $this->get_many_related( 'Line_Item', $query_params );
758
+	public function line_items($query_params = array()) {
759
+		return $this->get_many_related('Line_Item', $query_params);
760 760
 	}
761 761
 
762 762
 
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 	 * @throws \EE_Error
769 769
 	 */
770 770
 	public function tax_items() {
771
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) );
771
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax)));
772 772
 	}
773 773
 
774 774
 
@@ -781,10 +781,10 @@  discard block
 block discarded – undo
781 781
 	 * @return \EE_Line_Item
782 782
 	 * @throws \EE_Error
783 783
 	 */
784
-	public function total_line_item( $create_if_not_found = true ) {
785
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) );
786
-		if( ! $item && $create_if_not_found ){
787
-			$item = EEH_Line_Item::create_total_line_item( $this );
784
+	public function total_line_item($create_if_not_found = true) {
785
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total)));
786
+		if ( ! $item && $create_if_not_found) {
787
+			$item = EEH_Line_Item::create_total_line_item($this);
788 788
 		}
789 789
 		return $item;
790 790
 	}
@@ -800,10 +800,10 @@  discard block
 block discarded – undo
800 800
 	 */
801 801
 	public function tax_total() {
802 802
 		$tax_line_item = $this->tax_total_line_item();
803
-		if ( $tax_line_item ) {
804
-			return (float)$tax_line_item->total();
803
+		if ($tax_line_item) {
804
+			return (float) $tax_line_item->total();
805 805
 		} else {
806
-			return (float)0;
806
+			return (float) 0;
807 807
 		}
808 808
 	}
809 809
 
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 	 * @throws \EE_Error
817 817
 	 */
818 818
 	public function tax_total_line_item() {
819
-		return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() );
819
+		return EEH_Line_Item::get_taxes_subtotal($this->total_line_item());
820 820
 	}
821 821
 
822 822
 
@@ -827,20 +827,20 @@  discard block
 block discarded – undo
827 827
 	 * @return EE_Form_Section_Proper
828 828
 	 * @throws \EE_Error
829 829
 	 */
830
-	public function billing_info(){
830
+	public function billing_info() {
831 831
 		$payment_method = $this->payment_method();
832
-		if ( !$payment_method){
832
+		if ( ! $payment_method) {
833 833
 			EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
834 834
 			return false;
835 835
 		}
836 836
 		$primary_reg = $this->primary_registration();
837
-		if ( ! $primary_reg ) {
838
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
837
+		if ( ! $primary_reg) {
838
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
839 839
 			return FALSE;
840 840
 		}
841 841
 		$attendee = $primary_reg->attendee();
842
-		if ( ! $attendee ) {
843
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
842
+		if ( ! $attendee) {
843
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
844 844
 			return FALSE;
845 845
 		}
846 846
 		return $attendee->billing_info_for_payment_method($payment_method);
@@ -881,15 +881,15 @@  discard block
 block discarded – undo
881 881
 	 * @return EE_Payment_Method
882 882
 	 * @throws \EE_Error
883 883
 	 */
884
-	public function payment_method(){
884
+	public function payment_method() {
885 885
 		$pm = $this->get_first_related('Payment_Method');
886
-		if( $pm instanceof EE_Payment_Method ){
886
+		if ($pm instanceof EE_Payment_Method) {
887 887
 			return $pm;
888
-		}else{
888
+		} else {
889 889
 			$last_payment = $this->last_payment();
890
-			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
890
+			if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) {
891 891
 				return $last_payment->payment_method();
892
-			}else{
892
+			} else {
893 893
 				return NULL;
894 894
 			}
895 895
 		}
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 	 * @throws \EE_Error
905 905
 	 */
906 906
 	public function last_payment() {
907
-		return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) );
907
+		return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc')));
908 908
 	}
909 909
 
910 910
 
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
 	 * @return EE_Line_Item[]
916 916
 	 * @throws \EE_Error
917 917
 	 */
918
-	public function non_ticket_line_items(){
919
-		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() );
918
+	public function non_ticket_line_items() {
919
+		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID());
920 920
 	}
921 921
 
922 922
 
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 	public function update_based_on_payments()
965 965
 	{
966 966
 		EE_Error::doing_it_wrong(
967
-			__CLASS__ . '::' . __FUNCTION__,
967
+			__CLASS__.'::'.__FUNCTION__,
968 968
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
969 969
 				'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
970 970
 			'4.6.0'
@@ -988,9 +988,9 @@  discard block
 block discarded – undo
988 988
 	/**
989 989
 	 * @param string $old_txn_status
990 990
 	 */
991
-	public function set_old_txn_status( $old_txn_status ) {
991
+	public function set_old_txn_status($old_txn_status) {
992 992
 		// only set the first time
993
-		if ( $this->_old_txn_status === null ) {
993
+		if ($this->_old_txn_status === null) {
994 994
 			$this->_old_txn_status = $old_txn_status;
995 995
 		}
996 996
 	}
@@ -1019,17 +1019,17 @@  discard block
 block discarded – undo
1019 1019
 	 * @param bool           $check_all
1020 1020
 	 * @return boolean | int
1021 1021
 	 */
1022
-	private function _reg_steps_completed( $reg_step_slug = '', $check_all = true ) {
1022
+	private function _reg_steps_completed($reg_step_slug = '', $check_all = true) {
1023 1023
 		$reg_steps = $this->reg_steps();
1024
-		if ( ! is_array( $reg_steps ) || empty( $reg_steps ) ) {
1024
+		if ( ! is_array($reg_steps) || empty($reg_steps)) {
1025 1025
 			return false;
1026 1026
 		}
1027 1027
 		// loop thru reg steps array)
1028
-		foreach ( $reg_steps as $slug => $reg_step_completed ) {
1028
+		foreach ($reg_steps as $slug => $reg_step_completed) {
1029 1029
 			// if NOT checking ALL steps (only checking one step)
1030
-			if ( ! $check_all ) {
1030
+			if ( ! $check_all) {
1031 1031
 				// and this is the one
1032
-				if ( $slug === $reg_step_slug ) {
1032
+				if ($slug === $reg_step_slug) {
1033 1033
 					return $reg_step_completed;
1034 1034
 				} else {
1035 1035
 					// skip to next reg step in loop
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 				}
1038 1038
 			}
1039 1039
 			// $check_all must be true, else we would never have gotten to this point
1040
-			if ( $slug === $reg_step_slug ) {
1040
+			if ($slug === $reg_step_slug) {
1041 1041
 				// if we reach this point, then we are testing either:
1042 1042
 				// all_reg_steps_completed_except() or
1043 1043
 				// all_reg_steps_completed_except_final_step(),
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 				// ie: "is everything completed except the final step?"
1047 1047
 				// "that is correct... the final step is not completed, but all others are."
1048 1048
 				return $reg_step_completed !== true ? true : false;
1049
-			} else if ( $reg_step_completed !== true ) {
1049
+			} else if ($reg_step_completed !== true) {
1050 1050
 				// if any reg step is NOT completed, then ALL steps are not completed
1051 1051
 				return false;
1052 1052
 			}
@@ -1080,8 +1080,8 @@  discard block
 block discarded – undo
1080 1080
 	 * @param string         $exception
1081 1081
 	 * @return boolean
1082 1082
 	 */
1083
-	public function all_reg_steps_completed_except( $exception = '' ) {
1084
-		return $this->_reg_steps_completed( $exception );
1083
+	public function all_reg_steps_completed_except($exception = '') {
1084
+		return $this->_reg_steps_completed($exception);
1085 1085
 	}
1086 1086
 
1087 1087
 
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 	 * @return boolean
1097 1097
 	 */
1098 1098
 	public function all_reg_steps_completed_except_final_step() {
1099
-		return $this->_reg_steps_completed( 'finalize_registration' );
1099
+		return $this->_reg_steps_completed('finalize_registration');
1100 1100
 	}
1101 1101
 
1102 1102
 
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
 	 * @param string         $reg_step_slug
1112 1112
 	 * @return boolean | int
1113 1113
 	 */
1114
-	public function reg_step_completed( $reg_step_slug ) {
1115
-		return $this->_reg_steps_completed( $reg_step_slug, false );
1114
+	public function reg_step_completed($reg_step_slug) {
1115
+		return $this->_reg_steps_completed($reg_step_slug, false);
1116 1116
 	}
1117 1117
 
1118 1118
 
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 	 * @return boolean | int
1128 1128
 	 */
1129 1129
 	public function final_reg_step_completed() {
1130
-		return $this->_reg_steps_completed( 'finalize_registration', false );
1130
+		return $this->_reg_steps_completed('finalize_registration', false);
1131 1131
 	}
1132 1132
 
1133 1133
 
@@ -1141,8 +1141,8 @@  discard block
 block discarded – undo
1141 1141
 	 * @return boolean
1142 1142
 	 * @throws \EE_Error
1143 1143
 	 */
1144
-	public function set_reg_step_initiated( $reg_step_slug ) {
1145
-		return $this->_set_reg_step_completed_status( $reg_step_slug, time() );
1144
+	public function set_reg_step_initiated($reg_step_slug) {
1145
+		return $this->_set_reg_step_completed_status($reg_step_slug, time());
1146 1146
 	}
1147 1147
 
1148 1148
 
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
 	 * @return boolean
1157 1157
 	 * @throws \EE_Error
1158 1158
 	 */
1159
-	public function set_reg_step_completed( $reg_step_slug ) {
1160
-		return $this->_set_reg_step_completed_status( $reg_step_slug, true );
1159
+	public function set_reg_step_completed($reg_step_slug) {
1160
+		return $this->_set_reg_step_completed_status($reg_step_slug, true);
1161 1161
 	}
1162 1162
 
1163 1163
 
@@ -1171,8 +1171,8 @@  discard block
 block discarded – undo
1171 1171
 	 * @return boolean
1172 1172
 	 * @throws \EE_Error
1173 1173
 	 */
1174
-	public function set_reg_step_not_completed( $reg_step_slug ) {
1175
-		return $this->_set_reg_step_completed_status( $reg_step_slug, false );
1174
+	public function set_reg_step_not_completed($reg_step_slug) {
1175
+		return $this->_set_reg_step_completed_status($reg_step_slug, false);
1176 1176
 	}
1177 1177
 
1178 1178
 
@@ -1187,37 +1187,37 @@  discard block
 block discarded – undo
1187 1187
 	 * @return boolean
1188 1188
 	 * @throws \EE_Error
1189 1189
 	 */
1190
-	private function _set_reg_step_completed_status( $reg_step_slug, $status ) {
1190
+	private function _set_reg_step_completed_status($reg_step_slug, $status) {
1191 1191
 		// validate status
1192
-		$status = is_bool( $status ) || is_int( $status ) ? $status : false;
1192
+		$status = is_bool($status) || is_int($status) ? $status : false;
1193 1193
 		// get reg steps array
1194 1194
 		$txn_reg_steps = $this->reg_steps();
1195 1195
 		// if reg step does NOT exist
1196
-		if ( ! isset( $txn_reg_steps[ $reg_step_slug ] ) ) {
1196
+		if ( ! isset($txn_reg_steps[$reg_step_slug])) {
1197 1197
 			return false;
1198 1198
 		}
1199 1199
 		// if  we're trying to complete a step that is already completed
1200
-		if ( $txn_reg_steps[ $reg_step_slug ] === true ) {
1200
+		if ($txn_reg_steps[$reg_step_slug] === true) {
1201 1201
 			return true;
1202 1202
 		}
1203 1203
 		// if  we're trying to complete a step that hasn't even started
1204
-		if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) {
1204
+		if ($status === true && $txn_reg_steps[$reg_step_slug] === false) {
1205 1205
 			return false;
1206 1206
 		}
1207 1207
 		// if current status value matches the incoming value (no change)
1208 1208
 		// type casting as int means values should collapse to either 0, 1, or a timestamp like 1234567890
1209
-		if ( (int) $txn_reg_steps[ $reg_step_slug ] === (int) $status ) {
1209
+		if ((int) $txn_reg_steps[$reg_step_slug] === (int) $status) {
1210 1210
 			// this will happen in cases where multiple AJAX requests occur during the same step
1211 1211
 			return true;
1212 1212
 		}
1213 1213
 		// if we're trying to set a start time, but it has already been set...
1214
-		if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] ) ) {
1214
+		if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) {
1215 1215
 			// skip the update below, but don't return FALSE so that errors won't be displayed
1216 1216
 			return true;
1217 1217
 		}
1218 1218
 		// update completed status
1219
-		$txn_reg_steps[ $reg_step_slug ] = $status;
1220
-		$this->set_reg_steps( $txn_reg_steps );
1219
+		$txn_reg_steps[$reg_step_slug] = $status;
1220
+		$this->set_reg_steps($txn_reg_steps);
1221 1221
 		$this->save();
1222 1222
 		return true;
1223 1223
 	}
@@ -1233,11 +1233,11 @@  discard block
 block discarded – undo
1233 1233
 	 * @param string          $reg_step_slug
1234 1234
 	 * @return void
1235 1235
 	 */
1236
-	public function remove_reg_step( $reg_step_slug ) {
1236
+	public function remove_reg_step($reg_step_slug) {
1237 1237
 		// get reg steps array
1238 1238
 		$txn_reg_steps = $this->reg_steps();
1239
-		unset( $txn_reg_steps[ $reg_step_slug ] );
1240
-		$this->set_reg_steps( $txn_reg_steps );
1239
+		unset($txn_reg_steps[$reg_step_slug]);
1240
+		$this->set_reg_steps($txn_reg_steps);
1241 1241
 	}
1242 1242
 
1243 1243
 
@@ -1251,11 +1251,11 @@  discard block
 block discarded – undo
1251 1251
 	 * @param bool $save
1252 1252
 	 * @return bool
1253 1253
 	 */
1254
-	public function toggle_failed_transaction_status( $save = true ) {
1254
+	public function toggle_failed_transaction_status($save = true) {
1255 1255
 		// if TXN status is still set as "failed"...
1256
-		if ( $this->status_ID() === EEM_Transaction::failed_status_code ) {
1257
-			$this->set_status( EEM_Transaction::abandoned_status_code );
1258
-			if ( $save ) {
1256
+		if ($this->status_ID() === EEM_Transaction::failed_status_code) {
1257
+			$this->set_status(EEM_Transaction::abandoned_status_code);
1258
+			if ($save) {
1259 1259
 				$this->save();
1260 1260
 			}
1261 1261
 			return true;
@@ -1284,10 +1284,10 @@  discard block
 block discarded – undo
1284 1284
 				$this->primary_registration() instanceof EE_Registration
1285 1285
 				&& $this->primary_registration()->attendee() instanceof EE_Attendee
1286 1286
 			) {
1287
-				$this->set_status( EEM_Transaction::incomplete_status_code );
1287
+				$this->set_status(EEM_Transaction::incomplete_status_code);
1288 1288
 			} else {
1289 1289
 				// no contact record? yer abandoned!
1290
-				$this->set_status( EEM_Transaction::abandoned_status_code );
1290
+				$this->set_status(EEM_Transaction::abandoned_status_code);
1291 1291
 			}
1292 1292
 			return true;
1293 1293
 		}
@@ -1301,16 +1301,16 @@  discard block
 block discarded – undo
1301 1301
 	 * updates the TXN status based on the amount paid
1302 1302
 	 */
1303 1303
 	public function verify_abandoned_transaction_status() {
1304
-		if ( $this->status_ID() !== EEM_Transaction::abandoned_status_code ) {
1304
+		if ($this->status_ID() !== EEM_Transaction::abandoned_status_code) {
1305 1305
 			return;
1306 1306
 		}
1307
-		$payments = $this->get_many_related( 'Payment' );
1308
-		if ( ! empty( $payments ) ) {
1309
-			foreach ( $payments as $payment ) {
1310
-				if ( $payment instanceof EE_Payment ) {
1307
+		$payments = $this->get_many_related('Payment');
1308
+		if ( ! empty($payments)) {
1309
+			foreach ($payments as $payment) {
1310
+				if ($payment instanceof EE_Payment) {
1311 1311
 					// kk this TXN should NOT be abandoned
1312 1312
 					$this->update_status_based_on_total_paid();
1313
-					if ( is_admin() && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) {
1313
+					if (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)) {
1314 1314
 						EE_Error::add_attention(
1315 1315
 							sprintf(
1316 1316
 								esc_html__(
@@ -1326,8 +1326,8 @@  discard block
 block discarded – undo
1326 1326
 					$finalized = $this->final_reg_step_completed();
1327 1327
 					// if the 'finalize_registration' step has been initiated (has a timestamp)
1328 1328
 					// but has not yet been fully completed (TRUE)
1329
-					if ( is_int( $finalized ) && $finalized !== false && $finalized !== true ) {
1330
-						$this->set_reg_step_completed( 'finalize_registration' );
1329
+					if (is_int($finalized) && $finalized !== false && $finalized !== true) {
1330
+						$this->set_reg_step_completed('finalize_registration');
1331 1331
 						$this->save();
1332 1332
 					}
1333 1333
 				}
Please login to merge, or discard this patch.