Completed
Branch BUG-9647-cpt-queries (303307)
by
unknown
201:19 queued 184:10
created
core/helpers/EEH_Venue_View.helper.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
 	 * @param bool $password_check
46 46
 	 * @return \EE_Venue|null
47 47
 	 */
48
-	public static function get_venue( $VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true, $password_check = true ) {
49
-		$VNU_ID = absint( $VNU_ID );
48
+	public static function get_venue($VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true, $password_check = true) {
49
+		$VNU_ID = absint($VNU_ID);
50 50
 		// do we already have the Venue you are looking for?
51
-		if ( EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID ) {
52
-			return EEH_Venue_View::_get_venue( $privacy_check );
51
+		if (EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID) {
52
+			return EEH_Venue_View::_get_venue($privacy_check);
53 53
 		}
54 54
 		// international newspaper?
55 55
 		global $post;
56
-		if ( $post instanceof WP_Post ) {
57
-			switch ( $post->post_type ) {
56
+		if ($post instanceof WP_Post) {
57
+			switch ($post->post_type) {
58 58
 				// if this is being called from an EE_Venue post,
59 59
 				// and the EE_Venue post corresponds to the EE_Venue that is being asked for,
60 60
 				// then we can try to just grab the attached EE_Venue object
@@ -62,31 +62,31 @@  discard block
 block discarded – undo
62 62
 					// the post already contains the related EE_Venue object AND one of the following is TRUE:
63 63
 					// the requested Venue ID matches the post ID OR...
64 64
 					// there was no specific Venue ID requested
65
-					if ( isset( $post->EE_Venue ) && ( $VNU_ID == $post->ID || ! $VNU_ID )) {
65
+					if (isset($post->EE_Venue) && ($VNU_ID == $post->ID || ! $VNU_ID)) {
66 66
 						// use existing related EE_Venue object
67
-						EEH_Venue_View::$_venue =  $post->EE_Venue;
68
-					} else if ( $VNU_ID ) {
67
+						EEH_Venue_View::$_venue = $post->EE_Venue;
68
+					} else if ($VNU_ID) {
69 69
 						// there WAS a specific Venue ID requested, but it's NOT the current post object
70
-						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
70
+						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
71 71
 					} else {
72 72
 						// no specific Venue ID requested, so use post ID to generate EE_Venue object
73
-						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $post->ID );
73
+						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($post->ID);
74 74
 					}
75 75
 				break;
76 76
 
77 77
 				case 'espresso_events':
78
-					if ( $look_in_event ) {
78
+					if ($look_in_event) {
79 79
 						// grab the events related venues
80 80
 						$venues = EEH_Venue_View::get_event_venues();
81 81
 						// make sure the result is an array
82
-						$venues = is_array( $venues ) ? $venues : array();
82
+						$venues = is_array($venues) ? $venues : array();
83 83
 						// do we have an ID for a specific venue?
84
-						if ( $VNU_ID ) {
84
+						if ($VNU_ID) {
85 85
 							// loop thru the related venues
86
-							foreach( $venues as $venue ) {
87
-								if ( $venue instanceof EE_Venue ) {
86
+							foreach ($venues as $venue) {
87
+								if ($venue instanceof EE_Venue) {
88 88
 									// until we find the venue we're looking for
89
-									if ( $venue->ID() == $VNU_ID ) {
89
+									if ($venue->ID() == $VNU_ID) {
90 90
 										EEH_Venue_View::$_venue = $venue;
91 91
 										break;
92 92
 									}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 							// then the global post is an events post and this function was called with no argument
99 99
 						} else {
100 100
 							// just grab the first related event venue
101
-							EEH_Venue_View::$_venue = reset( $venues );
101
+							EEH_Venue_View::$_venue = reset($venues);
102 102
 						}
103 103
 					}
104 104
 				break;
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 			}
107 107
 		}
108 108
 		// now if we STILL do NOT have an EE_Venue model object, BUT we have a Venue ID...
109
-		if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID ) {
109
+		if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID) {
110 110
 			// sigh... pull it from the db
111
-			EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
111
+			EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
112 112
 		}
113
-		return EEH_Venue_View::_get_venue( $privacy_check, $password_check );
113
+		return EEH_Venue_View::_get_venue($privacy_check, $password_check);
114 114
 	}
115 115
 
116 116
 
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
 	 * @param bool $password_check
124 124
 	 * @return 	EE_Venue
125 125
 	 */
126
-	protected static function _get_venue( $privacy_check = true, $password_check = true ) {
126
+	protected static function _get_venue($privacy_check = true, $password_check = true) {
127 127
 		// check for private venues.
128 128
 		if (
129 129
 			EEH_Venue_View::$_venue instanceof EE_Venue
130 130
 			&& EEH_Venue_View::$_venue->status() == 'private'
131 131
 			&& $privacy_check
132
-			&& ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' )
132
+			&& ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')
133 133
 		) {
134 134
 			return null;
135 135
 		}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		if (
138 138
 			EEH_Venue_View::$_venue instanceof EE_Venue
139 139
 			&& $password_check
140
-			&& post_password_required( EEH_Venue_View::$_venue->ID() )
140
+			&& post_password_required(EEH_Venue_View::$_venue->ID())
141 141
 		) {
142 142
 			return null;
143 143
 		}
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public static function get_event_venues() {
156 156
 		global $post;
157
-		if ( $post->post_type == 'espresso_events' ) {
158
-			if ( isset( $post->EE_Event ) && $post->EE_Event instanceof EE_Event ) {
157
+		if ($post->post_type == 'espresso_events') {
158
+			if (isset($post->EE_Event) && $post->EE_Event instanceof EE_Event) {
159 159
 				return $post->EE_Event->venues();
160 160
 			}
161 161
 		}
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @return bool|null
177 177
 	 */
178
-	public static function is_venue_private( $VNU_ID = false ) {
179
-		$venue = EEH_Venue_View::get_venue( $VNU_ID, true, true );
180
-		if ( ! $venue instanceof EE_Venue ) {
178
+	public static function is_venue_private($VNU_ID = false) {
179
+		$venue = EEH_Venue_View::get_venue($VNU_ID, true, true);
180
+		if ( ! $venue instanceof EE_Venue) {
181 181
 			return null;
182 182
 		}
183 183
 
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 	 * @param bool $VNU_ID venue to check (optional). If not included will use internally derived venue object.
193 193
 	 * @return bool
194 194
 	 */
195
-	public static function is_venue_password_protected( $VNU_ID = false ) {
196
-		$venue = EEH_Venue_View::get_venue( $VNU_ID, true, true, false );
195
+	public static function is_venue_password_protected($VNU_ID = false) {
196
+		$venue = EEH_Venue_View::get_venue($VNU_ID, true, true, false);
197 197
 		if (
198 198
 			$venue instanceof EE_Venue
199
-			&& post_password_required( $venue->ID() )
199
+			&& post_password_required($venue->ID())
200 200
 		) {
201 201
 			return true;
202 202
 		}
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 	 *
214 214
 	 * @return string
215 215
 	 */
216
-	public static function password_protected_venue_form( $VNU_ID = false ) {
217
-		$venue = EEH_Venue_View::get_venue( $VNU_ID, true, true, false );
216
+	public static function password_protected_venue_form($VNU_ID = false) {
217
+		$venue = EEH_Venue_View::get_venue($VNU_ID, true, true, false);
218 218
 		if (
219 219
 			$venue instanceof EE_Venue
220
-			&& post_password_required( $venue->ID() )
220
+			&& post_password_required($venue->ID())
221 221
 		) {
222
-			return get_the_password_form( $venue->ID() );
222
+			return get_the_password_form($venue->ID());
223 223
 		}
224 224
 		return '';
225 225
 	}
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
 	 * @param int $VNU_ID
234 234
 	 * @return string
235 235
 	 */
236
-	public static function venue_description( $VNU_ID = 0 ) {
237
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
238
-		if ( $venue instanceof EE_Venue ) {
236
+	public static function venue_description($VNU_ID = 0) {
237
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
238
+		if ($venue instanceof EE_Venue) {
239 239
 			return$venue->description();
240 240
 		}
241 241
 		return '';
@@ -250,12 +250,12 @@  discard block
 block discarded – undo
250 250
 	 * @param int $VNU_ID
251 251
 	 * @return string
252 252
 	 */
253
-	public static function venue_excerpt( $VNU_ID = 0 ) {
254
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
255
-		if ( $venue instanceof EE_Venue ) {
253
+	public static function venue_excerpt($VNU_ID = 0) {
254
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
255
+		if ($venue instanceof EE_Venue) {
256 256
 			$excerpt = $venue->excerpt() != NULL && $venue->excerpt() ? $venue->excerpt() : $venue->description();
257
-			$venue_link = ' ' . EEH_Venue_View::venue_details_link( $venue->ID(), __( 'more', 'event_espresso' ) . '…' );
258
-			return ! empty( $excerpt ) ? wp_trim_words( $excerpt, 25, '' ) . $venue_link : '';
257
+			$venue_link = ' '.EEH_Venue_View::venue_details_link($venue->ID(), __('more', 'event_espresso').'…');
258
+			return ! empty($excerpt) ? wp_trim_words($excerpt, 25, '').$venue_link : '';
259 259
 		}
260 260
 		return '';
261 261
 	}
@@ -270,22 +270,22 @@  discard block
 block discarded – undo
270 270
 	 * @param bool $hide_uncategorized
271 271
 	 * @return string
272 272
 	 */
273
-	public static function venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE ) {
273
+	public static function venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE) {
274 274
 		$category_links = array();
275
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
276
-		if ( $venue instanceof EE_Venue ) {
275
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
276
+		if ($venue instanceof EE_Venue) {
277 277
 			// get category terms
278
-			if ( $venue_categories = get_the_terms( $venue->ID(), 'espresso_venue_categories' )) {
278
+			if ($venue_categories = get_the_terms($venue->ID(), 'espresso_venue_categories')) {
279 279
 				// loop thru terms and create links
280
-				foreach ( $venue_categories as $term ) {
281
-					$url = get_term_link( $term, 'espresso_venue_categories' );
282
-					if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) {
283
-						$category_links[] = '<a href="' . esc_url( $url ) . '" rel="tag">' . $term->name . '</a> ';
280
+				foreach ($venue_categories as $term) {
281
+					$url = get_term_link($term, 'espresso_venue_categories');
282
+					if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) {
283
+						$category_links[] = '<a href="'.esc_url($url).'" rel="tag">'.$term->name.'</a> ';
284 284
 					}
285 285
 				}
286 286
 			}
287 287
 		}
288
-		return implode( ', ', $category_links );
288
+		return implode(', ', $category_links);
289 289
 	}
290 290
 
291 291
 
@@ -300,10 +300,10 @@  discard block
 block discarded – undo
300 300
 	 * @param bool $add_wrapper
301 301
 	 * @return string
302 302
 	 */
303
-	public static function venue_address( $type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true ) {
304
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
305
-		if ( $venue instanceof EE_Venue ) {
306
-			return EEH_Address::format( $venue, $type, $use_schema, $add_wrapper );
303
+	public static function venue_address($type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true) {
304
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
305
+		if ($venue instanceof EE_Venue) {
306
+			return EEH_Address::format($venue, $type, $use_schema, $add_wrapper);
307 307
 		}
308 308
 		return '';
309 309
 	}
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 	 * @param int $VNU_ID
318 318
 	 * @return bool|string
319 319
 	 */
320
-	public static function venue_has_address( $VNU_ID = 0 ) {
321
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
322
-		if ( $venue instanceof EE_Venue ) {
323
-			return EEH_Address::format( $venue, 'inline', FALSE, FALSE );
320
+	public static function venue_has_address($VNU_ID = 0) {
321
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
322
+		if ($venue instanceof EE_Venue) {
323
+			return EEH_Address::format($venue, 'inline', FALSE, FALSE);
324 324
 		}
325 325
 		return false;
326 326
 	}
@@ -335,30 +335,30 @@  discard block
 block discarded – undo
335 335
 	 * @param int $VNU_ID
336 336
 	 * @return string
337 337
 	 */
338
-	public static function venue_name( $link_to = 'details', $VNU_ID = 0 ) {
339
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
340
-		if ( $venue instanceof EE_Venue ) {
338
+	public static function venue_name($link_to = 'details', $VNU_ID = 0) {
339
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
340
+		if ($venue instanceof EE_Venue) {
341 341
 			$venue_name = apply_filters(
342 342
 				'FHEE__EEH_Venue__venue_name__append_private_venue_name',
343 343
 				EEH_Venue_View::is_venue_private()
344
-					? EEH_Venue_View::$_venue->name() . "&nbsp;" . __( '(Private)', 'event_espresso' )
344
+					? EEH_Venue_View::$_venue->name()."&nbsp;".__('(Private)', 'event_espresso')
345 345
 					: EEH_Venue_View::$_venue->name(),
346 346
 				EEH_Venue_View::$_venue
347 347
 			);
348
-			$venue_name = EEH_Schema::name( $venue_name );
348
+			$venue_name = EEH_Schema::name($venue_name);
349 349
 
350 350
 			//if venue is trashed then ignore the "link to" setting because the venue is trashed.
351
-			if ( $venue->get('status') == 'trash' ) {
351
+			if ($venue->get('status') == 'trash') {
352 352
 				$link_to = '';
353 353
 			}
354
-			switch( $link_to ) {
354
+			switch ($link_to) {
355 355
 
356 356
 				case 'details' :
357
-					return EEH_Venue_View::venue_details_link( $venue->ID(), $venue_name );
357
+					return EEH_Venue_View::venue_details_link($venue->ID(), $venue_name);
358 358
 				break;
359 359
 
360 360
 				case 'website' :
361
-					return EEH_Venue_View::venue_website_link( $venue->ID(), $venue_name );
361
+					return EEH_Venue_View::venue_website_link($venue->ID(), $venue_name);
362 362
 				break;
363 363
 
364 364
 				default :
@@ -378,10 +378,10 @@  discard block
 block discarded – undo
378 378
 	 * @param    string $text
379 379
 	 * @return string
380 380
 	 */
381
-	public static function venue_details_link( $VNU_ID = 0, $text = '' ) {
382
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
383
-		if ( $venue instanceof EE_Venue ) {
384
-			return EEH_Schema::url( get_permalink( $venue->ID() ), $text );
381
+	public static function venue_details_link($VNU_ID = 0, $text = '') {
382
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
383
+		if ($venue instanceof EE_Venue) {
384
+			return EEH_Schema::url(get_permalink($venue->ID()), $text);
385 385
 		}
386 386
 		return '';
387 387
 	}
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
 	 * @param    string $text
397 397
 	 * @return string
398 398
 	 */
399
-	public static function venue_website_link( $VNU_ID = 0, $text = '' ) {
400
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
401
-		if ( $venue instanceof EE_Venue ) {
399
+	public static function venue_website_link($VNU_ID = 0, $text = '') {
400
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
401
+		if ($venue instanceof EE_Venue) {
402 402
 			$url = $venue->venue_url();
403
-			$text = ! empty( $text ) ? $text : $url;
404
-			return ! empty( $url ) ? EEH_Schema::url( $url, $text ) : '';
403
+			$text = ! empty($text) ? $text : $url;
404
+			return ! empty($url) ? EEH_Schema::url($url, $text) : '';
405 405
 		}
406 406
 		return '';
407 407
 	}
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
 	 * @param int $VNU_ID
416 416
 	 * @return string
417 417
 	 */
418
-	public static function venue_phone( $VNU_ID = 0) {
419
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
420
-		if ( $venue instanceof EE_Venue ) {
421
-			return EEH_Schema::telephone( $venue->phone() );
418
+	public static function venue_phone($VNU_ID = 0) {
419
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
420
+		if ($venue instanceof EE_Venue) {
421
+			return EEH_Schema::telephone($venue->phone());
422 422
 		}
423 423
 		return '';
424 424
 	}
@@ -434,48 +434,48 @@  discard block
 block discarded – undo
434 434
 	 * @param    array $gmap map options
435 435
 	 * @return string
436 436
 	 */
437
-	public static function venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array() ) {
437
+	public static function venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array()) {
438 438
 
439
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
440
-		if ( $venue instanceof EE_Venue ) {
439
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
440
+		if ($venue instanceof EE_Venue) {
441 441
 			// check for global espresso_events post and use it's ID if no map_ID is set
442 442
 			global $post;
443
-			$map_ID = empty( $map_ID ) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID;
443
+			$map_ID = empty($map_ID) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID;
444 444
 			// grab map settings
445 445
 			$map_cfg = EE_Registry::instance()->CFG->map_settings;
446 446
 			// are maps enabled ?
447
-			if ( $map_cfg->use_google_maps && $venue->enable_for_gmap() ) {
447
+			if ($map_cfg->use_google_maps && $venue->enable_for_gmap()) {
448 448
 
449 449
 				$details_page = is_single();
450 450
 				$options = array();
451
-				$options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID . '-' . $venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/;
451
+				$options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID.'-'.$venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/;
452 452
 
453
-				$options['location'] = EEH_Address::format( $venue, 'inline', FALSE, FALSE );
453
+				$options['location'] = EEH_Address::format($venue, 'inline', FALSE, FALSE);
454 454
 
455 455
 				$options['ee_map_width'] = $details_page ? $map_cfg->event_details_map_width : $map_cfg->event_list_map_width;
456
-				$options['ee_map_width'] = isset( $gmap['ee_map_width'] ) && ! empty( $gmap['ee_map_width'] ) ? $gmap['ee_map_width'] : $options['ee_map_width'];
456
+				$options['ee_map_width'] = isset($gmap['ee_map_width']) && ! empty($gmap['ee_map_width']) ? $gmap['ee_map_width'] : $options['ee_map_width'];
457 457
 
458 458
 				$options['ee_map_height'] = $details_page ? $map_cfg->event_details_map_height : $map_cfg->event_list_map_height;
459
-				$options['ee_map_height'] = isset( $gmap['ee_map_height'] ) && ! empty( $gmap['ee_map_height'] ) ? $gmap['ee_map_height'] : $options['ee_map_height'];
459
+				$options['ee_map_height'] = isset($gmap['ee_map_height']) && ! empty($gmap['ee_map_height']) ? $gmap['ee_map_height'] : $options['ee_map_height'];
460 460
 
461 461
 				$options['ee_map_zoom'] = $details_page ? $map_cfg->event_details_map_zoom : $map_cfg->event_list_map_zoom;
462
-				$options['ee_map_zoom'] = isset( $gmap['ee_map_zoom'] ) && ! empty( $gmap['ee_map_zoom'] ) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom'];
462
+				$options['ee_map_zoom'] = isset($gmap['ee_map_zoom']) && ! empty($gmap['ee_map_zoom']) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom'];
463 463
 
464 464
 				$options['ee_map_nav_display'] = $details_page ? $map_cfg->event_details_display_nav : $map_cfg->event_list_display_nav;
465
-				$options['ee_map_nav_display'] = isset( $gmap['ee_map_nav_display'] ) && ! empty( $gmap['ee_map_nav_display'] ) ? 'true' : $options['ee_map_nav_display'];;
465
+				$options['ee_map_nav_display'] = isset($gmap['ee_map_nav_display']) && ! empty($gmap['ee_map_nav_display']) ? 'true' : $options['ee_map_nav_display']; ;
466 466
 
467 467
 				$options['ee_map_nav_size'] = $details_page ? $map_cfg->event_details_nav_size : $map_cfg->event_list_nav_size;
468
-				$options['ee_map_nav_size'] =  isset( $gmap['ee_map_nav_size'] ) && ! empty( $gmap['ee_map_nav_size'] )? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size'];
468
+				$options['ee_map_nav_size'] = isset($gmap['ee_map_nav_size']) && ! empty($gmap['ee_map_nav_size']) ? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size'];
469 469
 
470 470
 				$options['ee_map_type_control'] = $details_page ? $map_cfg->event_details_control_type : $map_cfg->event_list_control_type;
471
-				$options['ee_map_type_control'] =  isset( $gmap['ee_map_type_control'] ) && ! empty( $gmap['ee_map_type_control'] )? $gmap['ee_map_type_control'] : $options['ee_map_type_control'];
471
+				$options['ee_map_type_control'] = isset($gmap['ee_map_type_control']) && ! empty($gmap['ee_map_type_control']) ? $gmap['ee_map_type_control'] : $options['ee_map_type_control'];
472 472
 
473 473
 				$options['ee_map_align'] = $details_page ? $map_cfg->event_details_map_align : $map_cfg->event_list_map_align;
474
-				$options['ee_map_align'] =  isset( $gmap['ee_map_align'] ) && ! empty( $gmap['ee_map_align'] )? $gmap['ee_map_align'] : $options['ee_map_align'];
474
+				$options['ee_map_align'] = isset($gmap['ee_map_align']) && ! empty($gmap['ee_map_align']) ? $gmap['ee_map_align'] : $options['ee_map_align'];
475 475
 
476
-				$options['ee_static_url'] =  isset( $gmap['ee_static_url'] ) && ! empty( $gmap['ee_static_url'] ) ? (bool)absint( $gmap['ee_static_url'] ) : $venue->google_map_link();
476
+				$options['ee_static_url'] = isset($gmap['ee_static_url']) && ! empty($gmap['ee_static_url']) ? (bool) absint($gmap['ee_static_url']) : $venue->google_map_link();
477 477
 
478
-				return EEH_Maps::google_map( $options );
478
+				return EEH_Maps::google_map($options);
479 479
 
480 480
 			}
481 481
 		}
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	 * @param array $atts like EEH_Maps::google_map_link
491 491
 	 * @return string
492 492
 	 */
493
-	public static function espresso_google_static_map( EE_Venue $venue, $atts = array() ){
493
+	public static function espresso_google_static_map(EE_Venue $venue, $atts = array()) {
494 494
 		$state = $venue->state_obj();
495 495
 		$country = $venue->country_obj();
496 496
 		$atts = shortcode_atts(
@@ -521,23 +521,23 @@  discard block
 block discarded – undo
521 521
 	 * @param string $after
522 522
 	 * @return string
523 523
 	 */
524
-	public static function edit_venue_link( $VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>' ) {
525
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
526
-		if ( $venue instanceof EE_Venue ) {
524
+	public static function edit_venue_link($VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>') {
525
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
526
+		if ($venue instanceof EE_Venue) {
527 527
 			// can the user edit this post ?
528
-			if ( current_user_can( 'edit_post', $venue->ID() )) {
528
+			if (current_user_can('edit_post', $venue->ID())) {
529 529
 				// set link text
530
-				$link = ! empty( $link ) ? $link : __('edit this venue');
530
+				$link = ! empty($link) ? $link : __('edit this venue');
531 531
 				// generate nonce
532
-				$nonce = wp_create_nonce( 'edit_nonce' );
532
+				$nonce = wp_create_nonce('edit_nonce');
533 533
 				// generate url to venue editor for this venue
534
-				$url = add_query_arg( array( 'page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce ), admin_url( 'admin.php' ) );
534
+				$url = add_query_arg(array('page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce), admin_url('admin.php'));
535 535
 				// get edit CPT text
536
-				$post_type_obj = get_post_type_object( 'espresso_venues' );
536
+				$post_type_obj = get_post_type_object('espresso_venues');
537 537
 				// build final link html
538
-				$link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>';
538
+				$link = '<a class="post-edit-link" href="'.$url.'" title="'.esc_attr($post_type_obj->labels->edit_item).'">'.$link.'</a>';
539 539
 				// put it all together
540
-				return $before . apply_filters( 'edit_post_link', $link, $venue->ID() ) . $after;
540
+				return $before.apply_filters('edit_post_link', $link, $venue->ID()).$after;
541 541
 			}
542 542
 		}
543 543
 		return '';
Please login to merge, or discard this patch.
modules/venue_single/EED_Venue_Single.module.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @return EED_Venue_Single
28 28
 	 */
29 29
 	public static function instance() {
30
-		return parent::get_instance( __CLASS__ );
30
+		return parent::get_instance(__CLASS__);
31 31
 	}
32 32
 
33 33
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 *  @return 	void
38 38
 	 */
39 39
 	public static function set_hooks() {
40
-		EE_Config::register_route( 'venue', 'Venue_Single', 'run' );
40
+		EE_Config::register_route('venue', 'Venue_Single', 'run');
41 41
 //		EE_Config::register_view( 'venue', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'single-espresso_venues.php' );
42 42
 	}
43 43
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 * @access    public
59 59
 	 * @param \WP $WP
60 60
 	 */
61
-	public function run( $WP ) {
61
+	public function run($WP) {
62 62
 		// check what template is loaded
63
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
64
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
63
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
64
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
65 65
 	}
66 66
 
67 67
 
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 	 * @param  string $template
74 74
 	 * @return string
75 75
 	 */
76
-	public function template_include( $template ) {
76
+	public function template_include($template) {
77 77
 		// not a custom template?
78
-		if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_venues.php' ) {
78
+		if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_venues.php') {
79 79
 			EEH_Template::load_espresso_theme_functions();
80 80
 			// then add extra event data via hooks
81
-			add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 );
82
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
81
+			add_filter('the_title', array($this, 'the_title'), 100, 1);
82
+			add_filter('the_content', array($this, 'venue_details'), 100);
83 83
 			// don't display entry meta because the existing theme will take car of that
84
-			add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' );
84
+			add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
85 85
 		}
86 86
 		return $template;
87 87
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @param  string $title
96 96
 	 * @return string
97 97
 	 */
98
-	public function the_title( $title = '' ) {
98
+	public function the_title($title = '') {
99 99
 		return $title;
100 100
 	}
101 101
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * @param  string $content
108 108
 	 * @return string
109 109
 	 */
110
-	public function venue_details( $content ) {
110
+	public function venue_details($content) {
111 111
 		global $post;
112 112
 		if (
113 113
 			$post->post_type == 'espresso_venues'
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 			// it uses the_content() for displaying the $post->post_content
118 118
 			// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
119 119
 			// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
120
-			remove_filter( 'the_content', array( $this, 'venue_details' ), 100 );
120
+			remove_filter('the_content', array($this, 'venue_details'), 100);
121 121
 			// add filters we want
122
-			add_filter( 'the_content', array( $this, 'venue_location' ), 110 );
122
+			add_filter('the_content', array($this, 'venue_location'), 110);
123 123
 			// now load our template
124
-			$template = EEH_Template::locate_template( 'content-espresso_venues-details.php' );
124
+			$template = EEH_Template::locate_template('content-espresso_venues-details.php');
125 125
 			// remove other filters we added so they won't get applied to the next post
126
-			remove_filter( 'the_content', array( $this, 'venue_location' ), 110 );
126
+			remove_filter('the_content', array($this, 'venue_location'), 110);
127 127
 		}
128 128
 		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
129
-		return ! empty( $template ) ? $template : $content;
129
+		return ! empty($template) ? $template : $content;
130 130
 	}
131 131
 
132 132
 
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 * @param  string $content
139 139
 	 * @return string
140 140
 	 */
141
-	public function venue_location( $content ) {
142
-		return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' );
141
+	public function venue_location($content) {
142
+		return $content.EEH_Template::locate_template('content-espresso_venues-location.php');
143 143
 	}
144 144
 
145 145
 
@@ -152,16 +152,16 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function wp_enqueue_scripts() {
154 154
 		// get some style
155
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) {
155
+		if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) {
156 156
 			// first check theme folder
157
-			if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
158
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
159
-			} else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) {
160
-				wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
157
+			if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
158
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
159
+			} else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) {
160
+				wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
161 161
 			}
162
-			wp_enqueue_style( $this->theme );
163
-			if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) {
164
-				add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 );
162
+			wp_enqueue_style($this->theme);
163
+			if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
164
+				add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
165 165
 			}
166 166
 		}
167 167
 	}
Please login to merge, or discard this patch.
modules/venues_archive/EED_Venues_Archive.module.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @return EED_Venues_Archive
28 28
 	 */
29 29
 	public static function instance() {
30
-		return parent::get_instance( __CLASS__ );
30
+		return parent::get_instance(__CLASS__);
31 31
 	}
32 32
 
33 33
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 *  @return 	void
38 38
 	 */
39 39
 	public static function set_hooks() {
40
-		EE_Config::register_route( 'venues', 'Venues_Archive', 'run' );
40
+		EE_Config::register_route('venues', 'Venues_Archive', 'run');
41 41
 //		EE_Config::register_view( 'venues', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.php' );
42 42
 	}
43 43
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 * @access    public
59 59
 	 * @param \WP $WP
60 60
 	 */
61
-	public function run( $WP ) {
61
+	public function run($WP) {
62 62
 		// check what template is loaded
63
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
64
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
63
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
64
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
65 65
 	}
66 66
 
67 67
 
@@ -73,18 +73,18 @@  discard block
 block discarded – undo
73 73
 	 * @param  string $template
74 74
 	 * @return string
75 75
 	 */
76
-	public function template_include( $template ) {
76
+	public function template_include($template) {
77 77
 		// not a custom template?
78
-		if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'archive-espresso_venues.php' ) {
78
+		if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'archive-espresso_venues.php') {
79 79
 			EEH_Template::load_espresso_theme_functions();
80 80
 			// then add extra event data via hooks
81
-			add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 );
81
+			add_filter('the_title', array($this, 'the_title'), 100, 1);
82 82
 			// don't know if theme uses the_excerpt
83
-			add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
83
+			add_filter('the_excerpt', array($this, 'venue_details'), 100);
84 84
 			// or the_content
85
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
85
+			add_filter('the_content', array($this, 'venue_details'), 100);
86 86
 			// don't display entry meta because the existing theme will take care of that
87
-			add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' );
87
+			add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
88 88
 		}
89 89
 		return $template;
90 90
 	}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @param  string $title
99 99
 	 * @return string
100 100
 	 */
101
-	public function the_title( $title = '' ) {
101
+	public function the_title($title = '') {
102 102
 		return $title;
103 103
 	}
104 104
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param  string $content
111 111
 	 * @return string
112 112
 	 */
113
-	public function venue_details( $content ) {
113
+	public function venue_details($content) {
114 114
 		global $post;
115 115
 		if (
116 116
 			$post->post_type == 'espresso_venues'
@@ -120,22 +120,22 @@  discard block
 block discarded – undo
120 120
 			// it uses the_content() for displaying the $post->post_content
121 121
 			// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
122 122
 			// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
123
-			remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
124
-			remove_filter( 'the_content', array( $this, 'venue_details' ), 100 );
123
+			remove_filter('the_excerpt', array($this, 'venue_details'), 100);
124
+			remove_filter('the_content', array($this, 'venue_details'), 100);
125 125
 			// add filters we want
126
-			add_filter( 'the_content', array( $this, 'venue_location' ), 110 );
127
-			add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 );
126
+			add_filter('the_content', array($this, 'venue_location'), 110);
127
+			add_filter('the_excerpt', array($this, 'venue_location'), 110);
128 128
 			// now load our template
129
-			$template = EEH_Template::locate_template( 'content-espresso_venues-details.php' );
129
+			$template = EEH_Template::locate_template('content-espresso_venues-details.php');
130 130
 			//now add our filter back in, plus some others
131
-			add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
132
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
131
+			add_filter('the_excerpt', array($this, 'venue_details'), 100);
132
+			add_filter('the_content', array($this, 'venue_details'), 100);
133 133
 			// remove other filters we added so they won't get applied to the next post
134
-			remove_filter( 'the_content', array( $this, 'venue_location' ), 110 );
135
-			remove_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 );
134
+			remove_filter('the_content', array($this, 'venue_location'), 110);
135
+			remove_filter('the_excerpt', array($this, 'venue_location'), 110);
136 136
 			// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
137 137
 		}
138
-		return ! empty( $template ) ? $template : $content;
138
+		return ! empty($template) ? $template : $content;
139 139
 	}
140 140
 
141 141
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @param  string $content
148 148
 	 * @return string
149 149
 	 */
150
-	public function venue_location( $content ) {
151
-		return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' );
150
+	public function venue_location($content) {
151
+		return $content.EEH_Template::locate_template('content-espresso_venues-location.php');
152 152
 	}
153 153
 
154 154
 
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function wp_enqueue_scripts() {
164 164
 		// get some style
165
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) {
165
+		if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) {
166 166
 			// first check theme folder
167
-			if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
168
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
169
-			} else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) {
170
-				wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
167
+			if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
168
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
169
+			} else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) {
170
+				wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
171 171
 			}
172
-			wp_enqueue_style( $this->theme );
172
+			wp_enqueue_style($this->theme);
173 173
 		}
174 174
 	}
175 175
 
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 1 patch
Spacing   +544 added lines, -544 removed lines patch added patch discarded remove patch
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Registrations_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
61
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ));
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61
+		add_action('wp_loaded', array($this, 'wp_loaded'));
62 62
 	}
63 63
 
64 64
 
65 65
 
66 66
 	public function wp_loaded() {
67 67
 		// when adding a new registration...
68
-		if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) {
68
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') {
69 69
 			EE_System::do_not_cache();
70 70
 			if (
71
-				! isset( $this->_req_data[ 'processing_registration' ] )
72
-				|| absint( $this->_req_data[ 'processing_registration' ] ) !== 1
71
+				! isset($this->_req_data['processing_registration'])
72
+				|| absint($this->_req_data['processing_registration']) !== 1
73 73
 			) {
74 74
 				// and it's NOT the attendee information reg step
75 75
 				// force cookie expiration by setting time to last week
76
-				setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' );
76
+				setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/');
77 77
 				// and update the global
78
-				$_COOKIE[ 'ee_registration_added' ] = 0;
78
+				$_COOKIE['ee_registration_added'] = 0;
79 79
 			}
80 80
 		}
81 81
 	}
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 				'trash' => 'post.php'
110 110
 			);
111 111
 
112
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
112
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
113 113
 		//add filters so that the comment urls don't take users to a confusing 404 page
114
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
114
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
115 115
 	}
116 116
 
117 117
 
118
-	public function clear_comment_link( $link, $comment, $args ) {
118
+	public function clear_comment_link($link, $comment, $args) {
119 119
 		//gotta make sure this only happens on this route
120
-		$post_type = get_post_type( $comment->comment_post_ID);
121
-		if ( $post_type == 'espresso_attendees' )
120
+		$post_type = get_post_type($comment->comment_post_ID);
121
+		if ($post_type == 'espresso_attendees')
122 122
 			return '#commentsdiv';
123 123
 		return $link;
124 124
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 	protected function _ajax_hooks() {
128 128
 		//todo: all hooks for registrations ajax goes in here
129
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
129
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
130 130
 	}
131 131
 
132 132
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 				'add-attendee' => __('Add Contact', 'event_espresso'),
142 142
 				'edit' => __('Edit Contact', 'event_espresso'),
143 143
 				'report'=>  __("Event Registrations CSV Report", "event_espresso"),
144
-				'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
145
-				'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
144
+				'report_all' => __('All Registrations CSV Report', 'event_espresso'),
145
+				'contact_list_report' => __('Contact List Report', 'event_espresso'),
146 146
 				'contact_list_export'=>  __("Export Data", "event_espresso"),
147 147
 			),
148 148
 			'publishbox' => array(
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$this->_get_registration_status_array();
172 172
 
173
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
174
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
175
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
173
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
174
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
175
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
176 176
 
177 177
 		$this->_page_routes = array(
178 178
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 				'restore_registrations' => array(
207 207
 					'func' => '_trash_or_restore_registrations',
208
-					'args' => array( 'trash' => FALSE ),
208
+					'args' => array('trash' => FALSE),
209 209
 					'noheader' => TRUE,
210 210
 					'capability' => 'ee_delete_registrations'
211 211
 					),
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 						'filename' => 'registrations_overview_other'
439 439
 					)
440 440
                 ),
441
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
441
+				'help_tour' => array('Registration_Overview_Help_Tour'),
442 442
 				'qtips' => array('Registration_List_Table_Tips'),
443 443
 				'list_table' => 'EE_Registrations_List_Table',
444 444
 				'require_nonce' => FALSE
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 				'nav' => array(
449 449
 					'label' => __('REG Details', 'event_espresso'),
450 450
 					'order' => 15,
451
-					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
451
+					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
452 452
 					'persistent' => FALSE
453 453
 				),
454 454
                 'help_tabs' => array(
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 						'filename' => 'registrations_details_registrant_details'
470 470
 					)
471 471
 				),
472
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
473
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
472
+				'help_tour' => array('Registration_Details_Help_Tour'),
473
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
474 474
 				'require_nonce' => FALSE
475 475
 			),
476 476
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 					'order' => 15,
495 495
 					'persistent' => FALSE
496 496
 				),
497
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
497
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
498 498
 				'require_nonce' => FALSE
499 499
 			),
500 500
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 					'label' => __('Edit Contact', 'event_espresso'),
504 504
 					'order' => 15,
505 505
 					'persistent' => FALSE,
506
-					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
506
+					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
507 507
 				),
508 508
 				'metaboxes' => array('attendee_editor_metaboxes'),
509 509
 				'require_nonce' => FALSE
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 						'filename' => 'registrations_contact_list_other'
534 534
 					)
535 535
                 ),
536
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
536
+				'help_tour' => array('Contact_List_Help_Tour'),
537 537
 				'metaboxes' => array(),
538 538
 				'require_nonce' => FALSE
539 539
 			),
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	protected function _add_screen_options() {}
553 553
 	protected function _add_feature_pointers() {}
554 554
 	public function admin_init() {
555
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
555
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
556 556
 	}
557 557
 	public function admin_notices() {}
558 558
 	public function admin_footer_scripts() {}
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 	*		@return void
571 571
 	*/
572 572
 	private function _get_registration_status_array() {
573
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
573
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
574 574
 	}
575 575
 
576 576
 
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
 	public function load_scripts_styles() {
594 594
 		//style
595 595
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
596
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
596
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
597 597
 		wp_enqueue_style('espresso_reg');
598 598
 
599 599
 		//script
600
-		wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
600
+		wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
601 601
 		wp_enqueue_script('espresso_reg');
602 602
 	}
603 603
 
@@ -606,9 +606,9 @@  discard block
 block discarded – undo
606 606
 	public function load_scripts_styles_edit_attendee() {
607 607
 		//stuff to only show up on our attendee edit details page.
608 608
 		$attendee_details_translations = array(
609
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
609
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
610 610
 			);
611
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
611
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
612 612
 		wp_enqueue_script('jquery-validate');
613 613
 	}
614 614
 
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
 		//styles
618 618
 		wp_enqueue_style('espresso-ui-theme');
619 619
 		//scripts
620
-		$this->_get_reg_custom_questions_form( $this->_registration->ID() );
621
-		$this->_reg_custom_questions_form->wp_enqueue_scripts( true );
620
+		$this->_get_reg_custom_questions_form($this->_registration->ID());
621
+		$this->_reg_custom_questions_form->wp_enqueue_scripts(true);
622 622
 	}
623 623
 
624 624
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 
629 629
 	public function load_scripts_styles_contact_list() {
630 630
 		wp_deregister_style('espresso_reg');
631
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
631
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
632 632
 		wp_enqueue_style('espresso_att');
633 633
 	}
634 634
 
@@ -637,9 +637,9 @@  discard block
 block discarded – undo
637 637
 
638 638
 
639 639
 	public function load_scripts_styles_new_registration() {
640
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
640
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
641 641
 		wp_enqueue_script('ee-spco-for-admin');
642
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
642
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
643 643
 		EE_Form_Section_Proper::wp_enqueue_scripts();
644 644
 		EED_Ticket_Selector::load_tckt_slctr_assets();
645 645
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 		//for notification related bulk actions we need to make sure only active messengers have an option.
667 667
 		EED_Messages::set_autoloaders();
668 668
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
669
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
669
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
670 670
 		$active_mts = $message_resource_manager->list_of_active_message_types();
671 671
 		//key= bulk_action_slug, value= message type.
672 672
 		$match_array = array(
@@ -679,23 +679,23 @@  discard block
 block discarded – undo
679 679
 
680 680
 		/** setup reg status bulk actions **/
681 681
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
682
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
682
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
683 683
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
684 684
 		}
685 685
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
686
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
686
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
687 687
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
688 688
 		}
689 689
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
690
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
690
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
691 691
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
692 692
 		}
693 693
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
694
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
694
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
695 695
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
696 696
 		}
697 697
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
698
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
698
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
699 699
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
700 700
 		}
701 701
 
@@ -704,29 +704,29 @@  discard block
 block discarded – undo
704 704
 				'slug' => 'all',
705 705
 				'label' => __('View All Registrations', 'event_espresso'),
706 706
 				'count' => 0,
707
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
707
+				'bulk_action' => array_merge($def_reg_status_actions, array(
708 708
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
709
-					) )
709
+					))
710 710
 				),
711 711
 			'month' => array(
712 712
 				'slug' => 'month',
713 713
 				'label' => __('This Month', 'event_espresso'),
714 714
 				'count' => 0,
715
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
715
+				'bulk_action' => array_merge($def_reg_status_actions, array(
716 716
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
717 717
 					))
718 718
 				),
719 719
 			'today' => array(
720 720
 				'slug' => 'today',
721
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
721
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
722 722
 				'count' => 0,
723
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
723
+				'bulk_action' => array_merge($def_reg_status_actions, array(
724 724
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
725 725
 					))
726 726
 				)
727 727
 			);
728 728
 
729
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
729
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
730 730
 			$this->_views['incomplete'] = array(
731 731
 				'slug' => 'incomplete',
732 732
 				'label' => __('Incomplete', 'event_espresso'),
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 				)
763 763
 			);
764 764
 
765
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
765
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
766 766
 			$this->_views['trash'] = array(
767 767
 				'slug' => 'trash',
768 768
 				'label' => __('Trash', 'event_espresso'),
@@ -801,18 +801,18 @@  discard block
 block discarded – undo
801 801
 				'desc' => __('View Transaction Invoice', 'event_espresso')
802 802
 				),
803 803
  			);
804
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
804
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
805 805
 			$fc_items['resend_registration'] = array(
806 806
 				'class' => 'dashicons dashicons-email-alt',
807 807
 				'desc' => __('Resend Registration Details', 'event_espresso')
808 808
 				);
809 809
 		} else {
810
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
810
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
811 811
 		}
812 812
 
813
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) {
814
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
815
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
813
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) {
814
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
815
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
816 816
 				$fc_items['view_related_messages'] = array(
817 817
 					'class' => $related_for_icon['css_class'],
818 818
 					'desc' => $related_for_icon['label'],
@@ -822,31 +822,31 @@  discard block
 block discarded – undo
822 822
 
823 823
 		$sc_items = array(
824 824
 			'approved_status' => array(
825
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
826
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
825
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
826
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
827 827
 				),
828 828
 			'pending_status' => array(
829
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
830
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
829
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
830
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
831 831
 				),
832 832
 			'incomplete_status' => array(
833
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
834
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
833
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
834
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
835 835
 			),
836 836
 			'not_approved' => array(
837
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
838
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
837
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
838
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
839 839
 				),
840 840
 			'declined_status' => array(
841
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
842
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
841
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
842
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
843 843
 				),
844 844
 			'cancelled_status' => array(
845
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
846
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
845
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
846
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
847 847
 				)
848 848
 			);
849
-		return array_merge( $fc_items, $sc_items );
849
+		return array_merge($fc_items, $sc_items);
850 850
 	}
851 851
 
852 852
 
@@ -859,15 +859,15 @@  discard block
 block discarded – undo
859 859
 
860 860
 
861 861
 	protected function _registrations_overview_list_table() {
862
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
863
-		if ( $EVT_ID ) {
864
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) {
865
-				$this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' );
862
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
863
+		if ($EVT_ID) {
864
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) {
865
+				$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2');
866 866
 			}
867
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
868
-			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : '';
867
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
868
+			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : '';
869 869
 		}
870
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
870
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
871 871
 		$this->display_admin_list_table_page_with_no_sidebar();
872 872
 	}
873 873
 
@@ -882,19 +882,19 @@  discard block
 block discarded – undo
882 882
 	 */
883 883
 	private function _set_registration_object() {
884 884
 		//get out if we've already set the object
885
-		if ( is_object( $this->_registration )) {
885
+		if (is_object($this->_registration)) {
886 886
 			return TRUE;
887 887
 		}
888 888
 
889 889
 	    $REG = EEM_Registration::instance();
890 890
 
891
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
891
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
892 892
 
893
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
893
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
894 894
 			return TRUE;
895 895
 		else {
896
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
897
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
896
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
897
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
898 898
 			$this->_registration = NULL;
899 899
 			return FALSE;
900 900
 		}
@@ -912,24 +912,24 @@  discard block
 block discarded – undo
912 912
 	 * @throws \EE_Error
913 913
 	 * @return mixed (int|array)  int = count || array of registration objects
914 914
 	 */
915
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
916
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
917
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
918
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
919
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
920
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
921
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
915
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
916
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
917
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
918
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
919
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
920
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
921
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE;
922 922
 		$start_date = FALSE;
923 923
 		$end_date = FALSE;
924 924
 		$_where = array();
925
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
926
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
925
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
926
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
927 927
 
928 928
 		//set orderby
929 929
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
930 930
 
931 931
 
932
-		switch ( $this->_req_data['orderby'] ) {
932
+		switch ($this->_req_data['orderby']) {
933 933
 			case '_REG_ID':
934 934
 				$orderby = 'REG_ID';
935 935
 				break;
@@ -949,26 +949,26 @@  discard block
 block discarded – undo
949 949
 				$orderby = 'REG_date';
950 950
 		}
951 951
 
952
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
953
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
954
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
952
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
953
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
954
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
955 955
 
956 956
 
957
-		$offset = ($current_page-1)*$per_page;
958
-		$limit = $count  ? NULL : array( $offset, $per_page );
957
+		$offset = ($current_page - 1) * $per_page;
958
+		$limit = $count ? NULL : array($offset, $per_page);
959 959
 
960
-		if($EVT_ID){
961
-			$_where['EVT_ID']=$EVT_ID;
960
+		if ($EVT_ID) {
961
+			$_where['EVT_ID'] = $EVT_ID;
962 962
 		}
963
-		if($CAT_ID){
963
+		if ($CAT_ID) {
964 964
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
965 965
 		}
966
-		if ( $incomplete ) {
966
+		if ($incomplete) {
967 967
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
968 968
 		} else if ( ! $trash) {
969
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
969
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
970 970
 		}
971
-		if($reg_status){
971
+		if ($reg_status) {
972 972
 			$_where['STS_ID'] = $reg_status;
973 973
 		}
974 974
 
@@ -980,105 +980,105 @@  discard block
 block discarded – undo
980 980
 		$time_start = ' 00:00:00';
981 981
 		$time_end = ' 23:59:59';
982 982
 
983
-		if($today_a || $today ){
983
+		if ($today_a || $today) {
984 984
 			$curdate = date('Y-m-d', current_time('timestamp'));
985
-			$_where['REG_date']= array('BETWEEN',
985
+			$_where['REG_date'] = array('BETWEEN',
986 986
 				array(
987
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
988
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
987
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
988
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
989 989
 			));
990
-		}elseif($this_month_a || $this_month){
990
+		}elseif ($this_month_a || $this_month) {
991 991
 			$this_month_r = date('m', current_time('timestamp'));
992
-			$days_this_month = date( 't', current_time('timestamp') );
993
-			$_where['REG_date']= array('BETWEEN',
992
+			$days_this_month = date('t', current_time('timestamp'));
993
+			$_where['REG_date'] = array('BETWEEN',
994 994
 				array(
995
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
996
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )
995
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
996
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s')
997 997
 			));
998
-		}elseif($month_range){
998
+		}elseif ($month_range) {
999 999
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1000
-			$month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : '';
1001
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1002
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
1003
-			$_where['REG_date']= array('BETWEEN',
1004
-				array(  EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month .  ' 23:59:59', 'Y-m-d H:i:s' ) ) );
1005
-		}elseif($start_date && $end_date){
1000
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : '';
1001
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1002
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
1003
+			$_where['REG_date'] = array('BETWEEN',
1004
+				array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s')));
1005
+		}elseif ($start_date && $end_date) {
1006 1006
 			throw new EE_Error("not yet supported");
1007
-		}elseif($start_date){
1007
+		}elseif ($start_date) {
1008 1008
 			throw new EE_Error("not yet supported");
1009
-		}elseif($end_date){
1009
+		}elseif ($end_date) {
1010 1010
 			throw new EE_Error("not yet supported");
1011 1011
 		}
1012 1012
 
1013
-		if ( ! empty( $this->_req_data['s'] ) ) {
1014
-			$sstr = '%' . $this->_req_data['s'] . '%';
1013
+		if ( ! empty($this->_req_data['s'])) {
1014
+			$sstr = '%'.$this->_req_data['s'].'%';
1015 1015
 			$_where['OR'] = array(
1016
-				'Event.EVT_name' => array( 'LIKE', $sstr),
1017
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
1018
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
1019
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
1020
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
1021
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
1022
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
1023
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
1024
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
1025
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
1026
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
1027
-				'REG_final_price' => array( 'LIKE', $sstr ),
1028
-				'REG_code' => array( 'LIKE', $sstr ),
1029
-				'REG_count' => array( 'LIKE' , $sstr ),
1030
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1031
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1032
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
1033
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
1016
+				'Event.EVT_name' => array('LIKE', $sstr),
1017
+				'Event.EVT_desc' => array('LIKE', $sstr),
1018
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
1019
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
1020
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
1021
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
1022
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
1023
+				'Attendee.ATT_email' => array('LIKE', $sstr),
1024
+				'Attendee.ATT_address' => array('LIKE', $sstr),
1025
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
1026
+				'Attendee.ATT_city' => array('LIKE', $sstr),
1027
+				'REG_final_price' => array('LIKE', $sstr),
1028
+				'REG_code' => array('LIKE', $sstr),
1029
+				'REG_count' => array('LIKE', $sstr),
1030
+				'REG_group_size' => array('LIKE', $sstr),
1031
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1032
+				'Ticket.TKT_description' => array('LIKE', $sstr),
1033
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
1034 1034
 				);
1035 1035
 		}
1036 1036
 
1037 1037
 		//capability checks
1038
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
1038
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
1039 1039
 			$_where['AND'] = array(
1040 1040
 				'Event.EVT_wp_user' => get_current_user_id()
1041 1041
 				);
1042 1042
 		}
1043 1043
 
1044 1044
 
1045
-		if( $count ){
1046
-			if ( $trash ) {
1047
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1048
-			} else if ( $incomplete ) {
1049
-				return EEM_Registration::instance()->count( array( $_where ));
1045
+		if ($count) {
1046
+			if ($trash) {
1047
+				return EEM_Registration::instance()->count_deleted(array($_where));
1048
+			} else if ($incomplete) {
1049
+				return EEM_Registration::instance()->count(array($_where));
1050 1050
 			} else {
1051
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1051
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1052 1052
 			}
1053 1053
 		} else {
1054 1054
 			//make sure we remove default where conditions cause all registrations matching query are returned
1055
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1056
-			if ( $per_page !== -1 ) {
1055
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1056
+			if ($per_page !== -1) {
1057 1057
 				$query_params['limit'] = $limit;
1058 1058
 			}
1059
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1059
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1060 1060
 
1061 1061
 
1062
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1062
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1063 1063
 				$first_registration = $registrations[0];
1064 1064
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1065 1065
 				$event_name = $first_registration->event_obj()->name();
1066
-				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1066
+				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1067 1067
 				// edit event link
1068
-				if ( $event_name != '' ) {
1069
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1070
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1071
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1068
+				if ($event_name != '') {
1069
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1070
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1071
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1072 1072
 				}
1073 1073
 
1074
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1075
-				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1074
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1075
+				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1076 1076
 
1077 1077
 				$this->_template_args['before_admin_page_content'] = '
1078 1078
 			<div id="admin-page-header">
1079
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1080
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1081
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1079
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1080
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1081
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1082 1082
 			</div>
1083 1083
 			';
1084 1084
 
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 
1117 1117
 		$this->_set_registration_object();
1118 1118
 
1119
-		if ( is_object( $this->_registration )) {
1119
+		if (is_object($this->_registration)) {
1120 1120
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1121 1121
 			$this->_session = $transaction->session_data();
1122 1122
 
@@ -1124,10 +1124,10 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
 
1126 1126
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1127
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1127
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1128 1128
 
1129
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->get_i18n_datetime( 'REG_date' );
1130
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1129
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
1130
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1131 1131
 
1132 1132
 			$this->_template_args['grand_total'] = $transaction->total();
1133 1133
 
@@ -1135,19 +1135,19 @@  discard block
 block discarded – undo
1135 1135
 			// link back to overview
1136 1136
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1137 1137
 			$this->_template_args['registration'] = $this->_registration;
1138
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1139
-			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) );
1140
-			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) );
1138
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1139
+			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php'));
1140
+			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php'));
1141 1141
 
1142 1142
 			//next and previous links
1143
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1144
-			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
1145
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1146
-			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
1143
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1144
+			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
1145
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1146
+			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
1147 1147
 
1148 1148
 			// grab header
1149
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1150
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1149
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1150
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1151 1151
 
1152 1152
 		} else {
1153 1153
 
@@ -1166,17 +1166,17 @@  discard block
 block discarded – undo
1166 1166
 
1167 1167
 
1168 1168
 	protected function _registration_details_metaboxes() {
1169
-		do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this );
1169
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1170 1170
 		$this->_set_registration_object();
1171 1171
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1172
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1173
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1174
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1175
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1172
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1173
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1174
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1175
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1176 1176
 		}
1177
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1178
-		if ( $this->_registration->group_size() > 1 ) {
1179
-			add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1177
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1178
+		if ($this->_registration->group_size() > 1) {
1179
+			add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high');
1180 1180
 		}
1181 1181
 	}
1182 1182
 
@@ -1197,23 +1197,23 @@  discard block
 block discarded – undo
1197 1197
 
1198 1198
 		//let's get an array of all possible buttons that we can just reference
1199 1199
 		$status_buttons = $this->_get_reg_status_buttons();
1200
-		$template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();
1201
-		$template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();
1200
+		$template_args['reg_status_value'] = $this->_registration->pretty_status();
1201
+		$template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();
1202 1202
 		$template_args['attendee'] = $this->_registration->attendee();
1203
-		$template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';
1204
-		if ( $this->_set_registration_object() ) {
1203
+		$template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';
1204
+		if ($this->_set_registration_object()) {
1205 1205
 			$current_status = $this->_registration->status_ID();
1206
-			unset( $status_buttons[$current_status] );
1207
-			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) {
1208
-				unset( $status_buttons[EEM_Registration::status_id_pending_payment] );
1206
+			unset($status_buttons[$current_status]);
1207
+			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) {
1208
+				unset($status_buttons[EEM_Registration::status_id_pending_payment]);
1209 1209
 			}
1210
-			$template_args['status_buttons'] = implode( "\n", $status_buttons );
1210
+			$template_args['status_buttons'] = implode("\n", $status_buttons);
1211 1211
 		}
1212 1212
 		$template_args['form_url'] = REG_ADMIN_URL;
1213 1213
 		$template_args['REG_ID'] = $this->_registration->ID();
1214
-		$template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce',  'change_reg_status_nonce', FALSE, FALSE );
1214
+		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE);
1215 1215
 
1216
-		EEH_Template::display_template( $template, $template_args );
1216
+		EEH_Template::display_template($template, $template_args);
1217 1217
 
1218 1218
 	}
1219 1219
 
@@ -1227,11 +1227,11 @@  discard block
 block discarded – undo
1227 1227
 	private function _get_reg_status_buttons() {
1228 1228
 
1229 1229
 		$buttons = array(
1230
-			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">',
1231
-			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">',
1232
-			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">',
1233
-			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">',
1234
-			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">',
1230
+			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">',
1231
+			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">',
1232
+			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">',
1233
+			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">',
1234
+			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">',
1235 1235
 			);
1236 1236
 		return $buttons;
1237 1237
 	}
@@ -1245,13 +1245,13 @@  discard block
 block discarded – undo
1245 1245
 	 *
1246 1246
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1247 1247
 	 */
1248
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1249
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();
1248
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1249
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1250 1250
 
1251
-		$success = $this->_set_registration_status( $REG_ID, $status );
1251
+		$success = $this->_set_registration_status($REG_ID, $status);
1252 1252
 
1253 1253
 		//notify?
1254
-		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
1254
+		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
1255 1255
 			$this->_process_resend_registration();
1256 1256
 		}
1257 1257
 
@@ -1269,19 +1269,19 @@  discard block
 block discarded – undo
1269 1269
 	 * @param bool $status
1270 1270
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1271 1271
 	 */
1272
-	protected function _set_registration_status( $REG_ID, $status = false ) {
1272
+	protected function _set_registration_status($REG_ID, $status = false) {
1273 1273
 		$success = true;
1274 1274
 		// set default status if none is passed
1275 1275
 		$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1276 1276
 
1277 1277
 		//typecast and sanitize reg_id
1278
-		$reg_ids = array_filter( (array) $REG_ID, 'absint' );
1278
+		$reg_ids = array_filter((array) $REG_ID, 'absint');
1279 1279
 
1280 1280
 		//loop through REG_ID's and change status
1281
-		foreach ( $reg_ids as $r_id ) {
1282
-			$registration = EEM_Registration::instance()->get_one_by_ID( $r_id );
1283
-			if ( $registration instanceof EE_Registration ) {
1284
-				$registration->set_status( $status );
1281
+		foreach ($reg_ids as $r_id) {
1282
+			$registration = EEM_Registration::instance()->get_one_by_ID($r_id);
1283
+			if ($registration instanceof EE_Registration) {
1284
+				$registration->set_status($status);
1285 1285
 				$result = $registration->save();
1286 1286
 
1287 1287
 				//verifying explicit fails because update *may* just return 0 for 0 rows affected
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 		$this->_req_data['_REG_ID'] = $reg_ids;
1294 1294
 
1295 1295
 		//return $success and processed registrations
1296
-		return array( 'REG_ID' => $reg_ids, 'success' => $success );
1296
+		return array('REG_ID' => $reg_ids, 'success' => $success);
1297 1297
 	}
1298 1298
 
1299 1299
 
@@ -1305,37 +1305,37 @@  discard block
 block discarded – undo
1305 1305
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1306 1306
 	 * @return void
1307 1307
 	 */
1308
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1308
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1309 1309
 
1310
-		$result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );
1310
+		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false);
1311 1311
 
1312 1312
 
1313
-		$success = isset( $result['success'] ) && $result['success'];
1313
+		$success = isset($result['success']) && $result['success'];
1314 1314
 
1315 1315
 		//setup success message
1316
-		if ( $success ) {
1317
-			$msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1  ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) :  sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ;
1318
-			EE_Error::add_success( $msg );
1316
+		if ($success) {
1317
+			$msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower'));
1318
+			EE_Error::add_success($msg);
1319 1319
 		} else {
1320
-			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ );
1320
+			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
1321 1321
 		}
1322 1322
 
1323
-		$route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' );
1323
+		$route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default');
1324 1324
 		//unset nonces
1325
-		foreach ( $this->_req_data as $ref => $value ) {
1326
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1327
-				unset( $this->_req_data[$ref] );
1325
+		foreach ($this->_req_data as $ref => $value) {
1326
+			if (strpos($ref, 'nonce') !== false) {
1327
+				unset($this->_req_data[$ref]);
1328 1328
 				continue;
1329 1329
 			}
1330 1330
 
1331
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1331
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1332 1332
 			$this->_req_data[$ref] = $value;
1333 1333
 		}
1334 1334
 
1335 1335
 		//merge request vars so that the reloaded list table contains any existing filter query params
1336
-		$route = array_merge( $this->_req_data, $route );
1336
+		$route = array_merge($this->_req_data, $route);
1337 1337
 
1338
-		$this->_redirect_after_action( false, '', '', $route, true );
1338
+		$this->_redirect_after_action(false, '', '', $route, true);
1339 1339
 	}
1340 1340
 
1341 1341
 
@@ -1347,29 +1347,29 @@  discard block
 block discarded – undo
1347 1347
 	protected function _change_reg_status() {
1348 1348
 		$this->_req_data['return'] = 'view_registration';
1349 1349
 		//set notify based on whether the send notifications toggle is set or not
1350
-		$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1351
-		$this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : '';
1350
+		$notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);
1351
+		$this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : '';
1352 1352
 
1353
-		switch ( $this->_req_data['_reg_status_id'] ) {
1354
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1355
-				$this->approve_registration( $notify );
1353
+		switch ($this->_req_data['_reg_status_id']) {
1354
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1355
+				$this->approve_registration($notify);
1356 1356
 				break;
1357
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1358
-				$this->pending_registration( $notify );
1357
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1358
+				$this->pending_registration($notify);
1359 1359
 				break;
1360
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1361
-				$this->not_approve_registration( $notify );
1360
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1361
+				$this->not_approve_registration($notify);
1362 1362
 				break;
1363
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1364
-				$this->decline_registration( $notify );
1363
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1364
+				$this->decline_registration($notify);
1365 1365
 				break;
1366
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1367
-				$this->cancel_registration( $notify );
1366
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1367
+				$this->cancel_registration($notify);
1368 1368
 				break;
1369 1369
 			default :
1370 1370
 				$result['success'] = false;
1371
-				unset( $this->_req_data['return'] );
1372
-				$this->_reg_status_change_return( '', false );
1371
+				unset($this->_req_data['return']);
1372
+				$this->_reg_status_change_return('', false);
1373 1373
 				break;
1374 1374
 		}
1375 1375
 	}
@@ -1382,8 +1382,8 @@  discard block
 block discarded – undo
1382 1382
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1383 1383
 	*		@return void
1384 1384
 	*/
1385
-	protected function approve_registration( $notify = false ) {
1386
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1385
+	protected function approve_registration($notify = false) {
1386
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1387 1387
 	}
1388 1388
 
1389 1389
 
@@ -1395,8 +1395,8 @@  discard block
 block discarded – undo
1395 1395
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1396 1396
 	*		@return void
1397 1397
 	*/
1398
-	protected function decline_registration( $notify = false ) {
1399
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1398
+	protected function decline_registration($notify = false) {
1399
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1400 1400
 	}
1401 1401
 
1402 1402
 
@@ -1408,8 +1408,8 @@  discard block
 block discarded – undo
1408 1408
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1409 1409
 	*		@return void
1410 1410
 	*/
1411
-	protected function cancel_registration( $notify = false ) {
1412
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1411
+	protected function cancel_registration($notify = false) {
1412
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1413 1413
 	}
1414 1414
 
1415 1415
 
@@ -1422,8 +1422,8 @@  discard block
 block discarded – undo
1422 1422
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1423 1423
 	*		@return void
1424 1424
 	*/
1425
-	protected function not_approve_registration( $notify = false ) {
1426
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1425
+	protected function not_approve_registration($notify = false) {
1426
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1427 1427
 	}
1428 1428
 
1429 1429
 
@@ -1434,8 +1434,8 @@  discard block
 block discarded – undo
1434 1434
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1435 1435
 	*		@return void
1436 1436
 	*/
1437
-	protected function pending_registration( $notify = false ) {
1438
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1437
+	protected function pending_registration($notify = false) {
1438
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1439 1439
 	}
1440 1440
 
1441 1441
 
@@ -1449,75 +1449,75 @@  discard block
 block discarded – undo
1449 1449
 	public function _reg_details_meta_box() {
1450 1450
 		EEH_Autoloader::register_line_item_display_autoloaders();
1451 1451
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1452
-		EE_Registry::instance()->load_Helper( 'Line_Item' );
1452
+		EE_Registry::instance()->load_Helper('Line_Item');
1453 1453
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1454 1454
 		$this->_session = $transaction->session_data();
1455 1455
 
1456 1456
 		$filters = new EE_Line_Item_Filter_Collection();
1457
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1458
-		$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1459
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1457
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1458
+		$filters->add(new EE_Non_Zero_Line_Item_Filter());
1459
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1460 1460
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1461 1461
 
1462 1462
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1463
-		$line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' );
1464
-		$this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) );
1463
+		$line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy');
1464
+		$this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration));
1465 1465
 
1466 1466
 
1467 1467
 		$attendee = $this->_registration->attendee();
1468 1468
 
1469 1469
 
1470
-		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : '';
1471
-		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : '';
1470
+		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : '';
1471
+		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : '';
1472 1472
 
1473 1473
 
1474 1474
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1475
-		$payment = $transaction->get_first_related( 'Payment' );
1475
+		$payment = $transaction->get_first_related('Payment');
1476 1476
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1477
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1477
+		$payment_method = $payment->get_first_related('Payment_Method');
1478 1478
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1479
-		$reg_status_class = 'status-' . $this->_registration->status_ID();
1479
+		$reg_status_class = 'status-'.$this->_registration->status_ID();
1480 1480
 		$reg_details = array(
1481 1481
 			'payment_method' => $payment_method->name(),
1482 1482
 			'response_msg' => $payment->gateway_response(),
1483
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1483
+			'registration_id' => $this->_registration->get('REG_code'),
1484 1484
 			'registration_session' => $this->_registration->session_ID(),
1485
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1486
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1485
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1486
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1487 1487
 			);
1488 1488
 
1489 1489
 
1490
-		if ( isset( $reg_details['registration_id'] )) {
1490
+		if (isset($reg_details['registration_id'])) {
1491 1491
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1492
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1492
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1493 1493
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1494 1494
 		}
1495 1495
 
1496
-		if ( isset( $reg_details['payment_method'] ) ) {
1496
+		if (isset($reg_details['payment_method'])) {
1497 1497
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1498
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1498
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1499 1499
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1500 1500
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1501
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1501
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1502 1502
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1503 1503
 		}
1504 1504
 
1505 1505
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1506
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1506
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1507 1507
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1508 1508
 
1509 1509
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1510
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1510
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1511 1511
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1512 1512
 
1513 1513
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1514
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1514
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1515 1515
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1516 1516
 
1517
-		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL );
1517
+		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL);
1518 1518
 
1519
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1520
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1519
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1520
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1521 1521
 
1522 1522
 	}
1523 1523
 
@@ -1531,14 +1531,14 @@  discard block
 block discarded – undo
1531 1531
 	*/
1532 1532
 	public function _reg_questions_meta_box() {
1533 1533
 		//allow someone to override this method entirely
1534
-		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
1535
-			$form = $this->_get_reg_custom_questions_form( $this->_registration->ID() );
1536
-			$this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : '';
1534
+		if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) {
1535
+			$form = $this->_get_reg_custom_questions_form($this->_registration->ID());
1536
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : '';
1537 1537
 			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
1538 1538
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1539 1539
 
1540
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1541
-			echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1540
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1541
+			echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1542 1542
 		}
1543 1543
 	}
1544 1544
 
@@ -1552,12 +1552,12 @@  discard block
 block discarded – undo
1552 1552
 	 * @param        string $output
1553 1553
 	 * @return        string
1554 1554
 	 */
1555
-	public function form_before_question_group( $output ) {
1555
+	public function form_before_question_group($output) {
1556 1556
 		EE_Error::doing_it_wrong(
1557
-			__CLASS__ . '::' . __FUNCTION__,
1558
-			__( 'This method would have been protected but was used on a filter callback'
1557
+			__CLASS__.'::'.__FUNCTION__,
1558
+			__('This method would have been protected but was used on a filter callback'
1559 1559
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1560
-				'event_espresso' ),
1560
+				'event_espresso'),
1561 1561
 			'4.8.32.rc.000'
1562 1562
 		);
1563 1563
 		return '
@@ -1576,20 +1576,20 @@  discard block
 block discarded – undo
1576 1576
 	 * @param        string $output
1577 1577
 	 * @return        string
1578 1578
 	 */
1579
-	public function form_after_question_group( $output ) {
1579
+	public function form_after_question_group($output) {
1580 1580
 		EE_Error::doing_it_wrong(
1581
-			__CLASS__ . '::' . __FUNCTION__,
1582
-			__( 'This method would have been protected but was used on a filter callback'
1581
+			__CLASS__.'::'.__FUNCTION__,
1582
+			__('This method would have been protected but was used on a filter callback'
1583 1583
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1584
-				'event_espresso' ),
1584
+				'event_espresso'),
1585 1585
 			'4.8.32.rc.000'
1586 1586
 		);
1587 1587
 		return  '
1588 1588
 			<tr class="hide-if-no-js">
1589 1589
 				<th> </th>
1590 1590
 				<td class="reg-admin-edit-attendee-question-td">
1591
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1592
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1591
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1592
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1593 1593
 						<div class="dashicons dashicons-edit"></div>
1594 1594
 					</a>
1595 1595
 				</td>
@@ -1609,18 +1609,18 @@  discard block
 block discarded – undo
1609 1609
 	 * @param        string $label
1610 1610
 	 * @return        string
1611 1611
 	 */
1612
-	public function form_form_field_label_wrap( $label ) {
1612
+	public function form_form_field_label_wrap($label) {
1613 1613
 		EE_Error::doing_it_wrong(
1614
-			__CLASS__ . '::' . __FUNCTION__,
1615
-			__( 'This method would have been protected but was used on a filter callback'
1614
+			__CLASS__.'::'.__FUNCTION__,
1615
+			__('This method would have been protected but was used on a filter callback'
1616 1616
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1617
-				'event_espresso' ),
1617
+				'event_espresso'),
1618 1618
 			'4.8.32.rc.000'
1619 1619
 		);
1620 1620
 		return '
1621 1621
 			<tr>
1622 1622
 				<th>
1623
-					' . $label  . '
1623
+					' . $label.'
1624 1624
 				</th>';
1625 1625
 	}
1626 1626
 
@@ -1634,17 +1634,17 @@  discard block
 block discarded – undo
1634 1634
 	 * @param        string $input
1635 1635
 	 * @return        string
1636 1636
 	 */
1637
-	public function form_form_field_input__wrap( $input ) {
1637
+	public function form_form_field_input__wrap($input) {
1638 1638
 		EE_Error::doing_it_wrong(
1639
-			__CLASS__ . '::' . __FUNCTION__,
1640
-			__( 'This method would have been protected but was used on a filter callback'
1639
+			__CLASS__.'::'.__FUNCTION__,
1640
+			__('This method would have been protected but was used on a filter callback'
1641 1641
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1642
-				'event_espresso' ),
1642
+				'event_espresso'),
1643 1643
 			'4.8.32.rc.000'
1644 1644
 		);
1645 1645
 		return '
1646 1646
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1647
-					' . $input . '
1647
+					' . $input.'
1648 1648
 				</td>
1649 1649
 			</tr>';
1650 1650
 	}
@@ -1658,14 +1658,14 @@  discard block
 block discarded – undo
1658 1658
 	 * @return void
1659 1659
 	 */
1660 1660
 	protected function _update_attendee_registration_form() {
1661
-		do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this );
1662
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
1663
-			$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1664
-			$success = $this->_save_reg_custom_questions_form( $REG_ID );
1665
-			if( $success ) {
1661
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
1662
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1663
+			$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1664
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
1665
+			if ($success) {
1666 1666
 				$what = __('Registration Form', 'event_espresso');
1667
-				$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1668
-				$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1667
+				$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1668
+				$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1669 1669
 			}
1670 1670
 		}
1671 1671
 	}
@@ -1676,11 +1676,11 @@  discard block
 block discarded – undo
1676 1676
 	 * @param int $REG_ID
1677 1677
 	 * @return EE_Registration_Custom_Questions_Form
1678 1678
 	 */
1679
-	protected function _get_reg_custom_questions_form( $REG_ID ) {
1680
-		if( ! $this->_reg_custom_questions_form ) {
1681
-			require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' );
1682
-			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) );
1683
-			$this->_reg_custom_questions_form->_construct_finalize( null, null );
1679
+	protected function _get_reg_custom_questions_form($REG_ID) {
1680
+		if ( ! $this->_reg_custom_questions_form) {
1681
+			require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php');
1682
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID));
1683
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
1684 1684
 		}
1685 1685
 		return $this->_reg_custom_questions_form;
1686 1686
 	}
@@ -1693,17 +1693,17 @@  discard block
 block discarded – undo
1693 1693
 	 * @param bool $REG_ID
1694 1694
 	 * @return bool
1695 1695
 	 */
1696
-	private function _save_reg_custom_questions_form( $REG_ID = FALSE ) {
1696
+	private function _save_reg_custom_questions_form($REG_ID = FALSE) {
1697 1697
 
1698 1698
 		if ( ! $REG_ID) {
1699
-			EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1699
+			EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1700 1700
 		}
1701
-		$form = $this->_get_reg_custom_questions_form( $REG_ID );
1702
-		$form->receive_form_submission( $this->_req_data );
1701
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
1702
+		$form->receive_form_submission($this->_req_data);
1703 1703
 		$success = false;
1704
-		if( $form->is_valid() ) {
1705
-			foreach( $form->subforms() as $question_group_id => $question_group_form ) {
1706
-				foreach( $question_group_form->inputs() as $question_id => $input ) {
1704
+		if ($form->is_valid()) {
1705
+			foreach ($form->subforms() as $question_group_id => $question_group_form) {
1706
+				foreach ($question_group_form->inputs() as $question_id => $input) {
1707 1707
 					$where_conditions = array(
1708 1708
 							'QST_ID' => $question_id,
1709 1709
 							'REG_ID' => $REG_ID
@@ -1711,19 +1711,19 @@  discard block
 block discarded – undo
1711 1711
 					$possibly_new_values = array(
1712 1712
 							'ANS_value' => $input->normalized_value()
1713 1713
 						);
1714
-					$answer = EEM_Answer::instance()->get_one( array( $where_conditions ) );
1715
-					if( $answer instanceof EE_Answer ) {
1716
-						$success = $answer->save( $possibly_new_values );
1714
+					$answer = EEM_Answer::instance()->get_one(array($where_conditions));
1715
+					if ($answer instanceof EE_Answer) {
1716
+						$success = $answer->save($possibly_new_values);
1717 1717
 					} else {
1718 1718
 						//insert it then
1719
-						$cols_n_vals = array_merge( $where_conditions, $possibly_new_values );
1720
-						$answer = EE_Answer::new_instance( $cols_n_vals );
1719
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
1720
+						$answer = EE_Answer::new_instance($cols_n_vals);
1721 1721
 						$success = $answer->save();
1722 1722
 					}
1723 1723
 				}
1724 1724
 			}
1725 1725
 		} else {
1726
-			EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ );
1726
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
1727 1727
 		}
1728 1728
 		return $success;
1729 1729
 	}
@@ -1741,29 +1741,29 @@  discard block
 block discarded – undo
1741 1741
 		$registrations = $REG->get_all(array(
1742 1742
 			array(
1743 1743
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1744
-				'REG_ID'=>array('!=',$this->_registration->ID())
1744
+				'REG_ID'=>array('!=', $this->_registration->ID())
1745 1745
 			),
1746 1746
 			'force_join'=>array('Attendee')));
1747 1747
 
1748 1748
 		$this->_template_args['attendees'] = array();
1749 1749
 		$this->_template_args['attendee_notice'] = '';
1750
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1751
-			EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1750
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1751
+			EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1752 1752
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1753 1753
 		} else {
1754 1754
 
1755 1755
 			$att_nmbr = 1;
1756
-			foreach ( $registrations as $registration ) {
1756
+			foreach ($registrations as $registration) {
1757 1757
 				/* @var $registration EE_Registration */
1758 1758
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1759
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1760
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1761
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1762
-				$this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1759
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1760
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1761
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1762
+				$this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1763 1763
 
1764
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1764
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1765 1765
 
1766
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1766
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1767 1767
 
1768 1768
 				$att_nmbr++;
1769 1769
 			}
@@ -1775,8 +1775,8 @@  discard block
 block discarded – undo
1775 1775
 
1776 1776
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1777 1777
 		}
1778
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1779
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1778
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1779
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1780 1780
 
1781 1781
 	}
1782 1782
 
@@ -1797,11 +1797,11 @@  discard block
 block discarded – undo
1797 1797
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1798 1798
 
1799 1799
 		//now let's determine if this is not the primary registration.  If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not)
1800
-		if ( ! $this->_registration->is_primary_registrant() ) {
1800
+		if ( ! $this->_registration->is_primary_registrant()) {
1801 1801
 			$primary_registration = $this->_registration->get_primary_registration();
1802 1802
 			$primary_attendee = $primary_registration->attendee();
1803 1803
 
1804
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1804
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1805 1805
 				//in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.
1806 1806
 				$primary_registration = NULL;
1807 1807
 			}
@@ -1810,27 +1810,27 @@  discard block
 block discarded – undo
1810 1810
 		}
1811 1811
 
1812 1812
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1813
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1814
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1815
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1813
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1814
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1815
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1816 1816
 		$this->_template_args['phone'] = $attendee->phone();
1817 1817
 
1818
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1818
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1819 1819
 
1820 1820
 
1821 1821
 		//edit link
1822
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1823
-		$this->_template_args['att_edit_label'] = __('View/Edit Contact' );
1822
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1823
+		$this->_template_args['att_edit_label'] = __('View/Edit Contact');
1824 1824
 
1825 1825
 		//create link
1826
-		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee',  '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): '';
1826
+		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : '';
1827 1827
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1828 1828
 
1829 1829
 		$this->_template_args['att_check'] = $att_check;
1830 1830
 
1831 1831
 
1832
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1833
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1832
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1833
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1834 1834
 	}
1835 1835
 
1836 1836
 
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
 	 * @access protected
1844 1844
 	 * @return void
1845 1845
 	 */
1846
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1846
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1847 1847
 		$REGM = EEM_Registration::instance();
1848 1848
 
1849 1849
 		$success = 1;
@@ -1853,26 +1853,26 @@  discard block
 block discarded – undo
1853 1853
 		$dtts = array();
1854 1854
 
1855 1855
 		//if empty _REG_ID then get out because there's nothing to do
1856
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1856
+		if (empty($this->_req_data['_REG_ID'])) {
1857 1857
 			$msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso');
1858
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1859
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1858
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1859
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1860 1860
 		}
1861 1861
 
1862 1862
 		//Checkboxes
1863
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1863
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1864 1864
 			// if array has more than one element than success message should be plural
1865
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1865
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1866 1866
 			// cycle thru checkboxes
1867
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1867
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1868 1868
 
1869 1869
 				$REG = $REGM->get_one_by_ID($REG_ID);
1870 1870
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1871
-				if ( $payment_count > 0 ) {
1872
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
1871
+				if ($payment_count > 0) {
1872
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
1873 1873
 					$error = 1;
1874 1874
 					$success = 0;
1875
-					EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ );
1875
+					EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__);
1876 1876
 					continue; //can't trash this registration because it has payments.
1877 1877
 				}
1878 1878
 				$ticket = $REG->get_first_related('Ticket');
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 				$dtts = array_merge($dtts, $dtt);
1882 1882
 
1883 1883
 				$updated = $trash ? $REG->delete() : $REG->restore();
1884
-				if ( !$updated ) {
1884
+				if ( ! $updated) {
1885 1885
 					$success = 0;
1886 1886
 				} else {
1887 1887
 					$success = 2;
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 			$tickets[$ticket->ID()] = $ticket;
1897 1897
 			$dtts = $ticket->get_many_related('Datetime');
1898 1898
 			$updated = $trash ? $REG->delete() : $REG->restore();
1899
-			if ( ! $updated ) {
1899
+			if ( ! $updated) {
1900 1900
 				$success = 0;
1901 1901
 			}
1902 1902
 
@@ -1906,10 +1906,10 @@  discard block
 block discarded – undo
1906 1906
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1907 1907
 		EEM_Datetime::instance()->update_sold($dtts);
1908 1908
 
1909
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1910
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1909
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1910
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1911 1911
 		$overwrite_msgs = $error ? TRUE : FALSE;
1912
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1912
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1913 1913
 	}
1914 1914
 
1915 1915
 
@@ -1933,16 +1933,16 @@  discard block
 block discarded – undo
1933 1933
 		$success = 1;
1934 1934
 
1935 1935
 		//Checkboxes
1936
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1936
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1937 1937
 			// if array has more than one element than success message should be plural
1938
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1938
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1939 1939
 			// cycle thru checkboxes
1940
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1940
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1941 1941
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1942
-				if ( ! $REG instanceof EE_Registration )
1942
+				if ( ! $REG instanceof EE_Registration)
1943 1943
 					continue;
1944 1944
 				$deleted = $this->_delete_registration($REG);
1945
-				if ( !$deleted ) {
1945
+				if ( ! $deleted) {
1946 1946
 					$success = 0;
1947 1947
 				}
1948 1948
 			}
@@ -1952,15 +1952,15 @@  discard block
 block discarded – undo
1952 1952
 			$REG_ID = $this->_req_data['_REG_ID'];
1953 1953
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
1954 1954
 			$deleted = $this->_delete_registration($REG);
1955
-			if ( ! $deleted ) {
1955
+			if ( ! $deleted) {
1956 1956
 				$success = 0;
1957 1957
 			}
1958 1958
 
1959 1959
 		}
1960 1960
 
1961
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1962
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
1963
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
1961
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1962
+		$action_desc = __('permanently deleted.', 'event_espresso');
1963
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
1964 1964
 	}
1965 1965
 
1966 1966
 
@@ -1972,31 +1972,31 @@  discard block
 block discarded – undo
1972 1972
 	 * @param  EE_Registration $REG registration to be deleted permenantly
1973 1973
 	 * @return boolean              true = successful deletion, false = fail.
1974 1974
 	 */
1975
-	protected function _delete_registration( EE_Registration $REG ) {
1975
+	protected function _delete_registration(EE_Registration $REG) {
1976 1976
 		//first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed.
1977 1977
 		$TXN = $REG->get_first_related('Transaction');
1978 1978
 		$REGS = $TXN->get_many_related('Registration');
1979 1979
 
1980 1980
 		$all_trashed = TRUE;
1981
-		foreach ( $REGS as $registration ) {
1982
-			if ( ! $registration->get('REG_deleted') )
1981
+		foreach ($REGS as $registration) {
1982
+			if ( ! $registration->get('REG_deleted'))
1983 1983
 				$all_trashed = FALSE;
1984 1984
 		}
1985 1985
 
1986
-		if ( ! $all_trashed ) {
1987
-			EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1986
+		if ( ! $all_trashed) {
1987
+			EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1988 1988
 			return false;
1989 1989
 		}
1990 1990
 
1991 1991
 		//k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one).
1992
-		foreach ( $REGS as $registration ) {
1992
+		foreach ($REGS as $registration) {
1993 1993
 
1994 1994
 			//delete related answers
1995 1995
 			$registration->delete_related_permanently('Answer');
1996 1996
 
1997 1997
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
1998 1998
 			$attendee = $registration->get_first_related('Attendee');
1999
-			if ( $attendee instanceof EE_Attendee ) {
1999
+			if ($attendee instanceof EE_Attendee) {
2000 2000
 				$registration->_remove_relation_to($attendee, 'Attendee');
2001 2001
 			}
2002 2002
 
@@ -2006,7 +2006,7 @@  discard block
 block discarded – undo
2006 2006
 			//now delete permanently the checkins related to this registration.
2007 2007
 			$registration->delete_related_permanently('Checkin');
2008 2008
 
2009
-			if ( $registration->ID() === $REG->ID() )
2009
+			if ($registration->ID() === $REG->ID())
2010 2010
 				continue; //we don't want to delete permanently the existing registration just yet.
2011 2011
 
2012 2012
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2039,35 +2039,35 @@  discard block
 block discarded – undo
2039 2039
 	 * @return void
2040 2040
 	 */
2041 2041
 	public function new_registration() {
2042
-		if ( ! $this->_set_reg_event() ) {
2043
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2042
+		if ( ! $this->_set_reg_event()) {
2043
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2044 2044
 		}
2045
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2045
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2046 2046
 		// gotta start with a clean slate if we're not coming here via ajax
2047 2047
 		if (
2048
-			! defined('DOING_AJAX' )
2049
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2048
+			! defined('DOING_AJAX')
2049
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2050 2050
 		) {
2051
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2051
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2052 2052
 		}
2053 2053
 
2054
-		$this->_template_args['event_name'] = '' ;
2054
+		$this->_template_args['event_name'] = '';
2055 2055
 		// event name
2056
-		if ( $this->_reg_event ) {
2056
+		if ($this->_reg_event) {
2057 2057
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2058
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2059
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2060
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2058
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2059
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2060
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2061 2061
 		}
2062 2062
 
2063 2063
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2064 2064
 
2065
-		if ( defined('DOING_AJAX' ) ) {
2065
+		if (defined('DOING_AJAX')) {
2066 2066
 			$this->_return_json();
2067 2067
 		}
2068 2068
 		// grab header
2069
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2070
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2069
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2070
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2071 2071
 
2072 2072
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2073 2073
 		// the details template wrapper
@@ -2084,7 +2084,7 @@  discard block
 block discarded – undo
2084 2084
 	 * @return string html
2085 2085
 	 */
2086 2086
 	protected function _get_registration_step_content() {
2087
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2087
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2088 2088
 			$warning_msg = sprintf(
2089 2089
 				__(
2090 2090
 					'%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s',
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
 				'</b>'
2101 2101
 			);
2102 2102
 			return '
2103
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2103
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2104 2104
 	<script >
2105 2105
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2106 2106
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2135,16 +2135,16 @@  discard block
 block discarded – undo
2135 2135
 		$cart = EE_Registry::instance()->SSN->cart();
2136 2136
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2137 2137
 
2138
-		switch ( $step ) {
2138
+		switch ($step) {
2139 2139
 			case 'ticket' :
2140 2140
 				$hidden_fields['processing_registration']['value'] = 1;
2141 2141
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2142
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2142
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2143 2143
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2144 2144
 				$template_args['show_notification_toggle'] = FALSE;
2145 2145
 				break;
2146 2146
 			case 'questions' :
2147
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2147
+				$hidden_fields['processing_registration']['value'] = 2;
2148 2148
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2149 2149
 				//in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run.
2150 2150
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2153,10 +2153,10 @@  discard block
 block discarded – undo
2153 2153
 				break;
2154 2154
 		}
2155 2155
 
2156
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2156
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2157 2157
 
2158 2158
 		return EEH_Template::display_template(
2159
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2159
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2160 2160
 		);
2161 2161
 	}
2162 2162
 
@@ -2171,11 +2171,11 @@  discard block
 block discarded – undo
2171 2171
 	*		@return boolean
2172 2172
 	*/
2173 2173
 	private function _set_reg_event() {
2174
-		if ( is_object( $this->_reg_event )) {
2174
+		if (is_object($this->_reg_event)) {
2175 2175
 			return TRUE;
2176 2176
 		}
2177
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2178
-		if ( ! $EVT_ID ) {
2177
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2178
+		if ( ! $EVT_ID) {
2179 2179
 			return FALSE;
2180 2180
 		}
2181 2181
 
@@ -2196,82 +2196,82 @@  discard block
 block discarded – undo
2196 2196
 	public function process_reg_step() {
2197 2197
 		EE_System::do_not_cache();
2198 2198
 		$this->_set_reg_event();
2199
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2199
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2200 2200
 
2201 2201
 		//what step are we on?
2202 2202
 		$cart = EE_Registry::instance()->SSN->cart();
2203 2203
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2204 2204
 
2205 2205
 		//if doing ajax then we need to verify the nonce
2206
-		if ( defined( 'DOING_AJAX' ) ) {
2207
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2208
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2206
+		if (defined('DOING_AJAX')) {
2207
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2208
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2209 2209
 		}
2210 2210
 
2211
-		switch ( $step ) {
2211
+		switch ($step) {
2212 2212
 
2213 2213
 			case 'ticket' :
2214 2214
 				//process ticket selection
2215 2215
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2216
-				if ( $success ) {
2217
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2216
+				if ($success) {
2217
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2218 2218
 				} else {
2219 2219
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2220 2220
 				}
2221
-				if ( defined('DOING_AJAX') ) {
2221
+				if (defined('DOING_AJAX')) {
2222 2222
 					$this->new_registration(); //display next step
2223 2223
 				} else {
2224 2224
 					$query_args['action'] = 'new_registration';
2225 2225
 					$query_args['processing_registration'] = 1;
2226 2226
 					$query_args['event_id'] = $this->_reg_event->ID();
2227
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2227
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2228 2228
 				}
2229 2229
 				break;
2230 2230
 
2231 2231
 			case 'questions' :
2232
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2233
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2232
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2233
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2234 2234
 				}
2235 2235
 				//process registration
2236 2236
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2237
-				if ( $cart instanceof EE_Cart ) {
2237
+				if ($cart instanceof EE_Cart) {
2238 2238
 					$grand_total = $cart->get_cart_grand_total();
2239
-					if ( $grand_total instanceof EE_Line_Item ) {
2239
+					if ($grand_total instanceof EE_Line_Item) {
2240 2240
 						$grand_total->save_this_and_descendants_to_txn();
2241 2241
 					}
2242 2242
 				}
2243
-				if ( ! $transaction instanceof EE_Transaction ) {
2243
+				if ( ! $transaction instanceof EE_Transaction) {
2244 2244
 					$query_args = array(
2245 2245
 						'action' => 'new_registration',
2246 2246
 						'processing_registration' => 2,
2247 2247
 						'event_id' => $this->_reg_event->ID()
2248 2248
 					);
2249 2249
 
2250
-					if ( defined('DOING_AJAX' )) {
2250
+					if (defined('DOING_AJAX')) {
2251 2251
 						//display registration form again because there are errors (maybe validation?)
2252 2252
 						$this->new_registration();
2253 2253
 						return;
2254 2254
 					} else {
2255
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2255
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2256 2256
 						return;
2257 2257
 					}
2258 2258
 				}
2259 2259
 				/** @type EE_Transaction_Payments $transaction_payments */
2260
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2260
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2261 2261
 				// maybe update status, and make sure to save transaction if not done already
2262
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2262
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2263 2263
 					$transaction->save();
2264 2264
 				}
2265
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2265
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2266 2266
 				$this->_req_data = array();
2267 2267
 				$query_args = array(
2268 2268
 					'action'        => 'redirect_to_txn',
2269 2269
 					'TXN_ID'        => $transaction->ID(),
2270 2270
 					'EVT_ID'        => $this->_reg_event->ID(),
2271
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2271
+					'event_name'    => urlencode($this->_reg_event->name()),
2272 2272
 					'redirect_from' => 'new_registration'
2273 2273
 				);
2274
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2274
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2275 2275
 				break;
2276 2276
 		}
2277 2277
 
@@ -2288,21 +2288,21 @@  discard block
 block discarded – undo
2288 2288
 	 */
2289 2289
 	public function redirect_to_txn() {
2290 2290
 		EE_System::do_not_cache();
2291
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2291
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2292 2292
 		$query_args = array(
2293 2293
 			'action' => 'view_transaction',
2294
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2294
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2295 2295
 			'page'   => 'espresso_transactions'
2296 2296
 		);
2297
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2298
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2299
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2300
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2297
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2298
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2299
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2300
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2301 2301
 		}
2302 2302
 		EE_Error::add_success(
2303
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2303
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2304 2304
 		);
2305
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2305
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2306 2306
 	}
2307 2307
 
2308 2308
 
@@ -2313,7 +2313,7 @@  discard block
 block discarded – undo
2313 2313
 	*		@return void
2314 2314
 	*/
2315 2315
 	protected function _attendee_contact_list_table() {
2316
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2316
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2317 2317
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2318 2318
 		$this->display_admin_list_table_page_with_no_sidebar();
2319 2319
 	}
@@ -2328,10 +2328,10 @@  discard block
 block discarded – undo
2328 2328
 	*		@access public
2329 2329
 	*		@return array
2330 2330
 	*/
2331
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2331
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2332 2332
 
2333
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2334
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2333
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2334
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2335 2335
 		$ATT_MDL = EEM_Attendee::instance();
2336 2336
 
2337 2337
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2359,47 +2359,47 @@  discard block
 block discarded – undo
2359 2359
 				$orderby = 'ATT_lname';
2360 2360
 		}
2361 2361
 
2362
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2362
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2363 2363
 
2364
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2365
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2366
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2364
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2365
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2366
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2367 2367
 
2368 2368
 		$_where = array();
2369 2369
 
2370
-		if ( isset( $this->_req_data['s'] ) ) {
2371
-			$sstr = '%' . $this->_req_data['s'] . '%';
2370
+		if (isset($this->_req_data['s'])) {
2371
+			$sstr = '%'.$this->_req_data['s'].'%';
2372 2372
 			$_where['OR'] = array(
2373
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2374
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2375
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2376
-				'ATT_fname' => array( 'LIKE', $sstr ),
2377
-				'ATT_lname' => array( 'LIKE', $sstr ),
2378
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2379
-				'ATT_email' => array('LIKE', $sstr ),
2380
-				'ATT_address' => array( 'LIKE', $sstr ),
2381
-				'ATT_address2' => array( 'LIKE', $sstr ),
2382
-				'ATT_city' => array( 'LIKE', $sstr ),
2383
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2384
-				'State.STA_name' => array('LIKE', $sstr ),
2385
-				'ATT_phone' => array( 'LIKE', $sstr ),
2386
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2387
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2388
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2389
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2373
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2374
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2375
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2376
+				'ATT_fname' => array('LIKE', $sstr),
2377
+				'ATT_lname' => array('LIKE', $sstr),
2378
+				'ATT_short_bio' => array('LIKE', $sstr),
2379
+				'ATT_email' => array('LIKE', $sstr),
2380
+				'ATT_address' => array('LIKE', $sstr),
2381
+				'ATT_address2' => array('LIKE', $sstr),
2382
+				'ATT_city' => array('LIKE', $sstr),
2383
+				'Country.CNT_name' => array('LIKE', $sstr),
2384
+				'State.STA_name' => array('LIKE', $sstr),
2385
+				'ATT_phone' => array('LIKE', $sstr),
2386
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2387
+				'Registration.REG_code' => array('LIKE', $sstr),
2388
+				'Registration.REG_count' => array('LIKE', $sstr),
2389
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2390 2390
 				);
2391 2391
 		}
2392 2392
 
2393 2393
 
2394
-		$offset = ($current_page-1)*$per_page;
2395
-		$limit = $count ? NULL : array( $offset, $per_page );
2394
+		$offset = ($current_page - 1) * $per_page;
2395
+		$limit = $count ? NULL : array($offset, $per_page);
2396 2396
 
2397
-		if ( $trash ) {
2398
-			$_where['status'] = array( '!=', 'publish' );
2399
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2397
+		if ($trash) {
2398
+			$_where['status'] = array('!=', 'publish');
2399
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2400 2400
 		} else {
2401
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2402
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2401
+			$_where['status'] = array('IN', array('publish'));
2402
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2403 2403
 		}
2404 2404
 
2405 2405
 		return $all_attendees;
@@ -2416,10 +2416,10 @@  discard block
 block discarded – undo
2416 2416
 	 */
2417 2417
 	protected function _resend_registration() {
2418 2418
 		$this->_process_resend_registration();
2419
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2419
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2420 2420
 			'action' => 'default'
2421 2421
 		);
2422
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2422
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2423 2423
 	}
2424 2424
 
2425 2425
 
@@ -2427,26 +2427,26 @@  discard block
 block discarded – undo
2427 2427
 
2428 2428
 
2429 2429
 
2430
-	public function _registrations_report(){
2431
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2432
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2430
+	public function _registrations_report() {
2431
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2432
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2433 2433
 				array(
2434 2434
 					'page' => 'espresso_batch',
2435 2435
 					'batch' => 'file',
2436
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2437
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2438
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2439
-				)) );
2436
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2437
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2438
+					'return_url' => urlencode($this->_req_data['return_url']),
2439
+				)));
2440 2440
 		} else {
2441 2441
 			$new_request_args = array(
2442 2442
 				'export' => 'report',
2443 2443
 				'action' => 'registrations_report_for_event',
2444
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2444
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2445 2445
 			);
2446 2446
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2447 2447
 
2448
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2449
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2448
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2449
+				require_once(EE_CLASSES.'EE_Export.class.php');
2450 2450
 				$EE_Export = EE_Export::instance($this->_req_data);
2451 2451
 				$EE_Export->export();
2452 2452
 			}
@@ -2455,26 +2455,26 @@  discard block
 block discarded – undo
2455 2455
 
2456 2456
 
2457 2457
 
2458
-	public function _contact_list_export(){
2459
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2460
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2458
+	public function _contact_list_export() {
2459
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2460
+			require_once(EE_CLASSES.'EE_Export.class.php');
2461 2461
 			$EE_Export = EE_Export::instance($this->_req_data);
2462 2462
 			$EE_Export->export_attendees();
2463 2463
 		}
2464 2464
 	}
2465 2465
 
2466
-	public function _contact_list_report(){
2467
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2468
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2466
+	public function _contact_list_report() {
2467
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2468
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2469 2469
 				array(
2470 2470
 					'page' => 'espresso_batch',
2471 2471
 					'batch' => 'file',
2472
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2473
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2474
-				)) );
2472
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2473
+					'return_url' => urlencode($this->_req_data['return_url']),
2474
+				)));
2475 2475
 		} else {
2476
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2477
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2476
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2477
+				require_once(EE_CLASSES.'EE_Export.class.php');
2478 2478
 				$EE_Export = EE_Export::instance($this->_req_data);
2479 2479
 				$EE_Export->report_attendees();
2480 2480
 			}
@@ -2494,73 +2494,73 @@  discard block
 block discarded – undo
2494 2494
 	 * @return void
2495 2495
 	 */
2496 2496
 	protected function _duplicate_attendee() {
2497
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2497
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2498 2498
 		//verify we have necessary info
2499
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2500
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2501
-			$query_args = array( 'action' => $action );
2499
+		if (empty($this->_req_data['_REG_ID'])) {
2500
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2501
+			$query_args = array('action' => $action);
2502 2502
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2503 2503
 		}
2504 2504
 
2505 2505
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2506
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2506
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2507 2507
 		$attendee = $registration->attendee();
2508 2508
 
2509 2509
 		//remove relation of existing attendee on registration
2510
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2510
+		$registration->_remove_relation_to($attendee, 'Attendee');
2511 2511
 		//new attendee
2512 2512
 		$new_attendee = clone $attendee;
2513
-		$new_attendee->set( 'ATT_ID', 0 );
2513
+		$new_attendee->set('ATT_ID', 0);
2514 2514
 		$new_attendee->save();
2515 2515
 
2516 2516
 		//add new attendee to reg
2517
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2517
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2518 2518
 
2519
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2519
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2520 2520
 
2521 2521
 		//redirect to edit page for attendee
2522
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2522
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2523 2523
 
2524
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2524
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2525 2525
 	}
2526 2526
 
2527 2527
 
2528 2528
 	//related to cpt routes
2529 2529
 	protected function _insert_update_cpt_item($post_id, $post) {
2530 2530
 		$success = true;
2531
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2531
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2532 2532
 		//for attendee updates
2533
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2533
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2534 2534
 			//note we should only be UPDATING attendees at this point.
2535 2535
 			$updated_fields = array(
2536 2536
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2537 2537
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2538
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2538
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2539 2539
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2540 2540
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2541
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2542
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2543
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2544
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2545
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2546
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2541
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2542
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2543
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2544
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2545
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2546
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2547 2547
 				);
2548
-			foreach ( $updated_fields as $field => $value ) {
2548
+			foreach ($updated_fields as $field => $value) {
2549 2549
 				$attendee->set($field, $value);
2550 2550
 			}
2551 2551
 
2552 2552
 			$success = $attendee->save();
2553 2553
 
2554
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2555
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2556
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2557
-					throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback ) );
2554
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2555
+			foreach ($attendee_update_callbacks as $a_callback) {
2556
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2557
+					throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback));
2558 2558
 				}
2559 2559
 			}
2560 2560
 		}
2561 2561
 
2562
-		if ( $success === FALSE )
2563
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2562
+		if ($success === FALSE)
2563
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2564 2564
 
2565 2565
 	}
2566 2566
 
@@ -2580,17 +2580,17 @@  discard block
 block discarded – undo
2580 2580
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2581 2581
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2582 2582
 
2583
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2584
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2583
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2584
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2585 2585
 		}
2586 2586
 
2587
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2587
+		if (post_type_supports('espresso_attendees', 'comments')) {
2588 2588
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2589 2589
 		}
2590 2590
 
2591
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2592
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2593
-		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2591
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2592
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2593
+		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2594 2594
 	}
2595 2595
 
2596 2596
 
@@ -2599,10 +2599,10 @@  discard block
 block discarded – undo
2599 2599
 	 * @param  WP_Post $post wp post object
2600 2600
 	 * @return string        attendee contact info ( and form )
2601 2601
 	 */
2602
-	public function attendee_contact_info( $post ) {
2602
+	public function attendee_contact_info($post) {
2603 2603
 		//get attendee object ( should already have it )
2604 2604
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2605
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2605
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2606 2606
 		EEH_Template::display_template($template, $this->_template_args);
2607 2607
 	}
2608 2608
 
@@ -2618,12 +2618,12 @@  discard block
 block discarded – undo
2618 2618
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2619 2619
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2620 2620
 				new EE_Question_Form_Input(
2621
-				EE_Question::new_instance( array(
2621
+				EE_Question::new_instance(array(
2622 2622
 					'QST_ID' => 0,
2623 2623
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2624 2624
 					'QST_system' => 'admin-state'
2625 2625
 					)),
2626
-				EE_Answer::new_instance( array(
2626
+				EE_Answer::new_instance(array(
2627 2627
 					'ANS_ID' => 0,
2628 2628
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2629 2629
 					)),
@@ -2636,12 +2636,12 @@  discard block
 block discarded – undo
2636 2636
 			));
2637 2637
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2638 2638
 				new EE_Question_Form_Input(
2639
-				EE_Question::new_instance( array(
2639
+				EE_Question::new_instance(array(
2640 2640
 					'QST_ID' => 0,
2641 2641
 					'QST_display_text' => __('Country', 'event_espresso'),
2642 2642
 					'QST_system' => 'admin-country'
2643 2643
 					)),
2644
-				EE_Answer::new_instance( array(
2644
+				EE_Answer::new_instance(array(
2645 2645
 					'ANS_ID' => 0,
2646 2646
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2647 2647
 					)),
@@ -2652,8 +2652,8 @@  discard block
 block discarded – undo
2652 2652
 					'append_qstn_id' => FALSE
2653 2653
 					)
2654 2654
 				));
2655
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2656
-		EEH_Template::display_template($template, $this->_template_args );
2655
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2656
+		EEH_Template::display_template($template, $this->_template_args);
2657 2657
 
2658 2658
 	}
2659 2659
 
@@ -2663,11 +2663,11 @@  discard block
 block discarded – undo
2663 2663
 	*		@access protected
2664 2664
 	*		@return void
2665 2665
 	*/
2666
-	public function attendee_registrations_meta_box( $post ) {
2666
+	public function attendee_registrations_meta_box($post) {
2667 2667
 
2668 2668
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2669 2669
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2670
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2670
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2671 2671
 		EEH_Template::display_template($template, $this->_template_args);
2672 2672
 
2673 2673
 	}
@@ -2681,8 +2681,8 @@  discard block
 block discarded – undo
2681 2681
 	 * @return string        html for new form.
2682 2682
 	 */
2683 2683
 	public function after_title_form_fields($post) {
2684
-		if ( $post->post_type == 'espresso_attendees' ) {
2685
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2684
+		if ($post->post_type == 'espresso_attendees') {
2685
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2686 2686
 			$template_args['attendee'] = $this->_cpt_model_obj;
2687 2687
 			EEH_Template::display_template($template, $template_args);
2688 2688
 		}
@@ -2699,21 +2699,21 @@  discard block
 block discarded – undo
2699 2699
 	*		@access protected
2700 2700
 	*		@return void
2701 2701
 	*/
2702
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2702
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2703 2703
 
2704
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2704
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2705 2705
 
2706 2706
 		$ATT_MDL = EEM_Attendee::instance();
2707 2707
 
2708 2708
 		$success = 1;
2709 2709
 		//Checkboxes
2710
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2710
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2711 2711
 			// if array has more than one element than success message should be plural
2712
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2712
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2713 2713
 			// cycle thru checkboxes
2714
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2715
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2716
-				if ( !$updated ) {
2714
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2715
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2716
+				if ( ! $updated) {
2717 2717
 					$success = 0;
2718 2718
 				}
2719 2719
 			}
@@ -2722,18 +2722,18 @@  discard block
 block discarded – undo
2722 2722
 			// grab single id and delete
2723 2723
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2724 2724
 			//get attendee
2725
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2725
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2726 2726
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2727 2727
 			$updated = $att->save();
2728
-			if ( ! $updated ) {
2728
+			if ( ! $updated) {
2729 2729
 				$success = 0;
2730 2730
 			}
2731 2731
 
2732 2732
 		}
2733 2733
 
2734
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2735
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2736
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2734
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2735
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2736
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2737 2737
 
2738 2738
 	}
2739 2739
 
Please login to merge, or discard this patch.
payment_methods/Aim/help_tabs/payment_methods_overview_aim.help_tab.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 <?php _e('Adjust the settings for the Authorize.net AIM payment gateway.', 'event_espresso'); ?>
4 4
 </p>
5 5
 <p>
6
-<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso' ), "<a href='http://www.authorize.net/international/'  target='_blank'>","</a>" ); ?>
6
+<?php printf(__('See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso'), "<a href='http://www.authorize.net/international/'  target='_blank'>", "</a>"); ?>
7 7
 </p>
8 8
 <p><strong><?php _e('Authorize.net AIM Settings', 'event_espresso'); ?></strong></p>
9 9
 <ul>
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
 <?php _e('By logging into Authorize.net, you can change which payment fields are required by Authorize.net when processing payments. These settings affect both the Advanced Integration Method (AIM, this) and the Simple Integration Method (SIM, different). The payment method settings "Excluded Payment Form Fields" and "Required Payment Form Fields" allow you to change the billing form in Event Espresso to reflect your payment form settings in Authorize.net.', 'event_espresso'); ?>
29 29
 <br>
30 30
 <?php printf( 
31
-		__( 'To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'),
31
+		__('To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'),
32 32
 		'<a href="http://authorize.net" target="_blank">',
33 33
 		'</a>',
34 34
 		'<a href="https://monosnap.com/file/nebVteOkEXcdDIos88SojStWOifP23" target="_blank">',
35 35
 		'<a href="https://monosnap.com/file/WyxGJtev87TcDmdGBEZ2oi1xaBIQAm" target="_blank">',
36
-		'<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">');?>
36
+		'<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">'); ?>
37 37
 </li>
38 38
 <li>
39
-	<strong><?php _e( 'Server', 'event_espresso');?></strong>
40
-	<?php _e( 'Use this setting to change the server where Authorize.net AIM requests are sent. Change this to "Authorize.net/Akamai" before June 30th 2016 to verify your server wil work with Authorize.net\'s servers which will be in use after that date.', 'event_espresso' );?>
39
+	<strong><?php _e('Server', 'event_espresso'); ?></strong>
40
+	<?php _e('Use this setting to change the server where Authorize.net AIM requests are sent. Change this to "Authorize.net/Akamai" before June 30th 2016 to verify your server wil work with Authorize.net\'s servers which will be in use after that date.', 'event_espresso'); ?>
41 41
 </li>
42 42
 <li>
43 43
 <strong><?php _e('Button Image URL', 'event_espresso'); ?></strong><br />
Please login to merge, or discard this patch.
caffeinated/payment_methods/Aim/EE_PMT_Aim.pm.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_PMT_Aim extends EE_PMT_Base{
28
+class EE_PMT_Aim extends EE_PMT_Base {
29 29
 
30 30
 	
31 31
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		require_once($this->file_folder().'EEG_Aim.gateway.php');
49 49
 		$this->_gateway = new EEG_AIM();
50 50
 		$this->_pretty_name = __("Authorize.net AIM", 'event_espresso');
51
-		$this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' );
51
+		$this->_default_description = __('Please provide the following billing information.', 'event_espresso');
52 52
 		$this->_requires_https = true;
53 53
 	}
54 54
 
@@ -57,60 +57,60 @@  discard block
 block discarded – undo
57 57
 	 * @param \EE_Transaction $transaction
58 58
 	 * @return EE_Billing_Info_Form
59 59
 	 */
60
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
61
-		$billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array(
60
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
61
+		$billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array(
62 62
 			'name'=>'AIM_Form',
63 63
 			'subsections'=>array(
64 64
 				'credit_card'=>new EE_Credit_Card_Input(array(
65 65
 					'required'=>true,
66
-					'html_label_text' => __( 'Card Number', 'event_espresso' )
66
+					'html_label_text' => __('Card Number', 'event_espresso')
67 67
 				)),
68 68
 				'exp_month'=>new EE_Credit_Card_Month_Input(true, array(
69 69
 					'required'=>true,
70
-					'html_label_text' => __( 'Expiry Month', 'event_espresso' )
70
+					'html_label_text' => __('Expiry Month', 'event_espresso')
71 71
 				)),
72
-				'exp_year'=>new EE_Credit_Card_Year_Input( array( 
72
+				'exp_year'=>new EE_Credit_Card_Year_Input(array( 
73 73
 					'required'=>true,
74
-					'html_label_text' => __( 'Expiry Year', 'event_espresso' ) 
74
+					'html_label_text' => __('Expiry Year', 'event_espresso') 
75 75
 				)),
76
-				'cvv'=>new EE_CVV_Input( array(
76
+				'cvv'=>new EE_CVV_Input(array(
77 77
 					'required'=>true,
78
-					'html_label_text' => __( 'CVV', 'event_espresso' ) ) ),
78
+					'html_label_text' => __('CVV', 'event_espresso') )),
79 79
 			)
80 80
 		));
81
-		$billing_form->add_subsections( array(
82
-			'company' => new EE_Text_Input( array(
81
+		$billing_form->add_subsections(array(
82
+			'company' => new EE_Text_Input(array(
83 83
 				'html_label_text' => __('Company', 'event_espresso')
84 84
 			))
85
-		), 'email', false );
85
+		), 'email', false);
86 86
 		$billing_form->add_subsections( 
87 87
 				array(
88
-					'fax' => new EE_Text_Input( array(
88
+					'fax' => new EE_Text_Input(array(
89 89
 						'html_label_text' => __('Fax', 'event_espresso')
90 90
 					))
91 91
 				), 
92 92
 				'phone', 
93 93
 				false );
94 94
 		$settings_form = $this->settings_form();
95
-		if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) {
96
-				$billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() );
95
+		if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) {
96
+				$billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value());
97 97
 		}
98
-		if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) {
99
-			$required_inputs = $settings_form->get_input( 'required_billing_inputs' )->normalized_value();
98
+		if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) {
99
+			$required_inputs = $settings_form->get_input('required_billing_inputs')->normalized_value();
100 100
 			//only change the requirement of inputs which are allowed to be changed
101 101
 			$inputs_to_evaluate = array_intersect_key( 
102 102
 				$billing_form->inputs(), 
103 103
 				$this->billing_input_names()
104 104
 			);
105
-			foreach( $inputs_to_evaluate as $input_name => $input ) {
106
-				if( in_array( $input_name, $required_inputs ) ) {
107
-					$input->set_required( true );
105
+			foreach ($inputs_to_evaluate as $input_name => $input) {
106
+				if (in_array($input_name, $required_inputs)) {
107
+					$input->set_required(true);
108 108
 				} else {
109
-					$input->set_required( false );
109
+					$input->set_required(false);
110 110
 				}
111 111
 			}
112 112
 		}
113
-		return $this->apply_billing_form_debug_settings( $billing_form );
113
+		return $this->apply_billing_form_debug_settings($billing_form);
114 114
 	}
115 115
 
116 116
 
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
 	 * @param \EE_Billing_Info_Form $billing_form
123 123
 	 * @return \EE_Billing_Info_Form
124 124
 	 */
125
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
126
-		if ( $this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE )) {
127
-			$billing_form->get_input( 'credit_card' )->set_default( '4007000000027' );
128
-			$billing_form->get_input( 'exp_year' )->set_default( '2020' );
129
-			if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) {
130
-				$billing_form->get_input( 'cvv' )->set_default(( '123' ));
125
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
126
+		if ($this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE)) {
127
+			$billing_form->get_input('credit_card')->set_default('4007000000027');
128
+			$billing_form->get_input('exp_year')->set_default('2020');
129
+			if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) {
130
+				$billing_form->get_input('cvv')->set_default(('123'));
131 131
 			}
132 132
 			$billing_form->add_subsections(
133
-				array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ),
133
+				array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()),
134 134
 				'credit_card'
135 135
 			);
136 136
 			$billing_form->add_subsections(
137
-				array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php' )),
137
+				array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php')),
138 138
 				'first_name'
139 139
 			);
140 140
 		}
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 				'extra_meta_inputs'=>array(
155 155
 					'login_id'=>new EE_Text_Input(
156 156
 						array(
157
-							'html_label_text'=>  sprintf( __("Authorize.net API Login ID %s", "event_espresso"),  $this->get_help_tab_link() ),
157
+							'html_label_text'=>  sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()),
158 158
 							'required' => true )
159 159
 					),
160 160
 					'transaction_key'=>new EE_Text_Input(
161 161
 						array(
162
-							'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ),
162
+							'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()),
163 163
 							'required' => true )
164 164
 					),
165 165
 					'test_transactions'=>new EE_Yes_No_Input(
166 166
 						array(
167
-							'html_label_text'=>  sprintf( __("Send test transactions? %s", 'event_espresso'),  $this->get_help_tab_link() ),
167
+							'html_label_text'=>  sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()),
168 168
 							'html_help_text'=>  __("Send test transactions, even to live server", 'event_espresso'),
169 169
 							'default' => false,
170 170
 							'required' => true
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 					'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( 
174 174
 							$billing_input_names,
175 175
 					array( 
176
-						'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'),  $this->get_help_tab_link() ),
176
+						'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()),
177 177
 						'default' => array(
178 178
 							'company',
179 179
 							'fax',
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 					'required_billing_inputs' => new EE_Checkbox_Multi_Input( 
183 183
 						$billing_input_names,
184 184
 						array(
185
-							'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'),  $this->get_help_tab_link() ),
185
+							'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()),
186 186
 							'default' => array_diff(
187
-										array_keys( $billing_input_names ),
188
-										array( 'address2', 'phone', 'company', 'fax' )
187
+										array_keys($billing_input_names),
188
+										array('address2', 'phone', 'company', 'fax')
189 189
 							),
190 190
 							'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso')
191 191
 						)
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 						apply_filters(
195 195
 							'FHEE__EE_PMT_Aim__generate_new_settings_form__server_select_input__options',
196 196
 							array(
197
-								'authorize.net' => __( 'Authorize.net (default)', 'event_espresso' ),
198
-								'akamai' => __( 'Authorize.net/Akamai', 'event_espresso' )
197
+								'authorize.net' => __('Authorize.net (default)', 'event_espresso'),
198
+								'akamai' => __('Authorize.net/Akamai', 'event_espresso')
199 199
 							),
200 200
 							$this
201 201
 						),
202 202
 						array(
203
-							'html_label_text' => __( 'Server', 'event_espresso' ),
204
-							'html_help_text' => __( 'The Gateway Server where payment requests will be sent', 'event_espresso' )
203
+							'html_label_text' => __('Server', 'event_espresso'),
204
+							'html_help_text' => __('The Gateway Server where payment requests will be sent', 'event_espresso')
205 205
 						)
206 206
 					)
207 207
 						
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	public function billing_input_names() {
219 219
 		return array(
220
-			'first_name' => __( 'First Name', 'event_espresso' ),
220
+			'first_name' => __('First Name', 'event_espresso'),
221 221
 			'last_name' => __('Last Name', 'event_espresso'),
222
-			'email' => __( 'Email', 'event_espresso' ),
223
-			'company' => __( 'Company', 'event_espresso' ),
222
+			'email' => __('Email', 'event_espresso'),
223
+			'company' => __('Company', 'event_espresso'),
224 224
 			'address' => __('Address', 'event_espresso'),
225 225
 			'address2' => __('Address2', 'event_espresso'),
226 226
 			'city' => __('City', 'event_espresso'),
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			'country' => __('Country', 'event_espresso'),
229 229
 			'zip' =>  __('Zip', 'event_espresso'),
230 230
 			'phone' => __('Phone', 'event_espresso'),
231
-			'fax' => __( 'Fax', 'event_espresso' ),
231
+			'fax' => __('Fax', 'event_espresso'),
232 232
 			'cvv' => __('CVV', 'event_espresso')
233 233
 		);
234 234
 	}
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	 * @param type $billing_form
240 240
 	 * @return array
241 241
 	 */
242
-	protected function _get_billing_values_from_form( $billing_form ){
242
+	protected function _get_billing_values_from_form($billing_form) {
243 243
 		$all_billing_values_empty = array();
244
-		foreach( array_keys( $this->billing_input_names() ) as $input_name ) {
245
-			$all_billing_values_empty[ $input_name ] = '';
244
+		foreach (array_keys($this->billing_input_names()) as $input_name) {
245
+			$all_billing_values_empty[$input_name] = '';
246 246
 		}
247 247
 		return array_merge(
248 248
 				$all_billing_values_empty,
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 * @see EE_PMT_Base::help_tabs_config()
258 258
 	 * @return array
259 259
 	 */
260
-	public function help_tabs_config(){
260
+	public function help_tabs_config() {
261 261
 		return array(
262 262
 			$this->get_help_tab_name() => array(
263 263
 				'title' => __('Authorize.net AIM Settings', 'event_espresso'),
Please login to merge, or discard this patch.
caffeinated/payment_methods/Aim/EEG_Aim.gateway.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEG_Aim extends EE_Onsite_Gateway{
28
+class EEG_Aim extends EE_Onsite_Gateway {
29 29
 	protected $_login_id;
30 30
 	protected $_transaction_key;
31 31
 	protected $_server;
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 	 * @param EEG_Aim $gateway_object
95 95
 	 * @return string
96 96
 	 */
97
-	public function possibly_use_akamai_server( $url, EEG_Aim $gateway_object ) {
98
-		if( $gateway_object->_server === 'akamai' && ! $gateway_object->_debug_mode ) {
97
+	public function possibly_use_akamai_server($url, EEG_Aim $gateway_object) {
98
+		if ($gateway_object->_server === 'akamai' && ! $gateway_object->_debug_mode) {
99 99
 			return 'https://secure2.authorize.net/gateway/transact.dll';
100 100
 		} else {
101 101
 			return $url;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 
120 120
 	public function do_direct_payment($payment, $billing_info = null) {
121
-			add_filter( 'FHEE__EEG_Aim___get_server_url', array( $this, 'possibly_use_akamai_server' ), 10, 2 );
121
+			add_filter('FHEE__EEG_Aim___get_server_url', array($this, 'possibly_use_akamai_server'), 10, 2);
122 122
 			// Enable test mode if needed
123 123
 			//4007000000027  <-- test successful visa
124 124
 			//4222222222222  <-- test failure card number
@@ -129,17 +129,17 @@  discard block
 block discarded – undo
129 129
 			$primary_registrant = $transaction->primary_registration();
130 130
 			//if we're are charging for the full amount, show the normal line items
131 131
 			//and the itemized total adds up properly
132
-			if( $this->_can_easily_itemize_transaction_for( $payment ) ){
132
+			if ($this->_can_easily_itemize_transaction_for($payment)) {
133 133
 				$total_line_item = $transaction->total_line_item();
134 134
 				foreach ($total_line_item->get_items() as $line_item) {
135 135
 					$this->addLineItem($item_num++, $line_item->name(), $line_item->desc(), $line_item->quantity(), $line_item->unit_price(), 'N');
136 136
 					$order_description .= $line_item->desc().', ';
137 137
 				}
138
-				foreach($total_line_item->tax_descendants() as $tax_line_item){
138
+				foreach ($total_line_item->tax_descendants() as $tax_line_item) {
139 139
 					$this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N');
140 140
 				}
141
-			}else{//partial payment
142
-				$order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code());
141
+			} else {//partial payment
142
+				$order_description = sprintf(__("Payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code());
143 143
 			}
144 144
 
145 145
 
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
 			//start transaction
149 149
 			//if in debug mode, use authorize.net's sandbox id; otherwise use the Event Espresso partner id
150 150
 			$partner_id = $this->_debug_mode ? 'AAA100302' : 'AAA105363';
151
-			$this->setField( 'solution_id', $partner_id );
151
+			$this->setField('solution_id', $partner_id);
152 152
 			$this->setField('amount', $this->format_currency($payment->amount()));
153
-			$this->setField('description',substr(rtrim($order_description, ', '), 0, 255));
154
-			$this->_set_sensitive_billing_data( $billing_info );
153
+			$this->setField('description', substr(rtrim($order_description, ', '), 0, 255));
154
+			$this->_set_sensitive_billing_data($billing_info);
155 155
 			$this->setField('first_name', $billing_info['first_name']);
156 156
 			$this->setField('last_name', $billing_info['last_name']);
157 157
 			$this->setField('email', $billing_info['email']);
158 158
 			$this->setField('company', $billing_info['company']);
159 159
 			$this->setField('address', $billing_info['address'].' '.$billing_info['address2']);
160 160
 			$this->setField('city', $billing_info['city']);
161
-			$this->setField('state', $billing_info['state'] );
162
-			$this->setField('country', $billing_info['country'] );
161
+			$this->setField('state', $billing_info['state']);
162
+			$this->setField('country', $billing_info['country']);
163 163
 			$this->setField('zip', $billing_info['zip']);
164 164
 			$this->setField('fax', $billing_info['fax']);
165 165
 			$this->setField('cust_id', $primary_registrant->ID());
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 			//invoice_num would be nice to have itbe unique per SPCO page-load, taht way if users
168 168
 			//press back, they don't submit a duplicate. However, we may be keepin gthe user on teh same spco page
169 169
 			//in which case, we need to generate teh invoice num per request right here...
170
-			$this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
170
+			$this->setField('invoice_num', wp_generate_password(12, false)); //$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
171 171
 			//tell AIM that any duplicates sent in the next 5 minutes are to be ignored
172
-            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS );
172
+            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS);
173 173
 
174 174
 
175 175
 			if ($this->_test_transactions) {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 			//Capture response
180 180
 			$this->type = "AUTH_CAPTURE";
181 181
 			$response = $this->_sendRequest($payment);
182
-			if (!empty($response)){
182
+			if ( ! empty($response)) {
183 183
 				if ($this->_debug_mode) {
184 184
 					$txn_id = $response->invoice_number;
185 185
 				} else {
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
 				$payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status();
189 189
 				$payment->set_status($payment_status);
190 190
 				//make sure we interpret the AMT as a float, not an international string (where periods are thousand seperators)
191
-				$payment->set_amount( floatval( $response->amount ) );
192
-				$payment->set_gateway_response(sprintf("%s (code: %s)",$response->response_reason_text,$response->response_reason_code));
193
-				$payment->set_txn_id_chq_nmbr( $txn_id );
191
+				$payment->set_amount(floatval($response->amount));
192
+				$payment->set_gateway_response(sprintf("%s (code: %s)", $response->response_reason_text, $response->response_reason_code));
193
+				$payment->set_txn_id_chq_nmbr($txn_id);
194 194
 				$payment->set_extra_accntng($primary_registrant->reg_code());
195
-				$payment->set_details(print_r($response,true));
195
+				$payment->set_details(print_r($response, true));
196 196
 			} else {
197 197
 				$payment->set_status($this->_pay_model->failed_status());
198 198
 				$payment->set_gateway_response(__("There was no response from Authorize.net", 'event_espresso'));
199
-				$payment->set_details(print_r($response,true));
199
+				$payment->set_details(print_r($response, true));
200 200
 			}
201 201
 		return $payment;
202 202
 	}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * what billing data gets sent
208 208
 	 * @param array $billing_info
209 209
 	 */
210
-	protected function _set_sensitive_billing_data( $billing_info ) {
210
+	protected function _set_sensitive_billing_data($billing_info) {
211 211
 		$this->setField('card_num', $billing_info['credit_card']);
212 212
 		$this->setField('exp_date', $billing_info['exp_month'].$billing_info['exp_year']);
213 213
 		$this->setField('card_code', $billing_info['cvv']);
@@ -259,22 +259,22 @@  discard block
 block discarded – undo
259 259
 		$this->_x_post_fields['tran_key'] = $this->_transaction_key;
260 260
 		$x_keys = array();
261 261
 		foreach ($this->_x_post_fields as $key => $value) {
262
-			$x_keys[] = "x_$key=" . urlencode($value);
262
+			$x_keys[] = "x_$key=".urlencode($value);
263 263
 		}
264 264
 		// Add line items
265 265
 		foreach ($this->_additional_line_items as $key => $value) {
266
-			$x_keys[] =  "x_line_item=" . urlencode($value);
266
+			$x_keys[] = "x_line_item=".urlencode($value);
267 267
 		}
268 268
 		$this->_log_clean_request($x_keys, $payment);
269 269
 		$post_url = $this->_get_server_url();
270 270
 		$curl_request = curl_init($post_url);
271
-		curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&",$x_keys));
271
+		curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&", $x_keys));
272 272
 		curl_setopt($curl_request, CURLOPT_HEADER, 0);
273 273
 		curl_setopt($curl_request, CURLOPT_TIMEOUT, 45);
274 274
 		curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
275 275
 		curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 2);
276 276
 		if ($this->VERIFY_PEER) {
277
-			curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)) . '/ssl/cert.pem');
277
+			curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)).'/ssl/cert.pem');
278 278
 		} else {
279 279
 			curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false);
280 280
 		}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		$response = curl_exec($curl_request);
287 287
 
288 288
 		curl_close($curl_request);
289
-		$response_obj =  new EE_AuthorizeNetAIM_Response($response);
289
+		$response_obj = new EE_AuthorizeNetAIM_Response($response);
290 290
 
291 291
 		return $this->_log_and_clean_response($response_obj, $payment);
292 292
 	}
@@ -295,18 +295,18 @@  discard block
 block discarded – undo
295 295
 	 * @param array $request_array
296 296
 	 * @param EEI_Payment $payment
297 297
 	 */
298
-	protected function _log_clean_request($request_array,$payment){
299
-		$keys_to_filter_out = array( 'x_card_num', 'x_card_code', 'x_exp_date' );
300
-		foreach($request_array as $index => $keyvaltogether ) {
301
-			foreach( $keys_to_filter_out as $key ) {
302
-				if( strpos( $keyvaltogether, $key ) === 0 ){
298
+	protected function _log_clean_request($request_array, $payment) {
299
+		$keys_to_filter_out = array('x_card_num', 'x_card_code', 'x_exp_date');
300
+		foreach ($request_array as $index => $keyvaltogether) {
301
+			foreach ($keys_to_filter_out as $key) {
302
+				if (strpos($keyvaltogether, $key) === 0) {
303 303
 					//found it at the first character
304 304
 					//so its one of them
305
-					unset( $request_array[ $index ] );
305
+					unset($request_array[$index]);
306 306
 				}
307 307
 			}
308 308
 		}
309
-		$this->log(array('AIM Request sent:'=>$request_array),$payment);
309
+		$this->log(array('AIM Request sent:'=>$request_array), $payment);
310 310
 	}
311 311
 
312 312
 	/**
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	 * @param EE_AuthorizeNetAIM_Response $response_obj
315 315
 	 * @param EE_Payment $payment
316 316
 	 */
317
-	private function _log_and_clean_response($response_obj,$payment){
317
+	private function _log_and_clean_response($response_obj, $payment) {
318 318
 		$response_obj->account_number = '';
319
-		$this->log(array('AIM Response received:'=>$response_obj),$payment);
319
+		$this->log(array('AIM Response received:'=>$response_obj), $payment);
320 320
 		return $response_obj;
321 321
 	}
322 322
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 			// Split Array
413 413
 			$this->response = $response;
414 414
 			if ($encap_char) {
415
-				$this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1));
415
+				$this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1));
416 416
 			} else {
417 417
 				$this->_response_array = explode($delimiter, $response);
418 418
 			}
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 			$this->held = ($this->response_code == self::HELD);
483 483
 
484 484
 			if ($this->error || $this->declined || $this->held) {
485
-				$this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />' . $this->response_reason_text . '<br /><span class="response_code">Response Code: ' . $this->response_code . '<br /></span><span class="response_subcode">Response Subcode: ' . $this->response_subcode . '</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> ';
485
+				$this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />'.$this->response_reason_text.'<br /><span class="response_code">Response Code: '.$this->response_code.'<br /></span><span class="response_subcode">Response Subcode: '.$this->response_subcode.'</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> ';
486 486
 
487 487
 
488 488
 				/* $this->error_message = "AuthorizeNet Error:
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/RegistrationsReport.php 1 patch
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 use EventEspressoBatchRequest\Helpers\JobParameters;
20 20
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
21 21
 
22
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
23
-	exit( 'No direct script access allowed' );
22
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
23
+	exit('No direct script access allowed');
24 24
 }
25 25
 
26 26
 
@@ -35,35 +35,35 @@  discard block
 block discarded – undo
35 35
 	 * @throws BatchRequestException
36 36
 	 * @return JobStepResponse
37 37
 	 */
38
-	public function create_job( JobParameters $job_parameters ) {
39
-		$event_id = intval( $job_parameters->request_datum( 'EVT_ID', '0' ) );
40
-		if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_registrations', 'generating_report' ) ) {
38
+	public function create_job(JobParameters $job_parameters) {
39
+		$event_id = intval($job_parameters->request_datum('EVT_ID', '0'));
40
+		if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) {
41 41
 			throw new BatchRequestException(
42
-				__( 'You do not have permission to view registrations', 'event_espresso')
42
+				__('You do not have permission to view registrations', 'event_espresso')
43 43
 			);
44 44
 		}
45 45
 		$filepath = $this->create_file_from_job_with_name(
46 46
 			$job_parameters->job_id(),
47
-			$this->get_filename_from_event( $event_id )
47
+			$this->get_filename_from_event($event_id)
48 48
 		);
49
-		$job_parameters->add_extra_data( 'filepath', $filepath );
50
-		$question_data_for_columns = $this->_get_questions_for_report( $event_id );
51
-		$job_parameters->add_extra_data( 'questions_data', $question_data_for_columns );
52
-		$job_parameters->set_job_size( $this->count_units_to_process( $event_id ) );
49
+		$job_parameters->add_extra_data('filepath', $filepath);
50
+		$question_data_for_columns = $this->_get_questions_for_report($event_id);
51
+		$job_parameters->add_extra_data('questions_data', $question_data_for_columns);
52
+		$job_parameters->set_job_size($this->count_units_to_process($event_id));
53 53
 		//we should also set the header columns
54 54
 		$csv_data_for_row = $this->get_csv_data_for(
55 55
 			$event_id,
56 56
 			0,
57 57
 			1,
58
-			$job_parameters->extra_datum( 'questions_data' ) );
59
-		\EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true );
58
+			$job_parameters->extra_datum('questions_data') );
59
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
60 60
 		//if we actually processed a row there, record it
61
-		if( $job_parameters->job_size() ) {
62
-			$job_parameters->mark_processed( 1 );
61
+		if ($job_parameters->job_size()) {
62
+			$job_parameters->mark_processed(1);
63 63
 		}
64 64
 		return new JobStepResponse(
65 65
 			$job_parameters,
66
-			__( 'Registrations report started successfully...', 'event_espresso' )
66
+			__('Registrations report started successfully...', 'event_espresso')
67 67
 		);
68 68
 	}
69 69
 
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
 	 * @param int $event_id
75 75
 	 * @return string
76 76
 	 */
77
-	protected function get_filename_from_event( $event_id ) {
78
-		if( $event_id ){
79
-			$event_slug =  \EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' );
80
-			if( ! $event_slug ) {
81
-				$event_slug = __( 'unknown', 'event_espresso' );
77
+	protected function get_filename_from_event($event_id) {
78
+		if ($event_id) {
79
+			$event_slug = \EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug');
80
+			if ( ! $event_slug) {
81
+				$event_slug = __('unknown', 'event_espresso');
82 82
 			}
83
-		}else{
84
-			$event_slug = __( 'all', 'event_espresso' );
83
+		} else {
84
+			$event_slug = __('all', 'event_espresso');
85 85
 		}
86
-		return sprintf( "registrations-for-%s.csv", $event_slug );
86
+		return sprintf("registrations-for-%s.csv", $event_slug);
87 87
 	}
88 88
 
89 89
 	/**
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 	 * @param int|null $event_id
93 93
 	 * @return array of wpdb results for questions which are to be used for this report
94 94
 	 */
95
-	protected function _get_questions_for_report( $event_id ) {
95
+	protected function _get_questions_for_report($event_id) {
96 96
 		$question_query_params = array(
97 97
 			array(
98
-				'Answer.ANS_ID' => array( 'IS_NOT_NULL' ),
98
+				'Answer.ANS_ID' => array('IS_NOT_NULL'),
99 99
 			),
100
-			'group_by' => array( 'QST_ID' )
100
+			'group_by' => array('QST_ID')
101 101
 		);
102
-		if( $event_id ) {
102
+		if ($event_id) {
103 103
 			$question_query_params[0]['Answer.Registration.EVT_ID'] = $event_id;
104 104
 		}
105
-		return \EEM_Question::instance()->get_all_wpdb_results( $question_query_params );
105
+		return \EEM_Question::instance()->get_all_wpdb_results($question_query_params);
106 106
 	}
107 107
 
108 108
 
@@ -115,27 +115,27 @@  discard block
 block discarded – undo
115 115
 	 * @return JobStepResponse
116 116
 	 * @throws \EE_Error
117 117
 	 */
118
-	public function continue_job( JobParameters $job_parameters, $batch_size = 50 ) {
118
+	public function continue_job(JobParameters $job_parameters, $batch_size = 50) {
119 119
 		$csv_data = $this->get_csv_data_for(
120
-			$job_parameters->request_datum( 'EVT_ID', '0'),
120
+			$job_parameters->request_datum('EVT_ID', '0'),
121 121
 			$job_parameters->units_processed(),
122 122
 			$batch_size,
123
-			$job_parameters->extra_datum( 'questions_data' ) );
124
-		\EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false );
125
-		$units_processed = count( $csv_data );
126
-		$job_parameters->mark_processed( $units_processed );
123
+			$job_parameters->extra_datum('questions_data') );
124
+		\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
125
+		$units_processed = count($csv_data);
126
+		$job_parameters->mark_processed($units_processed);
127 127
 		$extra_response_data = array(
128 128
 			'file_url' => ''
129 129
 		);
130
-		if( $units_processed < $batch_size ) {
131
-			$job_parameters->set_status( JobParameters::status_complete );
132
-			$extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) );
130
+		if ($units_processed < $batch_size) {
131
+			$job_parameters->set_status(JobParameters::status_complete);
132
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
133 133
 		}
134 134
 		return new JobStepResponse(
135 135
 				$job_parameters,
136 136
 				sprintf(
137
-					__( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ),
138
-					count( $csv_data ) ),
137
+					__('Wrote %1$s rows to report CSV file...', 'event_espresso'),
138
+					count($csv_data) ),
139 139
 				$extra_response_data );
140 140
 	}
141 141
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @return array top-level keys are numeric, next-level keys are column headers
149 149
 	 *
150 150
 	 */
151
-	function get_csv_data_for( $event_id, $offset, $limit, $questions_for_these_regs_rows ) {
151
+	function get_csv_data_for($event_id, $offset, $limit, $questions_for_these_regs_rows) {
152 152
 		$reg_fields_to_include = array(
153 153
 			'TXN_ID',
154 154
 			'ATT_ID',
@@ -179,166 +179,166 @@  discard block
 block discarded – undo
179 179
 				array(
180 180
 					'OR' => array(
181 181
 						//don't include registrations from failed or abandoned transactions...
182
-						'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ),
182
+						'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)),
183 183
 						//unless the registration is approved, in which case include it regardless of transaction status
184 184
 						'STS_ID' => \EEM_Registration::status_id_approved
185 185
 						),
186
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
186
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
187 187
 					),
188
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
189
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ),
190
-				'limit' => array( $offset, $limit ),
188
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
189
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
190
+				'limit' => array($offset, $limit),
191 191
 				'caps' => \EEM_Base::caps_read_admin
192 192
 			),
193 193
 			$event_id
194 194
 		);
195
-		if( $event_id ){
196
-			$query_params[0]['EVT_ID'] =  $event_id;
197
-		}else{
198
-			$query_params[ 'force_join' ][] = 'Event';
195
+		if ($event_id) {
196
+			$query_params[0]['EVT_ID'] = $event_id;
197
+		} else {
198
+			$query_params['force_join'][] = 'Event';
199 199
 		}
200
-		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
200
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
201 201
 		//get all questions which relate to someone in this group
202 202
 		$registration_ids = array();
203
-		foreach( $registration_rows as $reg_row ) {
204
-			$registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] );
203
+		foreach ($registration_rows as $reg_row) {
204
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
205 205
 		}
206 206
 
207
-		foreach($registration_rows as $reg_row){
208
-			if ( is_array( $reg_row ) ) {
207
+		foreach ($registration_rows as $reg_row) {
208
+			if (is_array($reg_row)) {
209 209
 				$reg_csv_array = array();
210
-				if( ! $event_id ){
210
+				if ( ! $event_id) {
211 211
 					//get the event's name and Id
212
-					$reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( \EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] );
212
+					$reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
213 213
 				}
214
-				$is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false;
214
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
215 215
 				/*@var $reg_row EE_Registration */
216
-				foreach($reg_fields_to_include as $field_name){
216
+				foreach ($reg_fields_to_include as $field_name) {
217 217
 					$field = $reg_model->field_settings_for($field_name);
218
-					if($field_name == 'REG_final_price'){
219
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
220
-					}elseif( $field_name == 'REG_count' ){
221
-						$value = sprintf( __( '%s of %s', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) );
222
-					}elseif( $field_name == 'REG_date' ) {
223
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
224
-					}else{
225
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
218
+					if ($field_name == 'REG_final_price') {
219
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float');
220
+					}elseif ($field_name == 'REG_count') {
221
+						$value = sprintf(__('%s of %s', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size']));
222
+					}elseif ($field_name == 'REG_date') {
223
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html');
224
+					} else {
225
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]);
226 226
 					}
227 227
 					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
228
-					if($field_name == 'REG_final_price'){
228
+					if ($field_name == 'REG_final_price') {
229 229
 						//add a column named Currency after the final price
230 230
 						$reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code;
231 231
 					}
232 232
 				}
233 233
 				//get pretty status
234
-				$stati = \EEM_Status::instance()->localized_status( array(
235
-					$reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ),
236
-					$reg_row[ 'TransactionTable.STS_ID' ] => __( 'unknown', 'event_espresso' ) ),
234
+				$stati = \EEM_Status::instance()->localized_status(array(
235
+					$reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'),
236
+					$reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso') ),
237 237
 						FALSE,
238
-						'sentence' );
239
-				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ];
238
+						'sentence');
239
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
240 240
 				//get pretty transaction status
241
-				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'TransactionTable.STS_ID' ] ];
242
-				$reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'TransactionTable.TXN_total' ], 'localized_float' ) : '0.00';
243
-				$reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'TransactionTable.TXN_paid' ], 'localized_float' ) : '0.00';
241
+				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
242
+				$reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00';
243
+				$reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00';
244 244
 				$payment_methods = array();
245 245
 				$gateway_txn_ids_etc = array();
246 246
 				$payment_times = array();
247
-				if( $is_primary_reg && $reg_row[ 'TransactionTable.TXN_ID' ] ){
247
+				if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
248 248
 					$payments_info = \EEM_Payment::instance()->get_all_wpdb_results(
249 249
 							array(
250 250
 								array(
251
-									'TXN_ID' => $reg_row[ 'TransactionTable.TXN_ID' ],
251
+									'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
252 252
 									'STS_ID' => \EEM_Payment::status_id_approved
253 253
 								),
254
-								'force_join' => array( 'Payment_Method' ),
254
+								'force_join' => array('Payment_Method'),
255 255
 
256 256
 							),
257 257
 							ARRAY_A,
258 258
 							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
259 259
 
260
-					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
261
-						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
262
-						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
263
-						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
260
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
261
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
262
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
263
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : '';
264 264
 					}
265 265
 
266 266
 				}
267
-				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
268
-				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
269
-				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );
267
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
268
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
269
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
270 270
 
271 271
 				//get whether or not the user has checked in
272
-				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' );
272
+				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
273 273
 				//get ticket of registration and its price
274 274
 				$ticket_model = \EE_Registry::instance()->load_model('Ticket');
275
-				if( $reg_row[ 'Ticket.TKT_ID'] ) {
276
-					$ticket_name = \EEH_Export::prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] );
275
+				if ($reg_row['Ticket.TKT_ID']) {
276
+					$ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']);
277 277
 					$datetimes_strings = array();
278
-					foreach( \EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){
279
-						$datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display( \EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] );
278
+					foreach (\EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) {
279
+						$datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
280 280
 					}
281 281
 
282 282
 				} else {
283
-					$ticket_name = __( 'Unknown', 'event_espresso' );
284
-					$datetimes_strings = array( __( 'Unknown', 'event_espresso' ) );
283
+					$ticket_name = __('Unknown', 'event_espresso');
284
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
285 285
 				}
286 286
 				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
287 287
 				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
288 288
 				//get datetime(s) of registration
289 289
 
290 290
 				//add attendee columns
291
-				foreach($att_fields_to_include as $att_field_name){
291
+				foreach ($att_fields_to_include as $att_field_name) {
292 292
 					$field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name);
293
-					if( $reg_row[ 'Attendee_CPT.ID' ]){
294
-						if($att_field_name == 'STA_ID'){
295
-							$value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
296
-						}elseif($att_field_name == 'CNT_ISO'){
297
-							$value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
298
-						}else{
299
-							$value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
293
+					if ($reg_row['Attendee_CPT.ID']) {
294
+						if ($att_field_name == 'STA_ID') {
295
+							$value = \EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name');
296
+						}elseif ($att_field_name == 'CNT_ISO') {
297
+							$value = \EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name');
298
+						} else {
299
+							$value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
300 300
 						}
301
-					}else{
301
+					} else {
302 302
 						$value = '';
303 303
 					}
304 304
 
305
-					$reg_csv_array[ \EEH_Export::get_column_name_for_field($field_obj) ] = $value;
305
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value;
306 306
 				}
307 307
 
308 308
 				//make sure each registration has the same questions in the same order
309
-				foreach($questions_for_these_regs_rows as $question_row){
310
-					if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){
311
-						$reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null;
309
+				foreach ($questions_for_these_regs_rows as $question_row) {
310
+					if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) {
311
+						$reg_csv_array[$question_row['Question.QST_admin_label']] = null;
312 312
 					}
313 313
 				}
314 314
 				$answers = \EEM_Answer::instance()->get_all_wpdb_results(
315 315
 					array(
316
-						array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ),
317
-						'force_join' => array( 'Question' )
316
+						array('REG_ID' => $reg_row['Registration.REG_ID']),
317
+						'force_join' => array('Question')
318 318
 					)
319 319
 				);
320 320
 				//now fill out the questions THEY answered
321
-				foreach( $answers as $answer_row ){
322
-					if( $answer_row[ 'Question.QST_ID' ] ){
321
+				foreach ($answers as $answer_row) {
322
+					if ($answer_row['Question.QST_ID']) {
323 323
 						$question_label = \EEH_Export::prepare_value_from_db_for_display(
324 324
 							\EEM_Question::instance(),
325 325
 							'QST_admin_label',
326
-							$answer_row[ 'Question.QST_admin_label' ]
326
+							$answer_row['Question.QST_admin_label']
327 327
 						);
328 328
 					} else {
329
-						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
329
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
330 330
 					}
331
-					if ( isset( $answer_row[ 'Question.QST_type' ] )
332
-						 && $answer_row[ 'Question.QST_type' ] == \EEM_Question::QST_type_state
331
+					if (isset($answer_row['Question.QST_type'])
332
+						 && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state
333 333
 					) {
334
-						$reg_csv_array[ $question_label ] = \EEM_State::instance()->get_state_name_by_ID(
335
-							$answer_row[ 'Answer.ANS_value' ]
334
+						$reg_csv_array[$question_label] = \EEM_State::instance()->get_state_name_by_ID(
335
+							$answer_row['Answer.ANS_value']
336 336
 						);
337 337
 					} else {
338
-						$reg_csv_array[ $question_label ] = \EEH_Export::prepare_value_from_db_for_display(
338
+						$reg_csv_array[$question_label] = \EEH_Export::prepare_value_from_db_for_display(
339 339
 							\EEM_Answer::instance(),
340 340
 							'ANS_value',
341
-							$answer_row[ 'Answer.ANS_value' ]
341
+							$answer_row['Answer.ANS_value']
342 342
 						);
343 343
 					}
344 344
 				}
@@ -349,17 +349,17 @@  discard block
 block discarded – undo
349 349
 			}
350 350
 		}
351 351
 		//if we couldn't export anything, we want to at least show the column headers
352
-		if ( empty( $registrations_csv_ready_array ) ) {
352
+		if (empty($registrations_csv_ready_array)) {
353 353
 			$reg_csv_array = array();
354 354
 			$model_and_fields_to_include = array(
355 355
 				'Registration' => $reg_fields_to_include,
356 356
 				'Attendee'     => $att_fields_to_include
357 357
 			);
358
-			foreach ( $model_and_fields_to_include as $model_name => $field_list ) {
359
-				$model = \EE_Registry::instance()->load_model( $model_name );
360
-				foreach ( $field_list as $field_name ) {
361
-					$field = $model->field_settings_for( $field_name );
362
-					$reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null;
358
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
359
+				$model = \EE_Registry::instance()->load_model($model_name);
360
+				foreach ($field_list as $field_name) {
361
+					$field = $model->field_settings_for($field_name);
362
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null;
363 363
 				}
364 364
 			}
365 365
 			$registrations_csv_ready_array[] = $reg_csv_array;
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 * @param int $event_id
376 376
 	 * @return int
377 377
 	 */
378
-	public function count_units_to_process( $event_id ) {
378
+	public function count_units_to_process($event_id) {
379 379
 		//use the legacy filter
380 380
 		$query_params = apply_filters(
381 381
 			'FHEE__EE_Export__report_registration_for_event',
@@ -383,24 +383,24 @@  discard block
 block discarded – undo
383 383
 				array(
384 384
 					'OR' => array(
385 385
 						//don't include registrations from failed or abandoned transactions...
386
-						'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ),
386
+						'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)),
387 387
 						//unless the registration is approved, in which case include it regardless of transaction status
388 388
 						'STS_ID' => \EEM_Registration::status_id_approved
389 389
 						),
390
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
390
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
391 391
 					),
392
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
393
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ),
392
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
393
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
394 394
 				'caps' => \EEM_Base::caps_read_admin
395 395
 			),
396 396
 			$event_id
397 397
 		);
398
-		if( $event_id ){
399
-			$query_params[0]['EVT_ID'] =  $event_id;
398
+		if ($event_id) {
399
+			$query_params[0]['EVT_ID'] = $event_id;
400 400
 		} else {
401
-			$query_params[ 'force_join' ][] = 'Event';
401
+			$query_params['force_join'][] = 'Event';
402 402
 		}
403
-		return \EEM_Registration::instance()->count( $query_params );
403
+		return \EEM_Registration::instance()->count($query_params);
404 404
 	}
405 405
 
406 406
 
@@ -411,13 +411,13 @@  discard block
 block discarded – undo
411 411
 	 * @param JobParameters $job_parameters
412 412
 	 * @return boolean
413 413
 	 */
414
-	public function cleanup_job( JobParameters $job_parameters ){
414
+	public function cleanup_job(JobParameters $job_parameters) {
415 415
 		$this->_file_helper->delete(
416
-			\EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ),
416
+			\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
417 417
 			true,
418 418
 			'd'
419 419
 		);
420
-		return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) );
420
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
421 421
 	}
422 422
 }
423 423
 
Please login to merge, or discard this patch.
core/db_models/EEM_Transaction.model.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
2
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 /**
4 4
  *
5 5
  * Transaction Model
@@ -67,36 +67,36 @@  discard block
 block discarded – undo
67 67
 	 * @return EEM_Transaction
68 68
 	 * @throws \EE_Error
69 69
 	 */
70
-	protected function __construct( $timezone ) {
71
-		$this->singular_item = __('Transaction','event_espresso');
72
-		$this->plural_item = __('Transactions','event_espresso');
70
+	protected function __construct($timezone) {
71
+		$this->singular_item = __('Transaction', 'event_espresso');
72
+		$this->plural_item = __('Transactions', 'event_espresso');
73 73
 
74 74
 		$this->_tables = array(
75
-			'TransactionTable'=>new EE_Primary_Table('esp_transaction','TXN_ID')
75
+			'TransactionTable'=>new EE_Primary_Table('esp_transaction', 'TXN_ID')
76 76
 		);
77 77
 		$this->_fields = array(
78 78
 			'TransactionTable'=>array(
79
-				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso')),
80
-				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created','event_espresso'), false, time(), $timezone ),
81
-				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction','event_espresso'), false, 0),
82
-				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date','event_espresso'), false, 0),
83
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
84
-				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data','event_espresso'), true, ''),
85
-				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt','event_espresso'), true, ''),
79
+				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')),
80
+				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, time(), $timezone),
81
+				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0),
82
+				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0),
83
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
84
+				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''),
85
+				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, ''),
86 86
 				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Last Used Payment Method", 'event_espresso'), true, NULL, 'Payment_Method'),
87
-				'TXN_reg_steps' => new EE_Serialized_Text_Field( 'TXN_reg_steps', __( 'Registration Steps', 'event_espresso' ), FALSE, array() ),
87
+				'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', __('Registration Steps', 'event_espresso'), FALSE, array()),
88 88
 			)
89 89
 		);
90 90
 		$this->_model_relations = array(
91 91
 			'Registration'=>new EE_Has_Many_Relation(),
92 92
 			'Payment'=>new EE_Has_Many_Relation(),
93 93
 			'Status'=>new EE_Belongs_To_Relation(),
94
-			'Line_Item'=>new EE_Has_Many_Relation(false),//you can delete a transaction without needing to delete its line items
94
+			'Line_Item'=>new EE_Has_Many_Relation(false), //you can delete a transaction without needing to delete its line items
95 95
 			'Payment_Method'=>new EE_Belongs_To_Relation(),
96 96
 			'Message' => new EE_Has_Many_Relation()
97 97
 		);
98 98
 		$this->_model_chain_to_wp_user = 'Registration.Event';
99
-		parent::__construct( $timezone );
99
+		parent::__construct($timezone);
100 100
 
101 101
 	}
102 102
 
@@ -107,22 +107,22 @@  discard block
 block discarded – undo
107 107
 	 * @param string $period
108 108
 	 * @return \stdClass[]
109 109
 	 */
110
-	public function get_revenue_per_day_report( $period = '-1 month' ) {
111
-		$sql_date = $this->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', strtotime( $period ) ), 'Y-m-d H:i:s', 'UTC' );
110
+	public function get_revenue_per_day_report($period = '-1 month') {
111
+		$sql_date = $this->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', strtotime($period)), 'Y-m-d H:i:s', 'UTC');
112 112
 
113
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'TXN_timestamp' );
113
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp');
114 114
 		return $this->_get_all_wpdb_results(
115 115
 			array(
116 116
 				array(
117
-					'TXN_timestamp' => array( '>=', $sql_date )
117
+					'TXN_timestamp' => array('>=', $sql_date)
118 118
 				),
119 119
 				'group_by' => 'txnDate',
120
-				'order_by' => array( 'TXN_timestamp' => 'ASC' )
120
+				'order_by' => array('TXN_timestamp' => 'ASC')
121 121
 			),
122 122
 			OBJECT,
123 123
 			array(
124
-				'txnDate' => array( 'DATE(' . $query_interval . ')', '%s' ),
125
-				'revenue' => array( 'SUM(TransactionTable.TXN_paid)', '%d' )
124
+				'txnDate' => array('DATE('.$query_interval.')', '%s'),
125
+				'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d')
126 126
 			)
127 127
 		);
128 128
 	}
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
 	 * @throws \EE_Error
138 138
 	 * @return mixed
139 139
 	 */
140
-	public function get_revenue_per_event_report( $period = '-1 month' ) {
140
+	public function get_revenue_per_event_report($period = '-1 month') {
141 141
 		global $wpdb;
142
-		$transaction_table = $wpdb->prefix . 'esp_transaction';
143
-		$registration_table = $wpdb->prefix . 'esp_registration';
142
+		$transaction_table = $wpdb->prefix.'esp_transaction';
143
+		$registration_table = $wpdb->prefix.'esp_registration';
144 144
 		$event_table = $wpdb->posts;
145
-		$payment_table = $wpdb->prefix . 'esp_payment';
146
-		$sql_date = date( 'Y-m-d H:i:s', strtotime( $period ) );
145
+		$payment_table = $wpdb->prefix.'esp_payment';
146
+		$sql_date = date('Y-m-d H:i:s', strtotime($period));
147 147
 		$approved_payment_status = EEM_Payment::status_id_approved;
148 148
 		$extra_event_on_join = '';
149 149
 		//exclude events not authored by user if permissions in effect
150
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
151
-			$extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id();
150
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
151
+			$extra_event_on_join = ' AND Event.post_author = '.get_current_user_id();
152 152
 		}
153 153
 
154 154
 		return $wpdb->get_results(
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 	 * @param string $reg_url_link
189 189
 	 * @return EE_Transaction
190 190
 	 */
191
-	public function get_transaction_from_reg_url_link( $reg_url_link = '' ){
192
-		return $this->get_one( array(
191
+	public function get_transaction_from_reg_url_link($reg_url_link = '') {
192
+		return $this->get_one(array(
193 193
 			array(
194
-				'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' )
194
+				'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '')
195 195
 			)
196 196
 		));
197 197
 	}
@@ -208,16 +208,16 @@  discard block
 block discarded – undo
208 208
 	 * @return boolean
209 209
 	 * @throws \EE_Error
210 210
 	 */
211
-	public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){
211
+	public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) {
212 212
 		EE_Error::doing_it_wrong(
213
-			__CLASS__ . '::' . __FUNCTION__,
214
-			sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ),
213
+			__CLASS__.'::'.__FUNCTION__,
214
+			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
215 215
 			'4.6.0'
216 216
 		);
217 217
 		/** @type EE_Transaction_Processor $transaction_processor */
218
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
218
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
219 219
 		return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment(
220
-			$this->ensure_is_obj( $transaction_obj_or_id )
220
+			$this->ensure_is_obj($transaction_obj_or_id)
221 221
 		);
222 222
 	}
223 223
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			array(
250 250
 				0 => array(
251 251
 					'STS_ID' => EEM_Transaction::failed_status_code,
252
-					'TXN_timestamp' => array( '<', time() - $time_to_leave_alone )
252
+					'TXN_timestamp' => array('<', time() - $time_to_leave_alone)
253 253
 				)
254 254
 			),
255 255
 			$time_to_leave_alone
@@ -262,29 +262,29 @@  discard block
 block discarded – undo
262 262
 		 */
263 263
 		$txn_ids = apply_filters(
264 264
 			'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete',
265
-			EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ),
265
+			EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'),
266 266
 			$time_to_leave_alone
267 267
 		);
268 268
 		//now that we have the ids to delete
269
-		if ( ! empty( $txn_ids ) && is_array( $txn_ids ) ) {
269
+		if ( ! empty($txn_ids) && is_array($txn_ids)) {
270 270
 			// first, make sure these TXN's are removed the "ee_locked_transactions" array
271
-			EEM_Transaction::unset_locked_transactions( $txn_ids );
271
+			EEM_Transaction::unset_locked_transactions($txn_ids);
272 272
 			// let's get deletin'...
273 273
 			// Why no wpdb->prepare?  Because the data is trusted.
274 274
 			// We got the ids from the original query to get them FROM
275 275
 			// the db (which is sanitized) so no need to prepare them again.
276
-			$query   = '
276
+			$query = '
277 277
 				DELETE
278
-				FROM ' . $this->table() . '
278
+				FROM ' . $this->table().'
279 279
 				WHERE
280
-					TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')';
281
-			$deleted = $wpdb->query( $query );
280
+					TXN_ID IN ( ' . implode(",", $txn_ids).')';
281
+			$deleted = $wpdb->query($query);
282 282
 		}
283
-		if ( $deleted ) {
283
+		if ($deleted) {
284 284
 			/**
285 285
 			 * Allows code to do something after the transactions have been deleted.
286 286
 			 */
287
-			do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids );
287
+			do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids);
288 288
 		}
289 289
 		return $deleted;
290 290
 	}
@@ -295,17 +295,17 @@  discard block
 block discarded – undo
295 295
 	 * @param array $transaction_IDs
296 296
 	 * @return bool
297 297
 	 */
298
-	public static function unset_locked_transactions( array $transaction_IDs ) {
299
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
298
+	public static function unset_locked_transactions(array $transaction_IDs) {
299
+		$locked_transactions = get_option('ee_locked_transactions', array());
300 300
 		$update = false;
301
-		foreach ( $transaction_IDs as $TXN_ID ) {
302
-			if ( isset( $locked_transactions[ $TXN_ID ] ) ) {
303
-				unset( $locked_transactions[ $TXN_ID ] );
301
+		foreach ($transaction_IDs as $TXN_ID) {
302
+			if (isset($locked_transactions[$TXN_ID])) {
303
+				unset($locked_transactions[$TXN_ID]);
304 304
 				$update = true;
305 305
 			}
306 306
 		}
307
-		if ( $update ) {
308
-			update_option( 'ee_locked_transactions', $locked_transactions );
307
+		if ($update) {
308
+			update_option('ee_locked_transactions', $locked_transactions);
309 309
 		}
310 310
 		return $update;
311 311
 	}
Please login to merge, or discard this patch.