Completed
Branch FET-9046-messages-queue (bbfce3)
by
unknown
947:38 queued 926:24
created
core/libraries/shortcodes/EE_Messenger_Shortcodes.lib.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
 		$this->label = __('Messenger Shortcodes', 'event_espresso');
42 42
 		$this->description = __('All shortcodes that are messenger specific.', 'event_espresso');
43 43
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
44
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
44
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
45 45
 		//add messages about what happens  when the messenger is active.
46 46
 		$this->_active_messengers = $message_resource_manager->active_messengers();
47 47
 
48
-		$this->_shortcodes['[DISPLAY_HTML_URL]'] =__('This will return a link to view the template in a browser if the html messenger is active.', 'event_espresso');
49
-		$this->_shortcodes['[DISPLAY_PDF_URL]'] = __('This will return a link to generate a pdf for the template if the pdf messenger is active.', 'event_espresso' );
48
+		$this->_shortcodes['[DISPLAY_HTML_URL]'] = __('This will return a link to view the template in a browser if the html messenger is active.', 'event_espresso');
49
+		$this->_shortcodes['[DISPLAY_PDF_URL]'] = __('This will return a link to generate a pdf for the template if the pdf messenger is active.', 'event_espresso');
50 50
 		$this->_shortcodes['[DISPLAY_PDF_BUTTON]'] = __('This will return html for a download pdf button trigger if the pdf messenger is active.', 'event_espresso');
51 51
 
52 52
 		//show error message about buttons/urls not working as expected if messenger deactivated.
53
-		if ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'update_message_template' ) {
54
-			if ( ! isset( $this->_active_messengers['pdf'] ) ) {
55
-				EE_Error::add_attention( __('Be aware that the pdf messenger is inactive.  This means that any pdf related shortcodes will parse to an empty string.', 'event_espresso' ) );
53
+		if (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'update_message_template') {
54
+			if ( ! isset($this->_active_messengers['pdf'])) {
55
+				EE_Error::add_attention(__('Be aware that the pdf messenger is inactive.  This means that any pdf related shortcodes will parse to an empty string.', 'event_espresso'));
56 56
 			}
57 57
 
58
-			if ( !isset( $this->_active_messengers['html'] ) ) {
59
-				EE_Error::add_attention( __('Be aware that the html messenger is inactive. This means that any html related shortcodes will parse to an empty string.', 'event_espresso' ) );
58
+			if ( ! isset($this->_active_messengers['html'])) {
59
+				EE_Error::add_attention(__('Be aware that the html messenger is inactive. This means that any html related shortcodes will parse to an empty string.', 'event_espresso'));
60 60
 			}
61 61
 		}
62 62
 
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
 
65 65
 
66 66
 
67
-	protected function _parser( $shortcode ) {
67
+	protected function _parser($shortcode) {
68 68
 		//make sure we end up with a copy of the EE_Messages_Addressee object
69 69
 		$recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
70
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient;
71
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
70
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient;
71
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
72 72
 
73
-		if ( ! $recipient instanceof EE_Messages_Addressee )
73
+		if ( ! $recipient instanceof EE_Messages_Addressee)
74 74
 			return '';
75 75
 
76
-		switch ( $shortcode ) {
76
+		switch ($shortcode) {
77 77
 			case '[DISPLAY_HTML_URL]' :
78
-				return  isset( $this->_active_messengers['html'] ) ? $this->_get_url( $recipient, 'html' ) : '';
78
+				return  isset($this->_active_messengers['html']) ? $this->_get_url($recipient, 'html') : '';
79 79
 				break;
80 80
 			case '[DISPLAY_PDF_URL]' :
81
-				return  isset( $this->_active_messengers['pdf'] ) ? $this->_get_url( $recipient, 'pdf' ) : '';
81
+				return  isset($this->_active_messengers['pdf']) ? $this->_get_url($recipient, 'pdf') : '';
82 82
 				break;
83 83
 			case '[DISPLAY_PDF_BUTTON]' :
84
-				return  isset( $this->_active_messengers['pdf'] ) ? $this->_get_button( $recipient, 'pdf' ) : '';
84
+				return  isset($this->_active_messengers['pdf']) ? $this->_get_button($recipient, 'pdf') : '';
85 85
 				break;
86 86
 		}
87 87
 		return '';
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return string                Generated html
101 101
 	 */
102
-	private function _get_button( EE_Messages_Addressee $recipient, $sending_messenger ) {
103
-		$download_text = $sending_messenger == 'pdf' ? __('Download PDF', 'event_espresso') : __('Show HTML', 'event_espresso' );
102
+	private function _get_button(EE_Messages_Addressee $recipient, $sending_messenger) {
103
+		$download_text = $sending_messenger == 'pdf' ? __('Download PDF', 'event_espresso') : __('Show HTML', 'event_espresso');
104 104
 		$content = '
105
-<form method="post" action="' . $this->_get_url( $recipient, $sending_messenger ) . '" >
106
-	<input class="print_button" type="submit" value="' . $download_text . '" />
105
+<form method="post" action="' . $this->_get_url($recipient, $sending_messenger).'" >
106
+	<input class="print_button" type="submit" value="' . $download_text.'" />
107 107
 </form>
108 108
 		';
109 109
 		return $content;
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
 	 * @return string The generated url for displaying the link.
123 123
 	 * @throws EE_Error
124 124
 	 */
125
-	private function _get_url( EE_Messages_Addressee $recipient, $sending_messenger ) {
125
+	private function _get_url(EE_Messages_Addressee $recipient, $sending_messenger) {
126 126
 
127 127
 		$reg = $recipient->reg_obj;
128 128
 		$reg = ! $reg instanceof EE_Registration ? $recipient->primary_reg_obj : $reg;
129 129
 
130 130
 
131
-		if ( $this->_message_type instanceof EE_message_type && $this->_message instanceof EE_Message ) {
132
-			EE_Registry::instance()->load_helper( 'MSG_Template' );
131
+		if ($this->_message_type instanceof EE_message_type && $this->_message instanceof EE_Message) {
132
+			EE_Registry::instance()->load_helper('MSG_Template');
133 133
 			try {
134
-				return EEH_MSG_Template::get_url_trigger( $this->_message_type, $this->_message, $reg, $sending_messenger );
135
-			} catch( EE_Error $e ) {
136
-				if ( WP_DEBUG ) {
134
+				return EEH_MSG_Template::get_url_trigger($this->_message_type, $this->_message, $reg, $sending_messenger);
135
+			} catch (EE_Error $e) {
136
+				if (WP_DEBUG) {
137 137
 					$e->get_error();
138 138
 				}
139 139
 			}
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 1 patch
Spacing   +511 added lines, -511 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param bool $routing
43 43
 	 * @return Registrations_Admin_Page
44 44
 	 */
45
-	public function __construct( $routing = TRUE ) {
46
-		parent::__construct( $routing );
45
+	public function __construct($routing = TRUE) {
46
+		parent::__construct($routing);
47 47
 	}
48 48
 
49 49
 
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
 				'trash' => 'post.php'
76 76
 			);
77 77
 
78
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
78
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
79 79
 		//add filters so that the comment urls don't take users to a confusing 404 page
80
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
80
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
81 81
 	}
82 82
 
83 83
 
84
-	public function clear_comment_link( $link, $comment, $args ) {
84
+	public function clear_comment_link($link, $comment, $args) {
85 85
 		//gotta make sure this only happens on this route
86
-		$post_type = get_post_type( $comment->comment_post_ID);
87
-		if ( $post_type == 'espresso_attendees' )
86
+		$post_type = get_post_type($comment->comment_post_ID);
87
+		if ($post_type == 'espresso_attendees')
88 88
 			return '#commentsdiv';
89 89
 		return $link;
90 90
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	protected function _ajax_hooks() {
94 94
 		//todo: all hooks for registrations ajax goes in here
95
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
95
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
96 96
 	}
97 97
 
98 98
 
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 					'add-attendee' => __('Add Contact', 'event_espresso'),
108 108
 					'edit' => __('Edit Contact', 'event_espresso'),
109 109
 					'report'=>  __("Event Registrations CSV Report", "event_espresso"),
110
-					'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
111
-					'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
110
+					'report_all' => __('All Registrations CSV Report', 'event_espresso'),
111
+					'contact_list_report' => __('Contact List Report', 'event_espresso'),
112 112
 					'contact_list_export'=>  __("Export Data", "event_espresso"),
113 113
 				),
114 114
 			'publishbox' => array(
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 
137 137
 		$this->_get_registration_status_array();
138 138
 
139
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
140
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
141
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
139
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
140
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
141
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
142 142
 
143 143
 		$this->_page_routes = array(
144 144
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 				'edit_registration'	=> array(
157 157
 						'func' => '_registration_details',
158
-						'args' => array( 'edit' ),
158
+						'args' => array('edit'),
159 159
 						'noheader' => TRUE,
160 160
 						'capability' => 'ee_edit_registration',
161 161
 						'obj_id' => $reg_id
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
 				'restore_registrations' => array(
172 172
 					'func' => '_trash_or_restore_registrations',
173
-					'args' => array( 'trash' => FALSE ),
173
+					'args' => array('trash' => FALSE),
174 174
 					'noheader' => TRUE,
175 175
 					'capability' => 'ee_delete_registrations'
176 176
 					),
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 						'filename' => 'registrations_overview_other'
405 405
 					)
406 406
                 ),
407
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
407
+				'help_tour' => array('Registration_Overview_Help_Tour'),
408 408
 				'qtips' => array('Registration_List_Table_Tips'),
409 409
 				'list_table' => 'EE_Registrations_List_Table',
410 410
 				'require_nonce' => FALSE
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 				'nav' => array(
415 415
 					'label' => __('REG Details', 'event_espresso'),
416 416
 					'order' => 15,
417
-					'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,
417
+					'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,
418 418
 					'persistent' => FALSE
419 419
 					),
420 420
                 'help_tabs' => array(
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 						'filename' => 'registrations_details_registrant_details'
436 436
 						)
437 437
 					),
438
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
439
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
438
+				'help_tour' => array('Registration_Details_Help_Tour'),
439
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
440 440
 				'require_nonce' => FALSE
441 441
 				),
442 442
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 					'order' => 15,
461 461
 					'persistent' => FALSE
462 462
 					),
463
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
463
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
464 464
 				'require_nonce' => FALSE
465 465
 				),
466 466
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 					'label' => __('Edit Contact', 'event_espresso'),
470 470
 					'order' => 15,
471 471
 					'persistent' => FALSE,
472
-					'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
472
+					'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
473 473
 					),
474 474
 				'metaboxes' => array('attendee_editor_metaboxes'),
475 475
 				'require_nonce' => FALSE
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 						'filename' => 'registrations_contact_list_other'
500 500
 					)
501 501
                 ),
502
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
502
+				'help_tour' => array('Contact_List_Help_Tour'),
503 503
 				'metaboxes' => array(),
504 504
 				'require_nonce' => FALSE
505 505
 				),
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 	protected function _add_screen_options() {}
519 519
 	protected function _add_feature_pointers() {}
520 520
 	public function admin_init() {
521
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
521
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
522 522
 	}
523 523
 	public function admin_notices() {}
524 524
 	public function admin_footer_scripts() {}
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	*		@return void
537 537
 	*/
538 538
 	private function _get_registration_status_array() {
539
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
539
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
540 540
 	}
541 541
 
542 542
 
@@ -559,11 +559,11 @@  discard block
 block discarded – undo
559 559
 	public function load_scripts_styles() {
560 560
 		//style
561 561
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
562
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
562
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
563 563
 		wp_enqueue_style('espresso_reg');
564 564
 
565 565
 		//script
566
-		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);
566
+		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);
567 567
 		wp_enqueue_script('espresso_reg');
568 568
 	}
569 569
 
@@ -572,9 +572,9 @@  discard block
 block discarded – undo
572 572
 	public function load_scripts_styles_edit_attendee() {
573 573
 		//stuff to only show up on our attendee edit details page.
574 574
 		$attendee_details_translations = array(
575
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
575
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
576 576
 			);
577
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
577
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
578 578
 		wp_enqueue_script('jquery-validate');
579 579
 	}
580 580
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 
593 593
 	public function load_scripts_styles_contact_list() {
594 594
 		wp_deregister_style('espresso_reg');
595
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
595
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
596 596
 		wp_enqueue_style('espresso_att');
597 597
 	}
598 598
 
@@ -601,9 +601,9 @@  discard block
 block discarded – undo
601 601
 
602 602
 
603 603
 	public function load_scripts_styles_new_registration() {
604
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
604
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
605 605
 		wp_enqueue_script('ee-spco-for-admin');
606
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
606
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
607 607
 		EE_Form_Section_Proper::wp_enqueue_scripts();
608 608
 		EED_Ticket_Selector::load_tckt_slctr_assets();
609 609
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 		//for notification related bulk actions we need to make sure only active messengers have an option.
631 631
 		EED_Messages::set_autoloaders();
632 632
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
633
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
633
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
634 634
 		$active_mts = $message_resource_manager->list_of_active_message_types();
635 635
 		//key= bulk_action_slug, value= message type.
636 636
 		$match_array = array(
@@ -643,23 +643,23 @@  discard block
 block discarded – undo
643 643
 
644 644
 		/** setup reg status bulk actions **/
645 645
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
646
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
646
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
647 647
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
648 648
 		}
649 649
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
650
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
650
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
651 651
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
652 652
 		}
653 653
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
654
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
654
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
655 655
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
656 656
 		}
657 657
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
658
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
658
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
659 659
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
660 660
 		}
661 661
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
662
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
662
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
663 663
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
664 664
 		}
665 665
 
@@ -668,29 +668,29 @@  discard block
 block discarded – undo
668 668
 				'slug' => 'all',
669 669
 				'label' => __('View All Registrations', 'event_espresso'),
670 670
 				'count' => 0,
671
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
671
+				'bulk_action' => array_merge($def_reg_status_actions, array(
672 672
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
673
-					) )
673
+					))
674 674
 				),
675 675
 			'month' => array(
676 676
 				'slug' => 'month',
677 677
 				'label' => __('This Month', 'event_espresso'),
678 678
 				'count' => 0,
679
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
679
+				'bulk_action' => array_merge($def_reg_status_actions, array(
680 680
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
681 681
 					))
682 682
 				),
683 683
 			'today' => array(
684 684
 				'slug' => 'today',
685
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
685
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
686 686
 				'count' => 0,
687
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
687
+				'bulk_action' => array_merge($def_reg_status_actions, array(
688 688
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
689 689
 					))
690 690
 				)
691 691
 			);
692 692
 
693
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
693
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
694 694
 			$this->_views['incomplete'] = array(
695 695
 				'slug' => 'incomplete',
696 696
 				'label' => __('Incomplete', 'event_espresso'),
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 				)
727 727
 			);
728 728
 
