Completed
Branch BETA-4.9-messages-queue (3a5d2a)
by
unknown
31:07 queued 15:44
created
modules/feeds/EED_Feeds.module.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 *  @access 	public
127 127
 	 *  @param 	string 	$SQL	the JOIN clause for the comment feed query
128
-	 *  @return 	void
128
+	 *  @return 	string
129 129
 	 */
130 130
 	public static function comment_feed_join( $SQL ) {
131 131
 		global $wpdb;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 *  @access 	public
148 148
 	 *  @param 	string 	$SQL	the WHERE clause for the comment feed query
149
-	 *  @return 	void
149
+	 *  @return 	string
150 150
 	 */
151 151
 	public static function comment_feed_where( $SQL ) {
152 152
 		global $wp_query, $wpdb;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 *
165 165
 	 *  @access 	public
166 166
 	 *  @param 	string 	$content
167
-	 *  @return 	void
167
+	 *  @return 	string
168 168
 	 */
169 169
 	public static function the_event_feed( $content ) {
170 170
 		if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 *  @access 	public
207 207
 	 *  @param 	string 	$content
208
-	 *  @return 	void
208
+	 *  @return 	string
209 209
 	 */
210 210
 	public static function the_venue_feed( $content ) {
211 211
 		if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) {
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @return EED_Feeds
30 30
 	 */
31 31
 	public static function instance() {
32
-		return parent::get_instance( __CLASS__ );
32
+		return parent::get_instance(__CLASS__);
33 33
 	}
34 34
 
35 35
 
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 	 *  @return 	void
42 42
 	 */
43 43
 	public static function set_hooks() {
44
-		add_action( 'parse_request', array( 'EED_Feeds', 'parse_request' ), 10 );
45
-		add_filter( 'default_feed', array( 'EED_Feeds', 'default_feed' ), 10, 1  );
46
-		add_filter( 'comment_feed_join', array( 'EED_Feeds', 'comment_feed_join' ), 10, 2 );
47
-		add_filter( 'comment_feed_where', array( 'EED_Feeds', 'comment_feed_where' ), 10, 2 );
44
+		add_action('parse_request', array('EED_Feeds', 'parse_request'), 10);
45
+		add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1);
46
+		add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2);
47
+		add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2);
48 48
 	}
49 49
 
50 50
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *  @access 	public
65 65
 	 *  @return 	void
66 66
 	 */
67
-	public function run( $WP ) {
67
+	public function run($WP) {
68 68
 	}
69 69
 
70 70
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 *  @param 	type	rss2, atom, rss, rdf, rssjs
77 77
 	 *  @return 	string
78 78
 	 */
79
-	public static function default_feed( $type = 'rss2' ) {
79
+	public static function default_feed($type = 'rss2') {
80 80
 		 //rss2, atom, rss, rdf, rssjs
81 81
 		$type = 'rss2';
82 82
 		return $type;
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 	 *  @return 	void
93 93
 	 */
94 94
 	public static function parse_request() {
95
-		if ( EE_Registry::instance()->REQ->is_set( 'post_type' )) {
95
+		if (EE_Registry::instance()->REQ->is_set('post_type')) {
96 96
 			// define path to templates
97
-			define( 'RSS_FEEDS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
97
+			define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
98 98
 			// what kinda post_type are we dealing with ?
99
-			switch( EE_Registry::instance()->REQ->get( 'post_type' )) {
99
+			switch (EE_Registry::instance()->REQ->get('post_type')) {
100 100
 				case 'espresso_events' :
101 101
 					// for rss2, atom, rss, rdf
102
-					add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 );
103
-					add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 );
102
+					add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1);
103
+					add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1);
104 104
 					// for json ( also uses the above filter )
105
-					add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_event_rssjs_feed' ), 10, 1 );
105
+					add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1);
106 106
 					break;
107 107
 				case 'espresso_venues' :
108 108
 					// for rss2, atom, rss, rdf
109
-					add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 );
110
-					add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 );
109
+					add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1);
110
+					add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1);
111 111
 					// for json ( also uses the above filter )
112
-					add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_venue_rssjs_feed' ), 10, 1 );
112
+					add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1);
113 113
 					break;
114 114
 			}
115 115
 		}
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 	 *  @param 	string 	$SQL	the JOIN clause for the comment feed query
128 128
 	 *  @return 	void
129 129
 	 */
