Completed
Branch BUG-8511-spco-revisit-oversell... (b4a10b)
by
unknown
15:37
created
admin_pages/registrations/Registrations_Admin_Page.core.php 1 patch
Spacing   +545 added lines, -545 removed lines patch added patch discarded remove patch
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Registrations_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
61
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ));
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61
+		add_action('wp_loaded', array($this, 'wp_loaded'));
62 62
 	}
63 63
 
64 64
 
65 65
 
66 66
 	public function wp_loaded() {
67 67
 		// when adding a new registration...
68
-		if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) {
68
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') {
69 69
 			EE_System::do_not_cache();
70 70
 			if (
71
-				! isset( $this->_req_data[ 'processing_registration' ] )
72
-				|| absint( $this->_req_data[ 'processing_registration' ] ) !== 1
71
+				! isset($this->_req_data['processing_registration'])
72
+				|| absint($this->_req_data['processing_registration']) !== 1
73 73
 			) {
74 74
 				// and it's NOT the attendee information reg step
75 75
 				// force cookie expiration by setting time to last week
76
-				setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' );
76
+				setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/');
77 77
 				// and update the global
78
-				$_COOKIE[ 'ee_registration_added' ] = 0;
78
+				$_COOKIE['ee_registration_added'] = 0;
79 79
 			}
80 80
 		}
81 81
 	}
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 				'trash' => 'post.php'
110 110
 			);
111 111
 
112
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
112
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
113 113
 		//add filters so that the comment urls don't take users to a confusing 404 page
114
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
114
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
115 115
 	}
116 116
 
117 117
 
118
-	public function clear_comment_link( $link, $comment, $args ) {
118
+	public function clear_comment_link($link, $comment, $args) {
119 119
 		//gotta make sure this only happens on this route
120
-		$post_type = get_post_type( $comment->comment_post_ID);
121
-		if ( $post_type == 'espresso_attendees' )
120
+		$post_type = get_post_type($comment->comment_post_ID);
121
+		if ($post_type == 'espresso_attendees')
122 122
 			return '#commentsdiv';
123 123
 		return $link;
124 124
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 	protected function _ajax_hooks() {
128 128
 		//todo: all hooks for registrations ajax goes in here
129
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
129
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
130 130
 	}
131 131
 
132 132
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 				'add-attendee' => __('Add Contact', 'event_espresso'),
142 142
 				'edit' => __('Edit Contact', 'event_espresso'),
143 143
 				'report'=>  __("Event Registrations CSV Report", "event_espresso"),
144
-				'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
145
-				'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
144
+				'report_all' => __('All Registrations CSV Report', 'event_espresso'),
145
+				'contact_list_report' => __('Contact List Report', 'event_espresso'),
146 146
 				'contact_list_export'=>  __("Export Data", "event_espresso"),
147 147
 			),
148 148
 			'publishbox' => array(
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$this->_get_registration_status_array();
172 172
 
173
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
174
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
175
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
173
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
174
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
175
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
176 176
 
177 177
 		$this->_page_routes = array(
178 178
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 				'restore_registrations' => array(
207 207
 					'func' => '_trash_or_restore_registrations',
208
-					'args' => array( 'trash' => FALSE ),
208
+					'args' => array('trash' => FALSE),
209 209
 					'noheader' => TRUE,
210 210
 					'capability' => 'ee_delete_registrations'
211 211
 					),
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 						'filename' => 'registrations_overview_other'
439 439
 					)
440 440
                 ),
441
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
441
+				'help_tour' => array('Registration_Overview_Help_Tour'),
442 442
 				'qtips' => array('Registration_List_Table_Tips'),
443 443
 				'list_table' => 'EE_Registrations_List_Table',
444 444
 				'require_nonce' => FALSE
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 				'nav' => array(
449 449
 					'label' => __('REG Details', 'event_espresso'),
450 450
 					'order' => 15,
451
-					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
451
+					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
452 452
 					'persistent' => FALSE
453 453
 				),
454 454
                 'help_tabs' => array(
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 						'filename' => 'registrations_details_registrant_details'
470 470
 					)
471 471
 				),
472
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
473
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
472
+				'help_tour' => array('Registration_Details_Help_Tour'),
473
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
474 474
 				'require_nonce' => FALSE
475 475
 			),
476 476
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 					'order' => 15,
495 495
 					'persistent' => FALSE
496 496
 				),
497
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
497
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
498 498
 				'require_nonce' => FALSE
499 499
 			),
500 500
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 					'label' => __('Edit Contact', 'event_espresso'),
504 504
 					'order' => 15,
505 505
 					'persistent' => FALSE,
506
-					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
506
+					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
507 507
 				),
508 508
 				'metaboxes' => array('attendee_editor_metaboxes'),
509 509
 				'require_nonce' => FALSE
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 						'filename' => 'registrations_contact_list_other'
534 534
 					)
535 535
                 ),
536
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
536
+				'help_tour' => array('Contact_List_Help_Tour'),
537 537
 				'metaboxes' => array(),
538 538
 				'require_nonce' => FALSE
539 539
 			),
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	protected function _add_screen_options() {}
553 553
 	protected function _add_feature_pointers() {}
554 554
 	public function admin_init() {
555
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
555
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
556 556
 	}
557 557
 	public function admin_notices() {}
558 558
 	public function admin_footer_scripts() {}
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 	*		@return void
571 571
 	*/
572 572
 	private function _get_registration_status_array() {
573
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
573
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
574 574
 	}
575 575
 
576 576
 
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
 	public function load_scripts_styles() {
594 594
 		//style
595 595
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
596
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
596
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
597 597
 		wp_enqueue_style('espresso_reg');
598 598
 
599 599
 		//script
600
-		wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
600
+		wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
601 601
 		wp_enqueue_script('espresso_reg');
602 602
 	}
603 603
 
@@ -606,9 +606,9 @@  discard block
 block discarded – undo
606 606
 	public function load_scripts_styles_edit_attendee() {
607 607
 		//stuff to only show up on our attendee edit details page.
608 608
 		$attendee_details_translations = array(
609
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
609
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
610 610
 			);
611
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
611
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
612 612
 		wp_enqueue_script('jquery-validate');
613 613
 	}
614 614
 
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
 		//styles
618 618
 		wp_enqueue_style('espresso-ui-theme');
619 619
 		//scripts
620
-		$this->_get_reg_custom_questions_form( $this->_registration->ID() );
621
-		$this->_reg_custom_questions_form->wp_enqueue_scripts( true );
620
+		$this->_get_reg_custom_questions_form($this->_registration->ID());
621
+		$this->_reg_custom_questions_form->wp_enqueue_scripts(true);
622 622
 	}
623 623
 
624 624
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 
629 629
 	public function load_scripts_styles_contact_list() {
630 630
 		wp_deregister_style('espresso_reg');
631
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
631
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
632 632
 		wp_enqueue_style('espresso_att');
633 633
 	}
634 634
 
@@ -637,9 +637,9 @@  discard block
 block discarded – undo
637 637
 
638 638
 
639 639
 	public function load_scripts_styles_new_registration() {
640
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
640
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
641 641
 		wp_enqueue_script('ee-spco-for-admin');
642
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
642
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
643 643
 		EE_Form_Section_Proper::wp_enqueue_scripts();
644 644
 		EED_Ticket_Selector::load_tckt_slctr_assets();
645 645
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 		//for notification related bulk actions we need to make sure only active messengers have an option.
667 667
 		EED_Messages::set_autoloaders();
668 668
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
669
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
669
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
670 670
 		$active_mts = $message_resource_manager->list_of_active_message_types();
671 671
 		//key= bulk_action_slug, value= message type.
672 672
 		$match_array = array(
@@ -679,23 +679,23 @@  discard block
 block discarded – undo
679 679
 
680 680
 		/** setup reg status bulk actions **/
681 681
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
682
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
682
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
683 683
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
684 684
 		}
685 685
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
686
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
686
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
687 687
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
688 688
 		}
689 689
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
690
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
690
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
691 691
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
692 692
 		}
693 693
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
694
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
694
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
695 695
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
696 696
 		}
697 697
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
698
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
698
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
699 699
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
700 700
 		}
701 701
 
@@ -704,29 +704,29 @@  discard block
 block discarded – undo
704 704
 				'slug' => 'all',
705 705
 				'label' => __('View All Registrations', 'event_espresso'),
706 706
 				'count' => 0,
707
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
707
+				'bulk_action' => array_merge($def_reg_status_actions, array(
708 708
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
709
-					) )
709
+					))
710 710
 				),
711 711
 			'month' => array(
712 712
 				'slug' => 'month',
713 713
 				'label' => __('This Month', 'event_espresso'),
714 714
 				'count' => 0,
715
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
715
+				'bulk_action' => array_merge($def_reg_status_actions, array(
716 716
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
717 717
 					))
718 718
 				),
719 719
 			'today' => array(
720 720
 				'slug' => 'today',
721
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
721
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
722 722
 				'count' => 0,
723
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
723
+				'bulk_action' => array_merge($def_reg_status_actions, array(
724 724
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
725 725
 					))
726 726
 				)
727 727
 			);
728 728
 
729
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
729
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
730 730
 			$this->_views['incomplete'] = array(
731 731
 				'slug' => 'incomplete',
732 732
 				'label' => __('Incomplete', 'event_espresso'),
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 				)
763 763
 			);