729
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
729
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
730 730
 			$this->_views['trash'] = array(
731 731
 				'slug' => 'trash',
732 732
 				'label' => __('Trash', 'event_espresso'),
@@ -765,42 +765,42 @@  discard block
 block discarded – undo
765 765
 				'desc' => __('View Transaction Invoice', 'event_espresso')
766 766
 				),
767 767
  			);
768
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
768
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
769 769
 			$fc_items['resend_registration'] = array(
770 770
 				'class' => 'dashicons dashicons-email-alt',
771 771
 				'desc' => __('Resend Registration Details', 'event_espresso')
772 772
 				);
773 773
 		} else {
774
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
774
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
775 775
 		}
776 776
 
777 777
 		$sc_items = array(
778 778
 			'approved_status' => array(
779
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
780
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
779
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
780
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
781 781
 				),
782 782
 			'pending_status' => array(
783
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
784
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
783
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
784
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
785 785
 				),
786 786
 			'incomplete_status' => array(
787
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
788
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
787
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
788
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
789 789
 			),
790 790
 			'not_approved' => array(
791
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
792
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
791
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
792
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
793 793
 				),
794 794
 			'declined_status' => array(
795
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
796
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
795
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
796
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
797 797
 				),
798 798
 			'cancelled_status' => array(
799
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
800
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
799
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
800
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
801 801
 				)
802 802
 			);
803
-		return array_merge( $fc_items, $sc_items );
803
+		return array_merge($fc_items, $sc_items);
804 804
 	}
805 805
 
806 806
 
@@ -813,15 +813,15 @@  discard block
 block discarded – undo
813 813
 
814 814
 
815 815
 	protected function _registrations_overview_list_table() {
816
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
817
-		if ( $EVT_ID ) {
818
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) {
819
-				$this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' );
816
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
817
+		if ($EVT_ID) {
818
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) {
819
+				$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2');
820 820
 			}
821
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
822
-			$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>' ) : '';
821
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
822
+			$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>') : '';
823 823
 		}
824
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
824
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
825 825
 		$this->display_admin_list_table_page_with_no_sidebar();
826 826
 	}
827 827
 
@@ -836,19 +836,19 @@  discard block
 block discarded – undo
836 836
 	 */