130
-	public static function comment_feed_join( $SQL ) {
130
+	public static function comment_feed_join($SQL) {
131 131
 		global $wpdb;
132 132
 		// check for wp_posts table in JOIN clause
133
-		if ( strpos( $SQL, $wpdb->posts ) !== FALSE ) {
134
-			add_filter( 'EED_Feeds__comment_feed_where__espresso_attendees', '__return_true' );
133
+		if (strpos($SQL, $wpdb->posts) !== FALSE) {
134
+			add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true');
135 135
 		}
136 136
 		return $SQL;
137 137
 	}
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 *  @param 	string 	$SQL	the WHERE clause for the comment feed query
149 149
 	 *  @return 	void
150 150
 	 */
151
-	public static function comment_feed_where( $SQL ) {
151
+	public static function comment_feed_where($SQL) {
152 152
 		global $wp_query, $wpdb;
153
-		if ( $wp_query->is_comment_feed && apply_filters( 'EED_Feeds__comment_feed_where__espresso_attendees', FALSE )) {
153
+		if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', FALSE)) {
154 154
 			$SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'";
155 155
 		}
156 156
 		return $SQL;
@@ -166,16 +166,16 @@  discard block
 block discarded – undo
166 166
 	 *  @param 	string 	$content
167 167
 	 *  @return 	void
168 168
 	 */
169
-	public static function the_event_feed( $content ) {
170
-		if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) {
171
-			EE_Registry::instance()->load_helper( 'Event_View' );
172
-			EE_Registry::instance()->load_helper( 'Venue_View' );
169
+	public static function the_event_feed($content) {
170
+		if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php')) {
171
+			EE_Registry::instance()->load_helper('Event_View');
172
+			EE_Registry::instance()->load_helper('Venue_View');
173 173
  			global $post;
174 174
 			$template_args = array(
175 175
 				'EVT_ID' => $post->ID,
176 176
 				'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content
177 177
 			);
178
-			$content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php', $template_args, TRUE );
178
+			$content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php', $template_args, TRUE);
179 179
 		}
180 180
 		return  $content;
181 181
 	}
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 *  @param 	object 	$item
191 191
 	 *  @return 	void
192 192
 	 */
193
-	public static function the_event_rssjs_feed( $item ) {
194
-		if ( is_feed() && isset( $item->description )) {
195
-			$item->description = EED_Feeds::the_event_feed( $item->description );
193
+	public static function the_event_rssjs_feed($item) {
194
+		if (is_feed() && isset($item->description)) {
195
+			$item->description = EED_Feeds::the_event_feed($item->description);
196 196
 		}
197 197
 		return $item;
198 198
 	}
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
 	 *  @param 	string 	$content
208 208
 	 *  @return 	void
209 209
 	 */
210
-	public static function the_venue_feed( $content ) {
211
-		if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) {
212
-			EE_Registry::instance()->load_helper( 'Event_View' );
213
-			EE_Registry::instance()->load_helper( 'Venue_View' );
210
+	public static function the_venue_feed($content) {
211
+		if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php')) {
212
+			EE_Registry::instance()->load_helper('Event_View');
213
+			EE_Registry::instance()->load_helper('Venue_View');
214 214
  			global $post;
215 215
 			$template_args = array(
216 216
 				'VNU_ID' => $post->ID,
217 217
 				'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content
218 218
 			);
219
-			$content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php', $template_args, TRUE );
219
+			$content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php', $template_args, TRUE);
220 220
 		}
221 221
 		return $content;
222 222
 	}
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
 	 *  @param 	object 	$item
232 232
 	 *  @return 	void
233 233
 	 */
234
-	public static function the_venue_rssjs_feed( $item ) {
235
-		if ( is_feed() && isset( $item->description )) {
236
-			$item->description = EED_Feeds::the_venue_feed( $item->description );
234
+	public static function the_venue_rssjs_feed($item) {
235
+		if (is_feed() && isset($item->description)) {
236
+			$item->description = EED_Feeds::the_venue_feed($item->description);
237 237
 		}
238 238
 		return $item;
239 239
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 *    process_registration_from_admin
297 297
 	 *
298 298
 	 * @access    public
299
-	 * @return    int
299
+	 * @return    EE_Transaction
300 300
 	 */
301 301
 	public static function process_registration_from_admin() {
302 302
 		EED_Single_Page_Checkout::load_reg_steps();
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	 * _get_transaction_and_cart_for_previous_visit
631 631
 	 *
632 632
 	 * @access private
633
-	 * 	@return mixed EE_Transaction|NULL
633
+	 * 	@return EE_Transaction|null EE_Transaction|NULL
634 634
 	 */
635 635
 	private function _get_transaction_and_cart_for_previous_visit() {
636 636
 		/** @var $TXN_model EEM_Transaction */
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 	 * 	generates a new EE_Transaction object and adds it to the $_transaction property.
688 688
 	 *
689 689
 	 * 	@access private
690
-	 * 	@return EE_Transaction
690
+	 * 	@return EE_Attendee|null
691 691
 	 */
692 692
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
693 693
 		//  if there's no transaction, then this is the FIRST visit to SPCO
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 	 * 	generates a new EE_Transaction object and adds it to the $_transaction property.
714 714
 	 *
715 715
 	 * 	@access private
716
-	 * 	@return mixed EE_Transaction|NULL
716
+	 * 	@return EE_Attendee|null EE_Transaction|NULL
717 717
 	 */
718 718
 	private function _initialize_transaction() {
719 719
 		try {
Please login to merge, or discard this patch.
Spacing   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 * @return EED_Single_Page_Checkout
39 39
 	 */
40 40
 	public static function instance() {
41
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
42
-		return parent::get_instance( __CLASS__ );
41
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
42
+		return parent::get_instance(__CLASS__);
43 43
 	}
44 44
 
45 45
 
@@ -84,22 +84,22 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function set_hooks_admin() {
86 86
 		EED_Single_Page_Checkout::set_definitions();
87
-		if ( defined( 'DOING_AJAX' )) {
87
+		if (defined('DOING_AJAX')) {
88 88
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
89 89
 			ob_start();
90 90
 			EED_Single_Page_Checkout::load_request_handler();
91 91
 			EED_Single_Page_Checkout::load_reg_steps();
92 92
 		} else {
93 93
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
94
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
94
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
95 95
 		}
96 96
 		// set ajax hooks
97
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
98
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
99
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
100
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
101
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
102
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
97
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
98
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
99
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
100
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
101
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
102
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
103 103
 	}
104 104
 
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * 	process ajax request
109 109
 	 * @param string $ajax_action
110 110
 	 */
111
-	public static function process_ajax_request( $ajax_action ) {
112
-		EE_Registry::instance()->REQ->set( 'action', $ajax_action );
111
+	public static function process_ajax_request($ajax_action) {
112
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
113 113
 		EED_Single_Page_Checkout::instance()->_initialize();
114 114
 	}
115 115
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * 	ajax display registration step
120 120
 	 */
121 121
 	public static function display_reg_step() {
122
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
122
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
123 123
 	}
124 124
 
125 125
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * 	ajax process registration step
129 129
 	 */
130 130
 	public static function process_reg_step() {
131
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
131
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
132 132
 	}
133 133
 
134 134
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * 	ajax process registration step
138 138
 	 */
139 139
 	public static function update_reg_step() {
140
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
140
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
141 141
 	}
142 142
 
143 143
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @return void
150 150
 	 */
151 151
 	public static function update_checkout() {
152
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
152
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
153 153
 	}
154 154
 
155 155
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public static function load_request_handler() {
164 164
 		// load core Request_Handler class
165
-		if ( ! isset( EE_Registry::instance()->REQ )) {
166
-			EE_Registry::instance()->load_core( 'Request_Handler' );
165
+		if ( ! isset(EE_Registry::instance()->REQ)) {
166
+			EE_Registry::instance()->load_core('Request_Handler');
167 167
 		}
168 168
 	}
169 169
 
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 	 *  @return 	void
177 177
 	 */
178 178
 	public static function set_definitions() {
179
-		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
180
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
181
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
182
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
183
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
184
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
185
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
186
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
179
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
180
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
181
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
182
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
183
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
184
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
185
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
186
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
187 187
 	}
188 188
 
189 189
 
@@ -198,31 +198,31 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public static function load_reg_steps() {
200 200
 		static $reg_steps_loaded = FALSE;
201
-		if ( $reg_steps_loaded ) {
201
+		if ($reg_steps_loaded) {
202 202
 			return;
203 203
 		}
204 204
 		// load EE_SPCO_Reg_Step base class
205 205
 //		EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class'  );
206 206
 		// filter list of reg_steps
207
-		$reg_steps_to_load = apply_filters( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps() );
207
+		$reg_steps_to_load = apply_filters('AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps());
208 208
 		// sort by key (order)
209
-		ksort( $reg_steps_to_load );
209
+		ksort($reg_steps_to_load);
210 210
 		// loop through folders
211
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
211
+		foreach ($reg_steps_to_load as $order => $reg_step) {
212 212
 			// we need a
213
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
213
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
214 214
 				// copy over to the reg_steps_array
215
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
215
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
216 216
 				// register custom key route for each reg step ( ie: step=>"slug" - this is the entire reason we load the reg steps array now )
217
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
217
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
218 218
 				// add AJAX or other hooks
219
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
219
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
220 220
 					// setup autoloaders if necessary
221
-					if ( ! class_exists( $reg_step['class_name'] )) {
222
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
221
+					if ( ! class_exists($reg_step['class_name'])) {
222
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
223 223
 					}
224
-					if ( is_callable( $reg_step['class_name'], 'set_hooks' )) {
225
-						call_user_func( array( $reg_step['class_name'], 'set_hooks' ));
224
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
225
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
226 226
 					}
227 227
 				}
228 228
 			}
@@ -241,28 +241,28 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public static function get_reg_steps() {
243 243
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
244
-		if ( empty( $reg_steps )) {
244
+		if (empty($reg_steps)) {
245 245
 			$reg_steps = array(
246 246
 				10 => array(
247
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
247
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
248 248
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
249 249
 					'slug' => 'attendee_information',
250 250
 					'has_hooks' => FALSE
251 251
 				),
252 252
 				20 => array(
253
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
253
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
254 254
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
255 255
 					'slug' => 'registration_confirmation',
256 256
 					'has_hooks' => FALSE
257 257
 				),
258 258
 				30 => array(
259
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
259
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
260 260
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
261 261
 					'slug' => 'payment_options',
262 262
 					'has_hooks' => TRUE
263 263
 				),
264 264
 				999 => array(
265
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
265
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
266 266
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
267 267
 					'slug' => 'finalize_registration',
268 268
 					'has_hooks' => FALSE
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	public static function registration_checkout_for_admin() {
284 284
 		EED_Single_Page_Checkout::load_reg_steps();
285
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
286
-		EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' );
287
-		EE_Registry::instance()->REQ->set( 'process_form_submission', false );
285
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
286
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
287
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
288 288
 		EED_Single_Page_Checkout::instance()->_initialize();
289 289
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
290 290
 		return EE_Registry::instance()->REQ->get_output();
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	public static function process_registration_from_admin() {
302 302
 		EED_Single_Page_Checkout::load_reg_steps();
303
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
304
-		EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' );
305
-		EE_Registry::instance()->REQ->set( 'process_form_submission', true );
303
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
304
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
305
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
306 306
 		EED_Single_Page_Checkout::instance()->_initialize();
307
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
308
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
309
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
310
-				if ( $final_reg_step->process_reg_step() ) {
307
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
308
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
309
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
310
+				if ($final_reg_step->process_reg_step()) {
311 311
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
312 312
 				}
313 313
 			}
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 	 * @param WP_Query $WP_Query
325 325
 	 * @return    void
326 326
 	 */
327
-	public function run( $WP_Query ) {
328
-		if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )) {
327
+	public function run($WP_Query) {
328
+		if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)) {
329 329
 			$this->_initialize();
330 330
 		}
331 331
 	}
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 	 * @param WP_Query $WP_Query
341 341
 	 * @return    void
342 342
 	 */
343
-	public static function init( $WP_Query ) {
344
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
343
+	public static function init($WP_Query) {
344
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
345 345
 	}
346 346
 
347 347
 
@@ -355,32 +355,32 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	private function _initialize() {
357 357
 		// ensure SPCO doesn't run twice
358
-		if ( EED_Single_Page_Checkout::$_initialized ) {
358
+		if (EED_Single_Page_Checkout::$_initialized) {
359 359
 			return;
360 360
 		}
361 361
 		// setup the EE_Checkout object
362 362
 		$this->checkout = $this->_initialize_checkout();
363 363
 		// filter checkout
364
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
364
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
365 365
 		// get the $_GET
366 366
 		$this->_get_request_vars();
367 367
 		// filter continue_reg
368
-		$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
368
+		$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
369 369
 		// load the reg steps array
370
-		if ( ! $this->_load_and_instantiate_reg_steps() ) {
370
+		if ( ! $this->_load_and_instantiate_reg_steps()) {
371 371
 			EED_Single_Page_Checkout::$_initialized = true;
372 372
 			return;
373 373
 		}
374 374
 		// set the current step
375
-		$this->checkout->set_current_step( $this->checkout->step );
375
+		$this->checkout->set_current_step($this->checkout->step);
376 376
 		// and the next step
377 377
 		$this->checkout->set_next_step();
378 378
 		// was there already a valid transaction in the checkout from the session ?
379
-		if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
379
+		if ( ! $this->checkout->transaction instanceof EE_Transaction) {
380 380
 			// get transaction from db or session
381 381
 			$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() ? $this->_get_transaction_and_cart_for_previous_visit() : $this->_get_cart_for_current_session_and_setup_new_transaction();
382
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
383
-				EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
382
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
383
+				EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
384 384
 				// add some style and make it dance
385 385
 				$this->checkout->transaction = EE_Transaction::new_instance();
386 386
 				$this->add_styles_and_scripts();
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 				return;
389 389
 			}
390 390
 			// and the registrations for the transaction
391
-			$this->_get_registrations( $this->checkout->transaction );
391
+			$this->_get_registrations($this->checkout->transaction);
392 392
 		}
393 393
 		// verify that everything has been setup correctly
394
-		if ( ! $this->_final_verifications() ) {
394
+		if ( ! $this->_final_verifications()) {
395 395
 			EED_Single_Page_Checkout::$_initialized = true;
396 396
 			return;
397 397
 		}
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 		// set no cache headers and constants
417 417
 		EE_System::do_not_cache();
418 418
 		// add anchor
419
-		add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
419
+		add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
420 420
 		// remove transaction lock
421
-		add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 );
421
+		add_action('shutdown', array($this, 'unlock_transaction'), 1);
422 422
 	}
423 423
 
424 424
 
@@ -435,20 +435,20 @@  discard block
 block discarded – undo
435 435
 		// look in session for existing checkout
436 436
 		$checkout = EE_Registry::instance()->SSN->checkout();
437 437
 		// verify
438
-		if ( ! $checkout instanceof EE_Checkout ) {
438
+		if ( ! $checkout instanceof EE_Checkout) {
439 439
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
440
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
440
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
441 441
 			// verify again
442
-			if ( ! $checkout instanceof EE_Checkout ) {
443
-				throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
442
+			if ( ! $checkout instanceof EE_Checkout) {
443
+				throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
444 444
 			}
445 445
 		} else {
446
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
447
-				wp_safe_redirect( $checkout->redirect_url );
446
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
447
+				wp_safe_redirect($checkout->redirect_url);
448 448
 				exit();
449 449
 			}
450 450
 		}
451
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
451
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
452 452
 		// reset anything that needs a clean slate for each request
453 453
 		$checkout->reset_for_current_request();
454 454
 		return $checkout;
@@ -466,22 +466,22 @@  discard block
 block discarded – undo
466 466
 		// load classes
467 467
 		EED_Single_Page_Checkout::load_request_handler();
468 468
 		//make sure this request is marked as belonging to EE
469
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
469
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
470 470
 		// which step is being requested ?
471
-		$this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() );
471
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
472 472
 		// which step is being edited ?
473
-		$this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' );
473
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
474 474
 		// and what we're doing on the current step
475
-		$this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' );
475
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
476 476
 		// returning to edit ?
477
-		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' );
477
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
478 478
 		// or some other kind of revisit ?
479
-		$this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
479
+		$this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE);
480 480
 		// and whether or not to generate a reg form for this request
481
-		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
481
+		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE 	FALSE
482 482
 		// and whether or not to process a reg form submission for this request
483
-		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
484
-		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; 		// TRUE 	FALSE
483
+		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE 	FALSE
484
+		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE 	FALSE
485 485
 		//$this->_display_request_vars();
486 486
 	}
487 487
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
 	 * @return    void
495 495
 	 */
496 496
 	protected function _display_request_vars() {
497
-		if ( ! WP_DEBUG ) {
497
+		if ( ! WP_DEBUG) {
498 498
 			return;
499 499
 		}
500
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
501
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
502
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
503
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
504
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
505
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
506
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
507
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
500
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
501
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
502
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
503
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
504
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
505
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
506
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
507
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
508 508
 	}
509 509
 
510 510
 
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 	 * @return    array
519 519
 	 */
520 520
 	private function _get_first_step() {
521
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
522
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
521
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
522
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
523 523
 	}
524 524
 
525 525
 
@@ -535,37 +535,37 @@  discard block
 block discarded – undo
535 535
 	private function _load_and_instantiate_reg_steps() {
536 536
 		// have reg_steps already been instantiated ?
537 537
 		if (
538
-			empty( $this->checkout->reg_steps ) ||
539
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
538
+			empty($this->checkout->reg_steps) ||
539
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
540 540
 		) {
541 541
 			// if not, then loop through raw reg steps array
542
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
543
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
542
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
543
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
544 544
 					return false;
545 545
 				}
546 546
 			}
547 547
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
548 548
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
549 549
 			// skip the registration_confirmation page ?
550
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
550
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
551 551
 				// just remove it from the reg steps array
552
-				$this->checkout->remove_reg_step( 'registration_confirmation' );
553
-			} else if ( EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset( 	$this->checkout->reg_steps['registration_confirmation'] )) {
552
+				$this->checkout->remove_reg_step('registration_confirmation');
553
+			} else if (EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset($this->checkout->reg_steps['registration_confirmation'])) {
554 554
 				// set the order to something big like 100
555
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
555
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
556 556
 			}
557 557
 			// filter the array for good luck
558
-			$this->checkout->reg_steps = apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps );
558
+			$this->checkout->reg_steps = apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps);
559 559
 			// finally re-sort based on the reg step class order properties
560 560
 			$this->checkout->sort_reg_steps();
561 561
 		} else {
562
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
562
+			foreach ($this->checkout->reg_steps as $reg_step) {
563 563
 				// set all current step stati to FALSE
564
-				$reg_step->set_is_current_step( FALSE );
564
+				$reg_step->set_is_current_step(FALSE);
565 565
 			}
566 566
 		}
567
-		if ( empty( $this->checkout->reg_steps )) {
568
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
567
+		if (empty($this->checkout->reg_steps)) {
568
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
569 569
 			return false;
570 570
 		}
571 571
 			// make reg step details available to JS
@@ -583,34 +583,34 @@  discard block
 block discarded – undo
583 583
 	 * @param int   $order
584 584
 	 * @return bool
585 585
 	 */
586
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
586
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
587 587
 
588 588
 		// we need a file_path, class_name, and slug to add a reg step
589
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
589
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
590 590
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
591
-			if ( $this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration' ) {
591
+			if ($this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration') {
592 592
 				return true;
593 593
 			}
594 594
 			// instantiate step class using file path and class name
595
-			$reg_step_obj = EE_Registry::instance()->load_file( $reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE  );
595
+			$reg_step_obj = EE_Registry::instance()->load_file($reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE);
596 596
 			// did we gets the goods ?
597
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
597
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
598 598
 				// set reg step order based on config
599
-				$reg_step_obj->set_order( $order );
599
+				$reg_step_obj->set_order($order);
600 600
 				// add instantiated reg step object to the master reg steps array
601
-				$this->checkout->add_reg_step( $reg_step_obj );
601
+				$this->checkout->add_reg_step($reg_step_obj);
602 602
 			} else {
603
-				EE_Error::add_error( __( 'The current step could not be set.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
603
+				EE_Error::add_error(__('The current step could not be set.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
604 604
 				return false;
605 605
 			}
606 606
 		} else {
607
-			if ( WP_DEBUG ) {
607
+			if (WP_DEBUG) {
608 608
 				EE_Error::add_error(
609 609
 					sprintf(
610
-						__( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ),
611
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
612
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
613
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
610
+						__('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'),
611
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
612
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
613
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
614 614
 						'<ul>',
615 615
 						'<li>',
616 616
 						'</li>',
@@ -634,16 +634,16 @@  discard block
 block discarded – undo
634 634
 	 */
635 635
 	private function _get_transaction_and_cart_for_previous_visit() {
636 636
 		/** @var $TXN_model EEM_Transaction */
637
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
637
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
638 638
 		// because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
639
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
639
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
640 640
 		// verify transaction
641
-		if ( $transaction instanceof EE_Transaction ) {
641
+		if ($transaction instanceof EE_Transaction) {
642 642
 			// and get the cart that was used for that transaction
643
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
643
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
644 644
 			return $transaction;
645 645
 		} else {
646
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
646
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
647 647
 			return NULL;
648 648
 		}
649 649
 	}
@@ -657,11 +657,11 @@  discard block
 block discarded – undo
657 657
 	 * @param EE_Transaction $transaction
658 658
 	 * @return EE_Cart
659 659
 	 */
660
-	private function _get_cart_for_transaction( $transaction ) {
661
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL;
660
+	private function _get_cart_for_transaction($transaction) {
661
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL;
662 662
 		// verify cart
663
-		if ( ! $cart instanceof EE_Cart ) {
664
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
663
+		if ( ! $cart instanceof EE_Cart) {
664
+			$cart = EE_Registry::instance()->load_core('Cart');
665 665
 		}
666 666
 		return $cart;
667 667
 	}
@@ -676,8 +676,8 @@  discard block
 block discarded – undo
676 676
 	 * @param EE_Transaction $transaction
677 677
 	 * 	@return EE_Cart
678 678
 	 */
679
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
680
-		return EE_Cart::get_cart_from_txn( $transaction );
679
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
680
+		return EE_Cart::get_cart_from_txn($transaction);
681 681
 	}
682 682
 
683 683
 
@@ -692,17 +692,17 @@  discard block
 block discarded – undo
692 692
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
693 693
 		//  if there's no transaction, then this is the FIRST visit to SPCO
694 694
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
695
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
695
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
696 696
 		// and then create a new transaction
697 697
 		$transaction = $this->_initialize_transaction();
698 698
 		// verify transaction
699
-		if ( $transaction instanceof EE_Transaction ) {
699
+		if ($transaction instanceof EE_Transaction) {
700 700
 			// save it so that we have an ID for other objects to use
701 701
 			$transaction->save();
702 702
 			// and save TXN data to the cart
703
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
703
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
704 704
 		} else {
705
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
705
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
706 706
 		}
707 707
 		return $transaction;
708 708
 	}
@@ -722,15 +722,15 @@  discard block
 block discarded – undo
722 722
 			// grab the cart grand total
723 723
 			$cart_total = $this->checkout->cart->get_cart_grand_total();
724 724
 			// create new TXN
725
-			return EE_Transaction::new_instance( array(
725
+			return EE_Transaction::new_instance(array(
726 726
 				'TXN_timestamp' 	=> time(),
727 727
 				'TXN_reg_steps' 		=> $this->checkout->initialize_txn_reg_steps_array(),
728 728
 				'TXN_total' 				=> $cart_total > 0 ? $cart_total : 0,
729 729
 				'TXN_paid' 				=> 0,
730 730
 				'STS_ID' 					=> EEM_Transaction::failed_status_code,
731 731
 			));
732
-		} catch( Exception $e ) {
733
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
732
+		} catch (Exception $e) {
733
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
734 734
 		}
735 735
 		return NULL;
736 736
 	}
@@ -744,34 +744,34 @@  discard block
 block discarded – undo
744 744
 	 * @param EE_Transaction $transaction
745 745
 	 * @return EE_Cart
746 746
 	 */
747
-	private function _get_registrations( EE_Transaction $transaction ) {
747
+	private function _get_registrations(EE_Transaction $transaction) {
748 748
 		// first step: grab the registrants  { : o
749
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
749
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
750 750
 		// verify registrations have been set
751
-		if ( empty( $registrations )) {
751
+		if (empty($registrations)) {
752 752
 			// if no cached registrations, then check the db
753
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
753
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
754 754
 			// still nothing ? well as long as this isn't a revisit
755
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
755
+			if (empty($registrations) && ! $this->checkout->revisit) {
756 756
 				// generate new registrations from scratch
757
-				$registrations = $this->_initialize_registrations( $transaction );
757
+				$registrations = $this->_initialize_registrations($transaction);
758 758
 			}
759 759
 		}
760 760
 		// sort by their original registration order
761
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
761
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
762 762
 		// then loop thru the array
763
-		foreach ( $registrations as $registration ) {
763
+		foreach ($registrations as $registration) {
764 764
 			// verify each registration
765
-			if ( $registration instanceof EE_Registration ) {
765
+			if ($registration instanceof EE_Registration) {
766 766
 				// we display all attendee info for the primary registrant
767
-				if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) {
767
+				if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) {
768 768
 					$this->checkout->primary_revisit = TRUE;
769 769
 					break;
770
-				} else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) {
770
+				} else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) {
771 771
 					// but hide info if it doesn't belong to you
772
-					$transaction->clear_cache( 'Registration', $registration->ID() );
772
+					$transaction->clear_cache('Registration', $registration->ID());
773 773
 				}
774
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
774
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
775 775
 			}
776 776
 		}
777 777
 	}
@@ -785,17 +785,17 @@  discard block
 block discarded – undo
785 785
 	 * @param EE_Transaction $transaction
786 786
 	 * @return    array
787 787
 	 */
788
-	private function _initialize_registrations( EE_Transaction $transaction ) {
788
+	private function _initialize_registrations(EE_Transaction $transaction) {
789 789
 		$att_nmbr = 0;
790 790
 		$registrations = array();
791
-		if ( $transaction instanceof EE_Transaction ) {
791
+		if ($transaction instanceof EE_Transaction) {
792 792
 			/** @type EE_Registration_Processor $registration_processor */
793
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
793
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
794 794
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
795 795
 			// now let's add the cart items to the $transaction
796
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
796
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
797 797
 				//do the following for each ticket of this type they selected
798
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
798
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
799 799
 					$att_nmbr++;
800 800
 					$registration = $registration_processor->generate_ONE_registration_from_line_item(
801 801
 						$line_item,
@@ -803,12 +803,12 @@  discard block
 block discarded – undo
803 803
 						$att_nmbr,
804 804
 						$this->checkout->total_ticket_count
805 805
 					);
806
-					if ( $registration instanceof EE_Registration ) {
807
-						$registrations[ $registration->ID() ] = $registration;
806
+					if ($registration instanceof EE_Registration) {
807
+						$registrations[$registration->ID()] = $registration;
808 808
 					}
809 809
 				}
810 810
 			}
811
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
811
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
812 812
 		}
813 813
 		return $registrations;
814 814
 	}
@@ -823,12 +823,12 @@  discard block
 block discarded – undo
823 823
 	 * @param EE_Registration $reg_B
824 824
 	 * @return array()
825 825
 	 */
826
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
826
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
827 827
 		// this shouldn't ever happen within the same TXN, but oh well
828
-		if ( $reg_A->count() == $reg_B->count() ) {
828
+		if ($reg_A->count() == $reg_B->count()) {
829 829
 			return 0;
830 830
 		}
831
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
831
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
832 832
 	}
833 833
 
834 834
 
@@ -843,35 +843,35 @@  discard block
 block discarded – undo
843 843
 	 */
844 844
 	private function _final_verifications() {
845 845
 		// filter checkout
846
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
846
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
847 847
 		//verify that current step is still set correctly
848
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
849
-			EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
848
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
849
+			EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850 850
 			return false;
851 851
 		}
852 852
 		// if returning to SPCO, then verify that primary registrant is set
853
-		if ( ! empty( $this->checkout->reg_url_link )) {
853
+		if ( ! empty($this->checkout->reg_url_link)) {
854 854
 			$valid_registrant = $this->checkout->transaction->primary_registration();
855
-			if ( ! $valid_registrant instanceof EE_Registration ) {
856
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
855
+			if ( ! $valid_registrant instanceof EE_Registration) {
856
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
857 857
 				return false;
858 858
 			}
859 859
 			$valid_registrant = null;
860
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
861
-				if ( $registration instanceof EE_Registration ) {
862
-					if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) {
860
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
861
+				if ($registration instanceof EE_Registration) {
862
+					if ($registration->reg_url_link() == $this->checkout->reg_url_link) {
863 863
 						$valid_registrant = $registration;
864 864
 					}
865 865
 				}
866 866
 			}
867
-			if ( ! $valid_registrant instanceof EE_Registration ) {
868
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
867
+			if ( ! $valid_registrant instanceof EE_Registration) {
868
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
869 869
 				return false;
870 870
 			}
871 871
 		}
872 872
 		// now that things have been kinda sufficiently verified,
873 873
 		// let's add the checkout to the session so that's available other systems
874
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
874
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
875 875
 		return true;
876 876
 	}
877 877
 
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 	 */
889 889
 	private function _initialize_reg_steps() {
890 890
 		/** @type EE_Transaction_Processor $transaction_processor */
891
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
891
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
892 892
 		// call set_reg_step_initiated ???
893 893
 		if (
894 894
 			// first time visiting SPCO ?
@@ -897,24 +897,24 @@  discard block
 block discarded – undo
897 897
 			&& $this->checkout->action === 'display_spco_reg_step'
898 898
 		) {
899 899
 			// set the start time for this reg step
900
-			if ( ! $transaction_processor->set_reg_step_initiated( $this->checkout->transaction, $this->checkout->current_step->slug() ) ) {
901
-				if ( WP_DEBUG ) {
902
-					EE_Error::add_error( sprintf(__( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), $this->checkout->current_step->name() ), __FILE__, __FUNCTION__, __LINE__ );
900
+			if ( ! $transaction_processor->set_reg_step_initiated($this->checkout->transaction, $this->checkout->current_step->slug())) {
901
+				if (WP_DEBUG) {
902
+					EE_Error::add_error(sprintf(__('The "%1$s" registration step was not initialized properly.', 'event_espresso'), $this->checkout->current_step->name()), __FILE__, __FUNCTION__, __LINE__);
903 903
 				}
904 904
 			};
905 905
 		}
906 906
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
907
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
907
+		foreach ($this->checkout->reg_steps as $reg_step) {
908 908
 			$reg_step->initialize_reg_step();
909 909
 			// i18n
910 910
 			$reg_step->translate_js_strings();
911
-			if ( $reg_step->is_current_step() ) {
911
+			if ($reg_step->is_current_step()) {
912 912
 				// the text that appears on the reg step form submit button
913 913
 				$reg_step->set_submit_button_text();
914 914
 			}
915 915
 		}
916 916
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
917
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
917
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
918 918
 	}
919 919
 
920 920
 
@@ -927,39 +927,39 @@  discard block
 block discarded – undo
927 927
 	 */
928 928
 	private function _check_form_submission() {
929 929
 		//does this request require the reg form to be generated ?
930
-		if ( $this->checkout->generate_reg_form ) {
930
+		if ($this->checkout->generate_reg_form) {
931 931
 			// ever heard that song by Blue Rodeo ?
932 932
 			try {
933 933
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
934 934
 				// if not displaying a form, then check for form submission
935
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
935
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
936 936
 					// clear out any old data in case this step is being run again
937
-					$this->checkout->current_step->set_valid_data( array() );
937
+					$this->checkout->current_step->set_valid_data(array());
938 938
 					// capture submitted form data
939 939
 					$this->checkout->current_step->reg_form->receive_form_submission(
940
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout )
940
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout)
941 941
 					);
942 942
 					// validate submitted form data
943
-					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) {
943
+					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) {
944 944
 						// thou shall not pass !!!
945 945
 						$this->checkout->continue_reg = FALSE;
946 946
 						// any form validation errors?
947
-						if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) {
947
+						if ($this->checkout->current_step->reg_form->submission_error_message() != '') {
948 948
 							$submission_error_messages = array();
949 949
 							// bad, bad, bad registrant
950
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
951
-								if ( $validation_error instanceof EE_Validation_Error ) {
952
-									$submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() );
950
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
951
+								if ($validation_error instanceof EE_Validation_Error) {
952
+									$submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage());
953 953
 								}
954 954
 							}
955
-							EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
955
+							EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
956 956
 						}
957 957
 						// well not really... what will happen is we'll just get redirected back to redo the current step
958 958
 						$this->go_to_next_step();
959 959
 						return;
960 960
 					}
961 961
 				}
962
-			} catch( EE_Error $e ) {
962
+			} catch (EE_Error $e) {
963 963
 				$e->get_error();
964 964
 			}
965 965
 		}
@@ -975,38 +975,38 @@  discard block
 block discarded – undo
975 975
 	 */
976 976
 	private function _process_form_action() {
977 977
 		// what cha wanna do?
978
-		switch( $this->checkout->action ) {
978
+		switch ($this->checkout->action) {
979 979
 			// AJAX next step reg form
980 980
 			case 'display_spco_reg_step' :
981 981
 				$this->checkout->redirect = FALSE;
982
-				if ( EE_Registry::instance()->REQ->ajax ) {
983
-					$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
982
+				if (EE_Registry::instance()->REQ->ajax) {
983
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
984 984
 				}
985 985
 				break;
986 986
 
987 987
 			default :
988 988
 				// meh... do one of those other steps first
989
-				if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
989
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
990 990
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
991
-					do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
991
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
992 992
 					// call action on current step
993
-					if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) {
993
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
994 994
 						// good registrant, you get to proceed
995
-						if ( $this->checkout->current_step->success_message() != '' ) {
996
-							if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) {
997
-								EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() );
995
+						if ($this->checkout->current_step->success_message() != '') {
996
+							if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) {
997
+								EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions());
998 998
 							}
999 999
 						}
1000 1000
 						// pack it up, pack it in...
1001 1001
 						$this->_setup_redirect();
1002 1002
 					}
1003 1003
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
1004
-					do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1004
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1005 1005
 
1006 1006
 				} else {
1007 1007
 					EE_Error::add_error(
1008 1008
 						sprintf(
1009
-							__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1009
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1010 1010
 							$this->checkout->action,
1011 1011
 							$this->checkout->current_step->name()
1012 1012
 						),
@@ -1032,10 +1032,10 @@  discard block
 block discarded – undo
1032 1032
 	public function add_styles_and_scripts() {
1033 1033
 		// i18n
1034 1034
 		$this->translate_js_strings();
1035
-		if ( $this->checkout->admin_request ) {
1036
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1035
+		if ($this->checkout->admin_request) {
1036
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1037 1037
 		} else {
1038
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1038
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1039 1039
 		}
1040 1040
 	}
1041 1041
 
@@ -1051,45 +1051,45 @@  discard block
 block discarded – undo
1051 1051
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1052 1052
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1053 1053
 		EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1054
-		EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' );
1055
-		EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' );
1056
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' );
1054
+		EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1055
+		EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso');
1056
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso');
1057 1057
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1058 1058
 		EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso');
1059
-		EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' );
1060
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1059
+		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>');
1060
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1061 1061
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1062 1062
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1063
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1064
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1065
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1066
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1067
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1068
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1069
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1070
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1071
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1072
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1073
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1074
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1075
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1076
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1063
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1064
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1065
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1066
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1067
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1068
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1069
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1070
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1071
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1072
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1073
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1074
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1075
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1076
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1077 1077
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1078
-			__( '%1$sWe\'re sorry, but you\'re registration time has expired
1078
+			__('%1$sWe\'re sorry, but you\'re registration time has expired
1079 1079
 			.%2$s%3$s%4$sIf you still wish to complete your registration, please
1080 1080
 			return to the %5$sEvent List%6$sEvent List%7$s and reselect your
1081 1081
 			tickets if available. Please except our apologies for any inconvenience this
1082
-			may have caused.%8$s', 'event_espresso' ),
1082
+			may have caused.%8$s', 'event_espresso'),
1083 1083
 			'<h4 class="important-notice">',
1084 1084
 			'</h4>',
1085 1085
 			'<br />',
1086 1086
 			'<p>',
1087
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1087
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1088 1088
 			'">',
1089 1089
 			'</a>',
1090 1090
 			'</p>'
1091 1091
 		);
1092
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1092
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1093 1093
 	}
1094 1094
 
1095 1095
 
@@ -1102,25 +1102,25 @@  discard block
 block discarded – undo
1102 1102
 	 */
1103 1103
 	public function enqueue_styles_and_scripts() {
1104 1104
 		// load css
1105
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1106
-		wp_enqueue_style( 'single_page_checkout' );
1105
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1106
+		wp_enqueue_style('single_page_checkout');
1107 1107
 		// load JS
1108
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1109
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1110
-		wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE );
1111
-		wp_enqueue_script( 'single_page_checkout' );
1108
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1109
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1110
+		wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE);
1111
+		wp_enqueue_script('single_page_checkout');
1112 1112
 
1113 1113
 		/**
1114 1114
 		 * global action hook for enqueueing styles and scripts with
1115 1115
 		 * spco calls.
1116 1116
 		 */
1117
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1117
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1118 1118
 
1119 1119
 		/**
1120 1120
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1121 1121
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1122 1122
 		 */
1123
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1123
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1124 1124
 
1125 1125
 		// add css and JS for current step
1126 1126
 		$this->checkout->current_step->enqueue_styles_and_scripts();
@@ -1136,20 +1136,20 @@  discard block
 block discarded – undo
1136 1136
 	 */
1137 1137
 	private function _display_spco_reg_form() {
1138 1138
 		// if registering via the admin, just display the reg form for the current step
1139
-		if ( $this->checkout->admin_request ) {
1140
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1139
+		if ($this->checkout->admin_request) {
1140
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1141 1141
 		} else {
1142 1142
 			// add powered by EE msg
1143
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1143
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1144 1144
 
1145
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1145
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1146 1146
 			$cookies_not_set_msg = '';
1147
-			if ( $empty_cart ) {
1148
-				if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1147
+			if ($empty_cart) {
1148
+				if ( ! isset($_COOKIE['ee_cookie_test'])) {
1149 1149
 					$cookies_not_set_msg = apply_filters(
1150 1150
 						'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1151 1151
 						sprintf(
1152
-							__( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ),
1152
+							__('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'),
1153 1153
 							'<div class="ee-attention">',
1154 1154
 							'</div>',
1155 1155
 							'<h6 class="important-notice">',
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
 					'layout_strategy' =>
1171 1171
 						new EE_Template_Layout(
1172 1172
 							array(
1173
-								'layout_template_file' 			=> SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1173
+								'layout_template_file' 			=> SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1174 1174
 								'template_args' => array(
1175 1175
 									'empty_cart' 		=> $empty_cart,
1176 1176
 									'revisit' 				=> $this->checkout->revisit,
@@ -1179,8 +1179,8 @@  discard block
 block discarded – undo
1179 1179
 									'empty_msg' 		=> apply_filters(
1180 1180
 										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1181 1181
 										sprintf(
1182
-											__( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ),
1183
-											'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1182
+											__('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'),
1183
+											'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1184 1184
 											'">',
1185 1185
 											'</a>'
1186 1186
 										)
@@ -1188,14 +1188,14 @@  discard block
 block discarded – undo
1188 1188
 									'cookies_not_set_msg' 		=> $cookies_not_set_msg,
1189 1189
 									'registration_time_limit' 	=> $this->checkout->get_registration_time_limit(),
1190 1190
 									'session_expiration' 			=>
1191
-										gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) )
1191
+										gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS))
1192 1192
 							)
1193 1193
 						)
1194 1194
 					)
1195 1195
 				)
1196 1196
 			);
1197 1197
 			// load template and add to output sent that gets filtered into the_content()
1198
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() );
1198
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js());
1199 1199
 		}
1200 1200
 	}
1201 1201
 
@@ -1209,8 +1209,8 @@  discard block
 block discarded – undo
1209 1209
 	 * @internal  param string $label
1210 1210
 	 * @return        string
1211 1211
 	 */
1212
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1213
-		if ( $next_step == 'finalize_registration' ) {
1212
+	public function add_extra_finalize_registration_inputs($next_step) {
1213
+		if ($next_step == 'finalize_registration') {
1214 1214
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1215 1215
 		}
1216 1216
 	}
@@ -1224,18 +1224,18 @@  discard block
 block discarded – undo
1224 1224
 	 *  @return 	string
1225 1225
 	 */
1226 1226
 	public static function display_registration_footer() {
1227
-		if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) {
1228
-			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1229
-			$url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'http://eventespresso.com/' );
1230
-			$url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1227
+		if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) {
1228
+			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1229
+			$url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'http://eventespresso.com/');
1230
+			$url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1231 1231
 			echo apply_filters(
1232 1232
 				'FHEE__EE_Front_Controller__display_registration_footer',
1233 1233
 				sprintf(
1234
-					__( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ),
1235
-					'<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="',
1234
+					__('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'),
1235
+					'<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="',
1236 1236
 					'" target="_blank">',
1237 1237
 					'</a>',
1238
-					'<a href="' . $url . '" title="',
1238
+					'<a href="'.$url.'" title="',
1239 1239
 					'" target="_blank">',
1240 1240
 					'</a></div>'
1241 1241
 				)
@@ -1266,12 +1266,12 @@  discard block
 block discarded – undo
1266 1266
 	 * @return 	array
1267 1267
 	 */
1268 1268
 	private function _setup_redirect() {
1269
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1269
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1270 1270
 			$this->checkout->redirect = TRUE;
1271
-			if ( empty( $this->checkout->redirect_url )) {
1271
+			if (empty($this->checkout->redirect_url)) {
1272 1272
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1273 1273
 			}
1274
-			$this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout );
1274
+			$this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout);
1275 1275
 		}
1276 1276
 	}
1277 1277
 
@@ -1284,12 +1284,12 @@  discard block
 block discarded – undo
1284 1284
 	 * @return void
1285 1285
 	 */
1286 1286
 	public function go_to_next_step() {
1287
-		if ( EE_Registry::instance()->REQ->ajax ) {
1287
+		if (EE_Registry::instance()->REQ->ajax) {
1288 1288
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1289
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1289
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1290 1290
 		}
1291 1291
 		// just return for these conditions
1292
-		if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) {
1292
+		if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') {
1293 1293
 			return;
1294 1294
 		}
1295 1295
 		// AJAX response
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 	 */
1311 1311
 	protected function _handle_json_response() {
1312 1312
 		// if this is an ajax request
1313
-		if ( EE_Registry::instance()->REQ->ajax ) {
1313
+		if (EE_Registry::instance()->REQ->ajax) {
1314 1314
 			// DEBUG LOG
1315 1315
 			//$this->checkout->log(
1316 1316
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1320,10 +1320,10 @@  discard block
 block discarded – undo
1320 1320
 			//		'continue_reg'               => $this->checkout->continue_reg,
1321 1321
 			//	)
1322 1322
 			//);
1323
-			$this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() );
1324
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1323
+			$this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit());
1324
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1325 1325
 			// just send the ajax (
1326
-			$json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response );
1326
+			$json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response);
1327 1327
 			$this->unlock_transaction();
1328 1328
 			echo $json_response;
1329 1329
 			exit();
@@ -1340,9 +1340,9 @@  discard block
 block discarded – undo
1340 1340
 	 */
1341 1341
 	protected function _handle_html_redirects() {
1342 1342
 		// going somewhere ?
1343
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1343
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1344 1344
 			// store notices in a transient
1345
-			EE_Error::get_notices( false, true, true );
1345
+			EE_Error::get_notices(false, true, true);
1346 1346
 			$this->unlock_transaction();
1347 1347
 			// DEBUG LOG
1348 1348
 			//$this->checkout->log(
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 			//		'headers_list'    => headers_list(),
1354 1354
 			//	)
1355 1355
 			//);
1356
-			wp_safe_redirect( $this->checkout->redirect_url );
1356
+			wp_safe_redirect($this->checkout->redirect_url);
1357 1357
 			exit();
1358 1358
 		}
1359 1359
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_Checkout.class.php 3 patches
Doc Comments   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
 	/**
253 253
 	 * returns true if ANY reg status was updated during checkout
254
-	 * @return array
254
+	 * @return boolean|null
255 255
 	 */
256 256
 	public function any_reg_status_updated() {
257 257
 		foreach ( $this->reg_status_updated as $reg_status ) {
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
 	/**
277 277
 	 * @param $REG_ID
278
-	 * @param $reg_status
278
+	 * @param boolean $reg_status
279 279
 	 */
280 280
 	public function set_reg_status_updated( $REG_ID, $reg_status ) {
281 281
 		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	 * 	reset_reg_steps
531 531
 	 *
532 532
 	 * 	@access public
533
-	 * 	@return 	bool
533
+	 * 	@return 	boolean|null
534 534
 	 */
535 535
 	public function reset_reg_steps() {
536 536
 		$this->sort_reg_steps();
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 	 * 	stores whether any updates were made to the TXN or it's related registrations
644 644
 	 *
645 645
 	 * 	@access public
646
-	 * 	@return 	bool
646
+	 * 	@return 	boolean|null
647 647
 	 */
648 648
 	public function track_transaction_and_registration_status_updates() {
649 649
 		// verify the transaction
@@ -991,6 +991,7 @@  discard block
 block discarded – undo
991 991
 	 *
992 992
 	 * @param 	string | int 	$reg_cache_ID
993 993
 	 * @param 	EE_Registration 	$registration
994
+	 * @param integer $reg_cache_ID
994 995
 	 * @return void
995 996
 	 */
996 997
 	protected function _refresh_registration( $reg_cache_ID, $registration ) {
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_Checkout
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage    core
10
- * @author				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_Checkout
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage    core
10
+  * @author				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_Checkout {
15 15
 
16 16
 	/**
Please login to merge, or discard this patch.
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 		$this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url();
243 243
 		$this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url();
244 244
 		$this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url();
245
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE );
245
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE);
246 246
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax;
247
-		$this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' ));
247
+		$this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC'));
248 248
 	}
249 249
 
250 250
 
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 	 * @return array
255 255
 	 */
256 256
 	public function any_reg_status_updated() {
257
-		foreach ( $this->reg_status_updated as $reg_status ) {
258
-			if ( $reg_status ) {
257
+		foreach ($this->reg_status_updated as $reg_status) {
258
+			if ($reg_status) {
259 259
 				return true;
260 260
 			}
261 261
 		}
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 	 * @param $REG_ID
268 268
 	 * @return array
269 269
 	 */
270
-	public function reg_status_updated( $REG_ID ) {
271
-		return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false;
270
+	public function reg_status_updated($REG_ID) {
271
+		return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false;
272 272
 	}
273 273
 
274 274
 
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 	 * @param $REG_ID
278 278
 	 * @param $reg_status
279 279
 	 */
280
-	public function set_reg_status_updated( $REG_ID, $reg_status ) {
281
-		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
280
+	public function set_reg_status_updated($REG_ID, $reg_status) {
281
+		$this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN);
282 282
 	}
283 283
 
284 284
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * can ONLY be set by the  Finalize_Registration reg step
300 300
 	 */
301 301
 	public function set_exit_spco() {
302
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
302
+		if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
303 303
 			$this->exit_spco = true;
304 304
 		}
305 305
 	}
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	public function reset_for_current_request() {
318 318
 		$this->process_form_submission = FALSE;
319
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true );
319
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true);
320 320
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax;
321 321
 		$this->continue_reg = true;
322 322
 		$this->redirect = false;
323 323
 		// don't reset the cached redirect form if we're about to be asked to display it !!!
324
-		if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) {
324
+		if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') {
325 325
 			$this->redirect_form = '';
326 326
 		}
327 327
 		$this->redirect_url = '';
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
 	 * @param EE_SPCO_Reg_Step $reg_step_obj
339 339
 	 * @return    void
340 340
 	 */
341
-	public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) {
342
-		$this->reg_steps[ $reg_step_obj->slug()  ] = $reg_step_obj;
341
+	public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) {
342
+		$this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj;
343 343
 	}
344 344
 
345 345
 
@@ -351,13 +351,13 @@  discard block
 block discarded – undo
351 351
 	 * @param string $reg_step_slug
352 352
 	 * @return    void
353 353
 	 */
354
-	public function remove_reg_step( $reg_step_slug = '' ) {
355
-		unset( $this->reg_steps[ $reg_step_slug  ] );
356
-		if ( $this->transaction instanceof EE_Transaction ) {
354
+	public function remove_reg_step($reg_step_slug = '') {
355
+		unset($this->reg_steps[$reg_step_slug]);
356
+		if ($this->transaction instanceof EE_Transaction) {
357 357
 			/** @type EE_Transaction_Processor $transaction_processor */
358
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
358
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
359 359
 			// now remove reg step from TXN and save
360
-			$transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug );
360
+			$transaction_processor->remove_reg_step($this->transaction, $reg_step_slug);
361 361
 			$this->transaction->save();
362 362
 		}
363 363
 	}
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
 	 * @param int    $order
373 373
 	 * @return    void
374 374
 	 */
375
-	public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) {
376
-		if ( isset( $this->reg_steps[ $reg_step_slug  ] )) {
377
-			$this->reg_steps[ $reg_step_slug ]->set_order( $order );
375
+	public function set_reg_step_order($reg_step_slug = '', $order = 100) {
376
+		if (isset($this->reg_steps[$reg_step_slug])) {
377
+			$this->reg_steps[$reg_step_slug]->set_order($order);
378 378
 		}
379 379
 	}
380 380
 
@@ -387,25 +387,25 @@  discard block
 block discarded – undo
387 387
 	 * @param string $current_step
388 388
 	 * @return    void
389 389
 	 */
390
-	public function set_current_step( $current_step ) {
390
+	public function set_current_step($current_step) {
391 391
 		// grab what step we're on
392
-		$this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps );
392
+		$this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps);
393 393
 		// verify instance
394
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step ) {
394
+		if ($this->current_step instanceof EE_SPCO_Reg_Step) {
395 395
 			// we don't want to repeat completed steps if this is the first time through SPCO
396
-			if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) {
396
+			if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) {
397 397
 				// so advance to the next step
398 398
 				$this->set_next_step();
399
-				if ( $this->next_step instanceof EE_SPCO_Reg_Step ) {
399
+				if ($this->next_step instanceof EE_SPCO_Reg_Step) {
400 400
 					// and attempt to set it as the current step
401
-					$this->set_current_step( $this->next_step->slug() );
401
+					$this->set_current_step($this->next_step->slug());
402 402
 				}
403 403
 				return;
404 404
 			}
405
-			$this->current_step->set_is_current_step( TRUE );
405
+			$this->current_step->set_is_current_step(TRUE);
406 406
 		} else {
407 407
 			EE_Error::add_error(
408
-				__( 'The current step could not be set.', 'event_espresso' ),
408
+				__('The current step could not be set.', 'event_espresso'),
409 409
 				__FILE__, __FUNCTION__, __LINE__
410 410
 			);
411 411
 		}
@@ -422,20 +422,20 @@  discard block
 block discarded – undo
422 422
 	 */
423 423
 	public function set_next_step() {
424 424
 		// set pointer to start of array
425
-		reset( $this->reg_steps );
425
+		reset($this->reg_steps);
426 426
 		// if there is more than one step
427
-		if ( count( $this->reg_steps ) > 1 ) {
427
+		if (count($this->reg_steps) > 1) {
428 428
 			// advance to the current step and set pointer
429
-			while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) {
430
-				next( $this->reg_steps );
429
+			while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') {
430
+				next($this->reg_steps);
431 431
 			}
432 432
 		}
433 433
 		// advance one more spot ( if it exists )
434
-		$this->next_step = next( $this->reg_steps );
434
+		$this->next_step = next($this->reg_steps);
435 435
 		// verify instance
436
-		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step  : NULL;
436
+		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL;
437 437
 		// then back to current step to reset
438
-		prev( $this->reg_steps );
438
+		prev($this->reg_steps);
439 439
 	}
440 440
 
441 441
 
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 	 *  @return 	EE_SPCO_Reg_Step | null
450 450
 	 */
451 451
 	public function get_next_reg_step() {
452
-		$next = next( $this->reg_steps );
453
-		prev( $this->reg_steps );
452
+		$next = next($this->reg_steps);
453
+		prev($this->reg_steps);
454 454
 		return $next instanceof EE_SPCO_Reg_Step ? $next : null;
455 455
 	}
456 456
 
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 	 *  @return 	EE_SPCO_Reg_Step | null
466 466
 	 */
467 467
 	public function get_prev_reg_step() {
468
-		$prev = prev( $this->reg_steps );
469
-		next( $this->reg_steps );
468
+		$prev = prev($this->reg_steps);
469
+		next($this->reg_steps);
470 470
 		return $prev instanceof EE_SPCO_Reg_Step ? $prev : null;
471 471
 	}
472 472
 
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
 	 * @return void
480 480
 	 */
481 481
 	public function sort_reg_steps() {
482
-		$reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' );
483
-		uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback ));
482
+		$reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback');
483
+		uasort($this->reg_steps, array($this, $reg_step_sorting_callback));
484 484
 	}
485 485
 
486 486
 
@@ -493,17 +493,17 @@  discard block
 block discarded – undo
493 493
 	 * @param EE_SPCO_Reg_Step $reg_step_B
494 494
 	 * @return array()
495 495
 	 */
496
-	public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) {
496
+	public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) {
497 497
 		// send finalize_registration step to the end of the array
498
-		if ( $reg_step_A->slug() == 'finalize_registration' ) {
498
+		if ($reg_step_A->slug() == 'finalize_registration') {
499 499
 			return 1;
500
-		} else if ( $reg_step_B->slug() == 'finalize_registration' ) {
500
+		} else if ($reg_step_B->slug() == 'finalize_registration') {
501 501
 			return -1;
502 502
 		}
503
-		if ( $reg_step_A->order() == $reg_step_B->order() ) {
503
+		if ($reg_step_A->order() == $reg_step_B->order()) {
504 504
 			return 0;
505 505
 		}
506
-		return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1;
506
+		return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1;
507 507
 	}
508 508
 
509 509
 
@@ -515,10 +515,10 @@  discard block
 block discarded – undo
515 515
 	 * 	@return 	void
516 516
 	 */
517 517
 	public function set_reg_step_JSON_info() {
518
-		EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array();
518
+		EE_Registry::$i18n_js_strings['reg_steps'] = array();
519 519
 		// pass basic reg step data to JS
520
-		foreach ( $this->reg_steps as $reg_step ) {
521
-			EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug();
520
+		foreach ($this->reg_steps as $reg_step) {
521
+			EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug();
522 522
 		}
523 523
 		// reset reg step html
524 524
 //		$this->json_response->set_reg_step_html( '' );
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	 */
535 535
 	public function reset_reg_steps() {
536 536
 		$this->sort_reg_steps();
537
-		$this->set_current_step( EE_Registry::instance()->REQ->get( 'step' ));
537
+		$this->set_current_step(EE_Registry::instance()->REQ->get('step'));
538 538
 		$this->set_next_step();
539 539
 		// the text that appears on the reg step form submit button
540 540
 		$this->current_step->set_submit_button_text();
@@ -551,9 +551,9 @@  discard block
 block discarded – undo
551 551
 	 */
552 552
 	public function get_registration_time_limit() {
553 553
 
554
-		$registration_time_limit = (float)( EE_Registry::instance()	->SSN->expiration() - time() );
554
+		$registration_time_limit = (float) (EE_Registry::instance()	->SSN->expiration() - time());
555 555
 		$time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s';
556
-		$registration_time_limit = gmdate( $time_limit_format, $registration_time_limit );
556
+		$registration_time_limit = gmdate($time_limit_format, $registration_time_limit);
557 557
 		return apply_filters(
558 558
 			'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit',
559 559
 			$registration_time_limit
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 		//		overpaid TXN
574 574
 		//		free TXN ( total = 0.00 )
575 575
 		// then payment required is TRUE
576
-		return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE;
576
+		return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE;
577 577
 	}
578 578
 
579 579
 
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 	 */
587 587
 	public function initialize_txn_reg_steps_array() {
588 588
 		$txn_reg_steps_array = array();
589
-		foreach ( $this->reg_steps as $reg_step ) {
590
-			$txn_reg_steps_array[ $reg_step->slug() ] = FALSE;
589
+		foreach ($this->reg_steps as $reg_step) {
590
+			$txn_reg_steps_array[$reg_step->slug()] = FALSE;
591 591
 		}
592 592
 		return $txn_reg_steps_array;
593 593
 	}
@@ -603,13 +603,13 @@  discard block
 block discarded – undo
603 603
 	public function update_txn_reg_steps_array() {
604 604
 		$updated = FALSE;
605 605
 		/** @type EE_Transaction_Processor $transaction_processor */
606
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
607
-		foreach ( $this->reg_steps as $reg_step ) {
608
-			if ( $reg_step->completed() ) {
609
-				$updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated;
606
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
607
+		foreach ($this->reg_steps as $reg_step) {
608
+			if ($reg_step->completed()) {
609
+				$updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated;
610 610
 			}
611 611
 		}
612
-		if ( $updated ) {
612
+		if ($updated) {
613 613
 			$this->transaction->save();
614 614
 		}
615 615
 		return $updated;
@@ -624,14 +624,14 @@  discard block
 block discarded – undo
624 624
 	 * 	@return 	void
625 625
 	 */
626 626
 	public function stash_transaction_and_checkout() {
627
-		if ( ! $this->revisit ) {
627
+		if ( ! $this->revisit) {
628 628
 			$this->update_txn_reg_steps_array();
629 629
 		}
630 630
 		$this->track_transaction_and_registration_status_updates();
631 631
 		// save all data to the db, but suppress errors
632 632
 		//$this->save_all_data( FALSE );
633 633
 		// cache the checkout in the session
634
-		EE_Registry::instance()->SSN->set_checkout( $this );
634
+		EE_Registry::instance()->SSN->set_checkout($this);
635 635
 	}
636 636
 
637 637
 
@@ -647,21 +647,21 @@  discard block
 block discarded – undo
647 647
 	 */
648 648
 	public function track_transaction_and_registration_status_updates() {
649 649
 		// verify the transaction
650
-		if ( $this->transaction instanceof EE_Transaction ) {
650
+		if ($this->transaction instanceof EE_Transaction) {
651 651
 			/** @type EE_Transaction_Payments $transaction_payments */
652
-			$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
652
+			$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
653 653
 			/** @type EE_Transaction_Processor $transaction_processor */
654
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
654
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
655 655
 			// has there been a TXN status change during this checkout?
656
-			if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) {
656
+			if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) {
657 657
 				$this->txn_status_updated = true;
658 658
 			}
659 659
 			/** @type EE_Registration_Processor $registration_processor */
660
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
660
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
661 661
 			// grab the saved registrations from the transaction
662
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) {
663
-				if ( $registration_processor->reg_status_updated( $registration->ID() ) ) {
664
-					$this->set_reg_status_updated( $registration->ID(), true );
662
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) {
663
+				if ($registration_processor->reg_status_updated($registration->ID())) {
664
+					$this->set_reg_status_updated($registration->ID(), true);
665 665
 				}
666 666
 			}
667 667
 		}
@@ -683,8 +683,8 @@  discard block
 block discarded – undo
683 683
 	 * @param 	EE_Registration 	$registration
684 684
 	 * 	@return 	bool
685 685
 	 */
686
-	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
687
-		return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE;
686
+	public function visit_allows_processing_of_this_registration(EE_Registration $registration) {
687
+		return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE;
688 688
 	}
689 689
 
690 690
 
@@ -709,18 +709,18 @@  discard block
 block discarded – undo
709 709
 	 * @param bool $show_errors
710 710
 	 * @return bool
711 711
 	 */
712
-	public function save_all_data( $show_errors = TRUE ) {
712
+	public function save_all_data($show_errors = TRUE) {
713 713
 		// verify the transaction
714
-		if ( $this->transaction instanceof EE_Transaction ) {
714
+		if ($this->transaction instanceof EE_Transaction) {
715 715
 			// save to ensure that TXN has ID
716 716
 			$this->transaction->save();
717 717
 			// grab the saved registrations from the transaction
718
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as  $registration ) {
719
-				$this->_save_registration( $registration, $show_errors );
718
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as  $registration) {
719
+				$this->_save_registration($registration, $show_errors);
720 720
 			}
721 721
 		} else {
722
-			if ( $show_errors ) {
723
-				EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
722
+			if ($show_errors) {
723
+				EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
724 724
 			}
725 725
 			return FALSE;
726 726
 		}
@@ -735,32 +735,32 @@  discard block
 block discarded – undo
735 735
 	 * @param bool $show_errors
736 736
 	 * @return void
737 737
 	 */
738
-	private function _save_registration( $registration, $show_errors = TRUE  ) {
738
+	private function _save_registration($registration, $show_errors = TRUE) {
739 739
 		// verify object
740
-		if ( $registration instanceof EE_Registration ) {
740
+		if ($registration instanceof EE_Registration) {
741 741
 			// should this registration be processed during this visit ?
742
-			if ( $this->visit_allows_processing_of_this_registration( $registration ) ) {
742
+			if ($this->visit_allows_processing_of_this_registration($registration)) {
743 743
 				//set TXN ID
744
-				if ( ! $registration->transaction_ID() ) {
745
-					$registration->set_transaction_id( $this->transaction->ID() );
744
+				if ( ! $registration->transaction_ID()) {
745
+					$registration->set_transaction_id($this->transaction->ID());
746 746
 				}
747 747
 				// verify and save the attendee
748
-				$this->_save_registration_attendee( $registration, $show_errors );
748
+				$this->_save_registration_attendee($registration, $show_errors);
749 749
 				// save answers to reg form questions
750
-				$this->_save_registration_answers( $registration, $show_errors );
750
+				$this->_save_registration_answers($registration, $show_errors);
751 751
 				// save changes
752 752
 				$registration->save();
753 753
 				// update txn cache
754
-				if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) {
755
-					if ( $show_errors ) {
756
-						EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
754
+				if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) {
755
+					if ($show_errors) {
756
+						EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
757 757
 					}
758 758
 				}
759 759
 			}
760 760
 		} else {
761
-			if ( $show_errors ) {
761
+			if ($show_errors) {
762 762
 				EE_Error::add_error(
763
-					__( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ),
763
+					__('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'),
764 764
 					__FILE__, __FUNCTION__, __LINE__
765 765
 				);
766 766
 			}
@@ -776,26 +776,26 @@  discard block
 block discarded – undo
776 776
 	 * @param bool $show_errors
777 777
 	 * @return void
778 778
 	 */
779
-	private function _save_registration_attendee( $registration, $show_errors = TRUE ) {
780
-		if ( $registration->attendee() instanceof EE_Attendee ) {
779
+	private function _save_registration_attendee($registration, $show_errors = TRUE) {
780
+		if ($registration->attendee() instanceof EE_Attendee) {
781 781
 			// save so that ATT has ID
782 782
 			$registration->attendee()->save();
783
-			if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) {
784
-				if ( $show_errors ) {
783
+			if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) {
784
+				if ($show_errors) {
785 785
 					EE_Error::add_error(
786
-						__( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ),
786
+						__('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'),
787 787
 						__FILE__, __FUNCTION__, __LINE__
788 788
 					);
789 789
 				}
790 790
 			}
791 791
 		} else {
792
-			if ( $show_errors ) {
792
+			if ($show_errors) {
793 793
 				ob_start();
794
-				var_dump( $registration->attendee() );
794
+				var_dump($registration->attendee());
795 795
 				EE_Error::add_error(
796 796
 					sprintf(
797 797
 						'%1$s||%1$s $attendee = %2$s',
798
-						__( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ),
798
+						__('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'),
799 799
 						ob_get_clean()
800 800
 					),
801 801
 					__FILE__, __FUNCTION__, __LINE__
@@ -813,25 +813,25 @@  discard block
 block discarded – undo
813 813
 	 * @param bool $show_errors
814 814
 	 * @return void
815 815
 	 */
816
-	private function _save_registration_answers( $registration, $show_errors = TRUE ) {
816
+	private function _save_registration_answers($registration, $show_errors = TRUE) {
817 817
 		// now save the answers
818
-		foreach ( $registration->answers() as $cache_key => $answer ) {
818
+		foreach ($registration->answers() as $cache_key => $answer) {
819 819
 			// verify object
820
-			if ( $answer instanceof EE_Answer ) {
821
-				$answer->set_registration( $registration->ID() );
820
+			if ($answer instanceof EE_Answer) {
821
+				$answer->set_registration($registration->ID());
822 822
 				$answer->save();
823
-				if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) {
824
-					if ( $show_errors ) {
823
+				if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) {
824
+					if ($show_errors) {
825 825
 						EE_Error::add_error(
826
-							__( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ),
826
+							__('The newly saved Answer object could not be cached on the registration.', 'event_espresso'),
827 827
 							__FILE__, __FUNCTION__, __LINE__
828 828
 						);
829 829
 					}
830 830
 				}
831 831
 			} else {
832
-				if ( $show_errors ) {
832
+				if ($show_errors) {
833 833
 					EE_Error::add_error(
834
-						__( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ),
834
+						__('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'),
835 835
 						__FILE__, __FUNCTION__, __LINE__
836 836
 					);
837 837
 				}
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 	 * @param bool $from_db
850 850
 	 * @return bool
851 851
 	 */
852
-	public function refresh_all_entities( $from_db = false ) {
852
+	public function refresh_all_entities($from_db = false) {
853 853
 		$from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db;
854 854
 		//$this->log(
855 855
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -870,11 +870,11 @@  discard block
 block discarded – undo
870 870
 	 */
871 871
 	protected function refresh_from_db() {
872 872
 		// verify the transaction
873
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
873
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
874 874
 			// pull fresh TXN data from the db
875
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() );
875
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID());
876 876
 			// update EE_Checkout's cached primary_attendee object
877
-			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction );
877
+			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction);
878 878
 			// update EE_Checkout's cached payment object
879 879
 			$payment = $this->transaction->last_payment();
880 880
 			$this->payment = $payment instanceof EE_Payment ? $payment : $this->payment;
@@ -882,15 +882,15 @@  discard block
 block discarded – undo
882 882
 			$payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null;
883 883
 			$this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method;
884 884
 			//now refresh the cart, based on the TXN
885
-			$this->cart = EE_Cart::get_cart_from_txn( $this->transaction );
885
+			$this->cart = EE_Cart::get_cart_from_txn($this->transaction);
886 886
 			// verify and update the cart because inaccurate totals are not so much fun
887
-			if ( $this->cart instanceof EE_Cart ) {
887
+			if ($this->cart instanceof EE_Cart) {
888 888
 				$this->cart->get_grand_total()->recalculate_total_including_taxes();
889 889
 			} else {
890
-				$this->cart = EE_Registry::instance()->load_core( 'Cart' );
890
+				$this->cart = EE_Registry::instance()->load_core('Cart');
891 891
 			}
892 892
 		} else {
893
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
893
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
894 894
 			return FALSE;
895 895
 		}
896 896
 		return TRUE;
@@ -904,24 +904,24 @@  discard block
 block discarded – undo
904 904
 	 * @param   EE_Transaction $transaction
905 905
 	 * @return  EE_Attendee | null
906 906
 	 */
907
-	protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) {
907
+	protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) {
908 908
 
909 909
 		$primary_attendee_obj = null;
910 910
 		// grab the saved registrations from the transaction
911
-		foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) {
911
+		foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) {
912 912
 			// verify object
913
-			if ( $registration instanceof EE_Registration ) {
913
+			if ($registration instanceof EE_Registration) {
914 914
 				$attendee = $registration->attendee();
915 915
 				// verify object
916
-				if ( $attendee instanceof EE_Attendee  ) {
916
+				if ($attendee instanceof EE_Attendee) {
917 917
 					// maybe cache primary_attendee_obj ?
918
-					if ( $registration->is_primary_registrant() ) {
918
+					if ($registration->is_primary_registrant()) {
919 919
 						$primary_attendee_obj = $attendee;
920 920
 					}
921 921
 				}
922 922
 			} else {
923 923
 				EE_Error::add_error(
924
-						__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
924
+						__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
925 925
 						__FILE__, __FUNCTION__, __LINE__
926 926
 				);
927 927
 			}
@@ -941,43 +941,43 @@  discard block
 block discarded – undo
941 941
 	 */
942 942
 	protected function refresh_entity_map() {
943 943
 		// verify the transaction
944
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
944
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
945 945
 			// never cache payment info
946
-			$this->transaction->clear_cache( 'Payment' );
946
+			$this->transaction->clear_cache('Payment');
947 947
 			/** @type EE_Transaction_Processor $transaction_processor */
948
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
948
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
949 949
 			// is the Payment Options Reg Step completed ?
950
-			if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) {
950
+			if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) {
951 951
 				// then check for payments and update TXN accordingly
952 952
 				/** @type EE_Transaction_Payments $transaction_payments */
953
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
954
-				$transaction_payments->calculate_total_payments_and_update_status( $this->transaction );
953
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
954
+				$transaction_payments->calculate_total_payments_and_update_status($this->transaction);
955 955
 			}
956 956
 			// grab the saved registrations from the transaction
957
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) {
958
-				$this->_refresh_registration( $reg_cache_ID, $registration );
957
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) {
958
+				$this->_refresh_registration($reg_cache_ID, $registration);
959 959
 			}
960 960
 			// make sure our cached TXN is added to the model entity mapper
961
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction );
961
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction);
962 962
 
963 963
 		} else {
964
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
964
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
965 965
 			return FALSE;
966 966
 		}
967 967
 		// verify and update the cart because inaccurate totals are not so much fun
968
-		if ( $this->cart instanceof EE_Cart ) {
968
+		if ($this->cart instanceof EE_Cart) {
969 969
 			$grand_total = $this->cart->get_grand_total();
970
-			if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) {
970
+			if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) {
971 971
 				$grand_total->recalculate_total_including_taxes();
972 972
 				$grand_total = $grand_total->get_model()->refresh_entity_map_with(
973 973
 					$this->cart->get_grand_total()->ID(),
974 974
 					$this->cart->get_grand_total()
975 975
 				);
976 976
 			}
977
-			if ( $grand_total instanceof EE_Line_Item ) {
978
-				$this->cart = EE_Cart::instance( $grand_total );
977
+			if ($grand_total instanceof EE_Line_Item) {
978
+				$this->cart = EE_Cart::instance($grand_total);
979 979
 			} else {
980
-				EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
980
+				EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
981 981
 				return false;
982 982
 			}
983 983
 		}
@@ -993,19 +993,19 @@  discard block
 block discarded – undo
993 993
 	 * @param 	EE_Registration 	$registration
994 994
 	 * @return void
995 995
 	 */
996
-	protected function _refresh_registration( $reg_cache_ID, $registration ) {
996
+	protected function _refresh_registration($reg_cache_ID, $registration) {
997 997
 
998 998
 		// verify object
999
-		if ( $registration instanceof EE_Registration ) {
999
+		if ($registration instanceof EE_Registration) {
1000 1000
 			// update the entity mapper attendee
1001
-			$this->_refresh_registration_attendee( $registration );
1001
+			$this->_refresh_registration_attendee($registration);
1002 1002
 			// update the entity mapper answers for reg form questions
1003
-			$this->_refresh_registration_answers( $registration );
1003
+			$this->_refresh_registration_answers($registration);
1004 1004
 			// make sure the cached registration is added to the model entity mapper
1005
-			$registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration );
1005
+			$registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration);
1006 1006
 		} else {
1007 1007
 			EE_Error::add_error(
1008
-				__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1008
+				__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1009 1009
 				__FILE__, __FUNCTION__, __LINE__
1010 1010
 			);
1011 1011
 		}
@@ -1019,15 +1019,15 @@  discard block
 block discarded – undo
1019 1019
 	 * @param 	EE_Registration 	$registration
1020 1020
 	 * @return void
1021 1021
 	 */
1022
-	protected function _refresh_registration_attendee( $registration ) {
1022
+	protected function _refresh_registration_attendee($registration) {
1023 1023
 
1024 1024
 		$attendee = $registration->attendee();
1025 1025
 		// verify object
1026
-		if ( $attendee instanceof EE_Attendee && $attendee->ID() ) {
1026
+		if ($attendee instanceof EE_Attendee && $attendee->ID()) {
1027 1027
 			// make sure the cached attendee is added to the model entity mapper
1028
-			$registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee );
1028
+			$registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee);
1029 1029
 			// maybe cache primary_attendee_obj ?
1030
-			if ( $registration->is_primary_registrant() ) {
1030
+			if ($registration->is_primary_registrant()) {
1031 1031
 				$this->primary_attendee_obj = $attendee;
1032 1032
 			}
1033 1033
 		}
@@ -1041,19 +1041,19 @@  discard block
 block discarded – undo
1041 1041
 	 * @param 	EE_Registration 	$registration
1042 1042
 	 * @return void
1043 1043
 	 */
1044
-	protected function _refresh_registration_answers( $registration ) {
1044
+	protected function _refresh_registration_answers($registration) {
1045 1045
 
1046 1046
 		// now update the answers
1047
-		foreach ( $registration->answers() as $cache_key => $answer ) {
1047
+		foreach ($registration->answers() as $cache_key => $answer) {
1048 1048
 			// verify object
1049
-			if ( $answer instanceof EE_Answer ) {
1050
-				if ( $answer->ID() ) {
1049
+			if ($answer instanceof EE_Answer) {
1050
+				if ($answer->ID()) {
1051 1051
 					// make sure the cached answer is added to the model entity mapper
1052
-					$answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer );
1052
+					$answer->get_model()->refresh_entity_map_with($answer->ID(), $answer);
1053 1053
 				}
1054 1054
 			} else {
1055 1055
 				EE_Error::add_error(
1056
-					__( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1056
+					__('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1057 1057
 					__FILE__, __FUNCTION__, __LINE__
1058 1058
 				);
1059 1059
 			}
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
 	 * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object
1069 1069
 	 */
1070 1070
 	function __wakeup() {
1071
-		foreach ( $this->reg_steps as $reg_step ) {
1071
+		foreach ($this->reg_steps as $reg_step) {
1072 1072
 			$reg_step->checkout = $this;
1073 1073
 		}
1074 1074
 	}
@@ -1084,11 +1084,11 @@  discard block
 block discarded – undo
1084 1084
 	 * @param array $info
1085 1085
 	 * @param bool $display_request
1086 1086
 	 */
1087
-	function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) {
1088
-		if ( WP_DEBUG && false ) {
1089
-			$debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() );
1087
+	function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) {
1088
+		if (WP_DEBUG && false) {
1089
+			$debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array());
1090 1090
 			$default_data = array(
1091
-				$class 		=> $func . '() : ' . $line,
1091
+				$class 		=> $func.'() : '.$line,
1092 1092
 				'request->step' 		=> $this->step,
1093 1093
 				'request->action' 	=> $this->action,
1094 1094
 				'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ?
@@ -1100,24 +1100,24 @@  discard block
 block discarded – undo
1100 1100
 				'reg_url_link' => $this->reg_url_link,
1101 1101
 				'REQ' => $display_request ? $_REQUEST : '',
1102 1102
 			);
1103
-			if ( $this->transaction instanceof EE_Transaction ) {
1104
-				$default_data[ 'TXN_status' ] 		= $this->transaction->status_ID();
1105
-				$default_data[ 'TXN_reg_steps' ] 	= $this->transaction->reg_steps();
1106
-				foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) {
1107
-					$default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID();
1103
+			if ($this->transaction instanceof EE_Transaction) {
1104
+				$default_data['TXN_status'] = $this->transaction->status_ID();
1105
+				$default_data['TXN_reg_steps'] = $this->transaction->reg_steps();
1106
+				foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) {
1107
+					$default_data['registrations'][$REG_ID] = $registration->status_ID();
1108 1108
 				}
1109
-				if ( $this->transaction->ID() ) {
1110
-					$TXN_ID = 'EE_Transaction: ' . $this->transaction->ID();
1109
+				if ($this->transaction->ID()) {
1110
+					$TXN_ID = 'EE_Transaction: '.$this->transaction->ID();
1111 1111
 					// don't serialize objects
1112
-					$info = $this->_strip_objects( $info );
1113
-					if ( ! isset( $debug_data[ $TXN_ID ] ) ) {
1114
-						$debug_data[ $TXN_ID ] = array();
1112
+					$info = $this->_strip_objects($info);
1113
+					if ( ! isset($debug_data[$TXN_ID])) {
1114
+						$debug_data[$TXN_ID] = array();
1115 1115
 					}
1116
-					$debug_data[ $TXN_ID ][ microtime() ] = array_merge(
1116
+					$debug_data[$TXN_ID][microtime()] = array_merge(
1117 1117
 						$default_data,
1118 1118
 						$info
1119 1119
 					);
1120
-					update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data );
1120
+					update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data);
1121 1121
 				}
1122 1122
 			}
1123 1123
 		}
@@ -1130,23 +1130,23 @@  discard block
 block discarded – undo
1130 1130
 	 * @param array $info
1131 1131
 	 * @return array
1132 1132
 	 */
1133
-	function _strip_objects( $info = array() ) {
1134
-		foreach ( $info as $key => $value ) {
1135
-			if ( is_array( $value )) {
1136
-				$info[ $key ] = $this->_strip_objects( $value );
1137
-			} else if ( is_object( $value ) ) {
1138
-				$object_class = get_class( $value );
1139
-				$info[ $object_class ] = array();
1140
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0;
1141
-				if ( method_exists( $value, 'status' ) ) {
1142
-					$info[ $object_class ][ 'status' ] = $value->status();
1143
-				} else if ( method_exists( $value, 'status_ID' ) ) {
1144
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
1133
+	function _strip_objects($info = array()) {
1134
+		foreach ($info as $key => $value) {
1135
+			if (is_array($value)) {
1136
+				$info[$key] = $this->_strip_objects($value);
1137
+			} else if (is_object($value)) {
1138
+				$object_class = get_class($value);
1139
+				$info[$object_class] = array();
1140
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0;
1141
+				if (method_exists($value, 'status')) {
1142
+					$info[$object_class]['status'] = $value->status();
1143
+				} else if (method_exists($value, 'status_ID')) {
1144
+					$info[$object_class]['status'] = $value->status_ID();
1145 1145
 				}
1146
-				unset( $info[ $key ] );
1146
+				unset($info[$key]);
1147 1147
 			}
1148 1148
 		}
1149
-		return (array)$info;
1149
+		return (array) $info;
1150 1150
 	}
1151 1151
 
1152 1152
 
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -387,7 +387,7 @@
 block discarded – undo
387 387
 
388 388
 	/**
389 389
 	 * creates the default hidden inputs section
390
-	 * @return EE_Form_Input_Base[]
390
+	 * @return EE_Form_Section_Proper
391 391
 	 */
392 392
 	public function reg_step_hidden_inputs() {
393 393
 		// hidden inputs for admin registrations
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_SPCO_Reg_Step
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_SPCO_Reg_Step
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage 	core
10
+  * @author 				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 abstract class EE_SPCO_Reg_Step {
15 15
 
16 16
 	/**
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	public function set_completed() {
154 154
 		// DEBUG LOG
155 155
 		//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
156
-		$this->_completed = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this );
156
+		$this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this);
157 157
 	}
158 158
 
159 159
 
@@ -201,18 +201,18 @@  discard block
 block discarded – undo
201 201
 	 * sets the text that appears on the reg step form submit button
202 202
 	 * @param string $submit_button_text
203 203
 	 */
204
-	public function set_submit_button_text( $submit_button_text = '' ) {
205
-		if ( ! empty( $submit_button_text )) {
204
+	public function set_submit_button_text($submit_button_text = '') {
205
+		if ( ! empty($submit_button_text)) {
206 206
 			$this->_submit_button_text = $submit_button_text;
207
-		} else if ( $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
208
-			if ( $this->checkout->revisit ) {
209
-				$this->_submit_button_text = sprintf( __( 'Update %s', 'event_espresso' ), $this->checkout->current_step->name() );
207
+		} else if ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
208
+			if ($this->checkout->revisit) {
209
+				$this->_submit_button_text = sprintf(__('Update %s', 'event_espresso'), $this->checkout->current_step->name());
210 210
 			} else {
211
-				$this->_submit_button_text = sprintf( __( 'Proceed to %s', 'event_espresso' ), $this->checkout->next_step->name() );
211
+				$this->_submit_button_text = sprintf(__('Proceed to %s', 'event_espresso'), $this->checkout->next_step->name());
212 212
 			}
213 213
 		}
214 214
 		// filters the submit button text
215
-		$this->_submit_button_text = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout );
215
+		$this->_submit_button_text = apply_filters('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout);
216 216
 	}
217 217
 
218 218
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	/**
221 221
 	 * @param boolean $is_current_step
222 222
 	 */
223
-	public function set_is_current_step( $is_current_step ) {
223
+	public function set_is_current_step($is_current_step) {
224 224
 		$this->_is_current_step = $is_current_step;
225 225
 	}
226 226
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	/**
248 248
 	 * @param int $order
249 249
 	 */
250
-	public function set_order( $order ) {
250
+	public function set_order($order) {
251 251
 		$this->_order = $order;
252 252
 	}
253 253
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	 * _set_success_message
286 286
 	 * @param string $success_message
287 287
 	 */
288
-	protected function _set_success_message( $success_message ) {
288
+	protected function _set_success_message($success_message) {
289 289
 		$this->_success_message = $success_message;
290 290
 	}
291 291
 
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 	/**
314 314
 	 * @param string $instructions
315 315
 	 */
316
-	public function set_instructions( $instructions ) {
317
-		$this->_instructions = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this );
316
+	public function set_instructions($instructions) {
317
+		$this->_instructions = apply_filters('FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this);
318 318
 	}
319 319
 
320 320
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	/**
323 323
 	 * @param array $valid_data
324 324
 	 */
325
-	public function set_valid_data( $valid_data ) {
325
+	public function set_valid_data($valid_data) {
326 326
 		$this->_valid_data = $valid_data;
327 327
 	}
328 328
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * @return array
333 333
 	 */
334 334
 	public function valid_data() {
335
-		if ( empty( $this->_valid_data )) {
335
+		if (empty($this->_valid_data)) {
336 336
 			$this->_valid_data = $this->reg_form->valid_data();
337 337
 		}
338 338
 		return $this->_valid_data;
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
 	 * @return string
344 344
 	 */
345 345
 	public function reg_form_name() {
346
-		if ( empty( $this->_reg_form_name )) {
347
-			$this->set_reg_form_name( 'ee-spco-' . $this->slug() . '-reg-step-form' );
346
+		if (empty($this->_reg_form_name)) {
347
+			$this->set_reg_form_name('ee-spco-'.$this->slug().'-reg-step-form');
348 348
 		}
349 349
 		return $this->_reg_form_name;
350 350
 	}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	/**
355 355
 	 * @param string $reg_form_name
356 356
 	 */
357
-	protected function set_reg_form_name( $reg_form_name ) {
357
+	protected function set_reg_form_name($reg_form_name) {
358 358
 		$this->_reg_form_name = $reg_form_name;
359 359
 	}
360 360
 
@@ -365,22 +365,22 @@  discard block
 block discarded – undo
365 365
 	 * @param string $action
366 366
 	 * @return string
367 367
 	 */
368
-	public function reg_step_url( $action = '' ) {
369
-		$query_args = array( 'step' => $this->slug() );
370
-		if( ! empty( $action )) {
368
+	public function reg_step_url($action = '') {
369
+		$query_args = array('step' => $this->slug());
370
+		if ( ! empty($action)) {
371 371
 			$query_args['action'] = $action;
372 372
 		}
373 373
 		// final step has no display
374
-		if ( $this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action == 'display_spco_reg_step' ) {
375
-			$query_args[ 'action' ] = 'process_reg_step';
374
+		if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action == 'display_spco_reg_step') {
375
+			$query_args['action'] = 'process_reg_step';
376 376
 		}
377
-		if( $this->checkout->revisit ) {
377
+		if ($this->checkout->revisit) {
378 378
 			$query_args['revisit'] = TRUE;
379 379
 		}
380
-		if( $this->checkout->reg_url_link ) {
380
+		if ($this->checkout->reg_url_link) {
381 381
 			$query_args['e_reg_url_link'] = $this->checkout->reg_url_link;
382 382
 		}
383
-		return add_query_arg( $query_args, $this->checkout->reg_page_base_url );
383
+		return add_query_arg($query_args, $this->checkout->reg_page_base_url);
384 384
 	}
385 385
 
386 386
 
@@ -391,16 +391,16 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	public function reg_step_hidden_inputs() {
393 393
 		// hidden inputs for admin registrations
394
-		if ( $this->checkout->admin_request ) {
394
+		if ($this->checkout->admin_request) {
395 395
 			return new EE_Form_Section_Proper(
396 396
 				array(
397 397
 					'layout_strategy' 	=> new EE_Div_Per_Section_Layout(),
398
-					'html_id' 					=> 'ee-' . $this->slug() . '-hidden-inputs',
398
+					'html_id' 					=> 'ee-'.$this->slug().'-hidden-inputs',
399 399
 					'subsections' 			=> array(
400 400
 						'next_step' 			=> new EE_Fixed_Hidden_Input(
401 401
 							array(
402 402
 								'html_name' 	=> 'next_step',
403
-								'html_id' 			=> 'spco-' . $this->slug() . '-next-step',
403
+								'html_id' 			=> 'spco-'.$this->slug().'-next-step',
404 404
 								'default' 			=> $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : ''
405 405
 							)
406 406
 						)
@@ -412,19 +412,19 @@  discard block
 block discarded – undo
412 412
 			return new EE_Form_Section_Proper(
413 413
 				array(
414 414
 					'layout_strategy' 	=> new EE_Div_Per_Section_Layout(),
415
-					'html_id' 					=> 'ee-' . $this->slug() . '-hidden-inputs',
415
+					'html_id' 					=> 'ee-'.$this->slug().'-hidden-inputs',
416 416
 					'subsections' 			=> array(
417 417
 						'action' 				=> new EE_Fixed_Hidden_Input(
418 418
 								array(
419 419
 									'html_name' 	=> 'action',
420
-									'html_id' 			=> 'spco-' . $this->slug() . '-action',
421
-									'default' 			=> empty( $this->checkout->reg_url_link ) ? 'process_reg_step' : 'update_reg_step'
420
+									'html_id' 			=> 'spco-'.$this->slug().'-action',
421
+									'default' 			=> empty($this->checkout->reg_url_link) ? 'process_reg_step' : 'update_reg_step'
422 422
 								)
423 423
 							),
424 424
 						'next_step' 			=> new EE_Fixed_Hidden_Input(
425 425
 								array(
426 426
 									'html_name' 	=> 'next_step',
427
-									'html_id' 			=> 'spco-' . $this->slug() . '-next-step',
427
+									'html_id' 			=> 'spco-'.$this->slug().'-next-step',
428 428
 									'default' 			=> $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : ''
429 429
 								)
430 430
 							),
@@ -456,9 +456,9 @@  discard block
 block discarded – undo
456 456
 	 * @param array $actions
457 457
 	 * @return void
458 458
 	 */
459
-	public function generate_reg_form_for_actions( $actions = array() ) {
460
-		$actions = array_merge( array( 'generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step' ), $actions );
461
-		$this->checkout->generate_reg_form = in_array( $this->checkout->action, $actions ) ? TRUE : FALSE;
459
+	public function generate_reg_form_for_actions($actions = array()) {
460
+		$actions = array_merge(array('generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step'), $actions);
461
+		$this->checkout->generate_reg_form = in_array($this->checkout->action, $actions) ? TRUE : FALSE;
462 462
 	}
463 463
 
464 464
 
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
 	 */
469 469
 	public function display_reg_form() {
470 470
 		$html = '';
471
-		if ( $this->reg_form instanceof EE_Form_Section_Proper ) {
472
-			$html .= ! $this->checkout->admin_request ? $this->reg_form->form_open( $this->reg_step_url() ) : '';
473
-			if ( EE_Registry::instance()->REQ->ajax ) {
471
+		if ($this->reg_form instanceof EE_Form_Section_Proper) {
472
+			$html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : '';
473
+			if (EE_Registry::instance()->REQ->ajax) {
474 474
 				$this->reg_form->localize_validation_rules();
475
-				$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
475
+				$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
476 476
 				$html .= $this->reg_form->get_html();
477 477
 			} else {
478 478
 				$html .= $this->reg_form->get_html_and_js();
@@ -490,26 +490,26 @@  discard block
 block discarded – undo
490 490
 	 * @return string
491 491
 	 */
492 492
 	public function reg_step_submit_button() {
493
-		if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
493
+		if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
494 494
 			return '';
495 495
 		}
496 496
 		ob_start();
497
-		do_action( 'AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout );
497
+		do_action('AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout);
498 498
 		$html = ob_get_clean();
499 499
 		// generate submit button
500
-		$sbmt_btn = new EE_Submit_Input( array(
501
-			'html_name' 					=> 'spco-go-to-step-' . $this->checkout->next_step->slug(),
502
-			'html_id' 							=> 'spco-go-to-step-' . $this->checkout->next_step->slug(),
500
+		$sbmt_btn = new EE_Submit_Input(array(
501
+			'html_name' 					=> 'spco-go-to-step-'.$this->checkout->next_step->slug(),
502
+			'html_id' 							=> 'spco-go-to-step-'.$this->checkout->next_step->slug(),
503 503
 			'html_class' 					=> 'spco-next-step-btn',
504
-			'other_html_attributes' 	=> ' rel="' . $this->slug() . '"',
504
+			'other_html_attributes' 	=> ' rel="'.$this->slug().'"',
505 505
 			'default'							=> $this->submit_button_text()
506 506
 		));
507
-		$sbmt_btn->set_button_css_attributes( TRUE, 'large' );
507
+		$sbmt_btn->set_button_css_attributes(TRUE, 'large');
508 508
 		$sbmt_btn_html = $sbmt_btn->get_html_for_input();
509 509
 		EE_Registry::instance()->load_helper('HTML');
510 510
 		$html .= EEH_HTML::div(
511
-			apply_filters( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this ),
512
-			'spco-' . $this->slug() . '-whats-next-buttons-dv',
511
+			apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this),
512
+			'spco-'.$this->slug().'-whats-next-buttons-dv',
513 513
 			'spco-whats-next-buttons'
514 514
 		);
515 515
 		return $html;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	 * @return string
533 533
 	 */
534 534
 	public function edit_lnk_url() {
535
-		return 	add_query_arg( array( 'step' => $this->slug() ), $this->checkout->reg_page_base_url );
535
+		return 	add_query_arg(array('step' => $this->slug()), $this->checkout->reg_page_base_url);
536 536
 
537 537
 	}
538 538
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 	 */
555 555
 	public function update_checkout() {
556 556
 		// grab the cart grand total and reset TXN total
557
-		$this->checkout->transaction->set_total( $this->checkout->cart->get_cart_grand_total() );
557
+		$this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total());
558 558
 		$this->checkout->stash_transaction_and_checkout();
559 559
 	}
560 560
 
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	 */
570 570
 	function __sleep() {
571 571
 		// remove the reg form and the checkout
572
-		return array_diff( array_keys( get_object_vars( $this )), array( 'reg_form', 'checkout' ));
572
+		return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout'));
573 573
 	}
574 574
 }
575 575
 
Please login to merge, or discard this patch.
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 4 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 	/**
65
-	 * @return boolean
65
+	 * @return boolean|null
66 66
 	 */
67 67
 	public function initialize_reg_step() {
68 68
 	}
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	 * _auto_copy_attendee_info
343 343
 	 *
344 344
 	 * @access public
345
-	 * @return 	EE_Form_Section_Proper
345
+	 * @return 	EE_Form_Section_HTML
346 346
 	 */
347 347
 	private function _auto_copy_attendee_info() {
348 348
 		return new EE_Form_Section_HTML(
@@ -456,6 +456,7 @@  discard block
 block discarded – undo
456 456
 	 * @param EE_Registration $registration
457 457
 	 * @param EE_Question     $question
458 458
 	 * @param mixed EE_Answer|NULL      $answer
459
+	 * @param EE_Answer $answer
459 460
 	 * @return EE_Form_Input_Base
460 461
 	 */
461 462
 	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_SPCO_Reg_Step_Attendee_Information
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_SPCO_Reg_Step_Attendee_Information
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage 	core
10
+  * @author 				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step {
15 15
 
16 16
 	/**
Please login to merge, or discard this patch.
Spacing   +254 added lines, -255 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 * @param    EE_Checkout $checkout
33 33
 	 * @return    \EE_SPCO_Reg_Step_Attendee_Information
34 34
 	 */
35
-	public function __construct( EE_Checkout $checkout ) {
35
+	public function __construct(EE_Checkout $checkout) {
36 36
 		$this->_slug = 'attendee_information';
37 37
 		$this->_name = __('Attendee Information', 'event_espresso');
38
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
38
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
39 39
 		$this->checkout = $checkout;
40 40
 		$this->_reset_success_message();
41
-		$this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso'));
41
+		$this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso'));
42 42
 	}
43 43
 
44 44
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
48 48
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso');
49 49
 		EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso');
50
-		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' );
50
+		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>');
51 51
 		EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso');
52 52
 		EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso');
53 53
 		EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso');
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		EEH_Autoloader::register_line_item_display_autoloaders();
80 80
 		$Line_Item_Display = new EE_Line_Item_Display();
81 81
 		// calculate taxes
82
-		$Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) );
82
+		$Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true));
83 83
 		EE_Registry::instance()->load_helper('Line_Item');
84 84
 		/** @var $subsections EE_Form_Section_Proper[] */
85 85
 		$subsections = array(
@@ -91,33 +91,33 @@  discard block
 block discarded – undo
91 91
 			'ticket_count' 	=> array()
92 92
 		);
93 93
 		// grab the saved registrations from the transaction
94
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
95
-		if ( $registrations ) {
96
-			foreach ( $registrations as $registration ) {
97
-				if ( $registration instanceof EE_Registration ) {
94
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
95
+		if ($registrations) {
96
+			foreach ($registrations as $registration) {
97
+				if ($registration instanceof EE_Registration) {
98 98
 					// can this registration be processed during this visit ?
99
-					if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
100
-						$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
101
-						if ( ! $this->checkout->admin_request ) {
102
-							$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
103
-							$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1;
104
-							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) );
105
-							$ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item;
106
-							$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item );
99
+					if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
100
+						$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
101
+						if ( ! $this->checkout->admin_request) {
102
+							$template_args['registrations'][$registration->reg_url_link()] = $registration;
103
+							$template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1;
104
+							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID()));
105
+							$ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item;
106
+							$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item);
107 107
 						}
108
-						if ( $registration->is_primary_registrant() ) {
108
+						if ($registration->is_primary_registrant()) {
109 109
 							$primary_registrant = $registration->reg_url_link();
110 110
 						}
111 111
 					}
112 112
 				}
113 113
 			}
114 114
 			// print_copy_info ?
115
-			if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) {
115
+			if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) {
116 116
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
117 117
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info();
118 118
 				// generate hidden input
119
-				if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) {
120
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
119
+				if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) {
120
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
121 121
 				}
122 122
 			}
123 123
 
@@ -129,8 +129,7 @@  discard block
 block discarded – undo
129 129
 				'html_id' 					=> $this->reg_form_name(),
130 130
 				'subsections' 			=> $subsections,
131 131
 				'layout_strategy'		=> $this->checkout->admin_request ?
132
-					new EE_Div_Per_Section_Layout() :
133
-					new EE_Template_Layout(
132
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
134 133
 						array(
135 134
 							'layout_template_file' 	=> $this->_template, // layout_template
136 135
 							'template_args' 				=> $template_args
@@ -147,61 +146,61 @@  discard block
 block discarded – undo
147 146
 	 * @param EE_Registration $registration
148 147
 	 * @return EE_Form_Section_Proper
149 148
 	 */
150
-	private function _registrations_reg_form( EE_Registration $registration ) {
151
-		EE_Registry::instance()->load_helper( 'Template' );
149
+	private function _registrations_reg_form(EE_Registration $registration) {
150
+		EE_Registry::instance()->load_helper('Template');
152 151
 		static $attendee_nmbr = 1;
153 152
 		// array of params to pass to parent constructor
154 153
 		$form_args = array(
155
-			'html_id' 				=> 'ee-registration-' . $registration->reg_url_link(),
154
+			'html_id' 				=> 'ee-registration-'.$registration->reg_url_link(),
156 155
 			'html_class' 		=> 'ee-reg-form-attendee-dv',
157 156
 			'html_style' 		=> $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '',
158 157
 			'subsections' 		=> array(),
159 158
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
160 159
 				array(
161 160
 					'legend_class' 	=> 'spco-attendee-lgnd smaller-text lt-grey-text',
162
-					'legend_text' 	=> sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
161
+					'legend_text' 	=> sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
163 162
 				)
164 163
 			)
165 164
 		);
166 165
 		// verify that registration has valid event
167
-		if ( $registration->event() instanceof EE_Event ) {
166
+		if ($registration->event() instanceof EE_Event) {
168 167
 			$query_params = array(
169 168
 				array(
170 169
 					'Event.EVT_ID' => $registration->event()->ID(),
171 170
 					'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE
172 171
 				),
173
-				'order_by'=>array( 'QSG_order'=>'ASC' )
172
+				'order_by'=>array('QSG_order'=>'ASC')
174 173
 			);
175
-			$question_groups = $registration->event()->question_groups( $query_params );
176
-			if ( $question_groups ) {
177
-				foreach ( $question_groups as $question_group ) {
178
-					if ( $question_group instanceof EE_Question_Group ) {
179
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group );
174
+			$question_groups = $registration->event()->question_groups($query_params);
175
+			if ($question_groups) {
176
+				foreach ($question_groups as $question_group) {
177
+					if ($question_group instanceof EE_Question_Group) {
178
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group);
180 179
 						// add hidden input
181
-						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration );
180
+						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration);
182 181
 					}
183 182
 				}
184 183
 				// if we have question groups for additional attendees, then display the copy options
185 184
 				$this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info;
186 185
 			} else {
187
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML(
186
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML(
188 187
 					EEH_Template::locate_template(
189
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
190
-						apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
188
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
189
+						apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
191 190
 						TRUE,
192 191
 						TRUE
193 192
 					)
194 193
 				);
195 194
 				// add hidden input
196
-				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE );
195
+				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE);
197 196
 			}
198 197
 		}
199
-		if ( $registration->is_primary_registrant() ) {
198
+		if ($registration->is_primary_registrant()) {
200 199
 			// generate hidden input
201
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
200
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
202 201
 		}
203 202
 		$attendee_nmbr++;
204
-		return new EE_Form_Section_Proper( $form_args );
203
+		return new EE_Form_Section_Proper($form_args);
205 204
 	}
206 205
 
207 206
 
@@ -214,11 +213,11 @@  discard block
 block discarded – undo
214 213
 	 * @param bool  $additional_attendee_reg_info
215 214
 	 * @return    EE_Form_Input_Base
216 215
 	 */
217
-	private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){
216
+	private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) {
218 217
 		// generate hidden input
219 218
 		return new EE_Hidden_Input(
220 219
 			array(
221
-				'html_id' 				=> 'additional-attendee-reg-info-' . $registration->reg_url_link(),
220
+				'html_id' 				=> 'additional-attendee-reg-info-'.$registration->reg_url_link(),
222 221
 				'default'				=> $additional_attendee_reg_info
223 222
 			)
224 223
 		);
@@ -231,22 +230,22 @@  discard block
 block discarded – undo
231 230
 	 * @param EE_Question_Group $question_group
232 231
 	 * @return EE_Form_Section_Proper
233 232
 	 */
234
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
233
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
235 234
 		// array of params to pass to parent constructor
236 235
 		$form_args = array(
237
-			'html_id' 					=> 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
236
+			'html_id' 					=> 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
238 237
 			'html_class' 			=> $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv',
239
-			'html_label_id' 		=> 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
238
+			'html_label_id' 		=> 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
240 239
 			'subsections' 			=> array(
241
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
240
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
242 241
 			),
243 242
 			'layout_strategy' 	=> $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout()
244 243
 		);
245 244
 		// where params
246
-		$query_params = array( 'QST_deleted' => 0 );
245
+		$query_params = array('QST_deleted' => 0);
247 246
 		// don't load admin only questions on the frontend
248
-		if ( ! $this->checkout->admin_request ) {
249
-			$query_params['QST_admin_only'] = array( '!=', TRUE );
247
+		if ( ! $this->checkout->admin_request) {
248
+			$query_params['QST_admin_only'] = array('!=', TRUE);
250 249
 		}
251 250
 		$questions = $question_group->get_many_related(
252 251
 			'Question',
@@ -258,21 +257,21 @@  discard block
 block discarded – undo
258 257
 			)
259 258
 		);
260 259
 		// filter for additional content before questions
261
-		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this ));
260
+		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this));
262 261
 		// loop thru questions
263
-		foreach ( $questions as $question ) {
264
-			if( $question instanceof EE_Question ){
262
+		foreach ($questions as $question) {
263
+			if ($question instanceof EE_Question) {
265 264
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
266
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
265
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
267 266
 			}
268 267
 		}
269
-		$form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this );
268
+		$form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this);
270 269
 
271 270
 		// filter for additional content after questions
272
-		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this ));
271
+		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this));
273 272
 //		d( $form_args );
274
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
275
-		return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this );
273
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
274
+		return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this);
276 275
 	}
277 276
 
278 277
 
@@ -282,12 +281,12 @@  discard block
 block discarded – undo
282 281
 	 * @param EE_Question_Group $question_group
283 282
 	 * @return 	EE_Form_Section_HTML
284 283
 	 */
285
-	private function _question_group_header( EE_Question_Group $question_group ){
284
+	private function _question_group_header(EE_Question_Group $question_group) {
286 285
 		$html = '';
287 286
 		// group_name
288
-		if ( $question_group->show_group_name() && $question_group->name() != '' ) {
287
+		if ($question_group->show_group_name() && $question_group->name() != '') {
289 288
 			EE_Registry::instance()->load_helper('HTML');
290
-			if ( $this->checkout->admin_request ) {
289
+			if ($this->checkout->admin_request) {
291 290
 				$html .= EEH_HTML::br();
292 291
 				$html .= EEH_HTML::h3(
293 292
 					$question_group->name(),
@@ -301,7 +300,7 @@  discard block
 block discarded – undo
301 300
 			}
302 301
 		}
303 302
 		// group_desc
304
-		if ( $question_group->show_group_desc() && $question_group->desc() != '' ) {
303
+		if ($question_group->show_group_desc() && $question_group->desc() != '') {
305 304
 			$html .= EEH_HTML::p(
306 305
 				$question_group->desc(),
307 306
 				'',
@@ -309,7 +308,7 @@  discard block
 block discarded – undo
309 308
 			);
310 309
 
311 310
 		}
312
-		return new EE_Form_Section_HTML( $html );
311
+		return new EE_Form_Section_HTML($html);
313 312
 	}
314 313
 
315 314
 
@@ -318,14 +317,14 @@  discard block
 block discarded – undo
318 317
 	 * @access public
319 318
 	 * @return 	EE_Form_Section_Proper
320 319
 	 */
321
-	private function _copy_attendee_info_form(){
320
+	private function _copy_attendee_info_form() {
322 321
 		// array of params to pass to parent constructor
323 322
 		return new EE_Form_Section_Proper(
324 323
 			array(
325 324
 				'subsections' 			=> $this->_copy_attendee_info_inputs(),
326 325
 				'layout_strategy' 	=> new EE_Template_Layout(
327 326
 					array(
328
-						'layout_template_file' 			=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template
327
+						'layout_template_file' 			=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template
329 328
 						'begin_template_file' 			=> NULL,
330 329
 						'input_template_file' 				=> NULL,
331 330
 						'subsection_template_file' 	=> NULL,
@@ -347,8 +346,8 @@  discard block
 block discarded – undo
347 346
 	private function _auto_copy_attendee_info() {
348 347
 		return new EE_Form_Section_HTML(
349 348
 			EEH_Template::locate_template(
350
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
351
-				apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
349
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
350
+				apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
352 351
 				TRUE,
353 352
 				TRUE
354 353
 			)
@@ -367,25 +366,25 @@  discard block
 block discarded – undo
367 366
 		$copy_attendee_info_inputs = array();
368 367
 		$prev_ticket = NULL;
369 368
 		// grab the saved registrations from the transaction
370
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
371
-		foreach ( $registrations as $registration ) {
369
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
370
+		foreach ($registrations as $registration) {
372 371
 			// for all  attendees other than the primary attendee
373
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
372
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
374 373
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
375
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
374
+				if ($registration->ticket()->ID() !== $prev_ticket) {
376 375
 					$item_name = $registration->ticket()->name();
377
-					$item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : '';
378
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
379
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
376
+					$item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : '';
377
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
378
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
380 379
 					);
381 380
 					$prev_ticket = $registration->ticket()->ID();
382 381
 				}
383 382
 
384
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
383
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
385 384
 				EE_Checkbox_Multi_Input(
386
-					array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )),
385
+					array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())),
387 386
 					array(
388
-						'html_id' 								=> 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
387
+						'html_id' 								=> 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
389 388
 						'html_class' 						=> 'spco-copy-attendee-chk ee-do-not-validate',
390 389
 						'display_html_label_text' 	=> FALSE
391 390
 					)
@@ -404,7 +403,7 @@  discard block
 block discarded – undo
404 403
 	 * @param EE_Registration $registration
405 404
 	 * @return    EE_Form_Input_Base
406 405
 	 */
407
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
406
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
408 407
 		// generate hidden input
409 408
 		return new EE_Hidden_Input(
410 409
 			array(
@@ -422,31 +421,31 @@  discard block
 block discarded – undo
422 421
 	 * @param EE_Question     $question
423 422
 	 * @return 	EE_Form_Input_Base
424 423
 	 */
425
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
424
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
426 425
 
427 426
 		// if this question was for an attendee detail, then check for that answer
428
-		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->ID() );
427
+		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->ID());
429 428
 		$answer = $answer_value === null
430
-				? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() )	) )
429
+				? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())))
431 430
 				: null;
432 431
 		// if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object
433
-		if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) {
432
+		if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) {
434 433
 			// create an EE_Answer object for storing everything in
435
-			$answer = EE_Answer::new_instance ( array(
434
+			$answer = EE_Answer::new_instance(array(
436 435
 				'QST_ID'=> $question->ID(),
437 436
 				'REG_ID'=> $registration->ID()
438 437
 			));
439 438
 		}
440 439
 		// verify instance
441
-		if( $answer instanceof EE_Answer ){
442
-			if ( ! empty( $answer_value )) {
443
-				$answer->set( 'ANS_value', $answer_value );
440
+		if ($answer instanceof EE_Answer) {
441
+			if ( ! empty($answer_value)) {
442
+				$answer->set('ANS_value', $answer_value);
444 443
 			}
445
-			$answer->cache( 'Question', $question );
446
-			$answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link();
447
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
444
+			$answer->cache('Question', $question);
445
+			$answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link();
446
+			$registration->cache('Answer', $answer, $answer_cache_id);
448 447
 		}
449
-		return $this->_generate_question_input( $registration, $question, $answer );
448
+		return $this->_generate_question_input($registration, $question, $answer);
450 449
 
451 450
 	}
452 451
 
@@ -458,7 +457,7 @@  discard block
 block discarded – undo
458 457
 	 * @param mixed EE_Answer|NULL      $answer
459 458
 	 * @return EE_Form_Input_Base
460 459
 	 */
461
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
460
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
462 461
 		//		d( $registration );
463 462
 		//		d( $question );
464 463
 		//		d( $answer );
@@ -481,95 +480,95 @@  discard block
 block discarded – undo
481 480
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
482 481
 
483 482
 		$input_constructor_args = array(
484
-			'html_name' 			=> 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
485
-			'html_id' 					=> 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
486
-			'html_class' 			=> 'ee-reg-qstn ee-reg-qstn-' . $identifier,
483
+			'html_name' 			=> 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
484
+			'html_id' 					=> 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
485
+			'html_class' 			=> 'ee-reg-qstn ee-reg-qstn-'.$identifier,
487 486
 			'required' 				=> $question->required() ? TRUE : FALSE,
488
-			'html_label_id'		=> 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
487
+			'html_label_id'		=> 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
489 488
 			'html_label_class'	=> 'ee-reg-qstn',
490 489
 			'html_label_text'		=> $question->display_text(),
491 490
 			'required_validation_error_message' => $question->required_text()
492 491
 		);
493 492
 		// has this question been answered ?
494
-		if ( $answer instanceof EE_Answer ) {
495
-			if ( $answer->ID() ) {
496
-				$input_constructor_args['html_name'] 		.= '[' . $answer->ID() . ']';
497
-				$input_constructor_args['html_id'] 				.= '-' . $answer->ID();
498
-				$input_constructor_args['html_label_id'] 	.= '-' . $answer->ID();
493
+		if ($answer instanceof EE_Answer) {
494
+			if ($answer->ID()) {
495
+				$input_constructor_args['html_name'] 		.= '['.$answer->ID().']';
496
+				$input_constructor_args['html_id'] 				.= '-'.$answer->ID();
497
+				$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
499 498
 			}
500 499
 			$input_constructor_args['default'] = $answer->value();
501 500
 		}
502 501
 		//add "-lbl" to the end of the label id
503
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
502
+		$input_constructor_args['html_label_id'] .= '-lbl';
504 503
 
505
-		switch ( $question->type() ) {
504
+		switch ($question->type()) {
506 505
 			// Text
507 506
 			case EEM_Question::QST_type_text :
508
-				if( $identifier == 'email' ){
509
-					return new EE_Email_Input( $input_constructor_args );
510
-				}else{
511
-					return new EE_Text_Input( $input_constructor_args );
507
+				if ($identifier == 'email') {
508
+					return new EE_Email_Input($input_constructor_args);
509
+				} else {
510
+					return new EE_Text_Input($input_constructor_args);
512 511
 				}
513 512
 				break;
514 513
 			// Textarea
515 514
 			case EEM_Question::QST_type_textarea :
516
-				return new EE_Text_Area_Input( $input_constructor_args );
515
+				return new EE_Text_Area_Input($input_constructor_args);
517 516
 				break;
518 517
 			// Radio Buttons
519 518
 			case EEM_Question::QST_type_radio :
520
-				return new EE_Radio_Button_Input( $question->options(), $input_constructor_args );
519
+				return new EE_Radio_Button_Input($question->options(), $input_constructor_args);
521 520
 				break;
522 521
 			// Dropdown
523 522
 			case EEM_Question::QST_type_dropdown :
524
-				return new EE_Select_Input( $question->options(), $input_constructor_args );
523
+				return new EE_Select_Input($question->options(), $input_constructor_args);
525 524
 				break;
526 525
 			// State Dropdown
527 526
 			case EEM_Question::QST_type_state :
528
-				$state_options = array( '' => array( '' => ''));
527
+				$state_options = array('' => array('' => ''));
529 528
 				$states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states();
530
-				if ( ! empty( $states )) {
531
-					foreach( $states as $state ){
532
-						if ( $state instanceof EE_State ) {
533
-							$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
529
+				if ( ! empty($states)) {
530
+					foreach ($states as $state) {
531
+						if ($state instanceof EE_State) {
532
+							$state_options[$state->country()->name()][$state->ID()] = $state->name();
534 533
 						}
535 534
 					}
536 535
 				}
537
-				$state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer );
538
-				return new EE_State_Select_Input( $state_options, $input_constructor_args );
536
+				$state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer);
537
+				return new EE_State_Select_Input($state_options, $input_constructor_args);
539 538
 				break;
540 539
 			// Country Dropdown
541 540
 			case EEM_Question::QST_type_country :
542
-				$country_options = array( '' => '' );
541
+				$country_options = array('' => '');
543 542
 				// get possibly cached list of countries
544 543
 				$countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
545
-				if ( ! empty( $countries )) {
546
-					foreach( $countries as $country ){
547
-						if ( $country instanceof EE_Country ) {
548
-							$country_options[ $country->ID() ] = $country->name();
544
+				if ( ! empty($countries)) {
545
+					foreach ($countries as $country) {
546
+						if ($country instanceof EE_Country) {
547
+							$country_options[$country->ID()] = $country->name();
549 548
 						}
550 549
 					}
551 550
 				}
552
-				$country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer );
553
-				return new EE_Country_Select_Input( $country_options, $input_constructor_args );
551
+				$country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer);
552
+				return new EE_Country_Select_Input($country_options, $input_constructor_args);
554 553
 				break;
555 554
 			// Checkboxes
556 555
 			case EEM_Question::QST_type_checkbox :
557
-				return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args );
556
+				return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args);
558 557
 				break;
559 558
 			// Date
560 559
 			case EEM_Question::QST_type_date :
561
-				return new EE_Datepicker_Input( $input_constructor_args );
560
+				return new EE_Datepicker_Input($input_constructor_args);
562 561
 				break;
563 562
 			case EEM_Question::QST_type_html_textarea :
564
-				$input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy();
565
-				$input =  new EE_Text_Area_Input( $input_constructor_args );
566
-				$input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' );
563
+				$input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy();
564
+				$input = new EE_Text_Area_Input($input_constructor_args);
565
+				$input->remove_validation_strategy('EE_Plaintext_Validation_Strategy');
567 566
 				return $input;
568 567
 			// fallback
569 568
 			default :
570
-				$default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args );
571
-				if( ! $default_input ){
572
-					$default_input = new EE_Text_Input( $input_constructor_args );
569
+				$default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args);
570
+				if ( ! $default_input) {
571
+					$default_input = new EE_Text_Input($input_constructor_args);
573 572
 				}
574 573
 				return $default_input;
575 574
 		}
@@ -594,65 +593,65 @@  discard block
 block discarded – undo
594 593
 	 */
595 594
 	public function process_reg_step() {
596 595
 
597
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
596
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
598 597
 		// grab validated data from form
599 598
 		$valid_data = $this->checkout->current_step->valid_data();
600 599
 		//EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
601 600
 		//EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
602 601
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
603
-		if ( empty( $valid_data ))  {
604
-			EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
602
+		if (empty($valid_data)) {
603
+			EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
605 604
 			return FALSE;
606 605
 		}
607 606
 		//EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ );
608
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
609
-			EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
607
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
608
+			EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
610 609
 			return FALSE;
611 610
 		}
612 611
 		// get cached registrations
613
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
612
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
614 613
 		// verify we got the goods
615
-		if ( empty( $registrations )) {
616
-			EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
614
+		if (empty($registrations)) {
615
+			EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
617 616
 			return FALSE;
618 617
 		}
619 618
 		// extract attendee info from form data and save to model objects
620
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
619
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
621 620
 		// if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart
622
-		if ( $registrations_processed === FALSE ) {
621
+		if ($registrations_processed === FALSE) {
623 622
 			// but return immediately if the previous step exited early due to errors
624 623
 			return FALSE;
625
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
624
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
626 625
 			// generate a correctly translated string for all possible singular/plural combinations
627
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
626
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
628 627
 				$error_msg = sprintf(
629
-					__( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
628
+					__('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
630 629
 					$this->checkout->total_ticket_count,
631 630
 					$registrations_processed
632 631
 				);
633
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
632
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
634 633
 				$error_msg = sprintf(
635
-					__( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ),
634
+					__('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'),
636 635
 					$this->checkout->total_ticket_count,
637 636
 					$registrations_processed
638 637
 				);
639 638
 			} else {
640 639
 				$error_msg = sprintf(
641
-					__( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
640
+					__('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
642 641
 					$this->checkout->total_ticket_count,
643 642
 					$registrations_processed
644 643
 				);
645 644
 
646 645
 			}
647
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
646
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
648 647
 			return FALSE;
649 648
 		}
650 649
 		// mark this reg step as completed
651 650
 		$this->checkout->current_step->set_completed();
652
-		$this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' ));
651
+		$this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso'));
653 652
 		//do action in case a plugin wants to do something with the data submitted in step 1.
654 653
 		//passes EE_Single_Page_Checkout, and it's posted data
655
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
654
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
656 655
 		return TRUE;
657 656
 
658 657
 	}
@@ -666,9 +665,9 @@  discard block
 block discarded – undo
666 665
 	 * @param array             $valid_data
667 666
 	 * @return boolean | int
668 667
 	 */
669
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
668
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
670 669
 		// load resources and set some defaults
671
-		EE_Registry::instance()->load_model( 'Attendee' );
670
+		EE_Registry::instance()->load_model('Attendee');
672 671
 		// holder for primary registrant attendee object
673 672
 		$this->checkout->primary_attendee_obj = NULL;
674 673
 		// array for tracking reg form data for the primary registrant
@@ -685,19 +684,19 @@  discard block
 block discarded – undo
685 684
 		// attendee counter
686 685
 		$att_nmbr = 0;
687 686
 		// grab the saved registrations from the transaction
688
-		foreach ( $registrations  as $registration ) {
687
+		foreach ($registrations  as $registration) {
689 688
 			// verify EE_Registration object
690
-			if ( ! $registration instanceof EE_Registration ) {
691
-				EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
689
+			if ( ! $registration instanceof EE_Registration) {
690
+				EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
692 691
 				return FALSE;
693 692
 			}
694 693
 			$reg_url_link = $registration->reg_url_link();
695 694
 			// reg_url_link exists ?
696
-			if ( $reg_url_link ) {
695
+			if ($reg_url_link) {
697 696
 				// should this registration be processed during this visit ?
698
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
697
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
699 698
 					// if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects
700
-					if ( ! $this->checkout->revisit ) {
699
+					if ( ! $this->checkout->revisit) {
701 700
 						$registration->save();
702 701
 					}
703 702
 
@@ -708,41 +707,41 @@  discard block
 block discarded – undo
708 707
 					 * @var bool   if TRUE is returned by the plugin then the
709 708
 					 *      		registration processing is halted.
710 709
 					 */
711
-					if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) {
710
+					if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) {
712 711
 						return FALSE;
713 712
 					}
714 713
 
715 714
 					// Houston, we have a registration!
716 715
 					$att_nmbr++;
717
-					$this->_attendee_data[ $reg_url_link ] = array();
716
+					$this->_attendee_data[$reg_url_link] = array();
718 717
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
719
-					if ( isset( $valid_data[ $reg_url_link ] )) {
718
+					if (isset($valid_data[$reg_url_link])) {
720 719
 						// do we need to copy basic info from primary attendee ?
721
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE;
720
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE;
722 721
 						// filter form input data for this registration
723
-						$valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] );
722
+						$valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]);
724 723
 						//EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
725
-						if ( isset( $valid_data['primary_attendee'] )) {
726
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE;
727
-							unset( $valid_data['primary_attendee'] );
724
+						if (isset($valid_data['primary_attendee'])) {
725
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE;
726
+							unset($valid_data['primary_attendee']);
728 727
 						}
729 728
 						// now loop through our array of valid post data && process attendee reg forms
730
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
731
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
732
-								foreach ( $form_inputs as $form_input => $input_value ) {
729
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
730
+							if ( ! in_array($form_section, $non_input_form_sections)) {
731
+								foreach ($form_inputs as $form_input => $input_value) {
733 732
 									// check for critical inputs
734
-									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) {
733
+									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) {
735 734
 										return FALSE;
736 735
 									}
737 736
 									// store a bit of data about the primary attendee
738
-									if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) {
739
-										$primary_registrant[ $form_input ] = $input_value;
740
-									} else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) {
741
-										$input_value = $primary_registrant[ $form_input ];
737
+									if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) {
738
+										$primary_registrant[$form_input] = $input_value;
739
+									} else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) {
740
+										$input_value = $primary_registrant[$form_input];
742 741
 									}
743 742
 									// now attempt to save the input data
744
-									if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value ))  {
745
-										EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ );
743
+									if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) {
744
+										EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__);
746 745
 										return FALSE;
747 746
 									}
748 747
 								}
@@ -751,51 +750,51 @@  discard block
 block discarded – undo
751 750
 					}
752 751
 					//EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ );
753 752
 					// this registration does not require additional attendee information ?
754
-					if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
753
+					if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
755 754
 						// just copy the primary registrant
756 755
 						$attendee = $this->checkout->primary_attendee_obj;
757 756
 					} else {
758 757
 						// have we met before?
759
-						$attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
758
+						$attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]);
760 759
 						// did we find an already existing record for this attendee ?
761
-						if ( $attendee instanceof EE_Attendee ) {
762
-							$attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] );
760
+						if ($attendee instanceof EE_Attendee) {
761
+							$attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]);
763 762
 						} else {
764 763
 							// ensure critical details are set for additional attendees
765
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ];
766
-							$attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
764
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link];
765
+							$attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]);
767 766
 						}
768 767
 						// who's #1 ?
769
-						if ( $att_nmbr == 1 ) {
768
+						if ($att_nmbr == 1) {
770 769
 							$this->checkout->primary_attendee_obj = $attendee;
771 770
 						}
772 771
 					}
773 772
 					//EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
774 773
 					// add relation to registration, set attendee ID, and cache attendee
775
-					$this->_associate_attendee_with_registration( $registration, $attendee );
776
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
777
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
774
+					$this->_associate_attendee_with_registration($registration, $attendee);
775
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
776
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
778 777
 						return FALSE;
779 778
 					}
780 779
 					/** @type EE_Registration_Processor $registration_processor */
781
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
780
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
782 781
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
783
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE );
782
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE);
784 783
 					/** @type EE_Transaction_Processor $transaction_processor */
785
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
784
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
786 785
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
787
-					$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
786
+					$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
788 787
 					// if we've gotten this far, then let's save what we have
789 788
 					$registration->save();
790 789
 					// add relation between TXN and registration
791
-					$this->_associate_registration_with_transaction( $registration );
790
+					$this->_associate_registration_with_transaction($registration);
792 791
 
793 792
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
794 793
 
795
-			}  else {
796
-				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
794
+			} else {
795
+				EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
797 796
 				// remove malformed data
798
-				unset( $valid_data[ $reg_url_link ] );
797
+				unset($valid_data[$reg_url_link]);
799 798
 				return FALSE;
800 799
 			}
801 800
 
@@ -813,22 +812,22 @@  discard block
 block discarded – undo
813 812
 	 * @param string           	$input_value
814 813
 	 * @return boolean
815 814
 	 */
816
-	private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) {
815
+	private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') {
817 816
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
818 817
 		//EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ );
819 818
 		// allow for plugins to hook in and do their own processing of the form input.
820 819
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
821
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) {
820
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) {
822 821
 			return TRUE;
823 822
 		}
824 823
 
825 824
 		// grab related answer objects
826 825
 		$answers = $registration->answers();
827 826
 		// $answer_cache_id is the key used to find the EE_Answer we want
828
-		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link();
829
-		$answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE;
827
+		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link();
828
+		$answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE;
830 829
 		//rename form_inputs if they are EE_Attendee properties
831
-		switch( (string)$form_input ) {
830
+		switch ((string) $form_input) {
832 831
 
833 832
 			case 'state' :
834 833
 			case 'STA_ID' :
@@ -843,32 +842,32 @@  discard block
 block discarded – undo
843 842
 				break;
844 843
 
845 844
 			default :
846
-				$ATT_input = 'ATT_' . $form_input;
845
+				$ATT_input = 'ATT_'.$form_input;
847 846
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
848
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE;
849
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
847
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE;
848
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
850 849
 		}
851 850
 		//EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
852 851
 		//EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
853 852
 		//EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
854 853
 		//EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
855 854
 		// if this form input has a corresponding attendee property
856
-		if ( $attendee_property ) {
857
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
858
-			if (  $answer_is_obj ) {
855
+		if ($attendee_property) {
856
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
857
+			if ($answer_is_obj) {
859 858
 				// and delete the corresponding answer since we won't be storing this data in that object
860
-				$registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' );
859
+				$registration->_remove_relation_to($answers[$answer_cache_id], 'Answer');
861 860
 			}
862 861
 			return TRUE;
863
-		} elseif ( $answer_is_obj ) {
862
+		} elseif ($answer_is_obj) {
864 863
 			// save this data to the answer object
865
-			$answers[ $answer_cache_id ]->set_value( $input_value );
866
-			$result = $answers[ $answer_cache_id ]->save();
864
+			$answers[$answer_cache_id]->set_value($input_value);
865
+			$result = $answers[$answer_cache_id]->save();
867 866
 			return $result !== false ? true : false;
868 867
 		} else {
869
-			foreach ( $answers as $answer ) {
870
-				if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) {
871
-					$answer->set_value( $input_value );
868
+			foreach ($answers as $answer) {
869
+				if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) {
870
+					$answer->set_value($input_value);
872 871
 					$result = $answer->save();
873 872
 					return $result !== false ? true : false;
874 873
 				}
@@ -886,29 +885,29 @@  discard block
 block discarded – undo
886 885
 	 * @param string $input_value
887 886
 	 * @return boolean
888 887
 	 */
889
-	private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) {
890
-		if ( empty( $input_value )) {
891
-			switch( $form_input ) {
888
+	private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') {
889
+		if (empty($input_value)) {
890
+			switch ($form_input) {
892 891
 				case 'fname' :
893
-					EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
892
+					EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
894 893
 					return FALSE;
895 894
 					break;
896 895
 				case 'lname' :
897
-					EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
896
+					EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
898 897
 					return FALSE;
899 898
 					break;
900 899
 				case 'email' :
901
-					EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
900
+					EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
902 901
 					return FALSE;
903 902
 					break;
904 903
 			}
905
-		} else if ( $form_input === 'email' ) {
904
+		} else if ($form_input === 'email') {
906 905
 			// clean the email address
907
-			$valid_email = sanitize_email( $input_value );
906
+			$valid_email = sanitize_email($input_value);
908 907
 			// check if it matches
909
-			if ( $input_value != $valid_email ) {
908
+			if ($input_value != $valid_email) {
910 909
 				// whoops!!!
911
-				EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
910
+				EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
912 911
 				return FALSE;
913 912
 			}
914 913
 		}
@@ -936,14 +935,14 @@  discard block
 block discarded – undo
936 935
 	 * @param array           $attendee_data
937 936
 	 * @return boolean
938 937
 	 */
939
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
938
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
940 939
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
941
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : '';
942
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : '';
943
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : '';
940
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : '';
941
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : '';
942
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : '';
944 943
 		// but only if those have values
945
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
946
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
944
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
945
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
947 946
 				'ATT_fname' => $ATT_fname,
948 947
 				'ATT_lname' => $ATT_lname,
949 948
 				'ATT_email' => $ATT_email
@@ -951,7 +950,7 @@  discard block
 block discarded – undo
951 950
 		} else {
952 951
 			$existing_attendee = NULL;
953 952
 		}
954
-		return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data );
953
+		return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data);
955 954
 	}
956 955
 
957 956
 
@@ -963,13 +962,13 @@  discard block
 block discarded – undo
963 962
 	 * @param array           $attendee_data
964 963
 	 * @return \EE_Attendee
965 964
 	 */
966
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
965
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
967 966
 		// first remove fname, lname, and email from attendee data
968
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
967
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
969 968
 		// now loop thru what's left and add to attendee CPT
970
-		foreach ( $attendee_data as $property_name => $property_value ) {
971
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
972
-				$existing_attendee->set( $property_name, $property_value );
969
+		foreach ($attendee_data as $property_name => $property_value) {
970
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
971
+				$existing_attendee->set($property_name, $property_value);
973 972
 			}
974 973
 		}
975 974
 		// better save that now
@@ -986,11 +985,11 @@  discard block
 block discarded – undo
986 985
 	 * @param EE_Attendee     $attendee
987 986
 	 * @return void
988 987
 	 */
989
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
988
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
990 989
 		// add relation to attendee
991
-		$registration->_add_relation_to( $attendee, 'Attendee' );
992
-		$registration->set_attendee_id( $attendee->ID() );
993
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
990
+		$registration->_add_relation_to($attendee, 'Attendee');
991
+		$registration->set_attendee_id($attendee->ID());
992
+		$registration->update_cache_after_object_save('Attendee', $attendee);
994 993
 	}
995 994
 
996 995
 
@@ -1001,10 +1000,10 @@  discard block
 block discarded – undo
1001 1000
 	 * @param EE_Registration $registration
1002 1001
 	 * @return void
1003 1002
 	 */
1004
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
1003
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
1005 1004
 		// add relation to attendee
1006
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
1007
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
1005
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1006
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1008 1007
 	}
1009 1008
 
1010 1009
 
@@ -1016,17 +1015,17 @@  discard block
 block discarded – undo
1016 1015
 	 * @param array $attendee_data
1017 1016
 	 * @return array
1018 1017
 	 */
1019
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1018
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1020 1019
 		// bare minimum critical details include first name, last name, email address
1021
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1020
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1022 1021
 		// add address info to critical details?
1023
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) {
1024
-			$address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' );
1025
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1022
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) {
1023
+			$address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone');
1024
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1026 1025
 		}
1027
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1028
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) {
1029
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail );
1026
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1027
+			if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) {
1028
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail);
1030 1029
 			}
1031 1030
 		}
1032 1031
 		return $attendee_data;
@@ -1041,11 +1040,11 @@  discard block
 block discarded – undo
1041 1040
 	 * @param array           $attendee_data
1042 1041
 	 * @return \EE_Attendee
1043 1042
 	 */
1044
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1043
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1045 1044
 		// create new attendee object
1046
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1045
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1047 1046
 		// set author to event creator
1048
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1047
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1049 1048
 		$new_attendee->save();
1050 1049
 		return $new_attendee;
1051 1050
 	}
@@ -1061,7 +1060,7 @@  discard block
 block discarded – undo
1061 1060
 	 */
1062 1061
 	public function update_reg_step() {
1063 1062
 		// save everything
1064
-		if ( $this->process_reg_step() ) {
1063
+		if ($this->process_reg_step()) {
1065 1064
 			$this->checkout->redirect = TRUE;
1066 1065
 			$this->checkout->redirect_url = add_query_arg(
1067 1066
 				array(
@@ -1070,7 +1069,7 @@  discard block
 block discarded – undo
1070 1069
 				),
1071 1070
 				$this->checkout->thank_you_page_url
1072 1071
 			);
1073
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1072
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1074 1073
 			return TRUE;
1075 1074
 		}
1076 1075
 		return FALSE;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 			case EEM_Question::QST_type_text :
508 508
 				if( $identifier == 'email' ){
509 509
 					return new EE_Email_Input( $input_constructor_args );
510
-				}else{
510
+				} else{
511 511
 					return new EE_Text_Input( $input_constructor_args );
512 512
 				}
513 513
 				break;
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 
793 793
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
794 794
 
795
-			}  else {
795
+			} else {
796 796
 				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
797 797
 				// remove malformed data
798 798
 				unset( $valid_data[ $reg_url_link ] );
Please login to merge, or discard this patch.
finalize_registration/EE_SPCO_Reg_Step_Finalize_Registration.class.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 
44 44
 	/**
45
-	 * @return boolean
45
+	 * @return boolean|null
46 46
 	 */
47 47
 	public function initialize_reg_step() {
48 48
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
 
171 171
 	/**
172
-	 * @return boolean
172
+	 * @return boolean|null
173 173
 	 */
174 174
 	public function update_reg_step() {
175 175
 		EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' );
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_SPCO_Reg_Step_Finalize_Registration
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_SPCO_Reg_Step_Finalize_Registration
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage 	core
10
+  * @author 				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_SPCO_Reg_Step_Finalize_Registration extends EE_SPCO_Reg_Step {
15 15
 
16 16
 	/**
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param    EE_Checkout $checkout
21 21
 	 * @return 	\EE_SPCO_Reg_Step_Finalize_Registration
22 22
 	 */
23
-	public function __construct( EE_Checkout $checkout ) {
23
+	public function __construct(EE_Checkout $checkout) {
24 24
 		$this->_slug = 'finalize_registration';
25 25
 		$this->_name = __('Finalize Registration', 'event_espresso');
26 26
 		$this->_submit_button_text = $this->_name;
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 	public function initialize_reg_step() {
48 48
 
49 49
 		// there's actually no reg form to process if this is the final step
50
-		if ( $this->is_current_step() ) {
50
+		if ($this->is_current_step()) {
51 51
 			$this->checkout->step = $_REQUEST['step'] = $this->slug();
52
-			$this->checkout->action = $_REQUEST[ 'action' ] = 'process_reg_step';
52
+			$this->checkout->action = $_REQUEST['action'] = 'process_reg_step';
53 53
 			$this->checkout->generate_reg_form = false;
54 54
 		}
55 55
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function process_reg_step() {
74 74
 		// ensure all data gets refreshed from the db
75
-		$this->checkout->refresh_all_entities( true );
75
+		$this->checkout->refresh_all_entities(true);
76 76
 		// ensures that all details and statuses for transaction, registration, and payments are updated
77 77
 		$txn_update_params = $this->_finalize_transaction();
78 78
 		// DEBUG LOG
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 		//	)
87 87
 		//);
88 88
 		// set a hook point
89
-		do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params );
89
+		do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params);
90 90
 		// check if transaction has a primary registrant and that it has a related Attendee object
91
-		if ( $this->checkout->transaction_has_primary_registrant() ) {
91
+		if ($this->checkout->transaction_has_primary_registrant()) {
92 92
 			// setup URL for redirect
93 93
 			$this->checkout->redirect_url = add_query_arg(
94
-				array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ),
94
+				array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()),
95 95
 				$this->checkout->thank_you_page_url
96 96
 			);
97 97
 		} else {
98
-			EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
98
+			EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
99 99
 			$this->checkout->redirect = false;
100 100
 			$this->checkout->continue_reg = false;
101 101
 			return false;
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 		// you don't have to go home but you can't stay here !
104 104
 		$this->checkout->redirect = true;
105 105
 		$this->checkout->continue_reg = true;
106
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
107
-		if ( ! ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) ) {
106
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
107
+		if ( ! ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site())) {
108 108
 			// mark this reg step as completed
109 109
 			$this->checkout->current_step->set_completed();
110 110
 		}
@@ -121,41 +121,41 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function _finalize_transaction() {
123 123
 		/** @type EE_Transaction_Processor $transaction_processor */
124
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
124
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
125 125
 		//set revisit flag in txn processor
126
-		$transaction_processor->set_revisit( $this->checkout->revisit );
126
+		$transaction_processor->set_revisit($this->checkout->revisit);
127 127
 		// at this point we'll consider a TXN to not have been abandoned
128
-		$transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction );
129
-		if ( $this->checkout->cart instanceof EE_Cart ) {
128
+		$transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction);
129
+		if ($this->checkout->cart instanceof EE_Cart) {
130 130
 			// save TXN data to the cart
131
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
131
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
132 132
 		}
133 133
 		/** @type EE_Transaction_Payments $transaction_payments */
134
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
134
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
135 135
 		// maybe update status, but don't save transaction just yet
136
-		$transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false );
136
+		$transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false);
137 137
 		// If the selected method of payment used an off-site gateway...
138
-		if ( $this->checkout->payment_method instanceof EE_Payment_Method ) {
139
-			if ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) {
140
-				$gateway= $this->checkout->payment_method->type_obj()->get_gateway();
141
-				if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
138
+		if ($this->checkout->payment_method instanceof EE_Payment_Method) {
139
+			if ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site()) {
140
+				$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
141
+				if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
142 142
 					// do NOT trigger notifications because it was already done during the IPN
143
-					remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' );
144
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
143
+					remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications');
144
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
145 145
 				}
146 146
 			} else if (
147 147
 				// if SPCO revisit and TXN status has changed due to a payment
148
-				filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN ) &&
149
-				( $this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated() )
148
+				filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN) &&
149
+				($this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated())
150 150
 			) {
151 151
 				// send out notifications
152
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
152
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
153 153
 			} else {
154
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
154
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
155 155
 			}
156 156
 		}
157 157
 		// this will result in the base session properties getting saved to the TXN_Session_data field
158
-		$this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true ));
158
+		$this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true));
159 159
 
160 160
 		// update the TXN if payment conditions have changed
161 161
 		return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment(
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 * @return boolean
173 173
 	 */
174 174
 	public function update_reg_step() {
175
-		EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' );
175
+		EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0');
176 176
 	 }
177 177
 
178 178
 
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 4 patches
Doc Comments   +12 added lines, -11 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 
105 105
 	/**
106
-	 * @return null
106
+	 * @return EE_Line_Item_Display
107 107
 	 */
108 108
 	public function line_item_display() {
109 109
 		return $this->line_item_display;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 
114 114
 	/**
115
-	 * @param null $line_item_display
115
+	 * @param EE_Line_Item_Display $line_item_display
116 116
 	 */
117 117
 	public function set_line_item_display( $line_item_display ) {
118 118
 		$this->line_item_display = $line_item_display;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
 
180 180
 	/**
181
-	 * @return bool
181
+	 * @return EE_Form_Section_Proper
182 182
 	 */
183 183
 	public function generate_reg_form() {
184 184
 		EE_Registry::instance()->load_helper( 'HTML' );
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	 * get_billing_form_html_for_payment_method
731 731
 	 *
732 732
 	 * @access public
733
-	 * @return string
733
+	 * @return boolean
734 734
 	 */
735 735
 	public function get_billing_form_html_for_payment_method() {
736 736
 		// how have they chosen to pay?
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 	 * switch_payment_method
851 851
 	 *
852 852
 	 * @access public
853
-	 * @return string
853
+	 * @return boolean
854 854
 	 */
855 855
 	public function switch_payment_method() {
856 856
 		if ( ! $this->_verify_payment_method_is_set() ) {
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 
1016 1016
 	/**
1017 1017
 	 * process_reg_step
1018
-	 * @return boolean
1018
+	 * @return null|boolean
1019 1019
 	 */
1020 1020
 	public function process_reg_step() {
1021 1021
 		// how have they chosen to pay?
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 	 *    update_reg_step
1092 1092
 	 *    this is the final step after a user  revisits the site to retry a payment
1093 1093
 	 *
1094
-	 * @return boolean
1094
+	 * @return null|boolean
1095 1095
 	 */
1096 1096
 	public function update_reg_step() {
1097 1097
 		$success = TRUE;
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
 	 *
1374 1374
 	 * 	@access 	private
1375 1375
 	 * 	@type 	EE_Payment_Method $payment_method
1376
-	 * 	@return 	mixed	EE_Payment | boolean
1376
+	 * 	@return 	EE_Payment|null	EE_Payment | boolean
1377 1377
 	 */
1378 1378
 	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1379 1379
 		$payment =NULL;
@@ -1570,6 +1570,7 @@  discard block
 block discarded – undo
1570 1570
 	 * @access private
1571 1571
 	 * @type    EE_Payment $payment
1572 1572
 	 * @param string $payment_occurs
1573
+	 * @param EE_Payment|null $payment
1573 1574
 	 * @return bool
1574 1575
 	 * @throws \EE_Error
1575 1576
 	 */
@@ -1675,7 +1676,7 @@  discard block
 block discarded – undo
1675 1676
 	 * 		or present the payment options again
1676 1677
 	 *
1677 1678
 	 * @access private
1678
-	 * @return EE_Payment | FALSE
1679
+	 * @return boolean | FALSE
1679 1680
 	 */
1680 1681
 	public function process_gateway_response() {
1681 1682
 		$payment = null;
@@ -1733,7 +1734,7 @@  discard block
 block discarded – undo
1733 1734
 	 * _validate_return
1734 1735
 	 *
1735 1736
 	 * @access private
1736
-	 * @return bool
1737
+	 * @return boolean|null
1737 1738
 	 */
1738 1739
 	private function _validate_offsite_return() {
1739 1740
 		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
@@ -1800,7 +1801,7 @@  discard block
 block discarded – undo
1800 1801
 	 *
1801 1802
 	 * @access private
1802 1803
 	 * @param \EE_Registration $primary_registrant
1803
-	 * @return bool
1804
+	 * @return false|null
1804 1805
 	 */
1805 1806
 	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1806 1807
 		if ( ! $primary_registrant instanceof EE_Registration ) {
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_SPCO_Reg_Step_Payment_Options
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_SPCO_Reg_Step_Payment_Options
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage 	core
10
+  * @author 				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_SPCO_Reg_Step_Payment_Options extends EE_SPCO_Reg_Step {
15 15
 
16 16
 	/**
@@ -740,13 +740,13 @@  discard block
 block discarded – undo
740 740
 			return FALSE;
741 741
 		}
742 742
 		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
743
-            EE_Error::add_success(
744
-                apply_filters(
745
-                    'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
746
-                    sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
747
-                )
748
-            );
749
-        }
743
+			EE_Error::add_success(
744
+				apply_filters(
745
+					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
746
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
747
+				)
748
+			);
749
+		}
750 750
 		// now generate billing form for selected method of payment
751 751
 		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method, FALSE );
752 752
 		// fill form with attendee info if applicable
@@ -778,14 +778,14 @@  discard block
 block discarded – undo
778 778
 		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
779 779
 		if ( $billing_form instanceof EE_Billing_Info_Form ) {
780 780
 			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
781
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
782
-                    EE_Error::add_success(
783
-                        apply_filters(
784
-                            'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
785
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
786
-                        )
787
-                    );
788
-                }
781
+				if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
782
+					EE_Error::add_success(
783
+						apply_filters(
784
+							'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
785
+							sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
786
+						)
787
+					);
788
+				}
789 789
 			}
790 790
 			return apply_filters(
791 791
 				'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form',
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1214,9 +1214,9 @@
 block discarded – undo
1214 1214
 						$form_section = $validation_error->get_form_section();
1215 1215
 						if( $form_section instanceof EE_Form_Input_Base ){
1216 1216
 							$label = $form_section->html_label_text();
1217
-						}elseif( $form_section instanceof EE_Form_Section_Base ){
1217
+						} elseif( $form_section instanceof EE_Form_Section_Base ){
1218 1218
 							$label = $form_section->name();
1219
-						}else{
1219
+						} else{
1220 1220
 							$label = __( 'Validation Error', 'event_espresso' );
1221 1221
 						}
1222 1222
 						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() );
Please login to merge, or discard this patch.
Spacing   +360 added lines, -360 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 *  @return 	void
29 29
 	 */
30 30
 	public static function set_hooks() {
31
-		add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) );
32
-		add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
33
-		add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
34
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
35
-		add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
36
-		add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) );
37
-		add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
31
+		add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters'));
32
+		add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
33
+		add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
34
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
35
+		add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
36
+		add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details'));
37
+		add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
38 38
 		);
39
-		add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 );
39
+		add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1);
40 40
 	}
41 41
 
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * 	ajax switch_spco_billing_form
46 46
 	 */
47 47
 	public static function switch_spco_billing_form() {
48
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
48
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
49 49
 	}
50 50
 
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * 	ajax save_payer_details
55 55
 	 */
56 56
 	public static function save_payer_details() {
57
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
57
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
58 58
 	}
59 59
 
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * 	ajax get_transaction_details
64 64
 	 */
65 65
 	public static function get_transaction_details() {
66
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
66
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
67 67
 	}
68 68
 
69 69
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	 * @param    EE_Checkout $checkout
92 92
 	 * @return    \EE_SPCO_Reg_Step_Payment_Options
93 93
 	 */
94
-	public function __construct( EE_Checkout $checkout ) {
94
+	public function __construct(EE_Checkout $checkout) {
95 95
 		$this->_slug = 'payment_options';
96 96
 		$this->_name = __('Payment Options', 'event_espresso');
97
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
97
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
98 98
 		$this->checkout = $checkout;
99 99
 		$this->_reset_success_message();
100
-		$this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
100
+		$this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
101 101
 	}
102 102
 
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * @param null $line_item_display
116 116
 	 */
117
-	public function set_line_item_display( $line_item_display ) {
117
+	public function set_line_item_display($line_item_display) {
118 118
 		$this->line_item_display = $line_item_display;
119 119
 	}
120 120
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @return void
126 126
 	 */
127 127
 	public function translate_js_strings() {
128
-		EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' );
129
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' );
130
-		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' );
128
+		EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso');
129
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso');
130
+		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso');
131 131
 	}
132 132
 
133 133
 
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 			// 	$ 0.00 transactions (no payment required)
157 157
 			! $this->checkout->payment_required()
158 158
 			// but do NOT remove if current action being called belongs to this reg step
159
-			&& ! is_callable( array( $this, $this->checkout->action ) )
159
+			&& ! is_callable(array($this, $this->checkout->action))
160 160
 			&& ! $this->completed()
161 161
 		) {
162 162
 				// and if so, then we no longer need the Payment Options step
163
-				$this->checkout->remove_reg_step( $this->_slug );
163
+				$this->checkout->remove_reg_step($this->_slug);
164 164
 				$this->checkout->reset_reg_steps();
165
-				if ( $this->is_current_step() ) {
165
+				if ($this->is_current_step()) {
166 166
 					$this->checkout->generate_reg_form = false;
167 167
 				}
168 168
 				// DEBUG LOG
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 				return;
171 171
 		}
172 172
 		// load EEM_Payment_Method
173
-		EE_Registry::instance()->load_model( 'Payment_Method' );
173
+		EE_Registry::instance()->load_model('Payment_Method');
174 174
 		// get all active payment methods
175
-		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart );
175
+		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart);
176 176
 	}
177 177
 
178 178
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @return bool
182 182
 	 */
183 183
 	public function generate_reg_form() {
184
-		EE_Registry::instance()->load_helper( 'HTML' );
184
+		EE_Registry::instance()->load_helper('HTML');
185 185
 		// reset in case someone changes their mind
186 186
 		$this->_reset_selected_method_of_payment();
187 187
 		// set some defaults
@@ -192,16 +192,16 @@  discard block
 block discarded – undo
192 192
 		$sold_out_events = array();
193 193
 		$reg_count = 0;
194 194
 		// loop thru registrations to gather info
195
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
196
-		foreach ( $registrations as $registration ) {
195
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
196
+		foreach ($registrations as $registration) {
197 197
 			//echo '<h3 style="color:#E76700;line-height:1em;">' . $registration->ID() . '<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span>    <b style="font-size:10px;color:#333">  ' . __LINE__ . ' </b></h3>';
198 198
 			/** @var $registration EE_Registration */
199 199
 			$reg_count++;
200 200
 			// if returning registrant is Approved then do NOT do this
201
-			if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) {
202
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) {
201
+			if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) {
202
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
203 203
 					// add event to list of events that are sold out
204
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
204
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
205 205
 					do_action(
206 206
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
207 207
 						$registration->event(),
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 					);
210 210
 				}
211 211
 				// event requires admin approval
212
-				if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) {
212
+				if ($registration->status_ID() == EEM_Registration::status_id_not_approved) {
213 213
 					// add event to list of events with pre-approval reg status
214
-					$registrations_requiring_pre_approval[ $registration->ID() ] = $registration;
214
+					$registrations_requiring_pre_approval[$registration->ID()] = $registration;
215 215
 					do_action(
216 216
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
217 217
 						$registration->event(),
@@ -220,29 +220,29 @@  discard block
 block discarded – undo
220 220
 				}
221 221
 			}
222 222
 			// are they allowed to pay now and is there monies owing?
223
-			if ( $registration->owes_monies_and_can_pay() ) {
224
-				$registrations_requiring_payment[ $registration->ID() ] = $registration;
223
+			if ($registration->owes_monies_and_can_pay()) {
224
+				$registrations_requiring_payment[$registration->ID()] = $registration;
225 225
 				do_action(
226 226
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
227 227
 					$registration->event(),
228 228
 					$this
229 229
 				);
230
-			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()  ) {
231
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
230
+			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) {
231
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
232 232
 			}
233 233
 		}
234 234
 		$subsections = array();
235 235
 		// now decide which template to load
236
-		if ( ! empty( $sold_out_events )) {
237
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
236
+		if ( ! empty($sold_out_events)) {
237
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
238 238
 		}
239
-		if ( ! empty( $registrations_requiring_pre_approval )) {
240
-			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval );
239
+		if ( ! empty($registrations_requiring_pre_approval)) {
240
+			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval);
241 241
 		}
242
-		if ( ! empty( $registrations_for_free_events ) ) {
243
-			$subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events );
242
+		if ( ! empty($registrations_for_free_events)) {
243
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
244 244
 		}
245
-		if ( ! empty( $registrations_requiring_payment ) ) {
245
+		if ( ! empty($registrations_requiring_payment)) {
246 246
 			//EEH_Debug_Tools::printr( $registrations_requiring_payment, '$registrations_requiring_payment', __FILE__, __LINE__ );
247 247
 			// autoload Line_Item_Display classes
248 248
 			EEH_Autoloader::register_line_item_filter_autoloaders();
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 			//EEH_Line_Item::visualize( $filtered_line_item_tree );
259 259
 			//EEH_Debug_Tools::printr( $filtered_line_item_tree->total(), '$filtered_line_item_tree->total()', __FILE__, __LINE__ );
260 260
 			$this->checkout->amount_owing = $filtered_line_item_tree->total();
261
-			if ( $this->checkout->amount_owing > 0 ) {
261
+			if ($this->checkout->amount_owing > 0) {
262 262
 				EEH_Autoloader::register_line_item_display_autoloaders();
263
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
264
-				$subsections[ 'payment_options' ] = $this->_display_payment_options(
265
-					$this->line_item_display->display_line_item( $filtered_line_item_tree )
263
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
264
+				$subsections['payment_options'] = $this->_display_payment_options(
265
+					$this->line_item_display->display_line_item($filtered_line_item_tree)
266 266
 				);
267 267
 			}
268 268
 		} else {
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection
297 297
 	 * @return \EE_Line_Item_Filter_Collection
298 298
 	 */
299
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
299
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
300 300
 		$line_item_filter_collection->add(
301 301
 			new EE_Billable_Line_Item_Filter(
302 302
 				EE_Registry::instance()->SSN->checkout()->transaction->registrations(
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 				)
305 305
 			)
306 306
 		);
307
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
307
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
308 308
 		return $line_item_filter_collection;
309 309
 	}
310 310
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 	 * @return void
319 319
 	 */
320 320
 	protected function _hide_reg_step_submit_button_if_revisit() {
321
-		if ( $this->checkout->revisit ) {
322
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
321
+		if ($this->checkout->revisit) {
322
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
323 323
 		}
324 324
 	}
325 325
 
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 	 * @param \EE_Event[] $sold_out_events_array
331 331
 	 * @return \EE_Form_Section_Proper
332 332
 	 */
333
-	private function _sold_out_events( $sold_out_events_array = array() ) {
333
+	private function _sold_out_events($sold_out_events_array = array()) {
334 334
 		// set some defaults
335 335
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
336 336
 		$sold_out_events = '';
337
-		foreach ( $sold_out_events_array as $sold_out_event ) {
338
-			$sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ));
337
+		foreach ($sold_out_events_array as $sold_out_event) {
338
+			$sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text'));
339 339
 		}
340 340
 		return new EE_Form_Section_Proper(
341 341
 			array(
@@ -347,14 +347,14 @@  discard block
 block discarded – undo
347 347
 				),
348 348
 				'layout_strategy'		=> new EE_Template_Layout(
349 349
 					array(
350
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template
350
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template
351 351
 						'template_args'  				=> apply_filters(
352 352
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
353 353
 							array(
354 354
 								'sold_out_events' 			=> $sold_out_events,
355 355
 								'sold_out_events_msg' 	=> apply_filters(
356 356
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg',
357
-									__( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' )
357
+									__('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso')
358 358
 								)
359 359
 							)
360 360
 						)
@@ -371,14 +371,14 @@  discard block
 block discarded – undo
371 371
 	 * @param array $registrations_requiring_pre_approval
372 372
 	 * @return \EE_Form_Section_Proper
373 373
 	 */
374
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) {
374
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
375 375
 		$events_requiring_pre_approval = '';
376
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
377
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
378
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
379
-					EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
376
+		foreach ($registrations_requiring_pre_approval as $registration) {
377
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
378
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
379
+					EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
380 380
 					)
381
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
381
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
382 382
 				);
383 383
 			}
384 384
 		}
@@ -390,14 +390,14 @@  discard block
 block discarded – undo
390 390
 				),
391 391
 				'layout_strategy'		=> new EE_Template_Layout(
392 392
 					array(
393
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template
393
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template
394 394
 						'template_args'  				=> apply_filters(
395 395
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
396 396
 							array(
397
-								'events_requiring_pre_approval' 			=> implode( '', $events_requiring_pre_approval ),
397
+								'events_requiring_pre_approval' 			=> implode('', $events_requiring_pre_approval),
398 398
 								'events_requiring_pre_approval_msg' 	=> apply_filters(
399 399
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
400
-									__( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' )
400
+									__('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso')
401 401
 								)
402 402
 							)
403 403
 						),
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	 * @param \EE_Event[] $registrations_for_free_events
416 416
 	 * @return \EE_Form_Section_Proper
417 417
 	 */
418
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
418
+	private function _no_payment_required($registrations_for_free_events = array()) {
419 419
 		// set some defaults
420 420
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
421 421
 		// generate no_payment_required form
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 				),
428 428
 				'layout_strategy' 	=> new EE_Template_Layout(
429 429
 					array(
430
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template
430
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template
431 431
 						'template_args'  				=> apply_filters(
432 432
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
433 433
 							array(
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 								'registrations' => array(),
436 436
 								'ticket_count' 	=> array(),
437 437
 								'registrations_for_free_events' 	=> $registrations_for_free_events,
438
-								'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' ))
438
+								'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso'))
439 439
 							)
440 440
 						),
441 441
 					)
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	 * @param string $transaction_details
453 453
 	 * @return \EE_Form_Section_Proper
454 454
 	 */
455
-	private function _display_payment_options( $transaction_details = '' ) {
455
+	private function _display_payment_options($transaction_details = '') {
456 456
 		// has method_of_payment been set by no-js user?
457 457
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
458 458
 		// build payment options form
@@ -464,20 +464,20 @@  discard block
 block discarded – undo
464 464
 						'before_payment_options' => apply_filters(
465 465
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
466 466
 							new EE_Form_Section_Proper(
467
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
467
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
468 468
 							)
469 469
 						),
470 470
 						'payment_options' => $this->_setup_payment_options(),
471 471
 						'after_payment_options' => apply_filters(
472 472
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
473 473
 							new EE_Form_Section_Proper(
474
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
474
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
475 475
 							)
476 476
 						),
477 477
 						'default_hidden_inputs' => $this->reg_step_hidden_inputs(),
478
-						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs( FALSE )
478
+						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs(FALSE)
479 479
 					),
480
-					'layout_strategy'	=> new EE_Template_Layout( array(
480
+					'layout_strategy'	=> new EE_Template_Layout(array(
481 481
 							'layout_template_file' 	=> $this->_template,
482 482
 							'template_args'  				=> apply_filters(
483 483
 								'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args',
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
 	 * @param bool $no_payment_required
502 502
 	 * @return \EE_Form_Section_Proper
503 503
 	 */
504
-	private function _extra_hidden_inputs( $no_payment_required = TRUE ) {
504
+	private function _extra_hidden_inputs($no_payment_required = TRUE) {
505 505
 
506 506
 		return new EE_Form_Section_Proper(
507 507
 			array(
508
-				'html_id' 				=> 'ee-' . $this->slug() . '-extra-hidden-inputs',
508
+				'html_id' 				=> 'ee-'.$this->slug().'-extra-hidden-inputs',
509 509
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
510 510
 				'subsections' 		=> array(
511 511
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -539,9 +539,9 @@  discard block
 block discarded – undo
539 539
 	 * @param 	bool $force_reset
540 540
 	 * @return 	void
541 541
 	 */
542
-	private function _reset_selected_method_of_payment( $force_reset = FALSE ) {
543
-		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE ));
544
-		if ( $reset_payment_method ) {
542
+	private function _reset_selected_method_of_payment($force_reset = FALSE) {
543
+		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE));
544
+		if ($reset_payment_method) {
545 545
 			$this->checkout->selected_method_of_payment = NULL;
546 546
 			$this->checkout->payment_method = NULL;
547 547
 			$this->checkout->billing_form = NULL;
@@ -560,9 +560,9 @@  discard block
 block discarded – undo
560 560
 	 * @param string $selected_method_of_payment
561 561
 	 * 	@return 		EE_Billing_Info_Form
562 562
 	 */
563
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
564
-		$selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
565
-		EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment ));
563
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
564
+		$selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
565
+		EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment));
566 566
 	}
567 567
 
568 568
 
@@ -575,40 +575,40 @@  discard block
 block discarded – undo
575 575
 		// load payment method classes
576 576
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
577 577
 		// switch up header depending on number of available payment methods
578
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
579
-			? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' ))
580
-			: apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' ));
578
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
579
+			? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso'))
580
+			: apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso'));
581 581
 		$available_payment_methods = array(
582 582
 			// display the "Payment Method" header
583 583
 			'payment_method_header' => new EE_Form_Section_HTML(
584
-				EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' )
584
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
585 585
 			)
586 586
 		);
587 587
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
588 588
 		$available_payment_method_options = array();
589 589
 		$default_payment_method_option = array();
590 590
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
591
-		$payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' )));
591
+		$payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;')));
592 592
 		// loop through payment methods
593
-		foreach( $this->checkout->available_payment_methods as $payment_method ) {
594
-			if ( $payment_method instanceof EE_Payment_Method ) {
595
-				$payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' );
593
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
594
+			if ($payment_method instanceof EE_Payment_Method) {
595
+				$payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img');
596 596
 				// check if any payment methods are set as default
597 597
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
598
-				if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) {
598
+				if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) {
599 599
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
600 600
 					$this->_save_selected_method_of_payment();
601
-					$default_payment_method_option[ $payment_method->slug() ] =  $payment_method_button;
601
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
602 602
 				} else {
603
-					$available_payment_method_options[ $payment_method->slug() ] =  $payment_method_button;
603
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
604 604
 				}
605
-				$payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method );
605
+				$payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method);
606 606
 			}
607 607
 		}
608 608
 		// prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs
609 609
 		$available_payment_method_options = $default_payment_method_option + $available_payment_method_options;
610 610
 		// now generate the actual form  inputs
611
-		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options );
611
+		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options);
612 612
 		$available_payment_methods = $available_payment_methods + $payment_methods_billing_info;
613 613
 
614 614
 		// build the available payment methods form
@@ -628,19 +628,19 @@  discard block
 block discarded – undo
628 628
 	 * @return EE_Payment_Method[]
629 629
 	 */
630 630
 	protected function _get_available_payment_methods() {
631
-		if ( ! empty( $this->checkout->available_payment_methods )) {
631
+		if ( ! empty($this->checkout->available_payment_methods)) {
632 632
 			return $this->checkout->available_payment_methods;
633 633
 		}
634 634
 		$available_payment_methods = array();
635 635
 		// load EEM_Payment_Method
636
-		EE_Registry::instance()->load_model( 'Payment_Method' );
636
+		EE_Registry::instance()->load_model('Payment_Method');
637 637
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
638 638
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
639 639
 		// get all active payment methods
640
-		$payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart );
641
-		foreach ( $payment_methods as $payment_method ) {
642
-			if ( $payment_method instanceof EE_Payment_Method ) {
643
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
640
+		$payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart);
641
+		foreach ($payment_methods as $payment_method) {
642
+			if ($payment_method instanceof EE_Payment_Method) {
643
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
644 644
 			}
645 645
 		}
646 646
 		return $available_payment_methods;
@@ -656,14 +656,14 @@  discard block
 block discarded – undo
656 656
 	 * @param 	array $available_payment_method_options
657 657
 	 * @return 	\EE_Form_Section_Proper
658 658
 	 */
659
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
659
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
660 660
 		// generate inputs
661 661
 		return new EE_Form_Section_Proper(
662 662
 			array(
663 663
 				'html_id' 				=> 'ee-available-payment-method-inputs',
664 664
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
665 665
 				'subsections' 		=> array(
666
-					'' => new EE_Radio_Button_Input (
666
+					'' => new EE_Radio_Button_Input(
667 667
 						$available_payment_method_options,
668 668
 						array(
669 669
 							'html_name' 				=> 'selected_method_of_payment',
@@ -687,36 +687,36 @@  discard block
 block discarded – undo
687 687
 	 * @param 	EE_Payment_Method $payment_method
688 688
 	 * @return 	\EE_Form_Section_Proper
689 689
 	 */
690
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
690
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
691 691
 		$currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE;
692 692
 		// generate the billing form for payment method
693
-		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML();
693
+		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML();
694 694
 		$this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form;
695 695
 		// it's all in the details
696
-		$info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' );
696
+		$info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr');
697 697
 		// add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not
698
-		if ( $payment_method->description() ) {
698
+		if ($payment_method->description()) {
699 699
 			$payment_method_info = $payment_method->description();
700
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
701
-			$payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
700
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
701
+			$payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
702 702
 		} else {
703
-			$payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
703
+			$payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
704 704
 		}
705
-		$info_html .= EEH_HTML::p (
706
-			apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ),
705
+		$info_html .= EEH_HTML::p(
706
+			apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info),
707 707
 			'',
708 708
 			'spco-payment-method-desc ee-attention'
709 709
 		);
710 710
 
711 711
 		return new EE_Form_Section_Proper(
712 712
 			array(
713
-				'html_id' 					=> 'spco-payment-method-info-' . $payment_method->slug(),
713
+				'html_id' 					=> 'spco-payment-method-info-'.$payment_method->slug(),
714 714
 				'html_class' 			=> 'spco-payment-method-info-dv',
715 715
 				// only display the selected or default PM
716 716
 				'html_style' 			=> $currently_selected ? '' : 'display:none;',
717 717
 				'layout_strategy'		=> new EE_Div_Per_Section_Layout(),
718 718
 				'subsections' 			=> array(
719
-					'info' 					=> new EE_Form_Section_HTML( $info_html ),
719
+					'info' 					=> new EE_Form_Section_HTML($info_html),
720 720
 					'billing_form' 		=> $currently_selected ? $billing_form : new EE_Form_Section_HTML()
721 721
 				)
722 722
 			)
@@ -734,12 +734,12 @@  discard block
 block discarded – undo
734 734
 	 */
735 735
 	public function get_billing_form_html_for_payment_method() {
736 736
 		// how have they chosen to pay?
737
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
737
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
738 738
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
739
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
739
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
740 740
 			return FALSE;
741 741
 		}
742
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
742
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
743 743
             EE_Error::add_success(
744 744
                 apply_filters(
745 745
                     'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -748,20 +748,20 @@  discard block
 block discarded – undo
748 748
             );
749 749
         }
750 750
 		// now generate billing form for selected method of payment
751
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method, FALSE );
751
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method, FALSE);
752 752
 		// fill form with attendee info if applicable
753
-		if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
754
-			$payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
753
+		if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
754
+			$payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
755 755
 		}
756 756
 		// and debug content
757
-		if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
758
-			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form );
757
+		if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
758
+			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form);
759 759
 		}
760 760
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : '';
761
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ));
761
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
762 762
 		// localize validation rules for main form
763 763
 		$this->checkout->current_step->reg_form->localize_validation_rules();
764
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
764
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
765 765
 		return TRUE;
766 766
 	}
767 767
 
@@ -774,15 +774,15 @@  discard block
 block discarded – undo
774 774
 	 * @param EE_Payment_Method $payment_method
775 775
 	 * @return \EE_Billing_Info_Form
776 776
 	 */
777
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
778
-		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
779
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
780
-			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
781
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
777
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
778
+		$billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing));
779
+		if ($billing_form instanceof EE_Billing_Info_Form) {
780
+			if (EE_Registry::instance()->REQ->is_set('payment_method')) {
781
+                if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
782 782
                     EE_Error::add_success(
783 783
                         apply_filters(
784 784
                             'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
785
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
785
+                            sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name())
786 786
                         )
787 787
                     );
788 788
                 }
@@ -807,27 +807,27 @@  discard block
 block discarded – undo
807 807
 	 * @param string 		$request_param
808 808
 	 * @return NULL|string
809 809
 	 */
810
-	private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) {
810
+	private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') {
811 811
 		// is selected_method_of_payment set in the request ?
812
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE );
813
-		if ( $selected_method_of_payment ) {
812
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE);
813
+		if ($selected_method_of_payment) {
814 814
 			// sanitize it
815
-			$selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment;
816
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
815
+			$selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment;
816
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
817 817
 			// store it in the session so that it's available for all subsequent requests including AJAX
818
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
818
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
819 819
 		} else {
820 820
 			// or is is set in the session ?
821
-			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' );
821
+			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment');
822 822
 		}
823 823
 		// do ya really really gotta have it?
824
-		if ( empty( $selected_method_of_payment ) && $required ) {
824
+		if (empty($selected_method_of_payment) && $required) {
825 825
 			EE_Error::add_error(
826 826
 				sprintf(
827
-					__( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ),
827
+					__('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'),
828 828
 					'<br/>',
829 829
 					'<br/>',
830
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
830
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
831 831
 				),
832 832
 				__FILE__, __FUNCTION__, __LINE__
833 833
 			);
@@ -853,37 +853,37 @@  discard block
 block discarded – undo
853 853
 	 * @return string
854 854
 	 */
855 855
 	public function switch_payment_method() {
856
-		if ( ! $this->_verify_payment_method_is_set() ) {
856
+		if ( ! $this->_verify_payment_method_is_set()) {
857 857
 			return FALSE;
858 858
 		}
859
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
859
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
860 860
 			EE_Error::add_success(
861 861
 				apply_filters(
862 862
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
863
-					sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() )
863
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
864 864
 				)
865 865
 			);
866 866
 		}
867 867
 		// generate billing form for selected method of payment if it hasn't been done already
868
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
869
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
868
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
869
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
870 870
 		}
871 871
 		// fill form with attendee info if applicable
872
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
873
-			$this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
872
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
873
+			$this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
874 874
 		}
875 875
 		// and debug content
876
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
877
-			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form );
876
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
877
+			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form);
878 878
 		}
879 879
 		// get html and validation rules for form
880
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
881
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() ));
880
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
881
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html()));
882 882
 			// localize validation rules for main form
883
-			$this->checkout->billing_form->localize_validation_rules( TRUE );
884
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
883
+			$this->checkout->billing_form->localize_validation_rules(TRUE);
884
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
885 885
 		} else {
886
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ));
886
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
887 887
 		}
888 888
 		//prevents advancement to next step
889 889
 		$this->checkout->continue_reg = FALSE;
@@ -898,12 +898,12 @@  discard block
 block discarded – undo
898 898
 	 */
899 899
 	protected function _verify_payment_method_is_set() {
900 900
 		// generate billing form for selected method of payment if it hasn't been done already
901
-		if ( empty( $this->checkout->selected_method_of_payment )) {
901
+		if (empty($this->checkout->selected_method_of_payment)) {
902 902
 			// how have they chosen to pay?
903
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
903
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
904 904
 		}
905 905
 		// verify payment method
906
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
906
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
907 907
 			// get payment method for selected method of payment
908 908
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
909 909
 		}
@@ -923,23 +923,23 @@  discard block
 block discarded – undo
923 923
 	 * @return void
924 924
 	 */
925 925
 	public function save_payer_details_via_ajax() {
926
-		if ( ! $this->_verify_payment_method_is_set() ) {
926
+		if ( ! $this->_verify_payment_method_is_set()) {
927 927
 			return;
928 928
 		}
929 929
 		// generate billing form for selected method of payment if it hasn't been done already
930
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
931
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
930
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
931
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
932 932
 		}
933 933
 		// generate primary attendee from payer info if applicable
934 934
 		if ( ! $this->checkout->transaction_has_primary_registrant()) {
935 935
 			$attendee = $this->_create_attendee_from_request_data();
936
-			if ( $attendee instanceof EE_Attendee ) {
937
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
938
-					if ( $registration->is_primary_registrant() ) {
936
+			if ($attendee instanceof EE_Attendee) {
937
+				foreach ($this->checkout->transaction->registrations() as $registration) {
938
+					if ($registration->is_primary_registrant()) {
939 939
 						$this->checkout->primary_attendee_obj = $attendee;
940
-						$registration->_add_relation_to( $attendee, 'Attendee' );
941
-						$registration->set_attendee_id( $attendee->ID() );
942
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
940
+						$registration->_add_relation_to($attendee, 'Attendee');
941
+						$registration->set_attendee_id($attendee->ID());
942
+						$registration->update_cache_after_object_save('Attendee', $attendee);
943 943
 					}
944 944
 				}
945 945
 			}
@@ -952,56 +952,56 @@  discard block
 block discarded – undo
952 952
 	 * uses info from alternate GET or POST data (such as AJAX) to create a new attendee
953 953
 	 * @return \EE_Attendee
954 954
 	 */
955
-	protected function _create_attendee_from_request_data(){
955
+	protected function _create_attendee_from_request_data() {
956 956
 		// get State ID
957
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
958
-		if ( ! empty( $STA_ID )) {
957
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
958
+		if ( ! empty($STA_ID)) {
959 959
 			// can we get state object from name ?
960
-			EE_Registry::instance()->load_model( 'State' );
961
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' );
962
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
960
+			EE_Registry::instance()->load_model('State');
961
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
962
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
963 963
 		}
964 964
 		// get Country ISO
965
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
966
-		if ( ! empty( $CNT_ISO )) {
965
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
966
+		if ( ! empty($CNT_ISO)) {
967 967
 			// can we get country object from name ?
968
-			EE_Registry::instance()->load_model( 'Country' );
969
-			$country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' );
970
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
968
+			EE_Registry::instance()->load_model('Country');
969
+			$country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO');
970
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
971 971
 		}
972 972
 		// grab attendee data
973 973
 		$attendee_data = array(
974
-			'ATT_fname' 		=> ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
975
-			'ATT_lname' 		=> ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
976
-			'ATT_email' 		=> ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
977
-			'ATT_address' 		=> ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
978
-			'ATT_address2' 	=> ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
979
-			'ATT_city' 			=> ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
974
+			'ATT_fname' 		=> ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
975
+			'ATT_lname' 		=> ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
976
+			'ATT_email' 		=> ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
977
+			'ATT_address' 		=> ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
978
+			'ATT_address2' 	=> ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
979
+			'ATT_city' 			=> ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
980 980
 			'STA_ID' 				=> $STA_ID,
981 981
 			'CNT_ISO' 			=> $CNT_ISO,
982
-			'ATT_zip' 				=> ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
983
-			'ATT_phone' 		=> ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
982
+			'ATT_zip' 				=> ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
983
+			'ATT_phone' 		=> ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
984 984
 		);
985 985
 		// validate the email address since it is the most important piece of info
986
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) {
987
-			EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
986
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) {
987
+			EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
988 988
 		}
989 989
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
990
-		if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) {
991
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
990
+		if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) {
991
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
992 992
 				'ATT_fname' => $attendee_data['ATT_fname'],
993 993
 				'ATT_lname' => $attendee_data['ATT_lname'],
994 994
 				'ATT_email' => $attendee_data['ATT_email']
995 995
 			));
996
-			if ( $existing_attendee instanceof EE_Attendee ) {
996
+			if ($existing_attendee instanceof EE_Attendee) {
997 997
 				return $existing_attendee;
998 998
 			}
999 999
 		}
1000 1000
 		// no existing attendee? kk let's create a new one
1001 1001
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1002
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1003
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1004
-		return EE_Attendee::new_instance( $attendee_data );
1002
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1003
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1004
+		return EE_Attendee::new_instance($attendee_data);
1005 1005
 	}
1006 1006
 
1007 1007
 
@@ -1021,22 +1021,22 @@  discard block
 block discarded – undo
1021 1021
 	 */
1022 1022
 	public function process_reg_step() {
1023 1023
 		// how have they chosen to pay?
1024
-		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE );
1024
+		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE);
1025 1025
 		// choose your own adventure based on method_of_payment
1026
-		switch(  $this->checkout->selected_method_of_payment ) {
1026
+		switch ($this->checkout->selected_method_of_payment) {
1027 1027
 
1028 1028
 			case 'events_sold_out' :
1029 1029
 				$this->checkout->redirect = TRUE;
1030 1030
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1031
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1031
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1032 1032
 				// mark this reg step as completed
1033 1033
 				$this->checkout->current_step->set_completed();
1034 1034
 				return FALSE;
1035 1035
 				break;
1036 1036
 
1037 1037
 			case 'payments_closed' :
1038
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) {
1039
-					EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1038
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) {
1039
+					EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1040 1040
 				}
1041 1041
 				// mark this reg step as completed
1042 1042
 				$this->checkout->current_step->set_completed();
@@ -1044,8 +1044,8 @@  discard block
 block discarded – undo
1044 1044
 				break;
1045 1045
 
1046 1046
 			case 'no_payment_required' :
1047
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) {
1048
-					EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1047
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) {
1048
+					EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1049 1049
 				}
1050 1050
 				// mark this reg step as completed
1051 1051
 				$this->checkout->current_step->set_completed();
@@ -1054,9 +1054,9 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
 			default:
1056 1056
 				$payment_successful = $this->_process_payment();
1057
-				if ( $payment_successful ) {
1057
+				if ($payment_successful) {
1058 1058
 					$this->checkout->continue_reg = true;
1059
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1059
+					$this->_maybe_set_completed($this->checkout->payment_method);
1060 1060
 				} else {
1061 1061
 					$this->checkout->continue_reg = false;
1062 1062
 				}
@@ -1074,8 +1074,8 @@  discard block
 block discarded – undo
1074 1074
 	 * @param \EE_Payment_Method $payment_method
1075 1075
 	 * @return void
1076 1076
 	 */
1077
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1078
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1077
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1078
+		switch ($payment_method->type_obj()->payment_occurs()) {
1079 1079
 			case EE_PMT_Base::offsite :
1080 1080
 				break;
1081 1081
 			case EE_PMT_Base::onsite :
@@ -1098,15 +1098,15 @@  discard block
 block discarded – undo
1098 1098
 	public function update_reg_step() {
1099 1099
 		$success = TRUE;
1100 1100
 		// if payment required
1101
-		if ( $this->checkout->transaction->total() > 0 ) {
1102
-			do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction );
1101
+		if ($this->checkout->transaction->total() > 0) {
1102
+			do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction);
1103 1103
 			// attempt payment via payment method
1104 1104
 			$success = $this->process_reg_step();
1105 1105
 		}
1106
-		if ( $success && ! $this->checkout->redirect ) {
1107
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
1106
+		if ($success && ! $this->checkout->redirect) {
1107
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
1108 1108
 			 // set return URL
1109
-			$this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url );
1109
+			$this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url);
1110 1110
 		}
1111 1111
 		return $success;
1112 1112
 	}
@@ -1126,24 +1126,24 @@  discard block
 block discarded – undo
1126 1126
 		// clear any previous errors related to not selecting a payment method
1127 1127
 //		EE_Error::overwrite_errors();
1128 1128
 		// ya gotta make a choice man
1129
-		if ( empty( $this->checkout->selected_method_of_payment )) {
1130
-			$this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' ));
1129
+		if (empty($this->checkout->selected_method_of_payment)) {
1130
+			$this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso'));
1131 1131
 			return FALSE;
1132 1132
 		}
1133 1133
 		// get EE_Payment_Method object
1134
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1134
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1135 1135
 			return FALSE;
1136 1136
 		}
1137 1137
 		// setup billing form
1138
-		if ( $this->checkout->payment_method->is_on_site() ) {
1139
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1138
+		if ($this->checkout->payment_method->is_on_site()) {
1139
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1140 1140
 			// bad billing form ?
1141
-			if ( ! $this->_billing_form_is_valid() ) {
1141
+			if ( ! $this->_billing_form_is_valid()) {
1142 1142
 				return FALSE;
1143 1143
 			}
1144 1144
 		}
1145 1145
 		// ensure primary registrant has been fully processed
1146
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1146
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1147 1147
 			return FALSE;
1148 1148
 		}
1149 1149
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1151,24 +1151,24 @@  discard block
 block discarded – undo
1151 1151
 		// in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved
1152 1152
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1153 1153
 		// attempt payment
1154
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1154
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1155 1155
 		// process results
1156
-		$payment = $this->_validate_payment( $payment );
1157
-		$payment = $this->_post_payment_processing( $payment );
1156
+		$payment = $this->_validate_payment($payment);
1157
+		$payment = $this->_post_payment_processing($payment);
1158 1158
 		// verify payment
1159
-		if ( $payment instanceof EE_Payment ) {
1159
+		if ($payment instanceof EE_Payment) {
1160 1160
 			// store that for later
1161 1161
 			$this->checkout->payment = $payment;
1162 1162
 			/** @type EE_Transaction_Processor $transaction_processor */
1163
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1163
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1164 1164
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1165
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1166
-			if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) {
1165
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1166
+			if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) {
1167 1167
 				return true;
1168 1168
 			} else {
1169 1169
 				return false;
1170 1170
 			}
1171
-		} else if ( $payment === true ) {
1171
+		} else if ($payment === true) {
1172 1172
 			// please note that offline payment methods will NOT make a payment,
1173 1173
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1174 1174
 			$this->checkout->payment = $payment;
@@ -1187,10 +1187,10 @@  discard block
 block discarded – undo
1187 1187
 	 * @return bool
1188 1188
 	 */
1189 1189
 	public function redirect_form() {
1190
-		$payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() );
1190
+		$payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment());
1191 1191
 		$html = $payment_method_billing_info->get_html_and_js();
1192 1192
 		$html .= $this->checkout->redirect_form;
1193
-		EE_Registry::instance()->REQ->add_output( $html );
1193
+		EE_Registry::instance()->REQ->add_output($html);
1194 1194
 		return TRUE;
1195 1195
 	}
1196 1196
 
@@ -1203,33 +1203,33 @@  discard block
 block discarded – undo
1203 1203
 	 * @return bool
1204 1204
 	 */
1205 1205
 	private function _billing_form_is_valid() {
1206
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1207
-			if ( $this->checkout->billing_form->was_submitted() ) {
1206
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1207
+			if ($this->checkout->billing_form->was_submitted()) {
1208 1208
 				$this->checkout->billing_form->receive_form_submission();
1209
-				if ( $this->checkout->billing_form->is_valid() ) {
1209
+				if ($this->checkout->billing_form->is_valid()) {
1210 1210
 					return TRUE;
1211 1211
 				}
1212 1212
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1213 1213
 				$error_strings = array();
1214
-				foreach( $validation_errors as $validation_error ){
1215
-					if( $validation_error instanceof EE_Validation_Error ){
1214
+				foreach ($validation_errors as $validation_error) {
1215
+					if ($validation_error instanceof EE_Validation_Error) {
1216 1216
 						$form_section = $validation_error->get_form_section();
1217
-						if( $form_section instanceof EE_Form_Input_Base ){
1217
+						if ($form_section instanceof EE_Form_Input_Base) {
1218 1218
 							$label = $form_section->html_label_text();
1219
-						}elseif( $form_section instanceof EE_Form_Section_Base ){
1219
+						}elseif ($form_section instanceof EE_Form_Section_Base) {
1220 1220
 							$label = $form_section->name();
1221
-						}else{
1222
-							$label = __( 'Validation Error', 'event_espresso' );
1221
+						} else {
1222
+							$label = __('Validation Error', 'event_espresso');
1223 1223
 						}
1224
-						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() );
1224
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1225 1225
 					}
1226 1226
 				}
1227
-				EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings )  ), __FILE__, __FUNCTION__, __LINE__ );
1227
+				EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__);
1228 1228
 			} else {
1229
-				EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1229
+				EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1230 1230
 			}
1231 1231
 		} else {
1232
-			EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1232
+			EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1233 1233
 		}
1234 1234
 		return FALSE;
1235 1235
 	}
@@ -1247,9 +1247,9 @@  discard block
 block discarded – undo
1247 1247
 	 */
1248 1248
 		private function _setup_primary_registrant_prior_to_payment() {
1249 1249
 			// check if transaction has a primary registrant and that it has a related Attendee object
1250
-			if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1250
+			if ( ! $this->checkout->transaction_has_primary_registrant()) {
1251 1251
 				// need to at least gather some primary registrant data before attempting payment
1252
-				if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) {
1252
+				if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) {
1253 1253
 					return FALSE;
1254 1254
 				}
1255 1255
 			}
@@ -1257,13 +1257,13 @@  discard block
 block discarded – undo
1257 1257
 			// grab the primary_registration object
1258 1258
 			$primary_registration = $this->checkout->transaction->primary_registration();
1259 1259
 			/** @type EE_Transaction_Processor $transaction_processor */
1260
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1260
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1261 1261
 			// at this point we'll consider a TXN to not have been failed
1262
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1262
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1263 1263
 			// save the TXN ( which clears cached copy of primary_registration)
1264 1264
 			$this->checkout->transaction->save();
1265 1265
 			// grab TXN ID and save it to the primary_registration
1266
-			$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1266
+			$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1267 1267
 			// save what we have so far
1268 1268
 			$primary_registration->save();
1269 1269
 			return TRUE;
@@ -1280,41 +1280,41 @@  discard block
 block discarded – undo
1280 1280
 		private function _capture_primary_registration_data_from_billing_form() {
1281 1281
 			// convert billing form data into an attendee
1282 1282
 			$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1283
-			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1283
+			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1284 1284
 				EE_Error::add_error(
1285 1285
 					sprintf(
1286
-						__( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1286
+						__('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1287 1287
 						'<br/>',
1288
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1288
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1289 1289
 					), __FILE__, __FUNCTION__, __LINE__
1290 1290
 				);
1291 1291
 				return FALSE;
1292 1292
 			}
1293 1293
 			$primary_registration = $this->checkout->transaction->primary_registration();
1294
-			if ( ! $primary_registration instanceof EE_Registration ) {
1294
+			if ( ! $primary_registration instanceof EE_Registration) {
1295 1295
 				EE_Error::add_error(
1296 1296
 					sprintf(
1297
-						__( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1297
+						__('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1298 1298
 						'<br/>',
1299
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1299
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1300 1300
 					), __FILE__, __FUNCTION__, __LINE__
1301 1301
 				);
1302 1302
 				return FALSE;
1303 1303
 			}
1304
-			if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) {
1304
+			if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) {
1305 1305
 				EE_Error::add_error(
1306 1306
 					sprintf(
1307
-						__( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1307
+						__('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1308 1308
 						'<br/>',
1309
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1309
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1310 1310
 					), __FILE__, __FUNCTION__, __LINE__
1311 1311
 				);
1312 1312
 				return FALSE;
1313 1313
 			}
1314 1314
 			/** @type EE_Registration_Processor $registration_processor */
1315
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1315
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1316 1316
 			// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1317
-			$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1317
+			$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1318 1318
 
1319 1319
 			return TRUE;
1320 1320
 		}
@@ -1330,35 +1330,35 @@  discard block
 block discarded – undo
1330 1330
 	 */
1331 1331
 		private function _get_payment_method_for_selected_method_of_payment() {
1332 1332
 			// get EE_Payment_Method object
1333
-			if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) {
1334
-				$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1333
+			if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1334
+				$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1335 1335
 			} else {
1336 1336
 				// load EEM_Payment_Method
1337
-				EE_Registry::instance()->load_model( 'Payment_Method' );
1337
+				EE_Registry::instance()->load_model('Payment_Method');
1338 1338
 				/** @type EEM_Payment_Method $EEM_Payment_Method */
1339 1339
 				$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1340
-				$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1340
+				$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1341 1341
 			}
1342 1342
 			// verify $payment_method
1343
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
1343
+			if ( ! $payment_method instanceof EE_Payment_Method) {
1344 1344
 				// not a payment
1345 1345
 				EE_Error::add_error(
1346 1346
 					sprintf(
1347
-						__( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1347
+						__('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1348 1348
 						'<br/>',
1349
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1349
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1350 1350
 					), __FILE__, __FUNCTION__, __LINE__
1351 1351
 				);
1352 1352
 				return NULL;
1353 1353
 			}
1354 1354
 			// and verify it has a valid Payment_Method Type object
1355
-			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1355
+			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1356 1356
 				// not a payment
1357 1357
 				EE_Error::add_error(
1358 1358
 					sprintf(
1359
-						__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1359
+						__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1360 1360
 						'<br/>',
1361
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1361
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1362 1362
 					), __FILE__, __FUNCTION__, __LINE__
1363 1363
 				);
1364 1364
 				return NULL;
@@ -1377,29 +1377,29 @@  discard block
 block discarded – undo
1377 1377
 	 * 	@type 	EE_Payment_Method $payment_method
1378 1378
 	 * 	@return 	mixed	EE_Payment | boolean
1379 1379
 	 */
1380
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1381
-		$payment =NULL;
1380
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1381
+		$payment = NULL;
1382 1382
 		$this->checkout->transaction->save();
1383
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1384
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1383
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1384
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1385 1385
 			return FALSE;
1386 1386
 		}
1387 1387
 		try {
1388
-			$payment_processor->set_revisit( $this->checkout->revisit );
1388
+			$payment_processor->set_revisit($this->checkout->revisit);
1389 1389
 			// generate payment object
1390 1390
 			$payment = $payment_processor->process_payment(
1391 1391
 				$payment_method,
1392 1392
 				$this->checkout->transaction,
1393 1393
 				$this->checkout->amount_owing,
1394 1394
 				$this->checkout->billing_form,
1395
-				$this->_get_return_url( $payment_method ),
1395
+				$this->_get_return_url($payment_method),
1396 1396
 				'CART',
1397 1397
 				$this->checkout->admin_request,
1398 1398
 				TRUE,
1399 1399
 				$this->reg_step_url()
1400 1400
 			);
1401
-		} catch( Exception $e ) {
1402
-			$this->_handle_payment_processor_exception( $e );
1401
+		} catch (Exception $e) {
1402
+			$this->_handle_payment_processor_exception($e);
1403 1403
 		}
1404 1404
 		return $payment;
1405 1405
 	}
@@ -1413,12 +1413,12 @@  discard block
 block discarded – undo
1413 1413
 	 * @param \Exception $e
1414 1414
 	 * @return void
1415 1415
 	 */
1416
-	protected function _handle_payment_processor_exception( Exception $e ) {
1416
+	protected function _handle_payment_processor_exception(Exception $e) {
1417 1417
 		EE_Error::add_error(
1418 1418
 			sprintf(
1419
-				__( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ),
1419
+				__('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'),
1420 1420
 				'<br/>',
1421
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
1421
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
1422 1422
 				$e->getMessage(),
1423 1423
 				$e->getFile(),
1424 1424
 				$e->getLine()
@@ -1435,9 +1435,9 @@  discard block
 block discarded – undo
1435 1435
 	 * @param \EE_Payment_Method $payment_method
1436 1436
 	 * @return string
1437 1437
 	 */
1438
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
1438
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
1439 1439
 		$return_url = '';
1440
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1440
+		switch ($payment_method->type_obj()->payment_occurs()) {
1441 1441
 
1442 1442
 			case EE_PMT_Base::offsite :
1443 1443
 				$return_url = add_query_arg(
@@ -1468,27 +1468,27 @@  discard block
 block discarded – undo
1468 1468
 	 * @param EE_Payment $payment
1469 1469
 	 * @return EE_Payment | FALSE
1470 1470
 	 */
1471
-	private function _validate_payment( $payment = NULL ) {
1472
-		if (  $this->checkout->payment_method->is_off_line() ) {
1471
+	private function _validate_payment($payment = NULL) {
1472
+		if ($this->checkout->payment_method->is_off_line()) {
1473 1473
 			return TRUE;
1474 1474
 		}
1475 1475
 		// verify payment object
1476
-		if ( $payment instanceof EE_Payment ) {
1476
+		if ($payment instanceof EE_Payment) {
1477 1477
 			if (
1478 1478
 				$payment->status() != EEM_Payment::status_id_approved
1479 1479
 				&& $payment->status() != EEM_Payment::status_id_pending
1480 1480
 				&& $payment->status() != EEM_Payment::status_id_cancelled
1481 1481
 				&& $payment->gateway_response() != ''
1482 1482
 			) {
1483
-				EE_Error::add_error( $payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__ );
1483
+				EE_Error::add_error($payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__);
1484 1484
 			}
1485 1485
 		} else {
1486 1486
 			// not a payment
1487 1487
 			EE_Error::add_error(
1488 1488
 				sprintf(
1489
-					__( 'A valid payment was not generated due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1489
+					__('A valid payment was not generated due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1490 1490
 					'<br/>',
1491
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1491
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1492 1492
 				), __FILE__, __FUNCTION__, __LINE__
1493 1493
 			);
1494 1494
 			return FALSE;
@@ -1505,22 +1505,22 @@  discard block
 block discarded – undo
1505 1505
 	 * @param EE_Payment $payment
1506 1506
 	 * @return bool
1507 1507
 	 */
1508
-	private function _post_payment_processing( $payment = NULL ) {
1508
+	private function _post_payment_processing($payment = NULL) {
1509 1509
 		// On-Site payment?
1510
-		if ( $this->checkout->payment_method->is_on_site() ) {
1511
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) {
1510
+		if ($this->checkout->payment_method->is_on_site()) {
1511
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
1512 1512
 				//$this->_setup_redirect_for_next_step();
1513 1513
 				$this->checkout->continue_reg = false;
1514 1514
 			}
1515 1515
 			// Off-Site payment?
1516
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
1516
+		} else if ($this->checkout->payment_method->is_off_site()) {
1517 1517
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
1518
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ){
1518
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
1519 1519
 				$this->checkout->redirect = TRUE;
1520 1520
 				$this->checkout->redirect_form = $payment->redirect_form();
1521
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
1521
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
1522 1522
 				// set JSON response
1523
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
1523
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
1524 1524
 				// set cron job for finalizing the TXN
1525 1525
 				// in case the user does not return from the off-site gateway
1526 1526
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -1532,14 +1532,14 @@  discard block
 block discarded – undo
1532 1532
 				$this->checkout->continue_reg = false;
1533 1533
 				EE_Error::add_error(
1534 1534
 					sprintf(
1535
-						__( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1535
+						__('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1536 1536
 						'<br/>',
1537
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1537
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1538 1538
 					), __FILE__, __FUNCTION__, __LINE__
1539 1539
 				);
1540 1540
 			}
1541 1541
 			// Off-Line payment?
1542
-		} else if ( $payment === TRUE ) {
1542
+		} else if ($payment === TRUE) {
1543 1543
 			//$this->_setup_redirect_for_next_step();
1544 1544
 			return TRUE;
1545 1545
 		} else {
@@ -1575,64 +1575,64 @@  discard block
 block discarded – undo
1575 1575
 	 * @return bool
1576 1576
 	 * @throws \EE_Error
1577 1577
 	 */
1578
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
1578
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
1579 1579
 		// off-line payment? carry on
1580
-		if ( $payment_occurs == EE_PMT_Base::offline ) {
1580
+		if ($payment_occurs == EE_PMT_Base::offline) {
1581 1581
 			return true;
1582 1582
 		}
1583 1583
 		// verify payment validity
1584
-		if ( $payment instanceof EE_Payment ) {
1584
+		if ($payment instanceof EE_Payment) {
1585 1585
 			$msg = $payment->gateway_response();
1586 1586
 			// check results
1587
-			switch ( $payment->status() ) {
1587
+			switch ($payment->status()) {
1588 1588
 
1589 1589
 				// good payment
1590 1590
 				case EEM_Payment::status_id_approved :
1591
-					EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1591
+					EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1592 1592
 					return TRUE;
1593 1593
 					break;
1594 1594
 
1595 1595
 				// slow payment
1596 1596
 				case EEM_Payment::status_id_pending :
1597
-					if ( empty( $msg )) {
1598
-						$msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' );
1597
+					if (empty($msg)) {
1598
+						$msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso');
1599 1599
 					}
1600
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
1600
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
1601 1601
 					return TRUE;
1602 1602
 					break;
1603 1603
 
1604 1604
 				// don't wanna payment
1605 1605
 				case EEM_Payment::status_id_cancelled :
1606
-					if ( empty( $msg )) {
1606
+					if (empty($msg)) {
1607 1607
 						$msg = _n(
1608 1608
 							'Payment cancelled. Please try again.',
1609 1609
 							'Payment cancelled. Please try again or select another method of payment.',
1610
-							count( $this->checkout->available_payment_methods ),
1610
+							count($this->checkout->available_payment_methods),
1611 1611
 							'event_espresso'
1612 1612
 						);
1613 1613
 					}
1614
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1614
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1615 1615
 					return FALSE;
1616 1616
 					break;
1617 1617
 
1618 1618
 				// not enough payment
1619 1619
 				case EEM_Payment::status_id_declined :
1620
-					if ( empty( $msg )) {
1620
+					if (empty($msg)) {
1621 1621
 						$msg = _n(
1622 1622
 							'We\'re sorry but your payment was declined. Please try again.',
1623 1623
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
1624
-							count( $this->checkout->available_payment_methods ),
1624
+							count($this->checkout->available_payment_methods),
1625 1625
 							'event_espresso'
1626 1626
 						);
1627 1627
 					}
1628
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1628
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1629 1629
 					return FALSE;
1630 1630
 					break;
1631 1631
 
1632 1632
 				// bad payment
1633 1633
 				case EEM_Payment::status_id_failed :
1634
-					if ( ! empty( $msg ) ) {
1635
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1634
+					if ( ! empty($msg)) {
1635
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1636 1636
 						return false;
1637 1637
 					}
1638 1638
 					// default to error below
@@ -1642,14 +1642,14 @@  discard block
 block discarded – undo
1642 1642
 		}
1643 1643
 		// off-site payment gateway responses are too unreliable, so let's just assume that
1644 1644
 		// the payment processing is just running slower than the registrant's request
1645
-		if ( $payment_occurs == EE_PMT_Base::offsite ) {
1645
+		if ($payment_occurs == EE_PMT_Base::offsite) {
1646 1646
 			return true;
1647 1647
 		}
1648 1648
 		EE_Error::add_error(
1649 1649
 				sprintf(
1650
-					__( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1650
+					__('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1651 1651
 					'<br/>',
1652
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1652
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1653 1653
 				),
1654 1654
 				__FILE__, __FUNCTION__, __LINE__
1655 1655
 			);
@@ -1682,13 +1682,13 @@  discard block
 block discarded – undo
1682 1682
 	public function process_gateway_response() {
1683 1683
 		$payment = null;
1684 1684
 		// how have they chosen to pay?
1685
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1685
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1686 1686
 		// get EE_Payment_Method object
1687
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1687
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1688 1688
 			$this->checkout->continue_reg = false;
1689 1689
 			return false;
1690 1690
 		}
1691
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
1691
+		if ( ! $this->checkout->payment_method->is_off_site()) {
1692 1692
 			return false;
1693 1693
 		}
1694 1694
 		$this->_validate_offsite_return();
@@ -1702,17 +1702,17 @@  discard block
 block discarded – undo
1702 1702
 		//	true
1703 1703
 		//);
1704 1704
 		// verify TXN
1705
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1705
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1706 1706
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
1707
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
1707
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
1708 1708
 				$this->checkout->continue_reg = false;
1709 1709
 				return false;
1710 1710
 			}
1711
-			$payment = $this->_process_off_site_payment( $gateway );
1712
-			$payment = $this->_process_cancelled_payments( $payment );
1713
-			$payment = $this->_validate_payment( $payment );
1711
+			$payment = $this->_process_off_site_payment($gateway);
1712
+			$payment = $this->_process_cancelled_payments($payment);
1713
+			$payment = $this->_validate_payment($payment);
1714 1714
 			// if payment was not declined by the payment gateway or cancelled by the registrant
1715
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
1715
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
1716 1716
 				//$this->_setup_redirect_for_next_step();
1717 1717
 				// store that for later
1718 1718
 				$this->checkout->payment = $payment;
@@ -1738,19 +1738,19 @@  discard block
 block discarded – undo
1738 1738
 	 * @return bool
1739 1739
 	 */
1740 1740
 	private function _validate_offsite_return() {
1741
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
1742
-		if ( $TXN_ID != $this->checkout->transaction->ID() ) {
1741
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
1742
+		if ($TXN_ID != $this->checkout->transaction->ID()) {
1743 1743
 			// Houston... we might have a problem
1744 1744
 			$invalid_TXN = false;
1745 1745
 			// first gather some info
1746
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1746
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1747 1747
 			$primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null;
1748 1748
 			// let's start by retrieving the cart for this TXN
1749
-			$cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction );
1750
-			if ( $cart instanceof EE_Cart ) {
1749
+			$cart = EE_Cart::get_cart_from_txn($this->checkout->transaction);
1750
+			if ($cart instanceof EE_Cart) {
1751 1751
 				// verify that the current cart has tickets
1752 1752
 				$tickets = $cart->get_tickets();
1753
-				if ( empty( $tickets ) ) {
1753
+				if (empty($tickets)) {
1754 1754
 					$invalid_TXN = true;
1755 1755
 				}
1756 1756
 			} else {
@@ -1758,39 +1758,39 @@  discard block
 block discarded – undo
1758 1758
 			}
1759 1759
 			$valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null;
1760 1760
 			// validate current Session ID and compare against valid TXN session ID
1761
-			if ( EE_Session::instance()->id() === null ) {
1761
+			if (EE_Session::instance()->id() === null) {
1762 1762
 				$invalid_TXN = true;
1763
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
1763
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
1764 1764
 				// WARNING !!!
1765 1765
 				// this could be PayPal sending back duplicate requests (ya they do that)
1766 1766
 				// or it **could** mean someone is simply registering AGAIN after having just done so
1767 1767
 				// so now we need to determine if this current TXN looks valid or not
1768 1768
 				/** @type EE_Transaction_Processor $transaction_processor */
1769
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1769
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1770 1770
 				// has this step even been started ?
1771
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
1771
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
1772 1772
 				) {
1773 1773
 					// really? you're half way through this reg step, but you never started it ?
1774 1774
 					$invalid_TXN = true;
1775 1775
 				}
1776 1776
 			}
1777
-			if ( $invalid_TXN ) {
1777
+			if ($invalid_TXN) {
1778 1778
 				// is the valid TXN completed ?
1779
-				if ( $valid_TXN instanceof EE_Transaction ) {
1779
+				if ($valid_TXN instanceof EE_Transaction) {
1780 1780
 					/** @type EE_Transaction_Processor $transaction_processor */
1781
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1781
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1782 1782
 					// has this step even been started ?
1783
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
1784
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
1783
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
1784
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
1785 1785
 						// so it **looks** like this is a double request from PayPal
1786 1786
 						// so let's try to pick up where we left off
1787 1787
 						$this->checkout->transaction = $valid_TXN;
1788
-						$this->checkout->refresh_all_entities( true );
1788
+						$this->checkout->refresh_all_entities(true);
1789 1789
 						return;
1790 1790
 					}
1791 1791
 				}
1792 1792
 				// you appear to be lost?
1793
-				$this->_redirect_wayward_request( $primary_registrant );
1793
+				$this->_redirect_wayward_request($primary_registrant);
1794 1794
 			}
1795 1795
 		}
1796 1796
 	}
@@ -1804,18 +1804,18 @@  discard block
 block discarded – undo
1804 1804
 	 * @param \EE_Registration $primary_registrant
1805 1805
 	 * @return bool
1806 1806
 	 */
1807
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1808
-		if ( ! $primary_registrant instanceof EE_Registration ) {
1807
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
1808
+		if ( ! $primary_registrant instanceof EE_Registration) {
1809 1809
 			// try redirecting based on the current TXN
1810 1810
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null;
1811
-			if ( ! $primary_registrant instanceof EE_Registration ) {
1811
+			if ( ! $primary_registrant instanceof EE_Registration) {
1812 1812
 				EE_Error::add_error(
1813 1813
 					sprintf(
1814
-						__( 'Invalid information was received from the Off-Site Payment Processor and your
1814
+						__('Invalid information was received from the Off-Site Payment Processor and your
1815 1815
 						Transaction details could not be retrieved from the database.%1$sPlease try again or contact
1816
-						%2$s for assistance.', 'event_espresso' ),
1816
+						%2$s for assistance.', 'event_espresso'),
1817 1817
 						'<br/>',
1818
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1818
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1819 1819
 					),
1820 1820
 					__FILE__, __FUNCTION__, __LINE__
1821 1821
 				);
@@ -1843,16 +1843,16 @@  discard block
 block discarded – undo
1843 1843
 	 * @param \EE_Offsite_Gateway $gateway
1844 1844
 	 * @return \EE_Payment
1845 1845
 	 */
1846
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
1846
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
1847 1847
 		try {
1848 1848
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
1849
-			if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
1849
+			if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
1850 1850
 				$payment = $this->checkout->transaction->last_payment();
1851 1851
 				//$payment_source = 'last_payment';
1852 1852
 			} else {
1853 1853
 				// get payment details and process results
1854 1854
 				/** @type EE_Payment_Processor $payment_processor */
1855
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1855
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1856 1856
 				$payment = $payment_processor->process_ipn(
1857 1857
 					$_REQUEST,
1858 1858
 					$this->checkout->transaction,
@@ -1862,14 +1862,14 @@  discard block
 block discarded – undo
1862 1862
 				);
1863 1863
 				//$payment_source = 'process_ipn';
1864 1864
 			}
1865
-		} catch ( Exception $e ) {
1865
+		} catch (Exception $e) {
1866 1866
 			// let's just eat the exception and try to move on using any previously set payment info
1867 1867
 			$payment = $this->checkout->transaction->last_payment();
1868 1868
 			//$payment_source = 'last_payment after Exception';
1869 1869
 			// but if we STILL don't have a payment object
1870
-			if ( ! $payment instanceof EE_Payment ) {
1870
+			if ( ! $payment instanceof EE_Payment) {
1871 1871
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
1872
-				$this->_handle_payment_processor_exception( $e );
1872
+				$this->_handle_payment_processor_exception($e);
1873 1873
 			}
1874 1874
 		}
1875 1875
 		// DEBUG LOG
@@ -1893,13 +1893,13 @@  discard block
 block discarded – undo
1893 1893
 	 * @param EE_Payment $payment
1894 1894
 	 * @return EE_Payment | FALSE
1895 1895
 	 */
1896
-	private function _process_cancelled_payments( $payment = NULL ) {
1896
+	private function _process_cancelled_payments($payment = NULL) {
1897 1897
 		if (
1898
-			isset( $_REQUEST[ 'ee_cancel_payment' ] )
1898
+			isset($_REQUEST['ee_cancel_payment'])
1899 1899
 			&& $payment instanceof EE_Payment
1900 1900
 			&& $payment->status() == EEM_Payment::status_id_failed
1901 1901
 		) {
1902
-			$payment->set_status( EEM_Payment::status_id_cancelled );
1902
+			$payment->set_status(EEM_Payment::status_id_cancelled);
1903 1903
 		}
1904 1904
 		return $payment;
1905 1905
 	}
@@ -1916,23 +1916,23 @@  discard block
 block discarded – undo
1916 1916
 	public function get_transaction_details_for_gateways() {
1917 1917
 		$txn_details = array();
1918 1918
 		// ya gotta make a choice man
1919
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1919
+		if (empty($this->checkout->selected_method_of_payment)) {
1920 1920
 			$txn_details = array(
1921
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
1921
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
1922 1922
 			);
1923 1923
 		}
1924 1924
 		// get EE_Payment_Method object
1925 1925
 		if (
1926
-			empty( $txn_details ) &&
1926
+			empty($txn_details) &&
1927 1927
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
1928 1928
 		) {
1929 1929
 			$txn_details = array(
1930 1930
 				'selected_method_of_payment' => $this->checkout->selected_method_of_payment,
1931
-				'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' )
1931
+				'error' => __('A valid Payment Method could not be determined.', 'event_espresso')
1932 1932
 			);
1933 1933
 		}
1934
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
1935
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
1934
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
1935
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
1936 1936
 			$txn_details = array(
1937 1937
 				'TXN_ID'        			=> $this->checkout->transaction->ID(),
1938 1938
 				'TXN_timestamp' 	=> $this->checkout->transaction->datetime(),
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
 				'STS_ID'        			=> $this->checkout->transaction->status_ID(),
1943 1943
 				'PMD_ID'        			=> $this->checkout->transaction->payment_method_ID(),
1944 1944
 				'return_url' 				=> $return_url,
1945
-				'cancel_url' 				=> add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
1945
+				'cancel_url' 				=> add_query_arg(array('ee_cancel_payment' => true), $return_url),
1946 1946
 				'notify_url' 				=> EE_Config::instance()->core->txn_page_url(
1947 1947
 					array(
1948 1948
 						'e_reg_url_link'    			=> $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -1951,7 +1951,7 @@  discard block
 block discarded – undo
1951 1951
 				)
1952 1952
 			);
1953 1953
 		}
1954
-		echo json_encode( $txn_details );
1954
+		echo json_encode($txn_details);
1955 1955
 		exit();
1956 1956
 	}
1957 1957
 
Please login to merge, or discard this patch.
EE_SPCO_Reg_Step_Registration_Confirmation.class.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 
42 42
 	/**
43
-	 * @return boolean
43
+	 * @return boolean|null
44 44
 	 */
45 45
 	public function initialize_reg_step() {
46 46
 		$this->checkout->remove_reg_step( $this->_slug );
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 
60 60
 	/**
61
-	 * @return boolean
61
+	 * @return boolean|null
62 62
 	 */
63 63
 	public function process_reg_step() {
64 64
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 
69 69
 	/**
70
-	 * @return boolean
70
+	 * @return boolean|null
71 71
 	 */
72 72
 	public function update_reg_step() {
73 73
 
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_SPCO_Reg_Step_Registration_Confirmation
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_SPCO_Reg_Step_Registration_Confirmation
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage 	core
10
+  * @author 				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_SPCO_Reg_Step_Registration_Confirmation extends EE_SPCO_Reg_Step {
15 15
 
16 16
 	/**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 	 * @param    EE_Checkout $checkout
21 21
 	 * @return 	\EE_SPCO_Reg_Step_Registration_Confirmation
22 22
 	 */
23
-	public function __construct( EE_Checkout $checkout ) {
23
+	public function __construct(EE_Checkout $checkout) {
24 24
 		$this->_slug = 'registration_confirmation';
25 25
 		$this->_name = __('Registration Confirmation', 'event_espresso');
26
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'registration_page_confirmation.template.php';
26
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'registration_page_confirmation.template.php';
27 27
 		$this->checkout = $checkout;
28 28
 	}
29 29
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return boolean
44 44
 	 */
45 45
 	public function initialize_reg_step() {
46
-		$this->checkout->remove_reg_step( $this->_slug );
46
+		$this->checkout->remove_reg_step($this->_slug);
47 47
 	}
48 48
 
49 49
 
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	 *
462 462
 	 *	@access public
463 463
 	 * 	@access 		public
464
-	 * 	@return		array  or FALSE
464
+	 * 	@return		boolean|null  or FALSE
465 465
 	 */
466 466
 	public function process_ticket_selections() {
467 467
 		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 	 * @access   private
721 721
 	 * @param EE_Ticket $ticket
722 722
 	 * @param int       $qty
723
-	 * @return TRUE on success, FALSE on fail
723
+	 * @return boolean on success, FALSE on fail
724 724
 	 */
725 725
 	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
726 726
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	protected static $_event = NULL;
36 36
 
37 37
 	/**
38
-	* array of datetimes and the spaces available for them
39
-	*
40
-	* @access private
41
-	* @var array
42
-	*/
38
+	 * array of datetimes and the spaces available for them
39
+	 *
40
+	 * @access private
41
+	 * @var array
42
+	 */
43 43
 	private static $_available_spaces = array();
44 44
 
45 45
 
@@ -855,11 +855,11 @@  discard block
 block discarded – undo
855 855
 
856 856
 
857 857
 	/**
858
-	* 	load js
859
-	*
860
-	* 	@access 		public
861
-	* 	@return 		void
862
-	*/
858
+	 * 	load js
859
+	 *
860
+	 * 	@access 		public
861
+	 * 	@return 		void
862
+	 */
863 863
 	public static function load_tckt_slctr_assets() {
864 864
 		// add some style
865 865
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
 	 * @return EED_Ticket_Selector
58 58
 	 */
59 59
 	public static function instance() {
60
-		return parent::get_instance( __CLASS__ );
60
+		return parent::get_instance(__CLASS__);
61 61
 	}
62 62
 
63 63
 
64 64
 
65
-	protected function set_config(){
66
-		$this->set_config_section( 'template_settings' );
67
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
68
-		$this->set_config_name( 'EED_Ticket_Selector' );
65
+	protected function set_config() {
66
+		$this->set_config_section('template_settings');
67
+		$this->set_config_class('EE_Ticket_Selector_Config');
68
+		$this->set_config_name('EED_Ticket_Selector');
69 69
 	}
70 70
 
71 71
 
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public static function set_hooks() {
82 82
 		// routing
83
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
84
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
85
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
86
-		add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 );
87
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
88
-		add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 );
89
-		add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 );
90
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
83
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
84
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
85
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
86
+		add_action('AHEE_event_details_before_post', array('EED_Ticket_Selector', 'ticket_selector_form_open'), 10, 1);
87
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
88
+		add_action('AHEE__ticket_selector_chart__template__after_ticket_selector', array('EED_Ticket_Selector', 'display_ticket_selector_submit'), 10, 1);
89
+		add_action('AHEE_event_details_after_post', array('EED_Ticket_Selector', 'ticket_selector_form_close'), 10);
90
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
91 91
 	}
92 92
 
93 93
 
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 	 *  @return 	void
100 100
 	 */
101 101
 	public static function set_hooks_admin() {
102
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
102
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
103 103
 		//add button for iframe code to event editor.
104
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
105
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
104
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
105
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
106 106
 	}
107 107
 
108 108
 
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 *  @return 	void
115 115
 	 */
116 116
 	public static function set_definitions() {
117
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
118
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
117
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
118
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
119 119
 
120 120
 		//if config is not set, initialize
121 121
 		//If config is not set, set it.
122
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
122
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
123 123
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
124 124
 		}
125
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
125
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
126 126
 	}
127 127
 
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * 	@param	object 			$WP
134 134
 	 * 	@return 	void
135 135
 	 */
136
-	public function run( $WP ) {}
136
+	public function run($WP) {}
137 137
 
138 138
 
139 139
 	/**
@@ -145,25 +145,25 @@  discard block
 block discarded – undo
145 145
 	public function ticket_selector_iframe() {
146 146
 		self::$_in_iframe = true;
147 147
 		/** @type EEM_Event $EEM_Event */
148
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
149
-		$event = $EEM_Event->get_one_by_ID( EE_Registry::instance()->REQ->get(
148
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
149
+		$event = $EEM_Event->get_one_by_ID(EE_Registry::instance()->REQ->get(
150 150
 			'event', 0 ));
151
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
152
-		$template_args['css'] = apply_filters( 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', array(
153
-			TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
154
-			TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
155
-			includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
156
-			EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
157
-			) );
158
-
159
-		$template_args['js'] = apply_filters( 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', array(
160
-			includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
161
-			EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
162
-			TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
163
-			) );
151
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
152
+		$template_args['css'] = apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', array(
153
+			TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
154
+			TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
155
+			includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
156
+			EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
157
+			));
158
+
159
+		$template_args['js'] = apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', array(
160
+			includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
161
+			EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
162
+			TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
163
+			));
164 164
 
165 165
 		EE_Registry::instance()->load_helper('Template');
166
-		EEH_Template::display_template( TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', $template_args );
166
+		EEH_Template::display_template(TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', $template_args);
167 167
 		exit;
168 168
 	}
169 169
 
@@ -180,23 +180,23 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return string The new html string for the permalink area.
182 182
 	 */
183
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
183
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
184 184
 		//make sure this is ONLY when editing and the event id has been set.
185
-		if ( ! empty( $id ) )  {
186
-			$post = get_post( $id );
185
+		if ( ! empty($id)) {
186
+			$post = get_post($id);
187 187
 
188 188
 			//if NOT event then let's get out.
189
-			if ( $post->post_type !== 'espresso_events' ) {
189
+			if ($post->post_type !== 'espresso_events') {
190 190
 				return $permalink_string;
191 191
 			}
192 192
 
193
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
193
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
194 194
 
195
-			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">' . __('Embed', 'event_espresso') . '</a> ';
195
+			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'.__('Embed', 'event_espresso').'</a> ';
196 196
 			$permalink_string .= '
197 197
 <div id="js-ts-iframe" style="display:none">
198 198
 	<div style="width:100%; height: 500px;">
199
-		<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>
199
+		<iframe src="' . $ticket_selector_url.'" width="100%" height="100%"></iframe>
200 200
 	</div>
201 201
 </div>';
202 202
 		}
@@ -215,23 +215,23 @@  discard block
 block discarded – undo
215 215
 	 * @param 	mixed $event
216 216
 	 * @return 	bool
217 217
 	 */
218
-	protected static function set_event( $event = null ) {
219
-		if( $event === null ) {
218
+	protected static function set_event($event = null) {
219
+		if ($event === null) {
220 220
 			global $post;
221 221
 			$event = $post;
222 222
 		}
223 223
 		//		d( $event );
224
-		if ( $event instanceof EE_Event ) {
224
+		if ($event instanceof EE_Event) {
225 225
 			self::$_event = $event;
226
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
226
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
227 227
 			self::$_event = $event->EE_Event;
228
-		} else if ( $event instanceof WP_Post && ( ! isset( $event->EE_Event ) || ! $event->EE_Event instanceof EE_Event ) ) {
229
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
228
+		} else if ($event instanceof WP_Post && ( ! isset($event->EE_Event) || ! $event->EE_Event instanceof EE_Event)) {
229
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
230 230
 			self::$_event = $event->EE_Event;
231 231
 		} else {
232
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
233
-			$dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' );
234
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
232
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
233
+			$dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso');
234
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
235 235
 			return false;
236 236
 		}
237 237
 		return true;
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 	 * @param 	bool 	$view_details
251 251
 	 * @return 	string
252 252
 	 */
253
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
253
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
254 254
 		// reset filter for displaying submit button
255
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
255
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
256 256
 		// poke and prod incoming event till it tells us what it is
257
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
257
+		if ( ! EED_Ticket_Selector::set_event($event)) {
258 258
 			return false;
259 259
 		}
260 260
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			&& (
266 266
 				! self::$_event->display_ticket_selector()
267 267
 				|| $view_details
268
-				|| post_password_required( $event_post )
268
+				|| post_password_required($event_post)
269 269
 				|| (
270 270
 					$_event_active_status != EE_Datetime::active
271 271
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -277,78 +277,78 @@  discard block
 block discarded – undo
277 277
 				)
278 278
 			)
279 279
 		) {
280
-			return ! is_single() ? EED_Ticket_Selector::display_view_details_btn( self::$_event ) : '';
280
+			return ! is_single() ? EED_Ticket_Selector::display_view_details_btn(self::$_event) : '';
281 281
 		}
282 282
 
283 283
 		$template_args = array();
284 284
 		$template_args['event_status'] = $_event_active_status;
285 285
 
286
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
287
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
286
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
287
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
288 288
 
289 289
 		$template_args['EVT_ID'] = self::$_event->ID();
290 290
 		$template_args['event'] = self::$_event;
291 291
 
292 292
 		// is the event expired ?
293 293
 		$template_args['event_is_expired'] = self::$_event->is_expired();
294
-		if ( $template_args['event_is_expired'] ) {
295
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>';
294
+		if ($template_args['event_is_expired']) {
295
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>';
296 296
 		}
297 297
 
298 298
 		$ticket_query_args = array(
299
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
300
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
299
+			array('Datetime.EVT_ID' => self::$_event->ID()),
300
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
301 301
 		);
302 302
 
303
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
303
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
304 304
 			//use the correct applicable time query depending on what version of core is being run.
305
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
306
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
305
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
306
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
307 307
 		}
308 308
 
309 309
 		// get all tickets for this event ordered by the datetime
310
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
310
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
311 311
 
312
-		if ( count( $template_args['tickets'] ) < 1 ) {
313
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
312
+		if (count($template_args['tickets']) < 1) {
313
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
314 314
 		}
315 315
 
316 316
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
317
-		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() );
318
-		if ( $template_args['max_atndz'] < 1 ) {
319
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
320
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
321
-				$sales_closed_msg .=  sprintf(
322
-					__( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ),
317
+		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit());
318
+		if ($template_args['max_atndz'] < 1) {
319
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
320
+			if (current_user_can('edit_post', self::$_event->ID())) {
321
+				$sales_closed_msg .= sprintf(
322
+					__('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'),
323 323
 					'<div class="ee-attention" style="text-align: left;"><b>',
324 324
 					'</b><br />',
325
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
325
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
326 326
 					'</a></span></div>'
327 327
 				);
328 328
 			}
329
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
329
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
330 330
 		}
331 331
 
332
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
333
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
332
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
333
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
334 334
 
335 335
 		// redirecting to another site for registration ??
336 336
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
337 337
 		// set up the form (but not for the admin)
338
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
338
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
339 339
 		// if not redirecting to another site for registration
340
-		if ( ! $external_url ) {
341
-			EE_Registry::instance()->load_helper( 'Template' );
340
+		if ( ! $external_url) {
341
+			EE_Registry::instance()->load_helper('Template');
342 342
 			// then display the ticket selector
343
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
343
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
344 344
 		} else {
345 345
 			// if not we still need to trigger the display of the submit button
346
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
346
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
347 347
 			//display notice to admin that registration is external
348
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
348
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
349 349
 		}
350 350
 		// submit button and form close tag
351
-		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit( self::$_event->ID() ) : '';
351
+		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit(self::$_event->ID()) : '';
352 352
 		// set no cache headers and constants
353 353
 		EE_System::do_not_cache();
354 354
 
@@ -365,28 +365,28 @@  discard block
 block discarded – undo
365 365
 	 * @param 		string $external_url
366 366
 	 * @return 		string
367 367
 	 */
368
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
368
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
369 369
 		// if redirecting, we don't need any anything else
370
-		if ( $external_url ) {
371
-			EE_Registry::instance()->load_helper( 'URL' );
372
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
373
-			$query_args = EEH_URL::get_query_string( $external_url );
374
-			foreach ( $query_args as $query_arg => $value ) {
375
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
370
+		if ($external_url) {
371
+			EE_Registry::instance()->load_helper('URL');
372
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
373
+			$query_args = EEH_URL::get_query_string($external_url);
374
+			foreach ($query_args as $query_arg => $value) {
375
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
376 376
 			}
377 377
 			return $html;
378 378
 		}
379
-		EE_Registry::instance()->load_helper( 'Event_View' );
380
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
381
-		if ( ! $checkout_url ) {
382
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
379
+		EE_Registry::instance()->load_helper('Event_View');
380
+		$checkout_url = EEH_Event_View::event_link_url($ID);
381
+		if ( ! $checkout_url) {
382
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
383 383
 		}
384 384
 		EED_Ticket_Selector::set_event();
385 385
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
386
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
387
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
386
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
387
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
388 388
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
389
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
389
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
390 390
 		return $html;
391 391
 	}
392 392
 
@@ -401,16 +401,16 @@  discard block
 block discarded – undo
401 401
 	 * 	@return		string
402 402
 	 */
403 403
 	public static function display_ticket_selector_submit() {
404
-		if ( ! is_admin() ) {
405
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
404
+		if ( ! is_admin()) {
405
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
406 406
 				$btn_text = apply_filters(
407 407
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
408
-					__('Register Now', 'event_espresso' ),
408
+					__('Register Now', 'event_espresso'),
409 409
 					self::$_event
410 410
 				);
411
-				return '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn ticket-selector-submit-ajax" type="submit" value="' . $btn_text . '" /><div class="clear"><br/></div></form>';
412
-			} else if ( is_archive() ) {
413
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
411
+				return '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn ticket-selector-submit-ajax" type="submit" value="'.$btn_text.'" /><div class="clear"><br/></div></form>';
412
+			} else if (is_archive()) {
413
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
414 414
 			}
415 415
 		}
416 416
 		return '';
@@ -442,12 +442,12 @@  discard block
 block discarded – undo
442 442
 	 * 	@return		string
443 443
 	 */
444 444
 	public static function display_view_details_btn() {
445
-		if ( ! self::$_event->get_permalink() ) {
446
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
445
+		if ( ! self::$_event->get_permalink()) {
446
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
447 447
 		}
448
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
449
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
450
-		$view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />';
448
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
449
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
450
+		$view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />';
451 451
 		$view_details_btn .= '<div class="clear"><br/></div>';
452 452
 		$view_details_btn .= '</form>';
453 453
 		return $view_details_btn;
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 	 * 	@return		array  or FALSE
467 467
 	 */
468 468
 	public function process_ticket_selections() {
469
-		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
469
+		do_action('EED_Ticket_Selector__process_ticket_selections__before');
470 470
 		// check nonce
471
-		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
471
+		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) {
472 472
 			EE_Error::add_error(
473
-				sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
473
+				sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
474 474
 				__FILE__, __FUNCTION__, __LINE__
475 475
 			);
476 476
 			return FALSE;
@@ -484,58 +484,58 @@  discard block
 block discarded – undo
484 484
 
485 485
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
486 486
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
487
-		EE_Registry::instance()->load_core( 'Session' );
487
+		EE_Registry::instance()->load_core('Session');
488 488
 		// unless otherwise requested, clear the session
489
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
490
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
489
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
490
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
491 491
 		}
492 492
 		//d( EE_Registry::instance()->SSN );
493 493
 
494
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
494
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
495 495
 		// do we have an event id?
496
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
496
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
497 497
 			// validate/sanitize data
498 498
 			$valid = self::_validate_post_data('add_event_to_cart');
499 499
 			// d( $valid );
500 500
 
501 501
 			//check total tickets ordered vs max number of attendees that can register
502
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
502
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
503 503
 
504 504
 				// ordering too many tickets !!!
505 505
 				$singular = 'You have attempted to purchase %s ticket.';
506 506
 				$plural = 'You have attempted to purchase %s tickets.';
507
-				$limit_error_1 = sprintf( _n( $singular, $plural, $valid['total_tickets'], 'event_espresso' ), $valid['total_tickets'], $valid['total_tickets'] );
507
+				$limit_error_1 = sprintf(_n($singular, $plural, $valid['total_tickets'], 'event_espresso'), $valid['total_tickets'], $valid['total_tickets']);
508 508
 				// dev only message
509 509
 				$singular = 'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.';
510 510
 				$plural = 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.';
511
-				$limit_error_2 = sprintf( _n( $singular, $plural, $valid['max_atndz'], 'event_espresso' ), $valid['max_atndz'], $valid['max_atndz'] );
512
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
511
+				$limit_error_2 = sprintf(_n($singular, $plural, $valid['max_atndz'], 'event_espresso'), $valid['max_atndz'], $valid['max_atndz']);
512
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
513 513
 			} else {
514 514
 
515 515
 				// all data appears to be valid
516 516
 				$tckts_slctd = FALSE;
517 517
 				$success = TRUE;
518 518
 				// load cart
519
-				EE_Registry::instance()->load_core( 'Cart' );
519
+				EE_Registry::instance()->load_core('Cart');
520 520
 
521 521
 				// cycle thru the number of data rows sent from the event listing
522
-				for ( $x = 0; $x < $valid['rows']; $x++ ) {
522
+				for ($x = 0; $x < $valid['rows']; $x++) {
523 523
 					// does this row actually contain a ticket quantity?
524
-					if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
524
+					if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
525 525
 						// YES we have a ticket quantity
526 526
 						$tckts_slctd = TRUE;
527 527
 						//						d( $valid['ticket_obj'][$x] );
528
-						if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
528
+						if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
529 529
 							// then add ticket to cart
530
-							$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
530
+							$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
531 531
 							$success = ! $ticket_added ? FALSE : $success;
532
-							if ( EE_Error::has_error() ) {
532
+							if (EE_Error::has_error()) {
533 533
 								break;
534 534
 							}
535 535
 						} else {
536 536
 							// nothing added to cart retrieved
537 537
 							EE_Error::add_error(
538
-								sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
538
+								sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
539 539
 								__FILE__, __FUNCTION__, __LINE__
540 540
 							);
541 541
 						}
@@ -544,44 +544,44 @@  discard block
 block discarded – undo
544 544
 //				d( EE_Registry::instance()->CART );
545 545
 //				die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
546 546
 
547
-				if ( $tckts_slctd ) {
548
-					if ( $success ) {
549
-						do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
547
+				if ($tckts_slctd) {
548
+					if ($success) {
549
+						do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
550 550
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
551
-						EE_Registry::instance()->CART->save_cart( FALSE );
551
+						EE_Registry::instance()->CART->save_cart(FALSE);
552 552
 						EE_Registry::instance()->SSN->update();
553 553
 //						d( EE_Registry::instance()->CART );
554 554
 //						die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
555 555
 						// just return TRUE for registrations being made from admin
556
-						if ( is_admin() ) {
556
+						if (is_admin()) {
557 557
 							return TRUE;
558 558
 						}
559
-						wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
559
+						wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
560 560
 						exit();
561 561
 
562 562
 					} else {
563
-						if ( ! EE_Error::has_error() ) {
563
+						if ( ! EE_Error::has_error()) {
564 564
 							// nothing added to cart
565
-							EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
565
+							EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
566 566
 						}
567 567
 					}
568 568
 
569 569
 				} else {
570 570
 					// no ticket quantities were selected
571
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
571
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
572 572
 				}
573 573
 			}
574 574
 			// at this point, just return if registration is being made from admin
575
-			if ( is_admin() ) {
575
+			if (is_admin()) {
576 576
 				return FALSE;
577 577
 			}
578
-			if ( $valid['return_url'] ) {
579
-				EE_Error::get_notices( FALSE, TRUE );
580
-				wp_safe_redirect( $valid['return_url'] );
578
+			if ($valid['return_url']) {
579
+				EE_Error::get_notices(FALSE, TRUE);
580
+				wp_safe_redirect($valid['return_url']);
581 581
 				exit();
582
-			} elseif ( isset( $event_to_add['id'] )) {
583
-				EE_Error::get_notices( FALSE, TRUE );
584
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
582
+			} elseif (isset($event_to_add['id'])) {
583
+				EE_Error::get_notices(FALSE, TRUE);
584
+				wp_safe_redirect(get_permalink($event_to_add['id']));
585 585
 				exit();
586 586
 			} else {
587 587
 				echo EE_Error::get_notices();
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 		} else {
591 591
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
592 592
 			EE_Error::add_error(
593
-				sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
593
+				sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
594 594
 				__FILE__, __FUNCTION__, __LINE__
595 595
 			);
596 596
 		}
@@ -608,18 +608,18 @@  discard block
 block discarded – undo
608 608
 	 * @return        array  or FALSE
609 609
 	 */
610 610
 	private static function _validate_post_data() {
611
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
611
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
612 612
 
613 613
 		// start with an empty array()
614 614
 		$valid_data = array();
615 615
 		//		d( $_POST );
616 616
 		//if event id is valid
617
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
618
-		if ( $id ) {
617
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
618
+		if ($id) {
619 619
 			// grab valid id
620 620
 			$valid_data['id'] = $id;
621 621
 			// grab and sanitize return-url
622
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
622
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
623 623
 			// array of other form names
624 624
 			$inputs_to_clean = array(
625 625
 				'event_id' => 'tkt-slctr-event-id',
@@ -632,22 +632,22 @@  discard block
 block discarded – undo
632 632
 			// let's track the total number of tickets ordered.'
633 633
 			$valid_data['total_tickets'] = 0;
634 634
 			// cycle through $inputs_to_clean array
635
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
635
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
636 636
 				// check for POST data
637
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
637
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
638 638
 					// grab value
639
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
639
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
640 640
 					switch ($what) {
641 641
 
642 642
 						// integers
643 643
 						case 'event_id':
644
-							$valid_data[$what] = absint( $input_value );
644
+							$valid_data[$what] = absint($input_value);
645 645
 							// get event via the event id we put in the form
646
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
646
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
647 647
 							break;
648 648
 						case 'rows':
649 649
 						case 'max_atndz':
650
-							$valid_data[$what] = absint( $input_value );
650
+							$valid_data[$what] = absint($input_value);
651 651
 							break;
652 652
 
653 653
 						// arrays of integers
@@ -655,27 +655,27 @@  discard block
 block discarded – undo
655 655
 							//							d( $input_value );
656 656
 							$row_qty = $input_value;
657 657
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
658
-							if( ! is_array( $row_qty )) {
658
+							if ( ! is_array($row_qty)) {
659 659
 								// get number of rows
660
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
660
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
661 661
 								//								d( $rows );
662 662
 								// explode ints by the dash
663
-								$row_qty = explode( '-', $row_qty );
664
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
665
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
666
-								$row_qty = array( $row => $qty );
663
+								$row_qty = explode('-', $row_qty);
664
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
665
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
666
+								$row_qty = array($row => $qty);
667 667
 								//								 d( $row_qty );
668
-								for( $x = 1; $x <= $rows; $x++ ) {
669
-									if ( ! isset( $row_qty[$x] )) {
668
+								for ($x = 1; $x <= $rows; $x++) {
669
+									if ( ! isset($row_qty[$x])) {
670 670
 										$row_qty[$x] = 0;
671 671
 									}
672 672
 								}
673 673
 							}
674
-							ksort( $row_qty );
674
+							ksort($row_qty);
675 675
 							//							 d( $row_qty );
676 676
 							// cycle thru values
677
-							foreach ( $row_qty as $qty ) {
678
-								$qty = absint( $qty );
677
+							foreach ($row_qty as $qty) {
678
+								$qty = absint($qty);
679 679
 								// sanitize as integers
680 680
 								$valid_data[$what][] = $qty;
681 681
 								$valid_data['total_tickets'] += $qty;
@@ -686,19 +686,19 @@  discard block
 block discarded – undo
686 686
 						case 'ticket_id':
687 687
 							$value_array = array();
688 688
 							// cycle thru values
689
-							foreach ( $input_value as $key=>$value ) {
689
+							foreach ($input_value as $key=>$value) {
690 690
 								// allow only numbers, letters,  spaces, commas and dashes
691
-								$value_array[ $key ] = wp_strip_all_tags( $value );
691
+								$value_array[$key] = wp_strip_all_tags($value);
692 692
 								// get ticket via the ticket id we put in the form
693
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
694
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
693
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
694
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
695 695
 							}
696
-							$valid_data[ $what ] = $value_array;
696
+							$valid_data[$what] = $value_array;
697 697
 							break;
698 698
 
699 699
 						case 'return_url' :
700 700
 							// grab and sanitize return-url
701
-							$valid_data[$what] = esc_url_raw( $input_value );
701
+							$valid_data[$what] = esc_url_raw($input_value);
702 702
 							break;
703 703
 
704 704
 					} 	// end switch $what
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 			} 	// end foreach $inputs_to_clean
707 707
 
708 708
 		} else {
709
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
709
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
710 710
 			return FALSE;
711 711
 		}
712 712
 
@@ -724,28 +724,28 @@  discard block
 block discarded – undo
724 724
 	 * @param int       $qty
725 725
 	 * @return TRUE on success, FALSE on fail
726 726
 	 */
727
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
728
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
727
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
728
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
729 729
 		// get the number of spaces left for this datetime ticket
730
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
730
+		$available_spaces = self::_ticket_datetime_availability($ticket);
731 731
 		// compare available spaces against the number of tickets being purchased
732
-		if ( $available_spaces >= $qty ) {
732
+		if ($available_spaces >= $qty) {
733 733
 			// allow addons to prevent a ticket from being added to cart
734
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
734
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
735 735
 				return false;
736 736
 			}
737 737
 			// add event to cart
738
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
739
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
738
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
739
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
740 740
 				return true;
741 741
 			} else {
742 742
 				return false;
743 743
 			}
744 744
 		} else {
745 745
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
746
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
746
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
747 747
 			// greedy greedy greedy eh?
748
-			if ( $available_spaces > 0 ) {
748
+			if ($available_spaces > 0) {
749 749
 				// add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces
750 750
 				EE_Error::add_error(
751 751
 					sprintf(
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 					__FILE__, __FUNCTION__, __LINE__
762 762
 				);
763 763
 			} else {
764
-				EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
764
+				EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
765 765
 			}
766 766
 			return false;
767 767
 		}
@@ -779,22 +779,22 @@  discard block
 block discarded – undo
779 779
 	 * @param 	bool         $get_original_ticket_spaces
780 780
 	 * @return 	int
781 781
 	 */
782
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
782
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
783 783
 		// if the $_available_spaces array has not been set up yet...
784
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
785
-				self::_set_initial_ticket_datetime_availability( $ticket );
784
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
785
+				self::_set_initial_ticket_datetime_availability($ticket);
786 786
 		}
787 787
 		$available_spaces = $ticket->qty() - $ticket->sold();
788
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
788
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
789 789
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
790
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
790
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
791 791
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
792
-				if ( $get_original_ticket_spaces ) {
792
+				if ($get_original_ticket_spaces) {
793 793
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
794
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
794
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
795 795
 				} else {
796 796
 					// we want the updated ticket availability as stored in the "datetimes" array
797
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
797
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
798 798
 				}
799 799
 			}
800 800
 		}
@@ -810,23 +810,23 @@  discard block
 block discarded – undo
810 810
 	 * @param 	EE_Ticket $ticket
811 811
 	 * @return 	int
812 812
 	 */
813
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
813
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
814 814
 		// first, get all of the datetimes that are available to this ticket
815 815
 		$datetimes = $ticket->get_many_related(
816 816
 			'Datetime',
817
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
817
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
818 818
 		);
819
-		if ( ! empty( $datetimes )) {
819
+		if ( ! empty($datetimes)) {
820 820
 			// now loop thru all of the datetimes
821
-			foreach ( $datetimes as $datetime  ) {
822
-				if ( $datetime instanceof EE_Datetime ) {
821
+			foreach ($datetimes as $datetime) {
822
+				if ($datetime instanceof EE_Datetime) {
823 823
 					// the number of spaces available for the datetime without considering individual ticket quantities
824 824
 					$spaces_remaining = $datetime->spaces_remaining();
825 825
 					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
826
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
826
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
827 827
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
828 828
 					// else just take the datetime spaces remaining, and assign to the datetimes array
829
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
829
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
830 830
 				}
831 831
 			}
832 832
 		}
@@ -842,12 +842,12 @@  discard block
 block discarded – undo
842 842
 	 * @param 	int   $qty
843 843
 	 * @return 	int
844 844
 	 */
845
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
846
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
845
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
846
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
847 847
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
848
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
848
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
849 849
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
850
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
850
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
851 851
 			}
852 852
 		}
853 853
 	}
@@ -864,8 +864,8 @@  discard block
 block discarded – undo
864 864
 	*/
865 865
 	public static function load_tckt_slctr_assets() {
866 866
 		// add some style
867
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
868
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
867
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
868
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
869 869
 			wp_enqueue_style('ticket_selector');
870 870
 			// make it dance
871 871
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -879,9 +879,9 @@  discard block
 block discarded – undo
879 879
 
880 880
 	public static function load_tckt_slctr_assets_admin() {
881 881
 		//iframe button js on admin event editor page
882
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
883
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
884
-			wp_enqueue_script( 'ticket_selector_embed' );
882
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
883
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
884
+			wp_enqueue_script('ticket_selector_embed');
885 885
 		}
886 886
 	}
887 887
 
Please login to merge, or discard this patch.