764 764
 
765
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
765
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
766 766
 			$this->_views['trash'] = array(
767 767
 				'slug' => 'trash',
768 768
 				'label' => __('Trash', 'event_espresso'),
@@ -801,18 +801,18 @@  discard block
 block discarded – undo
801 801
 				'desc' => __('View Transaction Invoice', 'event_espresso')
802 802
 				),
803 803
  			);
804
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
804
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
805 805
 			$fc_items['resend_registration'] = array(
806 806
 				'class' => 'dashicons dashicons-email-alt',
807 807
 				'desc' => __('Resend Registration Details', 'event_espresso')
808 808
 				);
809 809
 		} else {
810
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
810
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
811 811
 		}
812 812
 
813
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
814
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
815
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
813
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
814
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
815
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
816 816
 				$fc_items['view_related_messages'] = array(
817 817
 					'class' => $related_for_icon['css_class'],
818 818
 					'desc' => $related_for_icon['label'],
@@ -822,35 +822,35 @@  discard block
 block discarded – undo
822 822
 
823 823
 		$sc_items = array(
824 824
 			'approved_status' => array(
825
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
826
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
825
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
826
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
827 827
 				),
828 828
 			'pending_status' => array(
829
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
830
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
829
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
830
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
831 831
 				),
832 832
 			'wait_list' => array(
833
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
834
-				'desc'  => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' )
833
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list,
834
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence')
835 835
 			),
836 836
 			'incomplete_status' => array(
837
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
838
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
837
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
838
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
839 839
 			),
840 840
 			'not_approved' => array(
841
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
842
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
841
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
842
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
843 843
 				),
844 844
 			'declined_status' => array(
845
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
846
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
845
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
846
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
847 847
 				),
848 848
 			'cancelled_status' => array(
849
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
850
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
849
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
850
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
851 851
 				)
852 852
 			);
853
-		return array_merge( $fc_items, $sc_items );
853
+		return array_merge($fc_items, $sc_items);
854 854
 	}
855 855
 
856 856
 
@@ -863,15 +863,15 @@  discard block
 block discarded – undo
863 863
 
864 864
 
865 865
 	protected function _registrations_overview_list_table() {
866
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
867
-		if ( $EVT_ID ) {
868
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) {
869
-				$this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' );
866
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
867
+		if ($EVT_ID) {
868
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) {
869
+				$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2');
870 870
 			}
871
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
872
-			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : '';
871
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
872
+			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : '';
873 873
 		}
874
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
874
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
875 875
 		$this->display_admin_list_table_page_with_no_sidebar();
876 876
 	}
877 877
 
@@ -886,19 +886,19 @@  discard block
 block discarded – undo
886 886
 	 */