837 837
 	private function _set_registration_object() {
838 838
 		//get out if we've already set the object
839
-		if ( is_object( $this->_registration )) {
839
+		if (is_object($this->_registration)) {
840 840
 			return TRUE;
841 841
 		}
842 842
 
843 843
 	    $REG = EEM_Registration::instance();
844 844
 
845
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
845
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
846 846
 
847
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
847
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
848 848
 			return TRUE;
849 849
 		else {
850
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
851
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
850
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
851
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
852 852
 			$this->_registration = NULL;
853 853
 			return FALSE;
854 854
 		}
@@ -867,25 +867,25 @@  discard block
 block discarded – undo
867 867
 	 * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set)
868 868
 	 * @return mixed (int|array)  int = count || array of registration objects
869 869
 	 */
870
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
871
-
872
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
873
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
874
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
875
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
876
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;
877
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE  : FALSE;
870
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
871
+
872
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
873
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
874
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
875
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
876
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;
877
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE;
878 878
 		$start_date = FALSE;
879 879
 		$end_date = FALSE;
880 880
 		$_where = array();
881
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;
882
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;
881
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;
882
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;
883 883
 
884 884
 		//set orderby
885 885
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
886 886
 
887 887
 
888
-		switch ( $this->_req_data['orderby'] ) {
888
+		switch ($this->_req_data['orderby']) {
889 889
 			case '_REG_ID':
890 890
 				$orderby = 'REG_ID';
891 891
 				break;
@@ -905,26 +905,26 @@  discard block
 block discarded – undo
905 905
 				$orderby = 'REG_date';
906 906
 		}
907 907
 
908
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
909
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
910
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
908
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
909
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
910
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
911 911
 
912 912
 
913
-		$offset = ($current_page-1)*$per_page;
914
-		$limit = $count  ? NULL : array( $offset, $per_page );
913
+		$offset = ($current_page - 1) * $per_page;
914
+		$limit = $count ? NULL : array($offset, $per_page);
915 915
 
916
-		if($EVT_ID){
917
-			$_where['EVT_ID']=$EVT_ID;
916
+		if ($EVT_ID) {
917
+			$_where['EVT_ID'] = $EVT_ID;
918 918
 		}
919
-		if($CAT_ID){
919
+		if ($CAT_ID) {
920 920
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
921 921
 		}
922
-		if ( $incomplete ) {
922
+		if ($incomplete) {
923 923
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
924 924
 		} else if ( ! $trash) {
925
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
925
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
926 926
 		}
927
-		if($reg_status){
927
+		if ($reg_status) {
928 928
 			$_where['STS_ID'] = $reg_status;
929 929
 		}
930 930
 
@@ -936,105 +936,105 @@  discard block
 block discarded – undo
936 936
 		$time_start = ' 00:00:00';
937 937
 		$time_end = ' 23:59:59';
938 938
 
939
-		if($today_a || $today ){
939
+		if ($today_a || $today) {
940 940
 			$curdate = date('Y-m-d', current_time('timestamp'));
941
-			$_where['REG_date']= array('BETWEEN',
941
+			$_where['REG_date'] = array('BETWEEN',
942 942
 				array(
943
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
944
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
943
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
944
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
945 945
 			));
946
-		}elseif($this_month_a || $this_month){
946
+		}elseif ($this_month_a || $this_month) {
947 947
 			$this_month_r = date('m', current_time('timestamp'));
948
-			$days_this_month = date( 't', current_time('timestamp') );
949
-			$_where['REG_date']= array('BETWEEN',
948
+			$days_this_month = date('t', current_time('timestamp'));
949
+			$_where['REG_date'] = array('BETWEEN',
950 950
 				array(
951
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
952
-					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' )
951
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
952
+					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')
953 953
 			));
954
-		}elseif($month_range){
954
+		}elseif ($month_range) {
955 955
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
956
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
957
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
958
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
959
-			$_where['REG_date']= array('BETWEEN',
960
-				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' ) ) );
961
-		}elseif($start_date && $end_date){
956
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
957
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
958
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
959
+			$_where['REG_date'] = array('BETWEEN',
960
+				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')));
961
+		}elseif ($start_date && $end_date) {
962 962
 			throw new EE_Error("not yet supported");
963
-		}elseif($start_date){
963
+		}elseif ($start_date) {
964 964
 			throw new EE_Error("not yet supported");
965
-		}elseif($end_date){
965
+		}elseif ($end_date) {
966 966
 			throw new EE_Error("not yet supported");
967 967
 		}
968 968
 
969
-		if ( ! empty( $this->_req_data['s'] ) ) {
970
-			$sstr = '%' . $this->_req_data['s'] . '%';
969
+		if ( ! empty($this->_req_data['s'])) {
970
+			$sstr = '%'.$this->_req_data['s'].'%';
971 971
 			$_where['OR'] = array(
972
-				'Event.EVT_name' => array( 'LIKE', $sstr),
973
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
974
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
975
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
976
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
977
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
978
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
979
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
980
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
981
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
982
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
983
-				'REG_final_price' => array( 'LIKE', $sstr ),
984
-				'REG_code' => array( 'LIKE', $sstr ),
985
-				'REG_count' => array( 'LIKE' , $sstr ),
986
-				'REG_group_size' => array( 'LIKE' , $sstr ),
987
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
988
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
989
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
972
+				'Event.EVT_name' => array('LIKE', $sstr),
973
+				'Event.EVT_desc' => array('LIKE', $sstr),
974
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
975
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
976
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
977
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
978
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
979
+				'Attendee.ATT_email' => array('LIKE', $sstr),
980
+				'Attendee.ATT_address' => array('LIKE', $sstr),
981
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
982
+				'Attendee.ATT_city' => array('LIKE', $sstr),
983
+				'REG_final_price' => array('LIKE', $sstr),
984
+				'REG_code' => array('LIKE', $sstr),
985
+				'REG_count' => array('LIKE', $sstr),
986
+				'REG_group_size' => array('LIKE', $sstr),
987
+				'Ticket.TKT_name' => array('LIKE', $sstr),
988
+				'Ticket.TKT_description' => array('LIKE', $sstr),
989
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
990 990
 				);
991 991
 		}
992 992
 
993 993
 		//capability checks
994
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
994
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
995 995
 			$_where['AND'] = array(
996 996
 				'Event.EVT_wp_user' => get_current_user_id()
997 997
 				);
998 998
 		}
999 999
 
1000 1000
 
1001
-		if( $count ){
1002
-			if ( $trash ) {
1003
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1004
-			} else if ( $incomplete ) {
1005
-				return EEM_Registration::instance()->count( array( $_where ));
1001
+		if ($count) {
1002
+			if ($trash) {
1003
+				return EEM_Registration::instance()->count_deleted(array($_where));
1004
+			} else if ($incomplete) {
1005
+				return EEM_Registration::instance()->count(array($_where));
1006 1006
 			} else {
1007
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1007
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1008 1008
 			}
1009 1009
 		} else {
1010 1010
 			//make sure we remove default where conditions cause all registrations matching query are returned
1011
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1012
-			if ( $per_page !== -1 ) {
1011
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1012
+			if ($per_page !== -1) {
1013 1013
 				$query_params['limit'] = $limit;
1014 1014
 			}
1015
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1015
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1016 1016
 
1017 1017
 
1018
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1018
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1019 1019
 				$first_registration = $registrations[0];
1020 1020
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1021 1021
 				$event_name = $first_registration->event_obj()->name();
1022
-				$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 ) : '';
1022
+				$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 ) : '';
1023 1023
 				// edit event link
1024
-				if ( $event_name != '' ) {
1025
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1026
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1027
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1024
+				if ($event_name != '') {
1025
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1026
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1027
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1028 1028
 				}
1029 1029
 
1030
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1031
-				$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>';
1030
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1031
+				$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>';
1032 1032
 
1033 1033
 				$this->_template_args['before_admin_page_content'] = '
1034 1034
 			<div id="admin-page-header">
1035
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1036
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1037
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1035
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1036
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1037
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1038 1038
 			</div>
1039 1039
 			';
1040 1040
 
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
 
1073 1073
 		$this->_set_registration_object();
1074 1074
 
1075
-		if ( is_object( $this->_registration )) {
1075
+		if (is_object($this->_registration)) {
1076 1076
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1077 1077
 			$this->_session = $transaction->session_data();
1078 1078
 
@@ -1080,10 +1080,10 @@  discard block
 block discarded – undo
1080 1080
 
1081 1081
 
1082 1082
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1083
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1083
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1084 1084
 
1085
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->pretty_date('l F j, Y','g:i:s a') ;
1086
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1085
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a');
1086
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1087 1087
 
1088 1088
 			$this->_template_args['grand_total'] = $transaction->total();
1089 1089
 
@@ -1091,19 +1091,19 @@  discard block
 block discarded – undo
1091 1091
 			// link back to overview
1092 1092
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1093 1093
 			$this->_template_args['registration'] = $this->_registration;
1094
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1095
-			$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' ) );
1096
-			$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' ) );
1094
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1095
+			$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'));
1096
+			$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'));
1097 1097
 
1098 1098
 			//next and previous links
1099
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1100
-			$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' ) : '';
1101
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1102
-			$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' ) : '';
1099
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1100
+			$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') : '';
1101
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1102
+			$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') : '';
1103 1103
 
1104 1104
 			// grab header
1105
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1106
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1105
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1106
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1107 1107
 
1108 1108
 		} else {
1109 1109
 
@@ -1124,14 +1124,14 @@  discard block
 block discarded – undo
1124 1124
 	protected function _registration_details_metaboxes() {
1125 1125
 		$this->_set_registration_object();
1126 1126
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1127
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1128
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1129
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1130
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1127
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1128
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1129
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1130
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1131 1131
 		}
1132
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1133
-		if ( $this->_registration->group_size() > 1 ) {
1134
-			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' );
1132
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1133
+		if ($this->_registration->group_size() > 1) {
1134
+			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');
1135 1135
 		}
1136 1136
 	}
1137 1137
 
@@ -1152,23 +1152,23 @@  discard block
 block discarded – undo
1152 1152
 
1153 1153
 		//let's get an array of all possible buttons that we can just reference
1154 1154
 		$status_buttons = $this->_get_reg_status_buttons();
1155
-		$template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();
1156
-		$template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();
1155
+		$template_args['reg_status_value'] = $this->_registration->pretty_status();
1156
+		$template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();
1157 1157
 		$template_args['attendee'] = $this->_registration->attendee();
1158
-		$template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';
1159
-		if ( $this->_set_registration_object() ) {
1158
+		$template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';
1159
+		if ($this->_set_registration_object()) {
1160 1160
 			$current_status = $this->_registration->status_ID();
1161
-			unset( $status_buttons[$current_status] );
1162
-			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) {
1163
-				unset( $status_buttons[EEM_Registration::status_id_pending_payment] );
1161
+			unset($status_buttons[$current_status]);
1162
+			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) {
1163
+				unset($status_buttons[EEM_Registration::status_id_pending_payment]);
1164 1164
 			}
1165
-			$template_args['status_buttons'] = implode( "\n", $status_buttons );
1165
+			$template_args['status_buttons'] = implode("\n", $status_buttons);
1166 1166
 		}
1167 1167
 		$template_args['form_url'] = REG_ADMIN_URL;
1168 1168
 		$template_args['REG_ID'] = $this->_registration->ID();
1169
-		$template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce',  'change_reg_status_nonce', FALSE, FALSE );
1169
+		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE);
1170 1170
 
1171
-		EEH_Template::display_template( $template, $template_args );
1171
+		EEH_Template::display_template($template, $template_args);
1172 1172
 
1173 1173
 	}
1174 1174
 
@@ -1182,11 +1182,11 @@  discard block
 block discarded – undo
1182 1182
 	private function _get_reg_status_buttons() {
1183 1183
 
1184 1184
 		$buttons = array(
1185
-			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' ) . '">',
1186
-			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' ) . '">',
1187
-			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' ) . '">',
1188
-			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' ) . '">',
1189
-			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' ) . '">',
1185
+			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').'">',
1186
+			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').'">',
1187
+			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').'">',
1188
+			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').'">',
1189
+			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').'">',
1190 1190
 			);
1191 1191
 		return $buttons;
1192 1192
 	}
@@ -1200,13 +1200,13 @@  discard block
 block discarded – undo
1200 1200
 	 *
1201 1201
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1202 1202
 	 */
1203
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1204
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();
1203
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1204
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1205 1205
 
1206
-		$success = $this->_set_registration_status( $REG_ID, $status );
1206
+		$success = $this->_set_registration_status($REG_ID, $status);
1207 1207
 
1208 1208
 		//notify?
1209
-		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
1209
+		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
1210 1210
 			$this->_process_resend_registration();
1211 1211
 		}
1212 1212
 
@@ -1224,19 +1224,19 @@  discard block
 block discarded – undo
1224 1224
 	 * @param bool $status
1225 1225
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1226 1226
 	 */
1227
-	protected function _set_registration_status( $REG_ID, $status = false ) {
1227
+	protected function _set_registration_status($REG_ID, $status = false) {
1228 1228
 		$success = true;
1229 1229
 		// set default status if none is passed
1230 1230
 		$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1231 1231
 
1232 1232
 		//typecast and sanitize reg_id
1233
-		$reg_ids = array_filter( (array) $REG_ID, 'absint' );
1233
+		$reg_ids = array_filter((array) $REG_ID, 'absint');
1234 1234
 
1235 1235
 		//loop through REG_ID's and change status
1236
-		foreach ( $reg_ids as $r_id ) {
1237
-			$registration = EEM_Registration::instance()->get_one_by_ID( $r_id );
1238
-			if ( $registration instanceof EE_Registration ) {
1239
-				$registration->set_status( $status );
1236
+		foreach ($reg_ids as $r_id) {
1237
+			$registration = EEM_Registration::instance()->get_one_by_ID($r_id);
1238
+			if ($registration instanceof EE_Registration) {
1239
+				$registration->set_status($status);
1240 1240
 				$result = $registration->save();
1241 1241
 
1242 1242
 				//verifying explicit fails because update *may* just return 0 for 0 rows affected
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 		$this->_req_data['_REG_ID'] = $reg_ids;
1249 1249
 
1250 1250
 		//return $success and processed registrations
1251
-		return array( 'REG_ID' => $reg_ids, 'success' => $success );
1251
+		return array('REG_ID' => $reg_ids, 'success' => $success);
1252 1252
 	}
1253 1253
 
1254 1254
 
@@ -1260,37 +1260,37 @@  discard block
 block discarded – undo
1260 1260
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1261 1261
 	 * @return void
1262 1262
 	 */
1263
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1263
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1264 1264
 
1265
-		$result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );
1265
+		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false);
1266 1266
 
1267 1267
 
1268
-		$success = isset( $result['success'] ) && $result['success'];
1268
+		$success = isset($result['success']) && $result['success'];
1269 1269
 
1270 1270
 		//setup success message
1271
-		if ( $success ) {
1272
-			$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' ) ) ;
1273
-			EE_Error::add_success( $msg );
1271
+		if ($success) {
1272
+			$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'));
1273
+			EE_Error::add_success($msg);
1274 1274
 		} else {
1275
-			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ );
1275
+			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
1276 1276
 		}
1277 1277
 
1278
-		$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' );
1278
+		$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');
1279 1279
 		//unset nonces
1280
-		foreach ( $this->_req_data as $ref => $value ) {
1281
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1282
-				unset( $this->_req_data[$ref] );
1280
+		foreach ($this->_req_data as $ref => $value) {
1281
+			if (strpos($ref, 'nonce') !== false) {
1282
+				unset($this->_req_data[$ref]);
1283 1283
 				continue;
1284 1284
 			}
1285 1285
 
1286
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1286
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1287 1287
 			$this->_req_data[$ref] = $value;
1288 1288
 		}
1289 1289
 
1290 1290
 		//merge request vars so that the reloaded list table contains any existing filter query params
1291
-		$route = array_merge( $this->_req_data, $route );
1291
+		$route = array_merge($this->_req_data, $route);
1292 1292
 
1293
-		$this->_redirect_after_action( $success, '', '', $route, true );
1293
+		$this->_redirect_after_action($success, '', '', $route, true);
1294 1294
 
1295 1295
 		}
1296 1296
 
@@ -1303,29 +1303,29 @@  discard block
 block discarded – undo
1303 1303
 	protected function _change_reg_status() {
1304 1304
 		$this->_req_data['return'] = 'view_registration';
1305 1305
 		//set notify based on whether the send notifications toggle is set or not
1306
-		$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1307
-		$this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : '';
1306
+		$notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);
1307
+		$this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : '';
1308 1308
 
1309
-		switch ( $this->_req_data['_reg_status_id'] ) {
1310
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1311
-				$this->approve_registration( $notify );
1309
+		switch ($this->_req_data['_reg_status_id']) {
1310
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1311
+				$this->approve_registration($notify);
1312 1312
 				break;
1313
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1314
-				$this->pending_registration( $notify );
1313
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1314
+				$this->pending_registration($notify);
1315 1315
 				break;
1316
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1317
-				$this->not_approve_registration( $notify );
1316
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1317
+				$this->not_approve_registration($notify);
1318 1318
 				break;
1319
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1320
-				$this->decline_registration( $notify );
1319
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1320
+				$this->decline_registration($notify);
1321 1321
 				break;
1322
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1323
-				$this->cancel_registration( $notify );
1322
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1323
+				$this->cancel_registration($notify);
1324 1324
 				break;
1325 1325
 			default :
1326 1326
 				$result['success'] = false;
1327
-				unset( $this->_req_data['return'] );
1328
-				$this->_reg_status_change_return( '', false );
1327
+				unset($this->_req_data['return']);
1328
+				$this->_reg_status_change_return('', false);
1329 1329
 				break;
1330 1330
 		}
1331 1331
 	}
@@ -1338,8 +1338,8 @@  discard block
 block discarded – undo
1338 1338
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1339 1339
 	*		@return void
1340 1340
 	*/
1341
-	protected function approve_registration( $notify = false ) {
1342
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1341
+	protected function approve_registration($notify = false) {
1342
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1343 1343
 	}
1344 1344
 
1345 1345
 
@@ -1351,8 +1351,8 @@  discard block
 block discarded – undo
1351 1351
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1352 1352
 	*		@return void
1353 1353
 	*/
1354
-	protected function decline_registration( $notify = false ) {
1355
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1354
+	protected function decline_registration($notify = false) {
1355
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1356 1356
 	}
1357 1357
 
1358 1358
 
@@ -1364,8 +1364,8 @@  discard block
 block discarded – undo
1364 1364
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1365 1365
 	*		@return void
1366 1366
 	*/
1367
-	protected function cancel_registration( $notify = false ) {
1368
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1367
+	protected function cancel_registration($notify = false) {
1368
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1369 1369
 	}
1370 1370
 
1371 1371
 
@@ -1378,8 +1378,8 @@  discard block
 block discarded – undo
1378 1378
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1379 1379
 	*		@return void
1380 1380
 	*/
1381
-	protected function not_approve_registration( $notify = false ) {
1382
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1381
+	protected function not_approve_registration($notify = false) {
1382
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1383 1383
 	}
1384 1384
 
1385 1385
 
@@ -1390,8 +1390,8 @@  discard block
 block discarded – undo
1390 1390
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1391 1391
 	*		@return void
1392 1392
 	*/
1393
-	protected function pending_registration( $notify = false ) {
1394
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1393
+	protected function pending_registration($notify = false) {
1394
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1395 1395
 	}
1396 1396
 
1397 1397
 
@@ -1405,75 +1405,75 @@  discard block
 block discarded – undo
1405 1405
 	public function _reg_details_meta_box() {
1406 1406
 		EEH_Autoloader::register_line_item_display_autoloaders();
1407 1407
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1408
-		EE_Registry::instance()->load_Helper( 'Line_Item' );
1408
+		EE_Registry::instance()->load_Helper('Line_Item');
1409 1409
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1410 1410
 		$this->_session = $transaction->session_data();
1411 1411
 
1412 1412
 		$filters = new EE_Line_Item_Filter_Collection();
1413
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1414
-		$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1415
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1413
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1414
+		$filters->add(new EE_Non_Zero_Line_Item_Filter());
1415
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1416 1416
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1417 1417
 
1418 1418
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1419
-		$line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' );
1420
-		$this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) );
1419
+		$line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy');
1420
+		$this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration));
1421 1421
 
1422 1422
 
1423 1423
 		$attendee = $this->_registration->attendee();
1424 1424
 
1425 1425
 
1426
-		$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' ) : '';
1427
-		$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' ) : '';
1426
+		$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') : '';
1427
+		$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') : '';
1428 1428
 
1429 1429
 
1430 1430
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1431
-		$payment = $transaction->get_first_related( 'Payment' );
1431
+		$payment = $transaction->get_first_related('Payment');
1432 1432
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1433
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1433
+		$payment_method = $payment->get_first_related('Payment_Method');
1434 1434
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1435
-		$reg_status_class = 'status-' . $this->_registration->status_ID();
1435
+		$reg_status_class = 'status-'.$this->_registration->status_ID();
1436 1436
 		$reg_details = array(
1437 1437
 			'payment_method' => $payment_method->name(),
1438 1438
 			'response_msg' => $payment->gateway_response(),
1439
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1439
+			'registration_id' => $this->_registration->get('REG_code'),
1440 1440
 			'registration_session' => $this->_registration->session_ID(),
1441
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1442
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1441
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1442
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1443 1443
 			);
1444 1444
 
1445 1445
 
1446
-		if ( isset( $reg_details['registration_id'] )) {
1446
+		if (isset($reg_details['registration_id'])) {
1447 1447
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1448
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1448
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1449 1449
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1450 1450
 		}
1451 1451
 
1452
-		if ( isset( $reg_details['payment_method'] ) ) {
1452
+		if (isset($reg_details['payment_method'])) {
1453 1453
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1454
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1454
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1455 1455
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1456 1456
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1457
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1457
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1458 1458
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1459 1459
 		}
1460 1460
 
1461 1461
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1462
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1462
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1463 1463
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1464 1464
 
1465 1465
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1466
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1466
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1467 1467
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1468 1468
 
1469 1469
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1470
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1470
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1471 1471
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1472 1472
 
1473
-		$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 );
1473
+		$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);
1474 1474
 
1475
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1476
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1475
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1476
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1477 1477
 
1478 1478
 	}
1479 1479
 
@@ -1489,23 +1489,23 @@  discard block
 block discarded – undo
1489 1489
 	*/
1490 1490
 	public function _reg_questions_meta_box() {
1491 1491
 
1492
-		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 );
1493
-		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 );
1494
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 );
1495
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 );
1492
+		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1);
1493
+		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1);
1494
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1);
1495
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1);
1496 1496
 
1497
-		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') );
1497
+		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID'));
1498 1498
 
1499 1499
 		//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1500 1500
 
1501
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
1502
-		$this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups );
1501
+		EE_Registry::instance()->load_helper('Form_Fields');
1502
+		$this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups);
1503 1503
 
1504 1504
 		$this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form';
1505 1505
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1506 1506
 
1507
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1508
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1507
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1508
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1509 1509
 
1510 1510
 	}
1511 1511
 
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
 	 * 		@param 		string 		$output
1521 1521
 	 * 		@return 		string
1522 1522
 	 */
1523
-	public function form_before_question_group( $output ) {
1523
+	public function form_before_question_group($output) {
1524 1524
 		return '
1525 1525
 	<table class="form-table ee-width-100">
1526 1526
 		<tbody>
@@ -1537,13 +1537,13 @@  discard block
 block discarded – undo
1537 1537
 	 * 		@param 		string 		$output
1538 1538
 	 * 		@return 		string
1539 1539
 	 */
1540
-	public function form_after_question_group( $output ) {
1540
+	public function form_after_question_group($output) {
1541 1541
 		return  '
1542 1542
 			<tr class="hide-if-no-js">
1543 1543
 				<th> </th>
1544 1544
 				<td class="reg-admin-edit-attendee-question-td">
1545
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1546
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1545
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1546
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1547 1547
 						<div class="dashicons dashicons-edit"></div>
1548 1548
 					</a>
1549 1549
 				</td>
@@ -1563,11 +1563,11 @@  discard block
 block discarded – undo
1563 1563
 	 * 		@param 		string 		$label
1564 1564
 	 * 		@return 		string
1565 1565
 	 */
1566
-	public function form_form_field_label_wrap( $label ) {
1566
+	public function form_form_field_label_wrap($label) {
1567 1567
 		return '
1568 1568
 			<tr>
1569 1569
 				<th>
1570
-					' . $label  . '
1570
+					' . $label.'
1571 1571
 				</th>';
1572 1572
 	}
1573 1573
 
@@ -1581,10 +1581,10 @@  discard block
 block discarded – undo
1581 1581
 	 * 		@param 		string 		$label
1582 1582
 	 * 		@return 		string
1583 1583
 	 */
1584
-	public function form_form_field_input__wrap( $input ) {
1584
+	public function form_form_field_input__wrap($input) {
1585 1585
 		return '
1586 1586
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1587
-					' . $input . '
1587
+					' . $input.'
1588 1588
 				</td>
1589 1589
 			</tr>';
1590 1590
 	}
@@ -1598,13 +1598,13 @@  discard block
 block discarded – undo
1598 1598
 	*		@return void
1599 1599
 	*/
1600 1600
 	protected function _update_attendee_registration_form() {
1601
-		$qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE;
1602
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1603
-		$qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns );
1604
-		$success = $this->_save_attendee_registration_form( $REG_ID, $qstns );
1601
+		$qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE;
1602
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1603
+		$qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
1604
+		$success = $this->_save_attendee_registration_form($REG_ID, $qstns);
1605 1605
 		$what = __('Registration Form', 'event_espresso');
1606
-		$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1607
-		$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1606
+		$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1607
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1608 1608
 
1609 1609
 	}
1610 1610
 
@@ -1617,26 +1617,26 @@  discard block
 block discarded – undo
1617 1617
 	 * @param bool $qstns
1618 1618
 	 * @return bool
1619 1619
 	 */
1620
-	private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) {
1620
+	private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) {
1621 1621
 
1622
-		if ( ! $REG_ID || ! $qstns ) {
1623
-			EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1622
+		if ( ! $REG_ID || ! $qstns) {
1623
+			EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1624 1624
 		}
1625 1625
 		$success = TRUE;
1626 1626
 
1627 1627
 		// allow others to get in on this awesome fun   :D
1628
-		do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns );
1628
+		do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns);
1629 1629
 		// loop thru questions... FINALLY!!!
1630 1630
 
1631
-		foreach ( $qstns as $QST_ID => $qstn ) {
1631
+		foreach ($qstns as $QST_ID => $qstn) {
1632 1632
 			//if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
1633
-			if ( !is_array($qstn) ) {
1634
-				$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
1633
+			if ( ! is_array($qstn)) {
1634
+				$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
1635 1635
 				continue;
1636 1636
 			}
1637 1637
 
1638 1638
 
1639
-			foreach ( $qstn as $ANS_ID => $ANS_value ) {
1639
+			foreach ($qstn as $ANS_ID => $ANS_value) {
1640 1640
 				//get answer
1641 1641
 				$query_params = array(
1642 1642
 					0 => array(
@@ -1647,8 +1647,8 @@  discard block
 block discarded – undo
1647 1647
 					);
1648 1648
 				$answer = EEM_Answer::instance()->get_one($query_params);
1649 1649
 				//this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
1650
-				if ( ! $answer instanceof EE_Answer ) {
1651
-					$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
1650
+				if ( ! $answer instanceof EE_Answer) {
1651
+					$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
1652 1652
 					continue 2;
1653 1653
 				}
1654 1654
 
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
 
1663 1663
 
1664 1664
 	//TODO: try changing this to use the model directly... not indirectly through creating a default object...
1665
-	private function _save_new_answer( $REG_ID, $QST_ID, $ans ) {
1665
+	private function _save_new_answer($REG_ID, $QST_ID, $ans) {
1666 1666
 		$set_values = array(
1667 1667
 			'QST_ID' => $QST_ID,
1668 1668
 			'REG_ID' => $REG_ID,
@@ -1689,30 +1689,30 @@  discard block
 block discarded – undo
1689 1689
 		$registrations = $REG->get_all(array(
1690 1690
 			array(
1691 1691
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1692
-				'REG_ID'=>array('!=',$this->_registration->ID())
1692
+				'REG_ID'=>array('!=', $this->_registration->ID())
1693 1693
 			),
1694 1694
 			'force_join'=>array('Attendee')));
1695 1695
 
1696 1696
 		$this->_template_args['attendees'] = array();
1697 1697
 		$this->_template_args['attendee_notice'] = '';
1698 1698
 		EE_Registry::instance()->load_helper('Array');
1699
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1700
-			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__ );
1699
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1700
+			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__);
1701 1701
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1702 1702
 		} else {
1703 1703
 
1704 1704
 			$att_nmbr = 1;
1705
-			foreach ( $registrations as $registration ) {
1705
+			foreach ($registrations as $registration) {
1706 1706
 				/* @var $registration EE_Registration */
1707 1707
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1708
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1709
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1710
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1711
-				$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 : '';
1708
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1709
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1710
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1711
+				$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 : '';
1712 1712
 
1713
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1713
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1714 1714
 
1715
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1715
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1716 1716
 
1717 1717
 				$att_nmbr++;
1718 1718
 			}
@@ -1724,8 +1724,8 @@  discard block
 block discarded – undo
1724 1724
 
1725 1725
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1726 1726
 		}
1727
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1728
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1727
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1728
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1729 1729
 
1730 1730
 	}
1731 1731
 
@@ -1746,11 +1746,11 @@  discard block
 block discarded – undo
1746 1746
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1747 1747
 
1748 1748
 		//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)
1749
-		if ( ! $this->_registration->is_primary_registrant() ) {
1749
+		if ( ! $this->_registration->is_primary_registrant()) {
1750 1750
 			$primary_registration = $this->_registration->get_primary_registration();
1751 1751
 			$primary_attendee = $primary_registration->attendee();
1752 1752
 
1753
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1753
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1754 1754
 				//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.
1755 1755
 				$primary_registration = NULL;
1756 1756
 			}
@@ -1759,28 +1759,28 @@  discard block
 block discarded – undo
1759 1759
 		}
1760 1760
 
1761 1761
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1762
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1763
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1764
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1762
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1763
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1764
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1765 1765
 		$this->_template_args['phone'] = $attendee->phone();
1766 1766
 
1767
-		EE_Registry::instance()->load_helper( 'Formatter' );
1768
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1767
+		EE_Registry::instance()->load_helper('Formatter');
1768
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1769 1769
 
1770 1770
 
1771 1771
 		//edit link
1772
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1773
-		$this->_template_args['att_edit_label'] = __('View/Edit Contact' );
1772
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1773
+		$this->_template_args['att_edit_label'] = __('View/Edit Contact');
1774 1774
 
1775 1775
 		//create link
1776
-		$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 ): '';
1776
+		$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) : '';
1777 1777
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1778 1778
 
1779 1779
 		$this->_template_args['att_check'] = $att_check;
1780 1780
 
1781 1781
 
1782
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1783
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1782
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1783
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1784 1784
 	}
1785 1785
 
1786 1786
 
@@ -1793,7 +1793,7 @@  discard block
 block discarded – undo
1793 1793
 	 * @access protected
1794 1794
 	 * @return void
1795 1795
 	 */
1796
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1796
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1797 1797
 		$REGM = EEM_Registration::instance();
1798 1798
 
1799 1799
 		$success = 1;
@@ -1803,26 +1803,26 @@  discard block
 block discarded – undo
1803 1803
 		$dtts = array();
1804 1804
 
1805 1805
 		//if empty _REG_ID then get out because there's nothing to do
1806
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1806
+		if (empty($this->_req_data['_REG_ID'])) {
1807 1807
 			$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');
1808
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1809
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1808
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1809
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1810 1810
 		}
1811 1811
 
1812 1812
 		//Checkboxes
1813
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1813
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1814 1814
 			// if array has more than one element than success message should be plural
1815
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1815
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1816 1816
 			// cycle thru checkboxes
1817
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1817
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1818 1818
 
1819 1819
 				$REG = $REGM->get_one_by_ID($REG_ID);
1820 1820
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1821
-				if ( $payment_count > 0 ) {
1822
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
1821
+				if ($payment_count > 0) {
1822
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
1823 1823
 					$error = 1;
1824 1824
 					$success = 0;
1825
-					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__ );
1825
+					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__);
1826 1826
 					continue; //can't trash this registration because it has payments.
1827 1827
 				}
1828 1828
 				$ticket = $REG->get_first_related('Ticket');
@@ -1831,7 +1831,7 @@  discard block
 block discarded – undo
1831 1831
 				$dtts = array_merge($dtts, $dtt);
1832 1832
 
1833 1833
 				$updated = $trash ? $REG->delete() : $REG->restore();
1834
-				if ( !$updated ) {
1834
+				if ( ! $updated) {
1835 1835
 					$success = 0;
1836 1836
 				} else {
1837 1837
 					$success = 2;
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
 			$tickets[$ticket->ID()] = $ticket;
1847 1847
 			$dtts = $ticket->get_many_related('Datetime');
1848 1848
 			$updated = $trash ? $REG->delete() : $REG->restore();
1849
-			if ( ! $updated ) {
1849
+			if ( ! $updated) {
1850 1850
 				$success = 0;
1851 1851
 			}
1852 1852
 
@@ -1856,10 +1856,10 @@  discard block
 block discarded – undo
1856 1856
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1857 1857
 		EEM_Datetime::instance()->update_sold($dtts);
1858 1858
 
1859
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1860
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1859
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1860
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1861 1861
 		$overwrite_msgs = $error ? TRUE : FALSE;
1862
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1862
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1863 1863
 	}
1864 1864
 
1865 1865
 
@@ -1883,16 +1883,16 @@  discard block
 block discarded – undo
1883 1883
 		$success = 1;
1884 1884
 
1885 1885
 		//Checkboxes
1886
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1886
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1887 1887
 			// if array has more than one element than success message should be plural
1888
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1888
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1889 1889
 			// cycle thru checkboxes
1890
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1890
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1891 1891
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1892
-				if ( ! $REG instanceof EE_Registration )
1892
+				if ( ! $REG instanceof EE_Registration)
1893 1893
 					continue;
1894 1894
 				$deleted = $this->_delete_registration($REG);
1895
-				if ( !$deleted ) {
1895
+				if ( ! $deleted) {
1896 1896
 					$success = 0;
1897 1897
 				}
1898 1898
 			}
@@ -1902,15 +1902,15 @@  discard block
 block discarded – undo
1902 1902
 			$REG_ID = $this->_req_data['_REG_ID'];
1903 1903
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
1904 1904
 			$deleted = $this->_delete_registration($REG);
1905
-			if ( ! $deleted ) {
1905
+			if ( ! $deleted) {
1906 1906
 				$success = 0;
1907 1907
 			}
1908 1908
 
1909 1909
 		}
1910 1910
 
1911
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1912
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
1913
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
1911
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1912
+		$action_desc = __('permanently deleted.', 'event_espresso');
1913
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
1914 1914
 	}
1915 1915
 
1916 1916
 
@@ -1922,31 +1922,31 @@  discard block
 block discarded – undo
1922 1922
 	 * @param  EE_Registration $REG registration to be deleted permenantly
1923 1923
 	 * @return boolean              true = successful deletion, false = fail.
1924 1924
 	 */
1925
-	protected function _delete_registration( EE_Registration $REG ) {
1925
+	protected function _delete_registration(EE_Registration $REG) {
1926 1926
 		//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.
1927 1927
 		$TXN = $REG->get_first_related('Transaction');
1928 1928
 		$REGS = $TXN->get_many_related('Registration');
1929 1929
 
1930 1930
 		$all_trashed = TRUE;
1931
-		foreach ( $REGS as $registration ) {
1932
-			if ( ! $registration->get('REG_deleted') )
1931
+		foreach ($REGS as $registration) {
1932
+			if ( ! $registration->get('REG_deleted'))
1933 1933
 				$all_trashed = FALSE;
1934 1934
 		}
1935 1935
 
1936
-		if ( ! $all_trashed ) {
1937
-			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__ );
1936
+		if ( ! $all_trashed) {
1937
+			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__);
1938 1938
 			return false;
1939 1939
 		}
1940 1940
 
1941 1941
 		//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).
1942
-		foreach ( $REGS as $registration ) {
1942
+		foreach ($REGS as $registration) {
1943 1943
 
1944 1944
 			//delete related answers
1945 1945
 			$registration->delete_related_permanently('Answer');
1946 1946
 
1947 1947
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
1948 1948
 			$attendee = $registration->get_first_related('Attendee');
1949
-			if ( $attendee instanceof EE_Attendee ) {
1949
+			if ($attendee instanceof EE_Attendee) {
1950 1950
 				$registration->_remove_relation_to($attendee, 'Attendee');
1951 1951
 			}
1952 1952
 
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
 			//now delete permanently the checkins related to this registration.
1957 1957
 			$registration->delete_related_permanently('Checkin');
1958 1958
 
1959
-			if ( $registration->ID() === $REG->ID() )
1959
+			if ($registration->ID() === $REG->ID())
1960 1960
 				continue; //we don't want to delete permanently the existing registration just yet.
1961 1961
 
1962 1962
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -1989,34 +1989,34 @@  discard block
 block discarded – undo
1989 1989
 	 * @return void
1990 1990
 	 */
1991 1991
 	public function new_registration() {
1992
-		if ( ! $this->_set_reg_event() ) {
1993
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
1992
+		if ( ! $this->_set_reg_event()) {
1993
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
1994 1994
 		}
1995
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
1995
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
1996 1996
 
1997 1997
 		// gotta start with a clean slate if we're not coming here via ajax
1998
-		if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) {
1999
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
1998
+		if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) {
1999
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2000 2000
 		}
2001 2001
 
2002
-		$this->_template_args['event_name'] = '' ;
2002
+		$this->_template_args['event_name'] = '';
2003 2003
 		// event name
2004
-		if ( $this->_reg_event ) {
2004
+		if ($this->_reg_event) {
2005 2005
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2006
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2007
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2008
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2006
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2007
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2008
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2009 2009
 		}
2010 2010
 
2011 2011
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2012 2012
 
2013
-		if ( defined('DOING_AJAX' ) )
2013
+		if (defined('DOING_AJAX'))
2014 2014
 			$this->_return_json();
2015 2015
 
2016 2016
 
2017 2017
 		// grab header
2018
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2019
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2018
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2019
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2020 2020
 
2021 2021
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2022 2022
 		// the details template wrapper
@@ -2034,7 +2034,7 @@  discard block
 block discarded – undo
2034 2034
 	 */
2035 2035
 	protected function _get_registration_step_content() {
2036 2036
 
2037
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php';
2037
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php';
2038 2038
 		$template_args = array(
2039 2039
 			'title' => '',
2040 2040
 			'content' => '',
@@ -2055,11 +2055,11 @@  discard block
 block discarded – undo
2055 2055
 
2056 2056
 		//if the cart is empty then we know we're at step one so we'll display ticket selector
2057 2057
 		$cart = EE_Registry::instance()->SSN->get_session_data('cart');
2058
-		$step = empty( $cart ) ? 'ticket' : 'questions';
2059
-		switch ( $step ) {
2058
+		$step = empty($cart) ? 'ticket' : 'questions';
2059
+		switch ($step) {
2060 2060
 			case 'ticket' :
2061 2061
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2062
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2062
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2063 2063
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2064 2064
 				$template_args['show_notification_toggle'] = FALSE;
2065 2065
 				break;
@@ -2072,9 +2072,9 @@  discard block
 block discarded – undo
2072 2072
 				break;
2073 2073
 		}
2074 2074
 
2075
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2075
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2076 2076
 
2077
-		return EEH_Template::display_template( $template_path, $template_args, TRUE );
2077
+		return EEH_Template::display_template($template_path, $template_args, TRUE);
2078 2078
 	}
2079 2079
 
2080 2080
 
@@ -2088,11 +2088,11 @@  discard block
 block discarded – undo
2088 2088
 	*		@return boolean
2089 2089
 	*/
2090 2090
 	private function _set_reg_event() {
2091
-		if ( is_object( $this->_reg_event )) {
2091
+		if (is_object($this->_reg_event)) {
2092 2092
 			return TRUE;
2093 2093
 		}
2094
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2095
-		if ( ! $EVT_ID ) {
2094
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2095
+		if ( ! $EVT_ID) {
2096 2096
 			return FALSE;
2097 2097
 		}
2098 2098
 
@@ -2113,62 +2113,62 @@  discard block
 block discarded – undo
2113 2113
 	public function process_reg_step() {
2114 2114
 
2115 2115
 		$this->_set_reg_event();
2116
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2116
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2117 2117
 
2118 2118
 		//what step are we on?
2119
-		$cart = EE_Registry::instance()->SSN->get_session_data( 'cart' );
2120
-		$step = empty( $cart ) ? 'ticket' : 'questions';
2119
+		$cart = EE_Registry::instance()->SSN->get_session_data('cart');
2120
+		$step = empty($cart) ? 'ticket' : 'questions';
2121 2121
 
2122 2122
 		//if doing ajax then we need to verify the nonce
2123
-		if ( 'DOING_AJAX' ) {
2124
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2125
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2123
+		if ('DOING_AJAX') {
2124
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2125
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2126 2126
 		}
2127 2127
 
2128
-		switch ( $step ) {
2128
+		switch ($step) {
2129 2129
 			case 'ticket' :
2130 2130
 				//process ticket selection
2131 2131
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2132
-				if ( $success ) {
2133
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2132
+				if ($success) {
2133
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2134 2134
 				} else {
2135 2135
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2136 2136
 				}
2137
-				if ( defined('DOING_AJAX') ) {
2137
+				if (defined('DOING_AJAX')) {
2138 2138
 					$this->new_registration(); //display next step
2139 2139
 				} else {
2140 2140
 					$query_args['action'] = 'new_registration';
2141 2141
 					$query_args['processing_registration'] = true;
2142 2142
 					$query_args['event_id'] = $this->_reg_event->ID();
2143
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2143
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2144 2144
 				}
2145 2145
 				break;
2146 2146
 			case 'questions' :
2147
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2148
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2147
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2148
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2149 2149
 				}
2150 2150
 				//process registration
2151 2151
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2152
-				if ( ! $transaction instanceof EE_Transaction ) {
2152
+				if ( ! $transaction instanceof EE_Transaction) {
2153 2153
 					$query_args = array(
2154 2154
 						'action' => 'new_registration',
2155 2155
 						'processing_registration' => true,
2156 2156
 						'event_id' => $this->_reg_event->ID()
2157 2157
 					);
2158 2158
 
2159
-					if ( defined('DOING_AJAX' )) {
2159
+					if (defined('DOING_AJAX')) {
2160 2160
 						//display registration form again because there are errors (maybe validation?)
2161 2161
 						$this->new_registration();
2162 2162
 						return;
2163 2163
 					} else {
2164
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2164
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2165 2165
 						return;
2166 2166
 					}
2167 2167
 				}
2168 2168
 				/** @type EE_Transaction_Payments $transaction_payments */
2169
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2169
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2170 2170
 				// maybe update status, and make sure to save transaction if not done already
2171
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2171
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2172 2172
 					$transaction->save();
2173 2173
 				}
2174 2174
 				$query_args = array(
@@ -2176,8 +2176,8 @@  discard block
 block discarded – undo
2176 2176
 					'TXN_ID' => $transaction->ID(),
2177 2177
 					'page' => 'espresso_transactions'
2178 2178
 				);
2179
-				EE_Error::add_success( __('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso') );
2180
-				$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2179
+				EE_Error::add_success(__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso'));
2180
+				$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2181 2181
 				break;
2182 2182
 			}
2183 2183
 
@@ -2197,7 +2197,7 @@  discard block
 block discarded – undo
2197 2197
 	*		@return void
2198 2198
 	*/
2199 2199
 	protected function _attendee_contact_list_table() {
2200
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2200
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2201 2201
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2202 2202
 		$this->display_admin_list_table_page_with_no_sidebar();
2203 2203
 	}
@@ -2212,10 +2212,10 @@  discard block
 block discarded – undo
2212 2212
 	*		@access public
2213 2213
 	*		@return array
2214 2214
 	*/
2215
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2215
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2216 2216
 
2217
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2218
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2217
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2218
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2219 2219
 		$ATT_MDL = EEM_Attendee::instance();
2220 2220
 
2221 2221
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2243,47 +2243,47 @@  discard block
 block discarded – undo
2243 2243
 				$orderby = 'ATT_lname';
2244 2244
 		}
2245 2245
 
2246
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2246
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2247 2247
 
2248
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2249
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2250
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2248
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2249
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2250
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2251 2251
 
2252 2252
 		$_where = array();
2253 2253
 
2254
-		if ( isset( $this->_req_data['s'] ) ) {
2255
-			$sstr = '%' . $this->_req_data['s'] . '%';
2254
+		if (isset($this->_req_data['s'])) {
2255
+			$sstr = '%'.$this->_req_data['s'].'%';
2256 2256
 			$_where['OR'] = array(
2257
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2258
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2259
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2260
-				'ATT_fname' => array( 'LIKE', $sstr ),
2261
-				'ATT_lname' => array( 'LIKE', $sstr ),
2262
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2263
-				'ATT_email' => array('LIKE', $sstr ),
2264
-				'ATT_address' => array( 'LIKE', $sstr ),
2265
-				'ATT_address2' => array( 'LIKE', $sstr ),
2266
-				'ATT_city' => array( 'LIKE', $sstr ),
2267
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2268
-				'State.STA_name' => array('LIKE', $sstr ),
2269
-				'ATT_phone' => array( 'LIKE', $sstr ),
2270
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2271
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2272
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2273
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2257
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2258
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2259
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2260
+				'ATT_fname' => array('LIKE', $sstr),
2261
+				'ATT_lname' => array('LIKE', $sstr),
2262
+				'ATT_short_bio' => array('LIKE', $sstr),
2263
+				'ATT_email' => array('LIKE', $sstr),
2264
+				'ATT_address' => array('LIKE', $sstr),
2265
+				'ATT_address2' => array('LIKE', $sstr),
2266
+				'ATT_city' => array('LIKE', $sstr),
2267
+				'Country.CNT_name' => array('LIKE', $sstr),
2268
+				'State.STA_name' => array('LIKE', $sstr),
2269
+				'ATT_phone' => array('LIKE', $sstr),
2270
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2271
+				'Registration.REG_code' => array('LIKE', $sstr),
2272
+				'Registration.REG_count' => array('LIKE', $sstr),
2273
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2274 2274
 				);
2275 2275
 		}
2276 2276
 
2277 2277
 
2278
-		$offset = ($current_page-1)*$per_page;
2279
-		$limit = $count ? NULL : array( $offset, $per_page );
2278
+		$offset = ($current_page - 1) * $per_page;
2279
+		$limit = $count ? NULL : array($offset, $per_page);
2280 2280
 
2281
-		if ( $trash ) {
2282
-			$_where['status'] = array( '!=', 'publish' );
2283
-			$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));
2281
+		if ($trash) {
2282
+			$_where['status'] = array('!=', 'publish');
2283
+			$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));
2284 2284
 		} else {
2285
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2286
-			$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) );
2285
+			$_where['status'] = array('IN', array('publish'));
2286
+			$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));
2287 2287
 		}
2288 2288
 
2289 2289
 		return $all_attendees;
@@ -2300,10 +2300,10 @@  discard block
 block discarded – undo
2300 2300
 	 */
2301 2301
 	protected function _resend_registration() {
2302 2302
 		$this->_process_resend_registration();
2303
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2303
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2304 2304
 			'action' => 'default'
2305 2305
 		);
2306
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2306
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2307 2307
 	}
2308 2308
 
2309 2309
 
@@ -2311,27 +2311,27 @@  discard block
 block discarded – undo
2311 2311
 
2312 2312
 
2313 2313
 
2314
-	public function _registrations_report(){
2315
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2316
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2314
+	public function _registrations_report() {
2315
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2316
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2317 2317
 				array(
2318 2318
 					'page' => 'espresso_batch',
2319 2319
 					'batch' => 'file',
2320
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2321
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2322
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2323
-				)) );
2320
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2321
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2322
+					'return_url' => urlencode($this->_req_data['return_url']),
2323
+				)));
2324 2324
 		} else {
2325
-			EE_Registry::instance()->load_helper( 'File' );
2325
+			EE_Registry::instance()->load_helper('File');
2326 2326
 			$new_request_args = array(
2327 2327
 				'export' => 'report',
2328 2328
 				'action' => 'registrations_report_for_event',
2329
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2329
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2330 2330
 			);
2331 2331
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2332 2332
 
2333
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2334
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2333
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2334
+				require_once(EE_CLASSES.'EE_Export.class.php');
2335 2335
 				$EE_Export = EE_Export::instance($this->_req_data);
2336 2336
 				$EE_Export->export();
2337 2337
 			}
@@ -2340,28 +2340,28 @@  discard block
 block discarded – undo
2340 2340
 
2341 2341
 
2342 2342
 
2343
-	public function _contact_list_export(){
2344
-		EE_Registry::instance()->load_helper( 'File' );
2345
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2346
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2343
+	public function _contact_list_export() {
2344
+		EE_Registry::instance()->load_helper('File');
2345
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2346
+			require_once(EE_CLASSES.'EE_Export.class.php');
2347 2347
 			$EE_Export = EE_Export::instance($this->_req_data);
2348 2348
 			$EE_Export->export_attendees();
2349 2349
 		}
2350 2350
 	}
2351 2351
 
2352
-	public function _contact_list_report(){
2353
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2354
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2352
+	public function _contact_list_report() {
2353
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2354
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2355 2355
 				array(
2356 2356
 					'page' => 'espresso_batch',
2357 2357
 					'batch' => 'file',
2358
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2359
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2360
-				)) );
2358
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2359
+					'return_url' => urlencode($this->_req_data['return_url']),
2360
+				)));
2361 2361
 		} else {
2362
-			EE_Registry::instance()->load_helper( 'File' );
2363
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2364
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2362
+			EE_Registry::instance()->load_helper('File');
2363
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2364
+				require_once(EE_CLASSES.'EE_Export.class.php');
2365 2365
 				$EE_Export = EE_Export::instance($this->_req_data);
2366 2366
 				$EE_Export->report_attendees();
2367 2367
 			}
@@ -2381,73 +2381,73 @@  discard block
 block discarded – undo
2381 2381
 	 * @return void
2382 2382
 	 */
2383 2383
 	protected function _duplicate_attendee() {
2384
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2384
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2385 2385
 		//verify we have necessary info
2386
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2387
-			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__ );
2388
-			$query_args = array( 'action' => $action );
2386
+		if (empty($this->_req_data['_REG_ID'])) {
2387
+			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__);
2388
+			$query_args = array('action' => $action);
2389 2389
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2390 2390
 		}
2391 2391
 
2392 2392
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2393
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2393
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2394 2394
 		$attendee = $registration->attendee();
2395 2395
 
2396 2396
 		//remove relation of existing attendee on registration
2397
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2397
+		$registration->_remove_relation_to($attendee, 'Attendee');
2398 2398
 		//new attendee
2399 2399
 		$new_attendee = clone $attendee;
2400
-		$new_attendee->set( 'ATT_ID', 0 );
2400
+		$new_attendee->set('ATT_ID', 0);
2401 2401
 		$new_attendee->save();
2402 2402
 
2403 2403
 		//add new attendee to reg
2404
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2404
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2405 2405
 
2406
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2406
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2407 2407
 
2408 2408
 		//redirect to edit page for attendee
2409
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2409
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2410 2410
 
2411
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2411
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2412 2412
 	}
2413 2413
 
2414 2414
 
2415 2415
 	//related to cpt routes
2416 2416
 	protected function _insert_update_cpt_item($post_id, $post) {
2417 2417
 		$success = true;
2418
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2418
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2419 2419
 		//for attendee updates
2420
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2420
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2421 2421
 			//note we should only be UPDATING attendees at this point.
2422 2422
 			$updated_fields = array(
2423 2423
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2424 2424
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2425
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2425
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2426 2426
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2427 2427
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2428
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2429
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2430
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2431
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2432
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2433
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2428
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2429
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2430
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2431
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2432
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2433
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2434 2434
 				);
2435
-			foreach ( $updated_fields as $field => $value ) {
2435
+			foreach ($updated_fields as $field => $value) {
2436 2436
 				$attendee->set($field, $value);
2437 2437
 			}
2438 2438
 
2439 2439
 			$success = $attendee->save();
2440 2440
 
2441
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2442
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2443
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2444
-					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 ) );
2441
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2442
+			foreach ($attendee_update_callbacks as $a_callback) {
2443
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2444
+					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));
2445 2445
 				}
2446 2446
 			}
2447 2447
 		}
2448 2448
 
2449
-		if ( $success === FALSE )
2450
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2449
+		if ($success === FALSE)
2450
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2451 2451
 
2452 2452
 	}
2453 2453
 
@@ -2467,17 +2467,17 @@  discard block
 block discarded – undo
2467 2467
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2468 2468
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2469 2469
 
2470
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2471
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2470
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2471
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2472 2472
 		}
2473 2473
 
2474
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2474
+		if (post_type_supports('espresso_attendees', 'comments')) {
2475 2475
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2476 2476
 		}
2477 2477
 
2478
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2479
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2480
-		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');
2478
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2479
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2480
+		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');
2481 2481
 	}
2482 2482
 
2483 2483
 
@@ -2486,10 +2486,10 @@  discard block
 block discarded – undo
2486 2486
 	 * @param  WP_Post $post wp post object
2487 2487
 	 * @return string        attendee contact info ( and form )
2488 2488
 	 */
2489
-	public function attendee_contact_info( $post ) {
2489
+	public function attendee_contact_info($post) {
2490 2490
 		//get attendee object ( should already have it )
2491 2491
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2492
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2492
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2493 2493
 		EEH_Template::display_template($template, $this->_template_args);
2494 2494
 	}
2495 2495
 
@@ -2505,12 +2505,12 @@  discard block
 block discarded – undo
2505 2505
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2506 2506
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2507 2507
 				new EE_Question_Form_Input(
2508
-				EE_Question::new_instance( array(
2508
+				EE_Question::new_instance(array(
2509 2509
 					'QST_ID' => 0,
2510 2510
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2511 2511
 					'QST_system' => 'admin-state'
2512 2512
 					)),
2513
-				EE_Answer::new_instance( array(
2513
+				EE_Answer::new_instance(array(
2514 2514
 					'ANS_ID' => 0,
2515 2515
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2516 2516
 					)),
@@ -2523,12 +2523,12 @@  discard block
 block discarded – undo
2523 2523
 			));
2524 2524
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2525 2525
 				new EE_Question_Form_Input(
2526
-				EE_Question::new_instance( array(
2526
+				EE_Question::new_instance(array(
2527 2527
 					'QST_ID' => 0,
2528 2528
 					'QST_display_text' => __('Country', 'event_espresso'),
2529 2529
 					'QST_system' => 'admin-country'
2530 2530
 					)),
2531
-				EE_Answer::new_instance( array(
2531
+				EE_Answer::new_instance(array(
2532 2532
 					'ANS_ID' => 0,
2533 2533
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2534 2534
 					)),
@@ -2539,8 +2539,8 @@  discard block
 block discarded – undo
2539 2539
 					'append_qstn_id' => FALSE
2540 2540
 					)
2541 2541
 				));
2542
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2543
-		EEH_Template::display_template($template, $this->_template_args );
2542
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2543
+		EEH_Template::display_template($template, $this->_template_args);
2544 2544
 
2545 2545
 	}
2546 2546
 
@@ -2550,11 +2550,11 @@  discard block
 block discarded – undo
2550 2550
 	*		@access protected
2551 2551
 	*		@return void
2552 2552
 	*/
2553
-	public function attendee_registrations_meta_box( $post ) {
2553
+	public function attendee_registrations_meta_box($post) {
2554 2554
 
2555 2555
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2556 2556
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2557
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2557
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2558 2558
 		EEH_Template::display_template($template, $this->_template_args);
2559 2559
 
2560 2560
 	}
@@ -2568,8 +2568,8 @@  discard block
 block discarded – undo
2568 2568
 	 * @return string        html for new form.
2569 2569
 	 */
2570 2570
 	public function after_title_form_fields($post) {
2571
-		if ( $post->post_type == 'espresso_attendees' ) {
2572
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2571
+		if ($post->post_type == 'espresso_attendees') {
2572
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2573 2573
 			$template_args['attendee'] = $this->_cpt_model_obj;
2574 2574
 			EEH_Template::display_template($template, $template_args);
2575 2575
 		}
@@ -2586,21 +2586,21 @@  discard block
 block discarded – undo
2586 2586
 	*		@access protected
2587 2587
 	*		@return void
2588 2588
 	*/
2589
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2589
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2590 2590
 
2591
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2591
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2592 2592
 
2593 2593
 		$ATT_MDL = EEM_Attendee::instance();
2594 2594
 
2595 2595
 		$success = 1;
2596 2596
 		//Checkboxes
2597
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2597
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2598 2598
 			// if array has more than one element than success message should be plural
2599
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2599
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2600 2600
 			// cycle thru checkboxes
2601
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2602
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2603
-				if ( !$updated ) {
2601
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2602
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2603
+				if ( ! $updated) {
2604 2604
 					$success = 0;
2605 2605
 				}
2606 2606
 			}
@@ -2609,18 +2609,18 @@  discard block
 block discarded – undo
2609 2609
 			// grab single id and delete
2610 2610
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2611 2611
 			//get attendee
2612
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2612
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2613 2613
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2614 2614
 			$updated = $att->save();
2615
-			if ( ! $updated ) {
2615
+			if ( ! $updated) {
2616 2616
 				$success = 0;
2617 2617
 			}
2618 2618
 
2619 2619
 		}
2620 2620
 
2621
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2622
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2623
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2621
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2622
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2623
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2624 2624
 
2625 2625
 	}
2626 2626
 
Please login to merge, or discard this patch.
admin/extend/messages/espresso_events_Messages_Hooks_Extend.class.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @param \EE_Admin_Page $admin_page
24 24
 	 */
25
-	public function __construct( EE_Admin_Page $admin_page ) {
25
+	public function __construct(EE_Admin_Page $admin_page) {
26 26
 		/**
27 27
 		 * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages
28 28
 		 */
29 29
 		if (
30
-			! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' )
30
+			! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')
31 31
 		) {
32 32
 			return;
33 33
 		}
34 34
 		add_filter(
35 35
 			'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
36
-			array( $this, 'caf_updates' ),
36
+			array($this, 'caf_updates'),
37 37
 			10
38 38
 		);
39
-		parent::__construct( $admin_page );
39
+		parent::__construct($admin_page);
40 40
 	}
41 41
 
42 42
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function _extend_properties() {
51 51
 
52
-		define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' );
52
+		define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/');
53 53
 		$this->_ajax_func = array(
54 54
 			'ee_msgs_create_new_custom' => 'create_new_custom'
55 55
 			);
56 56
 		$this->_metaboxes = array(
57 57
 			0 => array(
58
-				'page_route' => array('edit','create_new'),
58
+				'page_route' => array('edit', 'create_new'),
59 59
 				'func' => 'messages_metabox',
60 60
 				'label' => __('Notifications', 'event_espresso'),
61 61
 				'priority' => 'high'
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 		$this->_scripts_styles = array(
67 67
 			'registers' => array(
68 68
 				'events_msg_admin' => array(
69
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js',
69
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js',
70 70
 					'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array')
71 71
 				),
72 72
 				'events_msg_admin_css' => array(
73
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css',
73
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css',
74 74
 					'type' => 'css'
75 75
 				)
76 76
 			),
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 
85
-	public function caf_updates( $update_callbacks ) {
86
-		$update_callbacks[] = array( $this, 'attach_evt_message_templates' );
85
+	public function caf_updates($update_callbacks) {
86
+		$update_callbacks[] = array($this, 'attach_evt_message_templates');
87 87
 		return $update_callbacks;
88 88
 	}
89 89
 
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 	 * @param  array    $data   The request data from the form
98 98
 	 * @return bool     		success or fail
99 99
 	 */
100
-	public function attach_evt_message_templates( $event, $data ) {
100
+	public function attach_evt_message_templates($event, $data) {
101 101
 		//first we remove all existing relations on the Event for message types.
102 102
 		$event->_remove_relations('Message_Template_Group');
103 103
 		//now let's just loop through the selected templates and add relations!
104
-		foreach( $data['event_message_templates_relation'] as $grp_ID ) {
105
-			$event->_add_relation_to( $grp_ID, 'Message_Template_Group' );
104
+		foreach ($data['event_message_templates_relation'] as $grp_ID) {
105
+			$event->_add_relation_to($grp_ID, 'Message_Template_Group');
106 106
 		}
107 107
 		//now save
108 108
 		return $event->save();
@@ -116,25 +116,25 @@  discard block
 block discarded – undo
116 116
 	 * @return string
117 117
 	 * @throws \EE_Error
118 118
 	 */
119
-	public function messages_metabox( $event, $callback_args ) {
119
+	public function messages_metabox($event, $callback_args) {
120 120
 		//let's get the active messengers (b/c messenger objects have the active message templates)
121 121
 		//convert 'evt_id' to 'EVT_ID'
122
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL;
123
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] )
122
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
123
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID'])
124 124
 			? $this->_req_data['post']
125 125
 			: $this->_req_data['EVT_ID'];
126 126
 
127
-		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] )
127
+		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id'])
128 128
 			? $this->_req_data['evt_id']
129 129
 			: $this->_req_data['EVT_ID'];
130 130
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
131
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
131
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
132 132
 		$active_messengers = $message_resource_manager->active_messengers();
133 133
 		$tabs = array();
134 134
 
135 135
 		//empty messengers?
136 136
 		//Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected.
137
-		if ( empty( $active_messengers ) ) {
137
+		if (empty($active_messengers)) {
138 138
 			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(
139 139
 				array('action' => 'settings'),
140 140
 				EE_MSG_ADMIN_URL
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 				__('There are no active messengers. So no notifications will go out for %1$sany%2$s events.  You will want to %3$sActivate a Messenger%4$s.', 'event_espresso'),
144 144
 				'<strong>',
145 145
 				'</strong>',
146
-				'<a href="' . $msg_activate_url . '">',
146
+				'<a href="'.$msg_activate_url.'">',
147 147
 				'</a>'
148 148
 			);
149
-			$error_content = '<div class="error"><p>' . $error_msg . '</p></div>';
150
-			$internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>';
149
+			$error_content = '<div class="error"><p>'.$error_msg.'</p></div>';
150
+			$internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>';
151 151
 
152 152
 			echo $error_content;
153 153
 			echo $internal_content;
@@ -156,45 +156,45 @@  discard block
 block discarded – undo
156 156
 
157 157
 		$event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
158 158
 		//get content for active messengers
159
-		foreach ( $active_messengers as $name => $messenger ) {
159
+		foreach ($active_messengers as $name => $messenger) {
160 160
 			//first check if there are any active message types for this messenger.
161
-			$active_mts = $message_resource_manager->get_active_message_types_for_messenger( $name );
162
-			if ( empty( $active_mts ) ) {
161
+			$active_mts = $message_resource_manager->get_active_message_types_for_messenger($name);
162
+			if (empty($active_mts)) {
163 163
 				continue;
164 164
 			}
165 165
 
166 166
 			$tab_content = $messenger->get_messenger_admin_page_content(
167 167
 				'events',
168 168
 				'edit',
169
-				array( 'event' => $event_id )
169
+				array('event' => $event_id)
170 170
 			);
171 171
 
172
-			if ( ! empty( $tab_content ) ) {
172
+			if ( ! empty($tab_content)) {
173 173
 				$tabs[$name] = $tab_content;
174 174
 			}
175 175
 		}
176 176
 
177 177
 
178
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
178
+		EE_Registry::instance()->load_helper('Tabbed_Content');
179 179
 		//we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper.
180 180
 		$tabbed_content = EEH_Tabbed_Content::display($tabs);
181
-		if ( $tabbed_content instanceof WP_Error ) {
181
+		if ($tabbed_content instanceof WP_Error) {
182 182
 			$tabbed_content = $tabbed_content->get_error_message();
183 183
 		}
184 184
 
185 185
 		$notices = '
186 186
 	<div id="espresso-ajax-loading" class="ajax-loader-grey">
187
-		<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span>
187
+		<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span>
188 188
 	</div>
189 189
 	<div class="ee-notices"></div>';
190 190
 
191
-		if ( defined('DOING_AJAX' ) ) {
191
+		if (defined('DOING_AJAX')) {
192 192
 			return $tabbed_content;
193 193
 		}
194 194
 
195
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content' );
196
-		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
197
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content' );
195
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content');
196
+		echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>';
197
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content');
198 198
 
199 199
 	}
200 200
 
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public function create_new_custom() {
211 211
 
212
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) {
213
-			wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) );
212
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) {
213
+			wp_die(__('You don\'t have privileges to do this action', 'event_espresso'));
214 214
 		}
215 215
 
216 216
 		//let's clean up the _POST global a bit for downstream usage of name and description.
217
-		$_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] )
217
+		$_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name'])
218 218
 			? $this->_req_data['custom_template_args']['MTP_name']
219 219
 			: '';
220
-		$_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] )
220
+		$_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description'])
221 221
 			? $this->_req_data['custom_template_args']['MTP_description']
222 222
 			: '';
223 223
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		$this->_set_page_object();
227 227
 
228 228
 		// is this a template switch if so EE_Admin_Page child needs this object
229
-		$this->_page_object->set_hook_object( $this );
229
+		$this->_page_object->set_hook_object($this);
230 230
 
231 231
 		$this->_page_object->add_message_template(
232 232
 			$this->_req_data['messageType'],
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function edit_admin_footer() {
252 252
 		EEH_Template::display_template(
253
-			EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php'
253
+			EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php'
254 254
 		);
255 255
 	}
256 256
 
Please login to merge, or discard this patch.
modules/messages/EED_Messages.module.php 1 patch
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @return EED_Module
70 70
 	 */
71 71
 	public static function instance() {
72
-		return parent::get_instance( __CLASS__ );
72
+		return parent::get_instance(__CLASS__);
73 73
 	}
74 74
 
75 75
 
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function set_hooks() {
86 86
 		//actions
87
-		add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 );
88
-		add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 2 );
87
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2);
88
+		add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 2);
89 89
 		//filters
90
-		add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
91
-		add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
90
+		add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
91
+		add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
92 92
 		//register routes
93 93
 		self::_register_routes();
94 94
 	}
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public static function set_hooks_admin() {
103 103
 		//actions
104
-		add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 );
105
-		add_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array( 'EED_Messages', 'payment_reminder' ), 10 );
106
-		add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 3 );
107
-		add_action( 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', array( 'EED_Messages', 'send_newsletter_message' ), 10, 2 );
108
-		add_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array( 'EED_Messages', 'cancelled_registration' ), 10 );
109
-		add_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', array( 'EED_Messages', 'process_admin_payment' ), 10, 1 );
104
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2);
105
+		add_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array('EED_Messages', 'payment_reminder'), 10);
106
+		add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 3);
107
+		add_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', array('EED_Messages', 'send_newsletter_message'), 10, 2);
108
+		add_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array('EED_Messages', 'cancelled_registration'), 10);
109
+		add_action('AHEE__EE_Admin_Page___process_admin_payment_notification', array('EED_Messages', 'process_admin_payment'), 10, 1);
110 110
 		//filters
111
-		add_filter( 'FHEE__EE_Admin_Page___process_resend_registration__success', array( 'EED_Messages', 'process_resend' ), 10, 2 );
112
-		add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
113
-		add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
111
+		add_filter('FHEE__EE_Admin_Page___process_resend_registration__success', array('EED_Messages', 'process_resend'), 10, 2);
112
+		add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
113
+		add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
114 114
 	}
115 115
 
116 116
 
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 	 * @return void
125 125
 	 */
126 126
 	protected static function _register_routes() {
127
-		EE_Config::register_route( 'msg_url_trigger', 'Messages', 'run' );
128
-		EE_Config::register_route( 'msg_cron_trigger', 'Messages', 'run_cron' );
129
-		EE_Config::register_route( 'msg_browser_trigger', 'Messages', 'browser_trigger' );
130
-		EE_Config::register_route( 'msg_browser_error_trigger', 'Messages', 'browser_error_trigger' );
131
-		do_action( 'AHEE__EED_Messages___register_routes' );
127
+		EE_Config::register_route('msg_url_trigger', 'Messages', 'run');
128
+		EE_Config::register_route('msg_cron_trigger', 'Messages', 'run_cron');
129
+		EE_Config::register_route('msg_browser_trigger', 'Messages', 'browser_trigger');
130
+		EE_Config::register_route('msg_browser_error_trigger', 'Messages', 'browser_error_trigger');
131
+		do_action('AHEE__EED_Messages___register_routes');
132 132
 	}
133 133
 
134 134
 
@@ -139,18 +139,18 @@  discard block
 block discarded – undo
139 139
 	 * @since 4.9.0
140 140
 	 * @param WP $WP
141 141
 	 */
142
-	public function browser_trigger( $WP ) {
142
+	public function browser_trigger($WP) {
143 143
 		//ensure controller is loaded
144 144
 		self::_load_controller();
145
-		$token = EE_Registry::instance()->REQ->get( 'token' );
145
+		$token = EE_Registry::instance()->REQ->get('token');
146 146
 		try {
147
-			$mtg = new EE_Message_Generated_From_Token( $token, 'html', self::$_message_resource_manager );
148
-			self::$_MSG_PROCESSOR->generate_and_send_now( $mtg );
149
-		} catch( EE_Error $e ) {
150
-			$error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' );
147
+			$mtg = new EE_Message_Generated_From_Token($token, 'html', self::$_message_resource_manager);
148
+			self::$_MSG_PROCESSOR->generate_and_send_now($mtg);
149
+		} catch (EE_Error $e) {
150
+			$error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso');
151 151
 			// add specific message for developers if WP_DEBUG in on
152
-			$error_msg .= '||' . $e->getMessage();
153
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
152
+			$error_msg .= '||'.$e->getMessage();
153
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
154 154
 		}
155 155
 	}
156 156
 
@@ -166,21 +166,21 @@  discard block
 block discarded – undo
166 166
 	 * @since 4.9.0
167 167
 	 * @param $WP
168 168
 	 */
169
-	public function browser_error_trigger( $WP ) {
170
-		$token = EE_Registry::instance()->REQ->get( 'token' );
171
-		if ( $token ) {
172
-			$message = EEM_Message::instance()->get_one_by_token( $token );
173
-			if ( $message instanceof EE_Message ) {
174
-				header( 'HTTP/1.1 200 OK' );
169
+	public function browser_error_trigger($WP) {
170
+		$token = EE_Registry::instance()->REQ->get('token');
171
+		if ($token) {
172
+			$message = EEM_Message::instance()->get_one_by_token($token);
173
+			if ($message instanceof EE_Message) {
174
+				header('HTTP/1.1 200 OK');
175 175
 				$error_msg = $message->error_message();
176 176
 				?>
177 177
 				<!DOCTYPE html>
178 178
 				<html>
179 179
 					<head></head>
180 180
 					<body>
181
-						<?php echo empty( $error_msg )
182
-						? esc_html__( 'Unfortunately, we were unable to capture the error message for this message.', 'event_espresso' )
183
-						: wp_kses( $error_msg, array( 'a', 'span', 'div', 'p', 'strong', 'em', 'br' ) ); ?>
181
+						<?php echo empty($error_msg)
182
+						? esc_html__('Unfortunately, we were unable to capture the error message for this message.', 'event_espresso')
183
+						: wp_kses($error_msg, array('a', 'span', 'div', 'p', 'strong', 'em', 'br')); ?>
184 184
 					</body>
185 185
 				</html>
186 186
 				<?php
@@ -200,19 +200,19 @@  discard block
 block discarded – undo
200 200
 	 * @throws EE_Error
201 201
 	 * @return    void
202 202
 	 */
203
-	public function run( $WP ) {
203
+	public function run($WP) {
204 204
 		//ensure controller is loaded
205 205
 		self::_load_controller();
206 206
 		// attempt to process message
207 207
 		try {
208 208
 			/** @type EE_Message_To_Generate_From_Request $message_to_generate */
209
-			$message_to_generate = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' );
210
-			self::$_MSG_PROCESSOR->generate_and_send_now( $message_to_generate );
211
-		} catch ( EE_Error $e ) {
212
-			$error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' );
209
+			$message_to_generate = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
210
+			self::$_MSG_PROCESSOR->generate_and_send_now($message_to_generate);
211
+		} catch (EE_Error $e) {
212
+			$error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso');
213 213
 			// add specific message for developers if WP_DEBUG in on
214
-			$error_msg .= '||' . $e->getMessage();
215
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
214
+			$error_msg .= '||'.$e->getMessage();
215
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
216 216
 		}
217 217
 	}
218 218
 
@@ -221,30 +221,30 @@  discard block
 block discarded – undo
221 221
 	 * This is triggered by the 'msg_cron_trigger' route.
222 222
 	 * @param WP $WP
223 223
 	 */
224
-	public function run_cron( $WP ) {
224
+	public function run_cron($WP) {
225 225
 		self::_load_controller();
226 226
 		//get required vars
227
-		$cron_type = EE_Registry::instance()->REQ->get( 'type' );
228
-		$nonce = EE_Registry::instance()->REQ->get( '_nonce' );
229
-		header( 'HTTP/1.1 200 OK' );
227
+		$cron_type = EE_Registry::instance()->REQ->get('type');
228
+		$nonce = EE_Registry::instance()->REQ->get('_nonce');
229
+		header('HTTP/1.1 200 OK');
230 230
 
231 231
 		//now let's verify nonce, if not valid exit immediately
232
-		if ( ! wp_verify_nonce( $nonce, 'EE_Messages_Scheduler_' . $cron_type ) ) {
232
+		if ( ! wp_verify_nonce($nonce, 'EE_Messages_Scheduler_'.$cron_type)) {
233 233
 			/**
234 234
 			 * trigger error so this gets in the error logs.  This is important because it happens on a non-user request.
235 235
 			 */
236
-			trigger_error( esc_attr__( 'Invalid Nonce', 'event_espresso' ) );
236
+			trigger_error(esc_attr__('Invalid Nonce', 'event_espresso'));
237 237
 		}
238 238
 
239
-		$method = 'batch_' . $cron_type . '_from_queue';
240
-		if ( method_exists( self::$_MSG_PROCESSOR, $method ) ) {
239
+		$method = 'batch_'.$cron_type.'_from_queue';
240
+		if (method_exists(self::$_MSG_PROCESSOR, $method)) {
241 241
 			self::$_MSG_PROCESSOR->$method();
242 242
 		} else {
243 243
 			//no matching task
244 244
 			/**
245 245
 			 * trigger error so this gets in the error logs.  This is important because it happens on a non user request.
246 246
 			 */
247
-			trigger_error( esc_attr( sprintf( __( 'There is no task corresponding to this route %s', 'event_espresso' ), $cron_type ) ) );
247
+			trigger_error(esc_attr(sprintf(__('There is no task corresponding to this route %s', 'event_espresso'), $cron_type)));
248 248
 		}
249 249
 		exit();
250 250
 	}
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	 *
263 263
 	 * @return EE_Messages_Template_Pack
264 264
 	 */
265
-	public static function get_template_pack( $template_pack_name ) {
266
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
267
-		return EEH_MSG_Template::get_template_pack( $template_pack_name );
265
+	public static function get_template_pack($template_pack_name) {
266
+		EE_Registry::instance()->load_helper('MSG_Template');
267
+		return EEH_MSG_Template::get_template_pack($template_pack_name);
268 268
 	}
269 269
 
270 270
 
@@ -278,14 +278,14 @@  discard block
 block discarded – undo
278 278
 	 * @return EE_Messages_Template_Pack[]
279 279
 	 */
280 280
 	public static function get_template_packs() {
281
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
281
+		EE_Registry::instance()->load_helper('MSG_Template');
282 282
 
283 283
 		//for backward compat, let's make sure this returns in the same format as originally.
284 284
 		$template_pack_collection = EEH_MSG_Template::get_template_pack_collection();
285 285
 		$template_pack_collection->rewind();
286 286
 		$template_packs = array();
287
-		while ( $template_pack_collection->valid() ) {
288
-			$template_packs[ $template_pack_collection->current()->dbref ] = $template_pack_collection->current();
287
+		while ($template_pack_collection->valid()) {
288
+			$template_packs[$template_pack_collection->current()->dbref] = $template_pack_collection->current();
289 289
 			$template_pack_collection->next();
290 290
 		}
291 291
 		return $template_packs;
@@ -301,15 +301,15 @@  discard block
 block discarded – undo
301 301
 	 * @return void
302 302
 	 */
303 303
 	public static function set_autoloaders() {
304
-		if ( empty( self::$_MSG_PATHS ) ) {
304
+		if (empty(self::$_MSG_PATHS)) {
305 305
 			self::_set_messages_paths();
306
-			EE_Registry::instance()->load_helper( 'Autoloader' );
307
-			foreach ( self::$_MSG_PATHS as $path ) {
308
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path );
306
+			EE_Registry::instance()->load_helper('Autoloader');
307
+			foreach (self::$_MSG_PATHS as $path) {
308
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path);
309 309
 			}
310 310
 			// add aliases
311
-			EEH_Autoloader::add_alias( 'EE_messages', 'EE_Messages' );
312
-			EEH_Autoloader::add_alias( 'EE_messenger', 'EE_Messenger' );
311
+			EEH_Autoloader::add_alias('EE_messages', 'EE_Messages');
312
+			EEH_Autoloader::add_alias('EE_messenger', 'EE_Messenger');
313 313
 		}
314 314
 	}
315 315
 
@@ -337,10 +337,10 @@  discard block
 block discarded – undo
337 337
 			'shortcodes',
338 338
 			);
339 339
 		$paths = array();
340
-		foreach ( $dir_ref as $index => $dir ) {
341
-			$paths[ $index ] = EE_LIBRARIES . $dir;
340
+		foreach ($dir_ref as $index => $dir) {
341
+			$paths[$index] = EE_LIBRARIES.$dir;
342 342
 		}
343
-		self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths );
343
+		self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths);
344 344
 	}
345 345
 
346 346
 
@@ -351,12 +351,12 @@  discard block
 block discarded – undo
351 351
 	 * @return void
352 352
 	 */
353 353
 	protected static function _load_controller() {
354
-		if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor ) {
355
-			EE_Registry::instance()->load_core( 'Request_Handler' );
354
+		if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor) {
355
+			EE_Registry::instance()->load_core('Request_Handler');
356 356
 			self::set_autoloaders();
357
-			self::$_EEMSG = EE_Registry::instance()->load_lib( 'messages' );
358
-			self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib( 'Messages_Processor' );
359
-			self::$_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
357
+			self::$_EEMSG = EE_Registry::instance()->load_lib('messages');
358
+			self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib('Messages_Processor');
359
+			self::$_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
360 360
 		}
361 361
 	}
362 362
 
@@ -365,10 +365,10 @@  discard block
 block discarded – undo
365 365
 	/**
366 366
 	 * @param EE_Transaction $transaction
367 367
 	 */
368
-	public static function payment_reminder( EE_Transaction $transaction ) {
368
+	public static function payment_reminder(EE_Transaction $transaction) {
369 369
 		self::_load_controller();
370
-		$data = array( $transaction, null );
371
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'payment_reminder', $data );
370
+		$data = array($transaction, null);
371
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('payment_reminder', $data);
372 372
 	}
373 373
 
374 374
 
@@ -379,14 +379,14 @@  discard block
 block discarded – undo
379 379
 	 * @param  EE_Payment object
380 380
 	 * @return void
381 381
 	 */
382
-	public static function payment( EE_Transaction $transaction, EE_Payment $payment ) {
382
+	public static function payment(EE_Transaction $transaction, EE_Payment $payment) {
383 383
 		self::_load_controller();
384
-		$data = array( $transaction, $payment );
385
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
386
-		$message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() );
384
+		$data = array($transaction, $payment);
385
+		EE_Registry::instance()->load_helper('MSG_Template');
386
+		$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
387 387
 		//if payment amount is less than 0 then switch to payment_refund message type.
388 388
 		$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
389
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data );
389
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
390 390
 	}
391 391
 
392 392
 
@@ -394,10 +394,10 @@  discard block
 block discarded – undo
394 394
 	/**
395 395
 	 * @param EE_Transaction $transaction
396 396
 	 */
397
-	public static function cancelled_registration( EE_Transaction $transaction ) {
397
+	public static function cancelled_registration(EE_Transaction $transaction) {
398 398
 		self::_load_controller();
399
-		$data = array( $transaction, null );
400
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'cancelled_registration', $data );
399
+		$data = array($transaction, null);
400
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('cancelled_registration', $data);
401 401
 	}
402 402
 
403 403
 
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
 	 * @param array $extra_details
411 411
 	 * @return void
412 412
 	 */
413
-	public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) {
413
+	public static function maybe_registration(EE_Registration $registration, $extra_details = array()) {
414 414
 
415
-		if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) {
415
+		if ( ! self::_verify_registration_notification_send($registration, $extra_details)) {
416 416
 			//no messages please
417 417
 			return;
418 418
 		}
419 419
 
420
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
420
+		EE_Registry::instance()->load_helper('MSG_Template');
421 421
 
422 422
 		//get all registrations so we make sure we send messages for the right status.
423 423
 		$all_registrations = $registration->transaction()->registrations();
@@ -428,22 +428,22 @@  discard block
 block discarded – undo
428 428
 		$mtgs = array();
429 429
 
430 430
 		//loop through registrations and trigger messages once per status.
431
-		foreach ( $all_registrations as $reg ) {
431
+		foreach ($all_registrations as $reg) {
432 432
 
433 433
 			//already triggered?
434
-			if ( in_array( $reg->status_ID(), $statuses_sent ) ) {
434
+			if (in_array($reg->status_ID(), $statuses_sent)) {
435 435
 				continue;
436 436
 			}
437 437
 
438
-			$message_type = EEH_MSG_Template::convert_reg_status_to_message_type( $reg->status_ID() );
439
-			$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) );
438
+			$message_type = EEH_MSG_Template::convert_reg_status_to_message_type($reg->status_ID());
439
+			$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers($message_type, array($registration->transaction(), null, $reg->status_ID()));
440 440
 			$statuses_sent[] = $reg->status_ID();
441 441
 		}
442 442
 
443
-		$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( 'registration_summary', array( $registration->transaction(), null ) );
443
+		$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers('registration_summary', array($registration->transaction(), null));
444 444
 
445 445
 		//batch queue and initiate request
446
-		self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $mtgs );
446
+		self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($mtgs);
447 447
 		self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
448 448
 	}
449 449
 
@@ -458,39 +458,39 @@  discard block
 block discarded – undo
458 458
 	 *
459 459
 	 * @return bool          true = send away, false = nope halt the presses.
460 460
 	 */
461
-	protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) {
461
+	protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) {
462 462
 		 //self::log(
463 463
 		 //	__CLASS__, __FUNCTION__, __LINE__,
464 464
 		 //	$registration->transaction(),
465 465
 		 //	array( '$extra_details' => $extra_details )
466 466
 		 //);
467 467
 		// currently only using this to send messages for the primary registrant
468
-		if ( ! $registration->is_primary_registrant() ) {
468
+		if ( ! $registration->is_primary_registrant()) {
469 469
 			return false;
470 470
 		}
471 471
 		// first we check if we're in admin and not doing front ajax
472
-		if ( is_admin() && ! EE_FRONT_AJAX ) {
472
+		if (is_admin() && ! EE_FRONT_AJAX) {
473 473
 			//make sure appropriate admin params are set for sending messages
474
-			if ( empty( $_REQUEST['txn_reg_status_change']['send_notifications'] ) || ! absint( $_REQUEST['txn_reg_status_change']['send_notifications'] ) ) {
474
+			if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) {
475 475
 				//no messages sent please.
476 476
 				return false;
477 477
 			}
478 478
 		} else {
479 479
 			// frontend request (either regular or via AJAX)
480 480
 			// TXN is NOT finalized ?
481
-			if ( ! isset( $extra_details['finalized'] ) || $extra_details['finalized'] === false ) {
481
+			if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) {
482 482
 				return false;
483 483
 			}
484 484
 			// return visit but nothing changed ???
485 485
 			if (
486
-				isset( $extra_details['revisit'], $extra_details['status_updates'] ) &&
486
+				isset($extra_details['revisit'], $extra_details['status_updates']) &&
487 487
 				$extra_details['revisit'] && ! $extra_details['status_updates']
488 488
 			) {
489 489
 				return false;
490 490
 			}
491 491
 			// NOT sending messages && reg status is something other than "Not-Approved"
492 492
 			if (
493
-				! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) &&
493
+				! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) &&
494 494
 				$registration->status_ID() !== EEM_Registration::status_id_not_approved
495 495
 			) {
496 496
 				return false;
@@ -512,10 +512,10 @@  discard block
 block discarded – undo
512 512
 	 *
513 513
 	 * @return array
514 514
 	 */
515
-	protected static function _get_reg_status_array( $reg_status = '' ) {
516
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
517
-		return EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status )
518
-			? EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status )
515
+	protected static function _get_reg_status_array($reg_status = '') {
516
+		EE_Registry::instance()->load_helper('MSG_Template');
517
+		return EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
518
+			? EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
519 519
 			: EEH_MSG_Template::reg_status_to_message_type_array();
520 520
 	}
521 521
 
@@ -531,10 +531,10 @@  discard block
 block discarded – undo
531 531
 	 *
532 532
 	 * @return string|bool The payment message type slug matching the status or false if no match.
533 533
 	 */
534
-	protected static function _get_payment_message_type( $payment_status ) {
535
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
536
-		return EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status )
537
-			? EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status )
534
+	protected static function _get_payment_message_type($payment_status) {
535
+		EE_Registry::instance()->load_helper('MSG_Template');
536
+		return EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
537
+			? EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
538 538
 			: false;
539 539
 	}
540 540
 
@@ -548,23 +548,23 @@  discard block
 block discarded – undo
548 548
 	 * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages
549 549
 	 * @return bool          success/fail
550 550
 	 */
551
-	public static function process_resend( $req_data ) {
551
+	public static function process_resend($req_data) {
552 552
 		self::_load_controller();
553 553
 
554 554
 		//if $msgID in this request then skip to the new resend_message
555
-		if ( EE_Registry::instance()->REQ->get( 'MSG_ID' ) ) {
555
+		if (EE_Registry::instance()->REQ->get('MSG_ID')) {
556 556
 			return self::resend_message();
557 557
 		}
558 558
 
559
-		if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request() ) {
559
+		if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request()) {
560 560
 			return false;
561 561
 		}
562 562
 
563 563
 		try {
564
-			self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $messages_to_send );
564
+			self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($messages_to_send);
565 565
 			self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
566
-		} catch( EE_Error $e ) {
567
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
566
+		} catch (EE_Error $e) {
567
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
568 568
 			return false;
569 569
 		}
570 570
 		return true; //everything got queued.
@@ -578,17 +578,17 @@  discard block
 block discarded – undo
578 578
 	public static function resend_message() {
579 579
 		self::_load_controller();
580 580
 
581
-		$msgID = EE_Registry::instance()->REQ->get( 'MSG_ID' );
582
-		if ( ! $msgID ) {
583
-			EE_Error::add_error( __( 'Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
581
+		$msgID = EE_Registry::instance()->REQ->get('MSG_ID');
582
+		if ( ! $msgID) {
583
+			EE_Error::add_error(__('Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
584 584
 			return false;
585 585
 		}
586 586
 
587
-		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( (array) $msgID );
587
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send((array) $msgID);
588 588
 
589 589
 		//setup success message.
590
-		$count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend );
591
-		EE_Error::add_success( sprintf(
590
+		$count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
591
+		EE_Error::add_success(sprintf(
592 592
 			_n(
593 593
 				'There was %d message queued for resending.',
594 594
 				'There were %d messages queued for resending.',
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 				'event_espresso'
597 597
 			),
598 598
 			$count_ready_for_resend
599
-		) );
599
+		));
600 600
 		return true;
601 601
 	}
602 602
 
@@ -609,13 +609,13 @@  discard block
 block discarded – undo
609 609
 	 * @param  EE_Payment $payment EE_payment object
610 610
 	 * @return bool              success/fail
611 611
 	 */
612
-	public static function process_admin_payment( EE_Payment $payment ) {
613
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
612
+	public static function process_admin_payment(EE_Payment $payment) {
613
+		EE_Registry::instance()->load_helper('MSG_Template');
614 614
 		//we need to get the transaction object
615 615
 		$transaction = $payment->transaction();
616
-		if ( $transaction instanceof EE_Transaction ) {
617
-			$data = array( $transaction, $payment );
618
-			$message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() );
616
+		if ($transaction instanceof EE_Transaction) {
617
+			$data = array($transaction, $payment);
618
+			$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
619 619
 
620 620
 			//if payment amount is less than 0 then switch to payment_refund message type.
621 621
 			$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
@@ -625,17 +625,17 @@  discard block
 block discarded – undo
625 625
 
626 626
 			self::_load_controller();
627 627
 
628
-			self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data );
628
+			self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
629 629
 
630 630
 			//get count of queued for generation
631
-			$count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete );
631
+			$count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete);
632 632
 
633
-			if ( $count_to_generate > 0 ) {
634
-				add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' );
633
+			if ($count_to_generate > 0) {
634
+				add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true');
635 635
 				return true;
636 636
 			} else {
637
-				$count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::instance()->stati_indicating_failed_sending() );
638
-				EE_Error::add_error( sprintf(
637
+				$count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::instance()->stati_indicating_failed_sending());
638
+				EE_Error::add_error(sprintf(
639 639
 					_n(
640 640
 						'The payment notification generation failed.',
641 641
 						'%d payment notifications failed being sent.',
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 						'event_espresso'
644 644
 					),
645 645
 					$count_failed
646
-				), __FILE__, __FUNCTION__, __LINE__ );
646
+				), __FILE__, __FUNCTION__, __LINE__);
647 647
 				return false;
648 648
 			}
649 649
 		} else {
@@ -666,11 +666,11 @@  discard block
 block discarded – undo
666 666
 	 * @param  int      	      $grp_id     a specific message template group id.
667 667
 	 * @return void
668 668
 	 */
669
-	public static function send_newsletter_message( $contacts, $grp_id ) {
669
+	public static function send_newsletter_message($contacts, $grp_id) {
670 670
 		//make sure mtp is id and set it in the EE_Request Handler later messages setup.
671
-		EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id );
671
+		EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id);
672 672
 		self::_load_controller();
673
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'newsletter', $contacts );
673
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('newsletter', $contacts);
674 674
 	}
675 675
 
676 676
 
@@ -685,10 +685,10 @@  discard block
 block discarded – undo
685 685
 	 * @param string 	$message_type
686 686
 	 * @return 	string
687 687
 	 */
688
-	public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) {
689
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
688
+	public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') {
689
+		EE_Registry::instance()->load_helper('MSG_Template');
690 690
 		// whitelist $messenger
691
-		switch ( $messenger ) {
691
+		switch ($messenger) {
692 692
 			case 'pdf' :
693 693
 				$sending_messenger = 'pdf';
694 694
 				$generating_messenger = 'html';
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 				break;
701 701
 		}
702 702
 		// whitelist $message_type
703
-		switch ( $message_type ) {
703
+		switch ($message_type) {
704 704
 			case 'receipt' :
705 705
 				$message_type = 'receipt';
706 706
 				break;
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 				break;
711 711
 		}
712 712
 		// verify that both the messenger AND the message type are active
713
-		if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type ) ) {
713
+		if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) {
714 714
 			//need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?)
715 715
 			$template_query_params = array(
716 716
 				'MTP_is_active' => true,
@@ -719,16 +719,16 @@  discard block
 block discarded – undo
719 719
 				'Event.EVT_ID' => $registration->event_ID()
720 720
 			);
721 721
 			//get the message template group.
722
-			$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) );
722
+			$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
723 723
 			//if we don't have an EE_Message_Template_Group then return
724
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
724
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
725 725
 				// remove EVT_ID from query params so that global templates get picked up
726
-				unset( $template_query_params['Event.EVT_ID'] );
726
+				unset($template_query_params['Event.EVT_ID']);
727 727
 				//get global template as the fallback
728
-				$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) );
728
+				$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
729 729
 			}
730 730
 			//if we don't have an EE_Message_Template_Group then return
731
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
731
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
732 732
 				return '';
733 733
 			}
734 734
 			// generate the URL
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 	 * @param bool 	  $send true we will do a test send using the messenger delivery, false we just do a regular preview
758 758
 	 * @return string          The body of the message.
759 759
 	 */
760
-	public static function preview_message( $type, $context, $messenger, $send = false ) {
760
+	public static function preview_message($type, $context, $messenger, $send = false) {
761 761
 		self::_load_controller();
762 762
 		$mtg = new EE_Message_To_Generate(
763 763
 			$messenger,
@@ -766,8 +766,8 @@  discard block
 block discarded – undo
766 766
 			$context,
767 767
 			true
768 768
 		);
769
-		$generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview( $mtg );
770
-		if ( $generated_preview_queue instanceof EE_Messages_Queue ) {
769
+		$generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview($mtg);
770
+		if ($generated_preview_queue instanceof EE_Messages_Queue) {
771 771
 			return $generated_preview_queue->get_queue()->current()->content();
772 772
 		} else {
773 773
 			return $generated_preview_queue;
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 *
792 792
 	 * @return bool          success or fail.
793 793
 	 */
794
-	public static function send_message_with_messenger_only( $messenger, $message_type, EE_Messages_Queue $queue ) {
794
+	public static function send_message_with_messenger_only($messenger, $message_type, EE_Messages_Queue $queue) {
795 795
 		self::_load_controller();
796 796
 		/** @type EE_Message_To_Generate_From_Queue $message_to_generate */
797 797
 		$message_to_generate = EE_Registry::instance()->load_lib(
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 				$queue
803 803
 			)
804 804
 		);
805
-		return self::$_MSG_PROCESSOR->queue_for_sending( $message_to_generate );
805
+		return self::$_MSG_PROCESSOR->queue_for_sending($message_to_generate);
806 806
 	}
807 807
 
808 808
 
@@ -815,22 +815,22 @@  discard block
 block discarded – undo
815 815
 	 * @param array     $message_ids An array of message ids
816 816
 	 * @return bool | EE_Messages_Queue     false if nothing was generated, EE_Messages_Queue containing generated messages.
817 817
 	 */
818
-	public static function generate_now( $message_ids ) {
818
+	public static function generate_now($message_ids) {
819 819
 		self::_load_controller();
820 820
 		$messages = EEM_Message::instance()->get_all(
821 821
 			array(
822 822
 				0 => array(
823
-					'MSG_ID' => array( 'IN', $message_ids ),
823
+					'MSG_ID' => array('IN', $message_ids),
824 824
 					'STS_ID' => EEM_Message::status_incomplete,
825 825
 				)
826 826
 			)
827 827
 		);
828 828
 
829
-		$generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue( $messages );
829
+		$generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue($messages);
830 830
 
831
-		if ( ! $generated_queue instanceof EE_Messages_Queue ) {
831
+		if ( ! $generated_queue instanceof EE_Messages_Queue) {
832 832
 			EE_Error::add_error(
833
-				__( 'The messages were not generated.  This is usually because there is already a batch being generated on a separate request.  You can wait a minute or two and try again.', 'event_espresso' ),
833
+				__('The messages were not generated.  This is usually because there is already a batch being generated on a separate request.  You can wait a minute or two and try again.', 'event_espresso'),
834 834
 				__FILE__, __FUNCTION__, __LINE__
835 835
 			);
836 836
 		}
@@ -849,28 +849,28 @@  discard block
 block discarded – undo
849 849
 	 *
850 850
 	 * @return bool | EE_Messages_Queue  false if no messages sent.
851 851
 	 */
852
-	public static function send_now( $message_ids ) {
852
+	public static function send_now($message_ids) {
853 853
 		self::_load_controller();
854 854
 		$messages = EEM_Message::instance()->get_all(
855 855
 			array(
856 856
 				0 => array(
857
-					'MSG_ID' => array( 'IN', $message_ids ),
858
-					'STS_ID' => array( 'IN', array( EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry ) )
857
+					'MSG_ID' => array('IN', $message_ids),
858
+					'STS_ID' => array('IN', array(EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry))
859 859
 				)
860 860
 			)
861 861
 		);
862 862
 
863
-		$sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue( $messages );
863
+		$sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue($messages);
864 864
 
865
-		if ( ! $sent_queue instanceof EE_Messages_Queue ) {
865
+		if ( ! $sent_queue instanceof EE_Messages_Queue) {
866 866
 			EE_Error::add_error(
867
-				__( 'The messages were not sent.  This is usually because there is already a batch being sent on a separate request.  You can wait a minute or two and try again.', 'event_espresso' ),
867
+				__('The messages were not sent.  This is usually because there is already a batch being sent on a separate request.  You can wait a minute or two and try again.', 'event_espresso'),
868 868
 				__FILE__, __FUNCTION__, __LINE__
869 869
 			);
870 870
 		} else {
871 871
 			//can count how many sent by using the messages in the queue
872
-			$sent_count = $sent_queue->count_STS_in_queue( array( EEM_Message::instance()->stati_indicating_sent() ) );
873
-			if ( $sent_count > 0 ) {
872
+			$sent_count = $sent_queue->count_STS_in_queue(array(EEM_Message::instance()->stati_indicating_sent()));
873
+			if ($sent_count > 0) {
874 874
 				EE_Error::add_success(
875 875
 					sprintf(
876 876
 						_n(
@@ -885,8 +885,8 @@  discard block
 block discarded – undo
885 885
 			} else {
886 886
 				EE_Error::overwrite_errors();
887 887
 				EE_Error::add_error(
888
-					__( 'No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, or there was an error.
889
-					If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso' ),
888
+					__('No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, or there was an error.
889
+					If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso'),
890 890
 					__FILE__, __FUNCTION__, __LINE__
891 891
 				);
892 892
 			}
@@ -907,13 +907,13 @@  discard block
 block discarded – undo
907 907
 	 *
908 908
 	 * @return bool  true means messages were successfully queued for resending, false means none were queued for resending.
909 909
 	 */
910
-	public static function queue_for_resending( $message_ids ) {
910
+	public static function queue_for_resending($message_ids) {
911 911
 		self::_load_controller();
912
-		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( $message_ids );
912
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send($message_ids);
913 913
 
914 914
 		//get queue and count
915
-		$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend );
916
-		if ( $queue_count > 0 ) {
915
+		$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
916
+		if ($queue_count > 0) {
917 917
 			EE_Error::add_success(
918 918
 				sprintf(
919 919
 					_n(
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 			);
928 928
 		} else {
929 929
 			EE_Error::add_error(
930
-				__( 'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso' ),
930
+				__('No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso'),
931 931
 				__FILE__, __FUNCTION__, __LINE__
932 932
 			);
933 933
 		}
@@ -949,17 +949,17 @@  discard block
 block discarded – undo
949 949
 	 * @param array $info
950 950
 	 * @param bool $display_request
951 951
 	 */
952
-	protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) {
953
-		EE_Registry::instance()->load_helper( 'Debug_Tools' );
954
-		if ( WP_DEBUG && false ) {
955
-			if ( $transaction instanceof EE_Transaction ) {
952
+	protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) {
953
+		EE_Registry::instance()->load_helper('Debug_Tools');
954
+		if (WP_DEBUG && false) {
955
+			if ($transaction instanceof EE_Transaction) {
956 956
 				// don't serialize objects
957
-				$info = EEH_Debug_Tools::strip_objects( $info );
957
+				$info = EEH_Debug_Tools::strip_objects($info);
958 958
 				$info['TXN_status'] = $transaction->status_ID();
959 959
 				$info['TXN_reg_steps'] = $transaction->reg_steps();
960
-				if ( $transaction->ID() ) {
961
-					$index = 'EE_Transaction: ' . $transaction->ID();
962
-					EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index );
960
+				if ($transaction->ID()) {
961
+					$index = 'EE_Transaction: '.$transaction->ID();
962
+					EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index);
963 963
 				}
964 964
 			}
965 965
 		}
Please login to merge, or discard this patch.