887 887
 	private function _set_registration_object() {
888 888
 		//get out if we've already set the object
889
-		if ( is_object( $this->_registration )) {
889
+		if (is_object($this->_registration)) {
890 890
 			return TRUE;
891 891
 		}
892 892
 
893 893
 	    $REG = EEM_Registration::instance();
894 894
 
895
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
895
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
896 896
 
897
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
897
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
898 898
 			return TRUE;
899 899
 		else {
900
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
901
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
900
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
901
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
902 902
 			$this->_registration = NULL;
903 903
 			return FALSE;
904 904
 		}
@@ -916,24 +916,24 @@  discard block
 block discarded – undo
916 916
 	 * @throws \EE_Error
917 917
 	 * @return mixed (int|array)  int = count || array of registration objects
918 918
 	 */
919
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
920
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
921
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
922
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
923
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
924
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
925
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
919
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
920
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
921
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
922
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
923
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
924
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
925
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE;
926 926
 		$start_date = FALSE;
927 927
 		$end_date = FALSE;
928 928
 		$_where = array();
929
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
930
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
929
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
930
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
931 931
 
932 932
 		//set orderby
933 933
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
934 934
 
935 935
 
936
-		switch ( $this->_req_data['orderby'] ) {
936
+		switch ($this->_req_data['orderby']) {
937 937
 			case '_REG_ID':
938 938
 				$orderby = 'REG_ID';
939 939
 				break;
@@ -953,26 +953,26 @@  discard block
 block discarded – undo
953 953
 				$orderby = 'REG_date';
954 954
 		}
955 955
 
956
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
957
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
958
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
956
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
957
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
958
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
959 959
 
960 960
 
961
-		$offset = ($current_page-1)*$per_page;
962
-		$limit = $count  ? NULL : array( $offset, $per_page );
961
+		$offset = ($current_page - 1) * $per_page;
962
+		$limit = $count ? NULL : array($offset, $per_page);
963 963
 
964
-		if($EVT_ID){
965
-			$_where['EVT_ID']=$EVT_ID;
964
+		if ($EVT_ID) {
965
+			$_where['EVT_ID'] = $EVT_ID;
966 966
 		}
967
-		if($CAT_ID){
967
+		if ($CAT_ID) {
968 968
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
969 969
 		}
970
-		if ( $incomplete ) {
970
+		if ($incomplete) {
971 971
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
972 972
 		} else if ( ! $trash) {
973
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
973
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
974 974
 		}
975
-		if($reg_status){
975
+		if ($reg_status) {
976 976
 			$_where['STS_ID'] = $reg_status;
977 977
 		}
978 978
 
@@ -984,105 +984,105 @@  discard block
 block discarded – undo
984 984
 		$time_start = ' 00:00:00';
985 985
 		$time_end = ' 23:59:59';
986 986
 
987
-		if($today_a || $today ){
987
+		if ($today_a || $today) {
988 988
 			$curdate = date('Y-m-d', current_time('timestamp'));
989
-			$_where['REG_date']= array('BETWEEN',
989
+			$_where['REG_date'] = array('BETWEEN',
990 990
 				array(
991
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
992
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
991
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
992
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
993 993
 			));
994
-		}elseif($this_month_a || $this_month){
994
+		}elseif ($this_month_a || $this_month) {
995 995
 			$this_month_r = date('m', current_time('timestamp'));
996
-			$days_this_month = date( 't', current_time('timestamp') );
997
-			$_where['REG_date']= array('BETWEEN',
996
+			$days_this_month = date('t', current_time('timestamp'));
997
+			$_where['REG_date'] = array('BETWEEN',
998 998
 				array(
999
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
1000
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )
999
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
1000
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s')
1001 1001
 			));
1002
-		}elseif($month_range){
1002
+		}elseif ($month_range) {
1003 1003
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1004
-			$month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : '';
1005
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1006
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
1007
-			$_where['REG_date']= array('BETWEEN',
1008
-				array(  EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month .  ' 23:59:59', 'Y-m-d H:i:s' ) ) );
1009
-		}elseif($start_date && $end_date){
1004
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : '';
1005
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1006
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
1007
+			$_where['REG_date'] = array('BETWEEN',
1008
+				array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s')));
1009
+		}elseif ($start_date && $end_date) {
1010 1010
 			throw new EE_Error("not yet supported");
1011
-		}elseif($start_date){
1011
+		}elseif ($start_date) {
1012 1012
 			throw new EE_Error("not yet supported");
1013
-		}elseif($end_date){
1013
+		}elseif ($end_date) {
1014 1014
 			throw new EE_Error("not yet supported");
1015 1015
 		}
1016 1016
 
1017
-		if ( ! empty( $this->_req_data['s'] ) ) {
1018
-			$sstr = '%' . $this->_req_data['s'] . '%';
1017
+		if ( ! empty($this->_req_data['s'])) {
1018
+			$sstr = '%'.$this->_req_data['s'].'%';
1019 1019
 			$_where['OR'] = array(
1020
-				'Event.EVT_name' => array( 'LIKE', $sstr),
1021
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
1022
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
1023
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
1024
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
1025
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
1026
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
1027
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
1028
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
1029
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
1030
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
1031
-				'REG_final_price' => array( 'LIKE', $sstr ),
1032
-				'REG_code' => array( 'LIKE', $sstr ),
1033
-				'REG_count' => array( 'LIKE' , $sstr ),
1034
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1035
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1036
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
1037
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
1020
+				'Event.EVT_name' => array('LIKE', $sstr),
1021
+				'Event.EVT_desc' => array('LIKE', $sstr),
1022
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
1023
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
1024
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
1025
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
1026
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
1027
+				'Attendee.ATT_email' => array('LIKE', $sstr),
1028
+				'Attendee.ATT_address' => array('LIKE', $sstr),
1029
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
1030
+				'Attendee.ATT_city' => array('LIKE', $sstr),
1031
+				'REG_final_price' => array('LIKE', $sstr),
1032
+				'REG_code' => array('LIKE', $sstr),
1033
+				'REG_count' => array('LIKE', $sstr),
1034
+				'REG_group_size' => array('LIKE', $sstr),
1035
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1036
+				'Ticket.TKT_description' => array('LIKE', $sstr),
1037
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
1038 1038
 				);
1039 1039
 		}
1040 1040
 
1041 1041
 		//capability checks
1042
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
1042
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
1043 1043
 			$_where['AND'] = array(
1044 1044
 				'Event.EVT_wp_user' => get_current_user_id()
1045 1045
 				);
1046 1046
 		}
1047 1047
 
1048 1048
 
1049
-		if( $count ){
1050
-			if ( $trash ) {
1051
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1052
-			} else if ( $incomplete ) {
1053
-				return EEM_Registration::instance()->count( array( $_where ));
1049
+		if ($count) {
1050
+			if ($trash) {
1051
+				return EEM_Registration::instance()->count_deleted(array($_where));
1052
+			} else if ($incomplete) {
1053
+				return EEM_Registration::instance()->count(array($_where));
1054 1054
 			} else {
1055
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1055
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1056 1056
 			}
1057 1057
 		} else {
1058 1058
 			//make sure we remove default where conditions cause all registrations matching query are returned
1059
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1060
-			if ( $per_page !== -1 ) {
1059
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1060
+			if ($per_page !== -1) {
1061 1061
 				$query_params['limit'] = $limit;
1062 1062
 			}
1063
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1063
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1064 1064
 
1065 1065
 
1066
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1066
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1067 1067
 				$first_registration = $registrations[0];
1068 1068
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1069 1069
 				$event_name = $first_registration->event_obj()->name();
1070
-				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1070
+				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1071 1071
 				// edit event link
1072
-				if ( $event_name != '' ) {
1073
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1074
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1075
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1072
+				if ($event_name != '') {
1073
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1074
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1075
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1076 1076
 				}
1077 1077
 
1078
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1079
-				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1078
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1079
+				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1080 1080
 
1081 1081
 				$this->_template_args['before_admin_page_content'] = '
1082 1082
 			<div id="admin-page-header">
1083
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1084
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1085
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1083
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1084
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1085
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1086 1086
 			</div>
1087 1087
 			';
1088 1088
 
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
 		$this->_set_registration_object();
1122 1122
 
1123
-		if ( is_object( $this->_registration )) {
1123
+		if (is_object($this->_registration)) {
1124 1124
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1125 1125
 			$this->_session = $transaction->session_data();
1126 1126
 
@@ -1128,10 +1128,10 @@  discard block
 block discarded – undo
1128 1128
 
1129 1129
 
1130 1130
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1131
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1131
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1132 1132
 
1133
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->get_i18n_datetime( 'REG_date' );
1134
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1133
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
1134
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1135 1135
 
1136 1136
 			$this->_template_args['grand_total'] = $transaction->total();
1137 1137
 
@@ -1139,19 +1139,19 @@  discard block
 block discarded – undo
1139 1139
 			// link back to overview
1140 1140
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1141 1141
 			$this->_template_args['registration'] = $this->_registration;
1142
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1143
-			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) );
1144
-			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) );
1142
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1143
+			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php'));
1144
+			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php'));
1145 1145
 
1146 1146
 			//next and previous links
1147
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1148
-			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
1149
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1150
-			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
1147
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1148
+			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
1149
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1150
+			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
1151 1151
 
1152 1152
 			// grab header
1153
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1154
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1153
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1154
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1155 1155
 
1156 1156
 		} else {
1157 1157
 
@@ -1170,17 +1170,17 @@  discard block
 block discarded – undo
1170 1170
 
1171 1171
 
1172 1172
 	protected function _registration_details_metaboxes() {
1173
-		do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this );
1173
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1174 1174
 		$this->_set_registration_object();
1175 1175
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1176
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1177
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1178
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1179
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1176
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1177
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1178
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1179
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1180 1180
 		}
1181
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1182
-		if ( $this->_registration->group_size() > 1 ) {
1183
-			add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1181
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1182
+		if ($this->_registration->group_size() > 1) {
1183
+			add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high');
1184 1184
 		}
1185 1185
 	}
1186 1186
 
@@ -1201,23 +1201,23 @@  discard block
 block discarded – undo
1201 1201
 
1202 1202
 		//let's get an array of all possible buttons that we can just reference
1203 1203
 		$status_buttons = $this->_get_reg_status_buttons();
1204
-		$template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();
1205
-		$template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();
1204
+		$template_args['reg_status_value'] = $this->_registration->pretty_status();
1205
+		$template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();
1206 1206
 		$template_args['attendee'] = $this->_registration->attendee();
1207
-		$template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';
1208
-		if ( $this->_set_registration_object() ) {
1207
+		$template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';
1208
+		if ($this->_set_registration_object()) {
1209 1209
 			$current_status = $this->_registration->status_ID();
1210
-			unset( $status_buttons[$current_status] );
1211
-			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) {
1212
-				unset( $status_buttons[EEM_Registration::status_id_pending_payment] );
1210
+			unset($status_buttons[$current_status]);
1211
+			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) {
1212
+				unset($status_buttons[EEM_Registration::status_id_pending_payment]);
1213 1213
 			}
1214
-			$template_args['status_buttons'] = implode( "\n", $status_buttons );
1214
+			$template_args['status_buttons'] = implode("\n", $status_buttons);
1215 1215
 		}
1216 1216
 		$template_args['form_url'] = REG_ADMIN_URL;
1217 1217
 		$template_args['REG_ID'] = $this->_registration->ID();
1218
-		$template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce',  'change_reg_status_nonce', FALSE, FALSE );
1218
+		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE);
1219 1219
 
1220
-		EEH_Template::display_template( $template, $template_args );
1220
+		EEH_Template::display_template($template, $template_args);
1221 1221
 
1222 1222
 	}
1223 1223
 
@@ -1231,11 +1231,11 @@  discard block
 block discarded – undo
1231 1231
 	private function _get_reg_status_buttons() {
1232 1232
 
1233 1233
 		$buttons = array(
1234
-			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">',
1235
-			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">',
1236
-			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">',
1237
-			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">',
1238
-			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">',
1234
+			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">',
1235
+			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">',
1236
+			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">',
1237
+			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">',
1238
+			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">',
1239 1239
 			);
1240 1240
 		return $buttons;
1241 1241
 	}
@@ -1249,13 +1249,13 @@  discard block
 block discarded – undo
1249 1249
 	 *
1250 1250
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1251 1251
 	 */
1252
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1253
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();
1252
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1253
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1254 1254
 
1255
-		$success = $this->_set_registration_status( $REG_ID, $status );
1255
+		$success = $this->_set_registration_status($REG_ID, $status);
1256 1256
 
1257 1257
 		//notify?
1258
-		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
1258
+		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
1259 1259
 			$this->_process_resend_registration();
1260 1260
 		}
1261 1261
 
@@ -1273,19 +1273,19 @@  discard block
 block discarded – undo
1273 1273
 	 * @param bool $status
1274 1274
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1275 1275
 	 */
1276
-	protected function _set_registration_status( $REG_ID, $status = false ) {
1276
+	protected function _set_registration_status($REG_ID, $status = false) {
1277 1277
 		$success = true;
1278 1278
 		// set default status if none is passed
1279 1279
 		$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1280 1280
 
1281 1281
 		//typecast and sanitize reg_id
1282
-		$reg_ids = array_filter( (array) $REG_ID, 'absint' );
1282
+		$reg_ids = array_filter((array) $REG_ID, 'absint');
1283 1283
 
1284 1284
 		//loop through REG_ID's and change status
1285
-		foreach ( $reg_ids as $r_id ) {
1286
-			$registration = EEM_Registration::instance()->get_one_by_ID( $r_id );
1287
-			if ( $registration instanceof EE_Registration ) {
1288
-				$registration->set_status( $status );
1285
+		foreach ($reg_ids as $r_id) {
1286
+			$registration = EEM_Registration::instance()->get_one_by_ID($r_id);
1287
+			if ($registration instanceof EE_Registration) {
1288
+				$registration->set_status($status);
1289 1289
 				$result = $registration->save();
1290 1290
 
1291 1291
 				//verifying explicit fails because update *may* just return 0 for 0 rows affected
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 		$this->_req_data['_REG_ID'] = $reg_ids;
1298 1298
 
1299 1299
 		//return $success and processed registrations
1300
-		return array( 'REG_ID' => $reg_ids, 'success' => $success );
1300
+		return array('REG_ID' => $reg_ids, 'success' => $success);
1301 1301
 	}
1302 1302
 
1303 1303
 
@@ -1309,37 +1309,37 @@  discard block
 block discarded – undo
1309 1309
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1310 1310
 	 * @return void
1311 1311
 	 */
1312
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1312
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1313 1313
 
1314
-		$result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );
1314
+		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false);
1315 1315
 
1316 1316
 
1317
-		$success = isset( $result['success'] ) && $result['success'];
1317
+		$success = isset($result['success']) && $result['success'];
1318 1318
 
1319 1319
 		//setup success message
1320
-		if ( $success ) {
1321
-			$msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1  ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) :  sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ;
1322
-			EE_Error::add_success( $msg );
1320
+		if ($success) {
1321
+			$msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower'));
1322
+			EE_Error::add_success($msg);
1323 1323
 		} else {
1324
-			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ );
1324
+			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
1325 1325
 		}
1326 1326
 
1327
-		$route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' );
1327
+		$route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default');
1328 1328
 		//unset nonces
1329
-		foreach ( $this->_req_data as $ref => $value ) {
1330
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1331
-				unset( $this->_req_data[$ref] );
1329
+		foreach ($this->_req_data as $ref => $value) {
1330
+			if (strpos($ref, 'nonce') !== false) {
1331
+				unset($this->_req_data[$ref]);
1332 1332
 				continue;
1333 1333
 			}
1334 1334
 
1335
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1335
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1336 1336
 			$this->_req_data[$ref] = $value;
1337 1337
 		}
1338 1338
 
1339 1339
 		//merge request vars so that the reloaded list table contains any existing filter query params
1340
-		$route = array_merge( $this->_req_data, $route );
1340
+		$route = array_merge($this->_req_data, $route);
1341 1341
 
1342
-		$this->_redirect_after_action( false, '', '', $route, true );
1342
+		$this->_redirect_after_action(false, '', '', $route, true);
1343 1343
 	}
1344 1344
 
1345 1345
 
@@ -1351,29 +1351,29 @@  discard block
 block discarded – undo
1351 1351
 	protected function _change_reg_status() {
1352 1352
 		$this->_req_data['return'] = 'view_registration';
1353 1353
 		//set notify based on whether the send notifications toggle is set or not
1354
-		$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1355
-		$this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : '';
1354
+		$notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);
1355
+		$this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : '';
1356 1356
 
1357
-		switch ( $this->_req_data['_reg_status_id'] ) {
1358
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1359
-				$this->approve_registration( $notify );
1357
+		switch ($this->_req_data['_reg_status_id']) {
1358
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1359
+				$this->approve_registration($notify);
1360 1360
 				break;
1361
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1362
-				$this->pending_registration( $notify );
1361
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1362
+				$this->pending_registration($notify);
1363 1363
 				break;
1364
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1365
-				$this->not_approve_registration( $notify );
1364
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1365
+				$this->not_approve_registration($notify);
1366 1366
 				break;
1367
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1368
-				$this->decline_registration( $notify );
1367
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1368
+				$this->decline_registration($notify);
1369 1369
 				break;
1370
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1371
-				$this->cancel_registration( $notify );
1370
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1371
+				$this->cancel_registration($notify);
1372 1372
 				break;
1373 1373
 			default :
1374 1374
 				$result['success'] = false;
1375
-				unset( $this->_req_data['return'] );
1376
-				$this->_reg_status_change_return( '', false );
1375
+				unset($this->_req_data['return']);
1376
+				$this->_reg_status_change_return('', false);
1377 1377
 				break;
1378 1378
 		}
1379 1379
 	}
@@ -1386,8 +1386,8 @@  discard block
 block discarded – undo
1386 1386
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1387 1387
 	*		@return void
1388 1388
 	*/
1389
-	protected function approve_registration( $notify = false ) {
1390
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1389
+	protected function approve_registration($notify = false) {
1390
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1391 1391
 	}
1392 1392
 
1393 1393
 
@@ -1399,8 +1399,8 @@  discard block
 block discarded – undo
1399 1399
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1400 1400
 	*		@return void
1401 1401
 	*/
1402
-	protected function decline_registration( $notify = false ) {
1403
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1402
+	protected function decline_registration($notify = false) {
1403
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1404 1404
 	}
1405 1405
 
1406 1406
 
@@ -1412,8 +1412,8 @@  discard block
 block discarded – undo
1412 1412
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1413 1413
 	*		@return void
1414 1414
 	*/
1415
-	protected function cancel_registration( $notify = false ) {
1416
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1415
+	protected function cancel_registration($notify = false) {
1416
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1417 1417
 	}
1418 1418
 
1419 1419
 
@@ -1426,8 +1426,8 @@  discard block
 block discarded – undo
1426 1426
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1427 1427
 	*		@return void
1428 1428
 	*/
1429
-	protected function not_approve_registration( $notify = false ) {
1430
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1429
+	protected function not_approve_registration($notify = false) {
1430
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1431 1431
 	}
1432 1432
 
1433 1433
 
@@ -1438,8 +1438,8 @@  discard block
 block discarded – undo
1438 1438
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1439 1439
 	*		@return void
1440 1440
 	*/
1441
-	protected function pending_registration( $notify = false ) {
1442
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1441
+	protected function pending_registration($notify = false) {
1442
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1443 1443
 	}
1444 1444
 
1445 1445
 
@@ -1453,75 +1453,75 @@  discard block
 block discarded – undo
1453 1453
 	public function _reg_details_meta_box() {
1454 1454
 		EEH_Autoloader::register_line_item_display_autoloaders();
1455 1455
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1456
-		EE_Registry::instance()->load_Helper( 'Line_Item' );
1456
+		EE_Registry::instance()->load_Helper('Line_Item');
1457 1457
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1458 1458
 		$this->_session = $transaction->session_data();
1459 1459
 
1460 1460
 		$filters = new EE_Line_Item_Filter_Collection();
1461
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1462
-		$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1463
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1461
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1462
+		$filters->add(new EE_Non_Zero_Line_Item_Filter());
1463
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1464 1464
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1465 1465
 
1466 1466
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1467
-		$line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' );
1468
-		$this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) );
1467
+		$line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy');
1468
+		$this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration));
1469 1469
 
1470 1470
 
1471 1471
 		$attendee = $this->_registration->attendee();
1472 1472
 
1473 1473
 
1474
-		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : '';
1475
-		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : '';
1474
+		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : '';
1475
+		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : '';
1476 1476
 
1477 1477
 
1478 1478
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1479
-		$payment = $transaction->get_first_related( 'Payment' );
1479
+		$payment = $transaction->get_first_related('Payment');
1480 1480
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1481
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1481
+		$payment_method = $payment->get_first_related('Payment_Method');
1482 1482
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1483
-		$reg_status_class = 'status-' . $this->_registration->status_ID();
1483
+		$reg_status_class = 'status-'.$this->_registration->status_ID();
1484 1484
 		$reg_details = array(
1485 1485
 			'payment_method' => $payment_method->name(),
1486 1486
 			'response_msg' => $payment->gateway_response(),
1487
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1487
+			'registration_id' => $this->_registration->get('REG_code'),
1488 1488
 			'registration_session' => $this->_registration->session_ID(),
1489
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1490
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1489
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1490
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1491 1491
 			);
1492 1492
 
1493 1493
 
1494
-		if ( isset( $reg_details['registration_id'] )) {
1494
+		if (isset($reg_details['registration_id'])) {
1495 1495
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1496
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1496
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1497 1497
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1498 1498
 		}
1499 1499
 
1500
-		if ( isset( $reg_details['payment_method'] ) ) {
1500
+		if (isset($reg_details['payment_method'])) {
1501 1501
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1502
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1502
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1503 1503
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1504 1504
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1505
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1505
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1506 1506
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1507 1507
 		}
1508 1508
 
1509 1509
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1510
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1510
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1511 1511
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1512 1512
 
1513 1513
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1514
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1514
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1515 1515
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1516 1516
 
1517 1517
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1518
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1518
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1519 1519
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1520 1520
 
1521
-		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL );
1521
+		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL);
1522 1522
 
1523
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1524
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1523
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1524
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1525 1525
 
1526 1526
 	}
1527 1527
 
@@ -1535,14 +1535,14 @@  discard block
 block discarded – undo
1535 1535
 	*/
1536 1536
 	public function _reg_questions_meta_box() {
1537 1537
 		//allow someone to override this method entirely
1538
-		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
1539
-			$form = $this->_get_reg_custom_questions_form( $this->_registration->ID() );
1540
-			$this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : '';
1538
+		if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) {
1539
+			$form = $this->_get_reg_custom_questions_form($this->_registration->ID());
1540
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : '';
1541 1541
 			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
1542 1542
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1543 1543
 
1544
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1545
-			echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1544
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1545
+			echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1546 1546
 		}
1547 1547
 	}
1548 1548
 
@@ -1556,12 +1556,12 @@  discard block
 block discarded – undo
1556 1556
 	 * @param        string $output
1557 1557
 	 * @return        string
1558 1558
 	 */
1559
-	public function form_before_question_group( $output ) {
1559
+	public function form_before_question_group($output) {
1560 1560
 		EE_Error::doing_it_wrong(
1561
-			__CLASS__ . '::' . __FUNCTION__,
1562
-			__( 'This method would have been protected but was used on a filter callback'
1561
+			__CLASS__.'::'.__FUNCTION__,
1562
+			__('This method would have been protected but was used on a filter callback'
1563 1563
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1564
-				'event_espresso' ),
1564
+				'event_espresso'),
1565 1565
 			'4.8.32.rc.000'
1566 1566
 		);
1567 1567
 		return '
@@ -1580,20 +1580,20 @@  discard block
 block discarded – undo
1580 1580
 	 * @param        string $output
1581 1581
 	 * @return        string
1582 1582
 	 */
1583
-	public function form_after_question_group( $output ) {
1583
+	public function form_after_question_group($output) {
1584 1584
 		EE_Error::doing_it_wrong(
1585
-			__CLASS__ . '::' . __FUNCTION__,
1586
-			__( 'This method would have been protected but was used on a filter callback'
1585
+			__CLASS__.'::'.__FUNCTION__,
1586
+			__('This method would have been protected but was used on a filter callback'
1587 1587
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1588
-				'event_espresso' ),
1588
+				'event_espresso'),
1589 1589
 			'4.8.32.rc.000'
1590 1590
 		);
1591 1591
 		return  '
1592 1592
 			<tr class="hide-if-no-js">
1593 1593
 				<th> </th>
1594 1594
 				<td class="reg-admin-edit-attendee-question-td">
1595
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1596
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1595
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1596
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1597 1597
 						<div class="dashicons dashicons-edit"></div>
1598 1598
 					</a>
1599 1599
 				</td>
@@ -1613,18 +1613,18 @@  discard block
 block discarded – undo
1613 1613
 	 * @param        string $label
1614 1614
 	 * @return        string
1615 1615
 	 */
1616
-	public function form_form_field_label_wrap( $label ) {
1616
+	public function form_form_field_label_wrap($label) {
1617 1617
 		EE_Error::doing_it_wrong(
1618
-			__CLASS__ . '::' . __FUNCTION__,
1619
-			__( 'This method would have been protected but was used on a filter callback'
1618
+			__CLASS__.'::'.__FUNCTION__,
1619
+			__('This method would have been protected but was used on a filter callback'
1620 1620
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1621
-				'event_espresso' ),
1621
+				'event_espresso'),
1622 1622
 			'4.8.32.rc.000'
1623 1623
 		);
1624 1624
 		return '
1625 1625
 			<tr>
1626 1626
 				<th>
1627
-					' . $label  . '
1627
+					' . $label.'
1628 1628
 				</th>';
1629 1629
 	}
1630 1630
 
@@ -1638,17 +1638,17 @@  discard block
 block discarded – undo
1638 1638
 	 * @param        string $input
1639 1639
 	 * @return        string
1640 1640
 	 */
1641
-	public function form_form_field_input__wrap( $input ) {
1641
+	public function form_form_field_input__wrap($input) {
1642 1642
 		EE_Error::doing_it_wrong(
1643
-			__CLASS__ . '::' . __FUNCTION__,
1644
-			__( 'This method would have been protected but was used on a filter callback'
1643
+			__CLASS__.'::'.__FUNCTION__,
1644
+			__('This method would have been protected but was used on a filter callback'
1645 1645
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1646
-				'event_espresso' ),
1646
+				'event_espresso'),
1647 1647
 			'4.8.32.rc.000'
1648 1648
 		);
1649 1649
 		return '
1650 1650
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1651
-					' . $input . '
1651
+					' . $input.'
1652 1652
 				</td>
1653 1653
 			</tr>';
1654 1654
 	}
@@ -1662,14 +1662,14 @@  discard block
 block discarded – undo
1662 1662
 	 * @return void
1663 1663
 	 */
1664 1664
 	protected function _update_attendee_registration_form() {
1665
-		do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this );
1666
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
1667
-			$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1668
-			$success = $this->_save_reg_custom_questions_form( $REG_ID );
1669
-			if( $success ) {
1665
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
1666
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1667
+			$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1668
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
1669
+			if ($success) {
1670 1670
 				$what = __('Registration Form', 'event_espresso');
1671
-				$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1672
-				$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1671
+				$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1672
+				$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1673 1673
 			}
1674 1674
 		}
1675 1675
 	}
@@ -1680,11 +1680,11 @@  discard block
 block discarded – undo
1680 1680
 	 * @param int $REG_ID
1681 1681
 	 * @return EE_Registration_Custom_Questions_Form
1682 1682
 	 */
1683
-	protected function _get_reg_custom_questions_form( $REG_ID ) {
1684
-		if( ! $this->_reg_custom_questions_form ) {
1685
-			require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' );
1686
-			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) );
1687
-			$this->_reg_custom_questions_form->_construct_finalize( null, null );
1683
+	protected function _get_reg_custom_questions_form($REG_ID) {
1684
+		if ( ! $this->_reg_custom_questions_form) {
1685
+			require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php');
1686
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID));
1687
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
1688 1688
 		}
1689 1689
 		return $this->_reg_custom_questions_form;
1690 1690
 	}
@@ -1697,17 +1697,17 @@  discard block
 block discarded – undo
1697 1697
 	 * @param bool $REG_ID
1698 1698
 	 * @return bool
1699 1699
 	 */
1700
-	private function _save_reg_custom_questions_form( $REG_ID = FALSE ) {
1700
+	private function _save_reg_custom_questions_form($REG_ID = FALSE) {
1701 1701
 
1702 1702
 		if ( ! $REG_ID) {
1703
-			EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1703
+			EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1704 1704
 		}
1705
-		$form = $this->_get_reg_custom_questions_form( $REG_ID );
1706
-		$form->receive_form_submission( $this->_req_data );
1705
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
1706
+		$form->receive_form_submission($this->_req_data);
1707 1707
 		$success = false;
1708
-		if( $form->is_valid() ) {
1709
-			foreach( $form->subforms() as $question_group_id => $question_group_form ) {
1710
-				foreach( $question_group_form->inputs() as $question_id => $input ) {
1708
+		if ($form->is_valid()) {
1709
+			foreach ($form->subforms() as $question_group_id => $question_group_form) {
1710
+				foreach ($question_group_form->inputs() as $question_id => $input) {
1711 1711
 					$where_conditions = array(
1712 1712
 							'QST_ID' => $question_id,
1713 1713
 							'REG_ID' => $REG_ID
@@ -1715,19 +1715,19 @@  discard block
 block discarded – undo
1715 1715
 					$possibly_new_values = array(
1716 1716
 							'ANS_value' => $input->normalized_value()
1717 1717
 						);
1718
-					$answer = EEM_Answer::instance()->get_one( array( $where_conditions ) );
1719
-					if( $answer instanceof EE_Answer ) {
1720
-						$success = $answer->save( $possibly_new_values );
1718
+					$answer = EEM_Answer::instance()->get_one(array($where_conditions));
1719
+					if ($answer instanceof EE_Answer) {
1720
+						$success = $answer->save($possibly_new_values);
1721 1721
 					} else {
1722 1722
 						//insert it then
1723
-						$cols_n_vals = array_merge( $where_conditions, $possibly_new_values );
1724
-						$answer = EE_Answer::new_instance( $cols_n_vals );
1723
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
1724
+						$answer = EE_Answer::new_instance($cols_n_vals);
1725 1725
 						$success = $answer->save();
1726 1726
 					}
1727 1727
 				}
1728 1728
 			}
1729 1729
 		} else {
1730
-			EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ );
1730
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
1731 1731
 		}
1732 1732
 		return $success;
1733 1733
 	}
@@ -1745,29 +1745,29 @@  discard block
 block discarded – undo
1745 1745
 		$registrations = $REG->get_all(array(
1746 1746
 			array(
1747 1747
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1748
-				'REG_ID'=>array('!=',$this->_registration->ID())
1748
+				'REG_ID'=>array('!=', $this->_registration->ID())
1749 1749
 			),
1750 1750
 			'force_join'=>array('Attendee')));
1751 1751
 
1752 1752
 		$this->_template_args['attendees'] = array();
1753 1753
 		$this->_template_args['attendee_notice'] = '';
1754
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1755
-			EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1754
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1755
+			EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1756 1756
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1757 1757
 		} else {
1758 1758
 
1759 1759
 			$att_nmbr = 1;
1760
-			foreach ( $registrations as $registration ) {
1760
+			foreach ($registrations as $registration) {
1761 1761
 				/* @var $registration EE_Registration */
1762 1762
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1763
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1764
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1765
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1766
-				$this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1763
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1764
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1765
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1766
+				$this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1767 1767
 
1768
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1768
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1769 1769
 
1770
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1770
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1771 1771
 
1772 1772
 				$att_nmbr++;
1773 1773
 			}
@@ -1779,8 +1779,8 @@  discard block
 block discarded – undo
1779 1779
 
1780 1780
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1781 1781
 		}
1782
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1783
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1782
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1783
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1784 1784
 
1785 1785
 	}
1786 1786
 
@@ -1801,11 +1801,11 @@  discard block
 block discarded – undo
1801 1801
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1802 1802
 
1803 1803
 		//now let's determine if this is not the primary registration.  If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not)
1804
-		if ( ! $this->_registration->is_primary_registrant() ) {
1804
+		if ( ! $this->_registration->is_primary_registrant()) {
1805 1805
 			$primary_registration = $this->_registration->get_primary_registration();
1806 1806
 			$primary_attendee = $primary_registration->attendee();
1807 1807
 
1808
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1808
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1809 1809
 				//in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.
1810 1810
 				$primary_registration = NULL;
1811 1811
 			}
@@ -1814,27 +1814,27 @@  discard block
 block discarded – undo
1814 1814
 		}
1815 1815
 
1816 1816
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1817
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1818
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1819
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1817
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1818
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1819
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1820 1820
 		$this->_template_args['phone'] = $attendee->phone();
1821 1821
 
1822
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1822
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1823 1823
 
1824 1824
 
1825 1825
 		//edit link
1826
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1826
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1827 1827
 		$this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso');
1828 1828
 
1829 1829
 		//create link
1830
-		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee',  '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): '';
1830
+		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : '';
1831 1831
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1832 1832
 
1833 1833
 		$this->_template_args['att_check'] = $att_check;
1834 1834
 
1835 1835
 
1836
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1837
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1836
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1837
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1838 1838
 	}
1839 1839
 
1840 1840
 
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
 	 * @access protected
1848 1848
 	 * @return void
1849 1849
 	 */
1850
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1850
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1851 1851
 		$REGM = EEM_Registration::instance();
1852 1852
 
1853 1853
 		$success = 1;
@@ -1857,26 +1857,26 @@  discard block
 block discarded – undo
1857 1857
 		$dtts = array();
1858 1858
 
1859 1859
 		//if empty _REG_ID then get out because there's nothing to do
1860
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1860
+		if (empty($this->_req_data['_REG_ID'])) {
1861 1861
 			$msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso');
1862
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1863
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1862
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1863
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1864 1864
 		}
1865 1865
 
1866 1866
 		//Checkboxes
1867
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1867
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1868 1868
 			// if array has more than one element than success message should be plural
1869
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1869
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1870 1870
 			// cycle thru checkboxes
1871
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1871
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1872 1872
 
1873 1873
 				$REG = $REGM->get_one_by_ID($REG_ID);
1874 1874
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1875
-				if ( $payment_count > 0 ) {
1876
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
1875
+				if ($payment_count > 0) {
1876
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
1877 1877
 					$error = 1;
1878 1878
 					$success = 0;
1879
-					EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ );
1879
+					EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__);
1880 1880
 					continue; //can't trash this registration because it has payments.
1881 1881
 				}
1882 1882
 				$ticket = $REG->get_first_related('Ticket');
@@ -1885,7 +1885,7 @@  discard block
 block discarded – undo
1885 1885
 				$dtts = array_merge($dtts, $dtt);
1886 1886
 
1887 1887
 				$updated = $trash ? $REG->delete() : $REG->restore();
1888
-				if ( !$updated ) {
1888
+				if ( ! $updated) {
1889 1889
 					$success = 0;
1890 1890
 				} else {
1891 1891
 					$success = 2;
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
 			$tickets[$ticket->ID()] = $ticket;
1901 1901
 			$dtts = $ticket->get_many_related('Datetime');
1902 1902
 			$updated = $trash ? $REG->delete() : $REG->restore();
1903
-			if ( ! $updated ) {
1903
+			if ( ! $updated) {
1904 1904
 				$success = 0;
1905 1905
 			}
1906 1906
 
@@ -1910,10 +1910,10 @@  discard block
 block discarded – undo
1910 1910
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1911 1911
 		EEM_Datetime::instance()->update_sold($dtts);
1912 1912
 
1913
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1914
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1913
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1914
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1915 1915
 		$overwrite_msgs = $error ? TRUE : FALSE;
1916
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1916
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1917 1917
 	}
1918 1918
 
1919 1919
 
@@ -1937,16 +1937,16 @@  discard block
 block discarded – undo
1937 1937
 		$success = 1;
1938 1938
 
1939 1939
 		//Checkboxes
1940
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1940
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1941 1941
 			// if array has more than one element than success message should be plural
1942
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1942
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1943 1943
 			// cycle thru checkboxes
1944
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1944
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1945 1945
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1946
-				if ( ! $REG instanceof EE_Registration )
1946
+				if ( ! $REG instanceof EE_Registration)
1947 1947
 					continue;
1948 1948
 				$deleted = $this->_delete_registration($REG);
1949
-				if ( !$deleted ) {
1949
+				if ( ! $deleted) {
1950 1950
 					$success = 0;
1951 1951
 				}
1952 1952
 			}
@@ -1956,15 +1956,15 @@  discard block
 block discarded – undo
1956 1956
 			$REG_ID = $this->_req_data['_REG_ID'];
1957 1957
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
1958 1958
 			$deleted = $this->_delete_registration($REG);
1959
-			if ( ! $deleted ) {
1959
+			if ( ! $deleted) {
1960 1960
 				$success = 0;
1961 1961
 			}
1962 1962
 
1963 1963
 		}
1964 1964
 
1965
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1966
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
1967
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
1965
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1966
+		$action_desc = __('permanently deleted.', 'event_espresso');
1967
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
1968 1968
 	}
1969 1969
 
1970 1970
 
@@ -1976,31 +1976,31 @@  discard block
 block discarded – undo
1976 1976
 	 * @param  EE_Registration $REG registration to be deleted permenantly
1977 1977
 	 * @return boolean              true = successful deletion, false = fail.
1978 1978
 	 */
1979
-	protected function _delete_registration( EE_Registration $REG ) {
1979
+	protected function _delete_registration(EE_Registration $REG) {
1980 1980
 		//first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed.
1981 1981
 		$TXN = $REG->get_first_related('Transaction');
1982 1982
 		$REGS = $TXN->get_many_related('Registration');
1983 1983
 
1984 1984
 		$all_trashed = TRUE;
1985
-		foreach ( $REGS as $registration ) {
1986
-			if ( ! $registration->get('REG_deleted') )
1985
+		foreach ($REGS as $registration) {
1986
+			if ( ! $registration->get('REG_deleted'))
1987 1987
 				$all_trashed = FALSE;
1988 1988
 		}
1989 1989
 
1990
-		if ( ! $all_trashed ) {
1991
-			EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1990
+		if ( ! $all_trashed) {
1991
+			EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1992 1992
 			return false;
1993 1993
 		}
1994 1994
 
1995 1995
 		//k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one).
1996
-		foreach ( $REGS as $registration ) {
1996
+		foreach ($REGS as $registration) {
1997 1997
 
1998 1998
 			//delete related answers
1999 1999
 			$registration->delete_related_permanently('Answer');
2000 2000
 
2001 2001
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
2002 2002
 			$attendee = $registration->get_first_related('Attendee');
2003
-			if ( $attendee instanceof EE_Attendee ) {
2003
+			if ($attendee instanceof EE_Attendee) {
2004 2004
 				$registration->_remove_relation_to($attendee, 'Attendee');
2005 2005
 			}
2006 2006
 
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
 			//now delete permanently the checkins related to this registration.
2011 2011
 			$registration->delete_related_permanently('Checkin');
2012 2012
 
2013
-			if ( $registration->ID() === $REG->ID() )
2013
+			if ($registration->ID() === $REG->ID())
2014 2014
 				continue; //we don't want to delete permanently the existing registration just yet.
2015 2015
 
2016 2016
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2043,35 +2043,35 @@  discard block
 block discarded – undo
2043 2043
 	 * @return void
2044 2044
 	 */
2045 2045
 	public function new_registration() {
2046
-		if ( ! $this->_set_reg_event() ) {
2047
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2046
+		if ( ! $this->_set_reg_event()) {
2047
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2048 2048
 		}
2049
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2049
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2050 2050
 		// gotta start with a clean slate if we're not coming here via ajax
2051 2051
 		if (
2052
-			! defined('DOING_AJAX' )
2053
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2052
+			! defined('DOING_AJAX')
2053
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2054 2054
 		) {
2055
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2055
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2056 2056
 		}
2057 2057
 
2058
-		$this->_template_args['event_name'] = '' ;
2058
+		$this->_template_args['event_name'] = '';
2059 2059
 		// event name
2060
-		if ( $this->_reg_event ) {
2060
+		if ($this->_reg_event) {
2061 2061
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2062
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2063
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2064
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2062
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2063
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2064
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2065 2065
 		}
2066 2066
 
2067 2067
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2068 2068
 
2069
-		if ( defined('DOING_AJAX' ) ) {
2069
+		if (defined('DOING_AJAX')) {
2070 2070
 			$this->_return_json();
2071 2071
 		}
2072 2072
 		// grab header
2073
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2074
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2073
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2074
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2075 2075
 
2076 2076
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2077 2077
 		// the details template wrapper
@@ -2088,7 +2088,7 @@  discard block
 block discarded – undo
2088 2088
 	 * @return string html
2089 2089
 	 */
2090 2090
 	protected function _get_registration_step_content() {
2091
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2091
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2092 2092
 			$warning_msg = sprintf(
2093 2093
 				__(
2094 2094
 					'%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s',
@@ -2104,7 +2104,7 @@  discard block
 block discarded – undo
2104 2104
 				'</b>'
2105 2105
 			);
2106 2106
 			return '
2107
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2107
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2108 2108
 	<script >
2109 2109
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2110 2110
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2139,16 +2139,16 @@  discard block
 block discarded – undo
2139 2139
 		$cart = EE_Registry::instance()->SSN->cart();
2140 2140
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2141 2141
 
2142
-		switch ( $step ) {
2142
+		switch ($step) {
2143 2143
 			case 'ticket' :
2144 2144
 				$hidden_fields['processing_registration']['value'] = 1;
2145 2145
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2146
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2146
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2147 2147
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2148 2148
 				$template_args['show_notification_toggle'] = FALSE;
2149 2149
 				break;
2150 2150
 			case 'questions' :
2151
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2151
+				$hidden_fields['processing_registration']['value'] = 2;
2152 2152
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2153 2153
 				//in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run.
2154 2154
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2157,10 +2157,10 @@  discard block
 block discarded – undo
2157 2157
 				break;
2158 2158
 		}
2159 2159
 
2160
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2160
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2161 2161
 
2162 2162
 		return EEH_Template::display_template(
2163
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2163
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2164 2164
 		);
2165 2165
 	}
2166 2166
 
@@ -2175,11 +2175,11 @@  discard block
 block discarded – undo
2175 2175
 	*		@return boolean
2176 2176
 	*/
2177 2177
 	private function _set_reg_event() {
2178
-		if ( is_object( $this->_reg_event )) {
2178
+		if (is_object($this->_reg_event)) {
2179 2179
 			return TRUE;
2180 2180
 		}
2181
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2182
-		if ( ! $EVT_ID ) {
2181
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2182
+		if ( ! $EVT_ID) {
2183 2183
 			return FALSE;
2184 2184
 		}
2185 2185
 
@@ -2200,82 +2200,82 @@  discard block
 block discarded – undo
2200 2200
 	public function process_reg_step() {
2201 2201
 		EE_System::do_not_cache();
2202 2202
 		$this->_set_reg_event();
2203
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2203
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2204 2204
 
2205 2205
 		//what step are we on?
2206 2206
 		$cart = EE_Registry::instance()->SSN->cart();
2207 2207
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2208 2208
 
2209 2209
 		//if doing ajax then we need to verify the nonce
2210
-		if ( defined( 'DOING_AJAX' ) ) {
2211
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2212
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2210
+		if (defined('DOING_AJAX')) {
2211
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2212
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2213 2213
 		}
2214 2214
 
2215
-		switch ( $step ) {
2215
+		switch ($step) {
2216 2216
 
2217 2217
 			case 'ticket' :
2218 2218
 				//process ticket selection
2219 2219
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2220
-				if ( $success ) {
2221
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2220
+				if ($success) {
2221
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2222 2222
 				} else {
2223 2223
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2224 2224
 				}
2225
-				if ( defined('DOING_AJAX') ) {
2225
+				if (defined('DOING_AJAX')) {
2226 2226
 					$this->new_registration(); //display next step
2227 2227
 				} else {
2228 2228
 					$query_args['action'] = 'new_registration';
2229 2229
 					$query_args['processing_registration'] = 1;
2230 2230
 					$query_args['event_id'] = $this->_reg_event->ID();
2231
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2231
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2232 2232
 				}
2233 2233
 				break;
2234 2234
 
2235 2235
 			case 'questions' :
2236
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2237
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2236
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2237
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2238 2238
 				}
2239 2239
 				//process registration
2240 2240
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2241
-				if ( $cart instanceof EE_Cart ) {
2241
+				if ($cart instanceof EE_Cart) {
2242 2242
 					$grand_total = $cart->get_cart_grand_total();
2243
-					if ( $grand_total instanceof EE_Line_Item ) {
2243
+					if ($grand_total instanceof EE_Line_Item) {
2244 2244
 						$grand_total->save_this_and_descendants_to_txn();
2245 2245
 					}
2246 2246
 				}
2247
-				if ( ! $transaction instanceof EE_Transaction ) {
2247
+				if ( ! $transaction instanceof EE_Transaction) {
2248 2248
 					$query_args = array(
2249 2249
 						'action' => 'new_registration',
2250 2250
 						'processing_registration' => 2,
2251 2251
 						'event_id' => $this->_reg_event->ID()
2252 2252
 					);
2253 2253
 
2254
-					if ( defined('DOING_AJAX' )) {
2254
+					if (defined('DOING_AJAX')) {
2255 2255
 						//display registration form again because there are errors (maybe validation?)
2256 2256
 						$this->new_registration();
2257 2257
 						return;
2258 2258
 					} else {
2259
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2259
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2260 2260
 						return;
2261 2261
 					}
2262 2262
 				}
2263 2263
 				/** @type EE_Transaction_Payments $transaction_payments */
2264
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2264
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2265 2265
 				// maybe update status, and make sure to save transaction if not done already
2266
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2266
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2267 2267
 					$transaction->save();
2268 2268
 				}
2269
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2269
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2270 2270
 				$this->_req_data = array();
2271 2271
 				$query_args = array(
2272 2272
 					'action'        => 'redirect_to_txn',
2273 2273
 					'TXN_ID'        => $transaction->ID(),
2274 2274
 					'EVT_ID'        => $this->_reg_event->ID(),
2275
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2275
+					'event_name'    => urlencode($this->_reg_event->name()),
2276 2276
 					'redirect_from' => 'new_registration'
2277 2277
 				);
2278
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2278
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2279 2279
 				break;
2280 2280
 		}
2281 2281
 
@@ -2292,21 +2292,21 @@  discard block
 block discarded – undo
2292 2292
 	 */
2293 2293
 	public function redirect_to_txn() {
2294 2294
 		EE_System::do_not_cache();
2295
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2295
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2296 2296
 		$query_args = array(
2297 2297
 			'action' => 'view_transaction',
2298
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2298
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2299 2299
 			'page'   => 'espresso_transactions'
2300 2300
 		);
2301
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2302
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2303
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2304
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2301
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2302
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2303
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2304
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2305 2305
 		}
2306 2306
 		EE_Error::add_success(
2307
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2307
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2308 2308
 		);
2309
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2309
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2310 2310
 	}
2311 2311
 
2312 2312
 
@@ -2317,7 +2317,7 @@  discard block
 block discarded – undo
2317 2317
 	*		@return void
2318 2318
 	*/
2319 2319
 	protected function _attendee_contact_list_table() {
2320
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2320
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2321 2321
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2322 2322
 		$this->display_admin_list_table_page_with_no_sidebar();
2323 2323
 	}
@@ -2332,10 +2332,10 @@  discard block
 block discarded – undo
2332 2332
 	*		@access public
2333 2333
 	*		@return array
2334 2334
 	*/
2335
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2335
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2336 2336
 
2337
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2338
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2337
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2338
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2339 2339
 		$ATT_MDL = EEM_Attendee::instance();
2340 2340
 
2341 2341
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2363,47 +2363,47 @@  discard block
 block discarded – undo
2363 2363
 				$orderby = 'ATT_lname';
2364 2364
 		}
2365 2365
 
2366
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2366
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2367 2367
 
2368
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2369
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2370
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2368
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2369
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2370
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2371 2371
 
2372 2372
 		$_where = array();
2373 2373
 
2374
-		if ( isset( $this->_req_data['s'] ) ) {
2375
-			$sstr = '%' . $this->_req_data['s'] . '%';
2374
+		if (isset($this->_req_data['s'])) {
2375
+			$sstr = '%'.$this->_req_data['s'].'%';
2376 2376
 			$_where['OR'] = array(
2377
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2378
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2379
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2380
-				'ATT_fname' => array( 'LIKE', $sstr ),
2381
-				'ATT_lname' => array( 'LIKE', $sstr ),
2382
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2383
-				'ATT_email' => array('LIKE', $sstr ),
2384
-				'ATT_address' => array( 'LIKE', $sstr ),
2385
-				'ATT_address2' => array( 'LIKE', $sstr ),
2386
-				'ATT_city' => array( 'LIKE', $sstr ),
2387
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2388
-				'State.STA_name' => array('LIKE', $sstr ),
2389
-				'ATT_phone' => array( 'LIKE', $sstr ),
2390
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2391
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2392
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2393
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2377
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2378
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2379
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2380
+				'ATT_fname' => array('LIKE', $sstr),
2381
+				'ATT_lname' => array('LIKE', $sstr),
2382
+				'ATT_short_bio' => array('LIKE', $sstr),
2383
+				'ATT_email' => array('LIKE', $sstr),
2384
+				'ATT_address' => array('LIKE', $sstr),
2385
+				'ATT_address2' => array('LIKE', $sstr),
2386
+				'ATT_city' => array('LIKE', $sstr),
2387
+				'Country.CNT_name' => array('LIKE', $sstr),
2388
+				'State.STA_name' => array('LIKE', $sstr),
2389
+				'ATT_phone' => array('LIKE', $sstr),
2390
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2391
+				'Registration.REG_code' => array('LIKE', $sstr),
2392
+				'Registration.REG_count' => array('LIKE', $sstr),
2393
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2394 2394
 				);
2395 2395
 		}
2396 2396
 
2397 2397
 
2398
-		$offset = ($current_page-1)*$per_page;
2399
-		$limit = $count ? NULL : array( $offset, $per_page );
2398
+		$offset = ($current_page - 1) * $per_page;
2399
+		$limit = $count ? NULL : array($offset, $per_page);
2400 2400
 
2401
-		if ( $trash ) {
2402
-			$_where['status'] = array( '!=', 'publish' );
2403
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2401
+		if ($trash) {
2402
+			$_where['status'] = array('!=', 'publish');
2403
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2404 2404
 		} else {
2405
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2406
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2405
+			$_where['status'] = array('IN', array('publish'));
2406
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2407 2407
 		}
2408 2408
 
2409 2409
 		return $all_attendees;
@@ -2420,10 +2420,10 @@  discard block
 block discarded – undo
2420 2420
 	 */
2421 2421
 	protected function _resend_registration() {
2422 2422
 		$this->_process_resend_registration();
2423
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2423
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2424 2424
 			'action' => 'default'
2425 2425
 		);
2426
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2426
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2427 2427
 	}
2428 2428
 
2429 2429
 
@@ -2431,26 +2431,26 @@  discard block
 block discarded – undo
2431 2431
 
2432 2432
 
2433 2433
 
2434
-	public function _registrations_report(){
2435
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2436
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2434
+	public function _registrations_report() {
2435
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2436
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2437 2437
 				array(
2438 2438
 					'page' => 'espresso_batch',
2439 2439
 					'batch' => 'file',
2440
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2441
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2442
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2443
-				)) );
2440
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2441
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2442
+					'return_url' => urlencode($this->_req_data['return_url']),
2443
+				)));
2444 2444
 		} else {
2445 2445
 			$new_request_args = array(
2446 2446
 				'export' => 'report',
2447 2447
 				'action' => 'registrations_report_for_event',
2448
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2448
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2449 2449
 			);
2450 2450
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2451 2451
 
2452
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2453
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2452
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2453
+				require_once(EE_CLASSES.'EE_Export.class.php');
2454 2454
 				$EE_Export = EE_Export::instance($this->_req_data);
2455 2455
 				$EE_Export->export();
2456 2456
 			}
@@ -2459,26 +2459,26 @@  discard block
 block discarded – undo
2459 2459
 
2460 2460
 
2461 2461
 
2462
-	public function _contact_list_export(){
2463
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2464
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2462
+	public function _contact_list_export() {
2463
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2464
+			require_once(EE_CLASSES.'EE_Export.class.php');
2465 2465
 			$EE_Export = EE_Export::instance($this->_req_data);
2466 2466
 			$EE_Export->export_attendees();
2467 2467
 		}
2468 2468
 	}
2469 2469
 
2470
-	public function _contact_list_report(){
2471
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2472
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2470
+	public function _contact_list_report() {
2471
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2472
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2473 2473
 				array(
2474 2474
 					'page' => 'espresso_batch',
2475 2475
 					'batch' => 'file',
2476
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2477
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2478
-				)) );
2476
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2477
+					'return_url' => urlencode($this->_req_data['return_url']),
2478
+				)));
2479 2479
 		} else {
2480
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2481
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2480
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2481
+				require_once(EE_CLASSES.'EE_Export.class.php');
2482 2482
 				$EE_Export = EE_Export::instance($this->_req_data);
2483 2483
 				$EE_Export->report_attendees();
2484 2484
 			}
@@ -2498,73 +2498,73 @@  discard block
 block discarded – undo
2498 2498
 	 * @return void
2499 2499
 	 */
2500 2500
 	protected function _duplicate_attendee() {
2501
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2501
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2502 2502
 		//verify we have necessary info
2503
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2504
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2505
-			$query_args = array( 'action' => $action );
2503
+		if (empty($this->_req_data['_REG_ID'])) {
2504
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2505
+			$query_args = array('action' => $action);
2506 2506
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2507 2507
 		}
2508 2508
 
2509 2509
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2510
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2510
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2511 2511
 		$attendee = $registration->attendee();
2512 2512
 
2513 2513
 		//remove relation of existing attendee on registration
2514
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2514
+		$registration->_remove_relation_to($attendee, 'Attendee');
2515 2515
 		//new attendee
2516 2516
 		$new_attendee = clone $attendee;
2517
-		$new_attendee->set( 'ATT_ID', 0 );
2517
+		$new_attendee->set('ATT_ID', 0);
2518 2518
 		$new_attendee->save();
2519 2519
 
2520 2520
 		//add new attendee to reg
2521
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2521
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2522 2522
 
2523
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2523
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2524 2524
 
2525 2525
 		//redirect to edit page for attendee
2526
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2526
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2527 2527
 
2528
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2528
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2529 2529
 	}
2530 2530
 
2531 2531
 
2532 2532
 	//related to cpt routes
2533 2533
 	protected function _insert_update_cpt_item($post_id, $post) {
2534 2534
 		$success = true;
2535
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2535
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2536 2536
 		//for attendee updates
2537
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2537
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2538 2538
 			//note we should only be UPDATING attendees at this point.
2539 2539
 			$updated_fields = array(
2540 2540
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2541 2541
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2542
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2542
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2543 2543
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2544 2544
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2545
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2546
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2547
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2548
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2549
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2550
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2545
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2546
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2547
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2548
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2549
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2550
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2551 2551
 				);
2552
-			foreach ( $updated_fields as $field => $value ) {
2552
+			foreach ($updated_fields as $field => $value) {
2553 2553
 				$attendee->set($field, $value);
2554 2554
 			}
2555 2555
 
2556 2556
 			$success = $attendee->save();
2557 2557
 
2558
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2559
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2560
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2561
-					throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback ) );
2558
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2559
+			foreach ($attendee_update_callbacks as $a_callback) {
2560
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2561
+					throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback));
2562 2562
 				}
2563 2563
 			}
2564 2564
 		}
2565 2565
 
2566
-		if ( $success === FALSE )
2567
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2566
+		if ($success === FALSE)
2567
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2568 2568
 
2569 2569
 	}
2570 2570
 
@@ -2584,17 +2584,17 @@  discard block
 block discarded – undo
2584 2584
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2585 2585
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2586 2586
 
2587
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2588
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2587
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2588
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2589 2589
 		}
2590 2590
 
2591
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2591
+		if (post_type_supports('espresso_attendees', 'comments')) {
2592 2592
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2593 2593
 		}
2594 2594
 
2595
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2596
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2597
-		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2595
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2596
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2597
+		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2598 2598
 	}
2599 2599
 
2600 2600
 
@@ -2603,10 +2603,10 @@  discard block
 block discarded – undo
2603 2603
 	 * @param  WP_Post $post wp post object
2604 2604
 	 * @return string        attendee contact info ( and form )
2605 2605
 	 */
2606
-	public function attendee_contact_info( $post ) {
2606
+	public function attendee_contact_info($post) {
2607 2607
 		//get attendee object ( should already have it )
2608 2608
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2609
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2609
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2610 2610
 		EEH_Template::display_template($template, $this->_template_args);
2611 2611
 	}
2612 2612
 
@@ -2622,12 +2622,12 @@  discard block
 block discarded – undo
2622 2622
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2623 2623
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2624 2624
 				new EE_Question_Form_Input(
2625
-				EE_Question::new_instance( array(
2625
+				EE_Question::new_instance(array(
2626 2626
 					'QST_ID' => 0,
2627 2627
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2628 2628
 					'QST_system' => 'admin-state'
2629 2629
 					)),
2630
-				EE_Answer::new_instance( array(
2630
+				EE_Answer::new_instance(array(
2631 2631
 					'ANS_ID' => 0,
2632 2632
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2633 2633
 					)),
@@ -2640,12 +2640,12 @@  discard block
 block discarded – undo
2640 2640
 			));
2641 2641
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2642 2642
 				new EE_Question_Form_Input(
2643
-				EE_Question::new_instance( array(
2643
+				EE_Question::new_instance(array(
2644 2644
 					'QST_ID' => 0,
2645 2645
 					'QST_display_text' => __('Country', 'event_espresso'),
2646 2646
 					'QST_system' => 'admin-country'
2647 2647
 					)),
2648
-				EE_Answer::new_instance( array(
2648
+				EE_Answer::new_instance(array(
2649 2649
 					'ANS_ID' => 0,
2650 2650
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2651 2651
 					)),
@@ -2656,8 +2656,8 @@  discard block
 block discarded – undo
2656 2656
 					'append_qstn_id' => FALSE
2657 2657
 					)
2658 2658
 				));
2659
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2660
-		EEH_Template::display_template($template, $this->_template_args );
2659
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2660
+		EEH_Template::display_template($template, $this->_template_args);
2661 2661
 
2662 2662
 	}
2663 2663
 
@@ -2667,11 +2667,11 @@  discard block
 block discarded – undo
2667 2667
 	*		@access protected
2668 2668
 	*		@return void
2669 2669
 	*/
2670
-	public function attendee_registrations_meta_box( $post ) {
2670
+	public function attendee_registrations_meta_box($post) {
2671 2671
 
2672 2672
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2673 2673
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2674
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2674
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2675 2675
 		EEH_Template::display_template($template, $this->_template_args);
2676 2676
 
2677 2677
 	}
@@ -2685,8 +2685,8 @@  discard block
 block discarded – undo
2685 2685
 	 * @return string        html for new form.
2686 2686
 	 */
2687 2687
 	public function after_title_form_fields($post) {
2688
-		if ( $post->post_type == 'espresso_attendees' ) {
2689
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2688
+		if ($post->post_type == 'espresso_attendees') {
2689
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2690 2690
 			$template_args['attendee'] = $this->_cpt_model_obj;
2691 2691
 			EEH_Template::display_template($template, $template_args);
2692 2692
 		}
@@ -2703,21 +2703,21 @@  discard block
 block discarded – undo
2703 2703
 	*		@access protected
2704 2704
 	*		@return void
2705 2705
 	*/
2706
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2706
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2707 2707
 
2708
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2708
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2709 2709
 
2710 2710
 		$ATT_MDL = EEM_Attendee::instance();
2711 2711
 
2712 2712
 		$success = 1;
2713 2713
 		//Checkboxes
2714
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2714
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2715 2715
 			// if array has more than one element than success message should be plural
2716
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2716
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2717 2717
 			// cycle thru checkboxes
2718
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2719
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2720
-				if ( !$updated ) {
2718
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2719
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2720
+				if ( ! $updated) {
2721 2721
 					$success = 0;
2722 2722
 				}
2723 2723
 			}
@@ -2726,18 +2726,18 @@  discard block
 block discarded – undo
2726 2726
 			// grab single id and delete
2727 2727
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2728 2728
 			//get attendee
2729
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2729
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2730 2730
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2731 2731
 			$updated = $att->save();
2732
-			if ( ! $updated ) {
2732
+			if ( ! $updated) {
2733 2733
 				$success = 0;
2734 2734
 			}
2735 2735
 
2736 2736
 		}
2737 2737
 
2738
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2739
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2740
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2738
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2739
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2740
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2741 2741
 
2742 2742
 	}
2743 2743
 
Please login to merge, or discard this patch.