Completed
Branch BUG-9492-refactor-activation-l... (cb6da3)
by
unknown
23:45 queued 12:49
created
core/helpers/EEH_Venue_View.helper.php 2 patches
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.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -208,7 +208,6 @@
 block discarded – undo
208 208
 	/**
209 209
 	 * If a venue is password protected, this will return the password form for gaining access
210 210
 	 * returns an empty string otherwise
211
-
212 211
 	 * @param bool $VNU_ID venue to check (optional). If not included will use internally derived venue object.
213 212
 	 *
214 213
 	 * @return string
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.
registrations/form_sections/EE_Registration_Custom_Questions_Form.form.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since		 	   4.8.30.rc.009
14 14
  *
15 15
  */
16
-if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
17
-	exit( 'No direct script access allowed' );
16
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
17
+	exit('No direct script access allowed');
18 18
 }
19 19
 
20
-class EE_Registration_Custom_Questions_Form extends EE_Form_Section_Proper{
20
+class EE_Registration_Custom_Questions_Form extends EE_Form_Section_Proper {
21 21
 	/**
22 22
 	 *
23 23
 	 * @var EE_Registration
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
 	 * @param EE_Registration $reg
30 30
 	 * @param array $options
31 31
 	 */
32
-	public function __construct( EE_Registration $reg, $options = array() ) {
32
+	public function __construct(EE_Registration $reg, $options = array()) {
33 33
 		$this->_registration = $reg;
34
-		if( ! isset( $options[ 'layout_strategy' ] ) ) {
35
-			$options[ 'layout_strategy' ] = new EE_Admin_Two_Column_Layout();
34
+		if ( ! isset($options['layout_strategy'])) {
35
+			$options['layout_strategy'] = new EE_Admin_Two_Column_Layout();
36 36
 		}
37
-		if( ! isset( $options[ 'html_id' ] ) ) {
38
-			$options[ 'html_id' ] = 'reg-admin-attendee-questions-frm';
37
+		if ( ! isset($options['html_id'])) {
38
+			$options['html_id'] = 'reg-admin-attendee-questions-frm';
39 39
 		}
40 40
 		$this->build_form_from_registration();
41
-		parent::__construct( $options );
41
+		parent::__construct($options);
42 42
 	}
43 43
 
44 44
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 	public function build_form_from_registration() {
54 54
 		$reg = $this->get_registration();
55
-		if( ! $reg instanceof EE_Registration ) {
56
-			throw new EE_Error( __( 'We cannot build the registration custom questions form because there is no registration set on it yet', 'event_espresso') );
55
+		if ( ! $reg instanceof EE_Registration) {
56
+			throw new EE_Error(__('We cannot build the registration custom questions form because there is no registration set on it yet', 'event_espresso'));
57 57
 		}
58 58
 		//we want to get all their question groups
59 59
 		$question_groups = EEM_Question_Group::instance()->get_all(
@@ -63,16 +63,16 @@  discard block
 block discarded – undo
63 63
 					'Event_Question_Group.EQG_primary' => $reg->count() == 1 ? TRUE : FALSE,
64 64
 					'OR' => array(
65 65
 						'Question.QST_system*blank' =>  '',
66
-						'Question.QST_system*null' => array( 'IS_NULL' ) 
66
+						'Question.QST_system*null' => array('IS_NULL') 
67 67
 					)
68 68
 				),
69
-				'order_by' => array( 'QSG_order' => 'ASC' )
69
+				'order_by' => array('QSG_order' => 'ASC')
70 70
 			)
71 71
 		);
72 72
 		//get each question groups questions
73
-		foreach( $question_groups as $question_group ) {
74
-			if ( $question_group instanceof EE_Question_Group ) {
75
-				$this->_subsections[ $question_group->ID() ] = $this->build_subform_from_question_group(
73
+		foreach ($question_groups as $question_group) {
74
+			if ($question_group instanceof EE_Question_Group) {
75
+				$this->_subsections[$question_group->ID()] = $this->build_subform_from_question_group(
76 76
 					$question_group,
77 77
 					$reg
78 78
 				);
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 	 * @return \EE_Form_Section_Proper
90 90
 	 * @throws \EE_Error
91 91
 	 */
92
-	public function build_subform_from_question_group( $question_group, $registration ) {
93
-		if( ! $question_group instanceof EE_Question_Group ||
92
+	public function build_subform_from_question_group($question_group, $registration) {
93
+		if ( ! $question_group instanceof EE_Question_Group ||
94 94
 			! $registration instanceof EE_Registration) {
95
-			throw new EE_Error( __( 'A valid question group and registration must be passed to EE_Registration_Custom_Question_Form', 'event_espresso' ) );
95
+			throw new EE_Error(__('A valid question group and registration must be passed to EE_Registration_Custom_Question_Form', 'event_espresso'));
96 96
 		}
97 97
 		$parts_of_subsection = array(
98 98
 			'title' => new EE_Form_Section_HTML(
99
-					EEH_HTML::h5( $question_group->name(),
99
+					EEH_HTML::h5($question_group->name(),
100 100
 					$question_group->identifier(),
101
-					'espresso-question-group-title-h5 section-title' )
101
+					'espresso-question-group-title-h5 section-title')
102 102
 				)
103 103
 		);
104 104
 		$questions = $question_group->questions( 
@@ -106,17 +106,17 @@  discard block
 block discarded – undo
106 106
 				array( 
107 107
 					'OR' => array(
108 108
 						'QST_system*blank' => '',
109
-						'QST_system*null' => array( 'IS_NULL' )
109
+						'QST_system*null' => array('IS_NULL')
110 110
 					)
111 111
 				)
112 112
 			)
113 113
 		);
114
-		foreach( $questions as $question ) {
115
-			$parts_of_subsection[ $question->ID() ] = $question->generate_form_input( $registration );
114
+		foreach ($questions as $question) {
115
+			$parts_of_subsection[$question->ID()] = $question->generate_form_input($registration);
116 116
 		}
117
-		$parts_of_subsection[ 'edit_link' ] = new EE_Form_Section_HTML(
118
-				'<tr><th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
119
-					<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
117
+		$parts_of_subsection['edit_link'] = new EE_Form_Section_HTML(
118
+				'<tr><th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" title="'.esc_attr__('click to edit question', 'event_espresso').'">
119
+					<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
120 120
 					<div class="dashicons dashicons-edit"></div>
121 121
 				</a></td></tr>'
122 122
 			);
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 	protected function _normalize($req_data) {
137 137
 		$this->_received_submission = TRUE;
138 138
 		$this->_validation_errors = array();
139
-		foreach($this->get_validatable_subsections() as $subsection){
140
-			if( $subsection->form_data_present_in( $req_data ) ) {
141
-				try{
139
+		foreach ($this->get_validatable_subsections() as $subsection) {
140
+			if ($subsection->form_data_present_in($req_data)) {
141
+				try {
142 142
 					$subsection->_normalize($req_data);
143
-				}catch( EE_Validation_Error $e ){
144
-					$subsection->add_validation_error( $e );
143
+				} catch (EE_Validation_Error $e) {
144
+					$subsection->add_validation_error($e);
145 145
 				}
146 146
 			}
147 147
 		}
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 	 * calling parent::_validate() first.
157 157
 	 */
158 158
 	protected function _validate() {
159
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
160
-			if( $subsection->form_data_present_in( array_merge( $_GET, $_POST ) ) ) {
161
-				if(method_exists($this,'_validate_'.$subsection_name)){
162
-					call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
159
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
160
+			if ($subsection->form_data_present_in(array_merge($_GET, $_POST))) {
161
+				if (method_exists($this, '_validate_'.$subsection_name)) {
162
+					call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
163 163
 				}
164 164
 				$subsection->_validate();
165
-			} elseif( $subsection instanceof EE_Form_Section_Proper ) {
165
+			} elseif ($subsection instanceof EE_Form_Section_Proper) {
166 166
 				$subsection->_received_submission = true;
167 167
 			}
168 168
 		}
Please login to merge, or discard this patch.
core/db_classes/EE_Export.class.php 1 patch
Spacing   +170 added lines, -170 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
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3 3
 /**
4 4
  * EE_Export class
5 5
  * 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	  * @access private
40 40
 	  * @param array $request_data
41 41
 	  */
42
- 	private function __construct( $request_data = array() ) {
42
+ 	private function __construct($request_data = array()) {
43 43
 		$this->_req_data = $request_data;
44
-		$this->today = date("Y-m-d",time());
45
-		require_once( EE_CLASSES . 'EE_CSV.class.php' );
46
-		$this->EE_CSV= EE_CSV::instance();
44
+		$this->today = date("Y-m-d", time());
45
+		require_once(EE_CLASSES.'EE_CSV.class.php');
46
+		$this->EE_CSV = EE_CSV::instance();
47 47
 	}
48 48
 
49 49
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	  * @param array $request_data
56 56
 	  * @return \EE_Export
57 57
 	  */
58
-	public static function instance( $request_data = array() ) {
58
+	public static function instance($request_data = array()) {
59 59
 		// check if class object is instantiated
60
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Export )) {
61
-			self::$_instance = new self( $request_data );
60
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Export)) {
61
+			self::$_instance = new self($request_data);
62 62
 		}
63 63
 		return self::$_instance;
64 64
 	}
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 	public function export() {
73 73
 
74 74
 		// in case of bulk exports, the "actual" action will be in action2, but first check regular action for "export" keyword
75
-		if ( isset( $this->_req_data['action'] ) && strpos( $this->_req_data['action'], 'export' ) === FALSE ) {
75
+		if (isset($this->_req_data['action']) && strpos($this->_req_data['action'], 'export') === FALSE) {
76 76
 			// check if action2 has export action
77
-			if ( isset( $this->_req_data['action2'] ) && strpos( $this->_req_data['action2'], 'export' ) !== FALSE ) {
77
+			if (isset($this->_req_data['action2']) && strpos($this->_req_data['action2'], 'export') !== FALSE) {
78 78
 				// whoop! there it is!
79 79
 				$this->_req_data['action'] = $this->_req_data['action2'];
80 80
 			}
81 81
 		}
82 82
 
83
-		$this->_req_data['export'] = isset( $this->_req_data['export'] ) ? $this->_req_data['export'] : '';
83
+		$this->_req_data['export'] = isset($this->_req_data['export']) ? $this->_req_data['export'] : '';
84 84
 
85 85
 		switch ($this->_req_data['export']) {
86 86
 			case 'report':
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 					break;
95 95
 
96 96
 					case 'registrations_report_for_event':
97
-						$this->report_registrations_for_event( $this->_req_data['EVT_ID'] );
97
+						$this->report_registrations_for_event($this->_req_data['EVT_ID']);
98 98
 					break;
99 99
 
100 100
 					case 'attendees':
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 					break;
107 107
 
108 108
 					default:
109
-						EE_Error::add_error(__('An error occurred! The requested export report could not be found.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ ) ;
109
+						EE_Error::add_error(__('An error occurred! The requested export report could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
110 110
 						return FALSE;
111 111
 					break;
112 112
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * Downloads a CSV file with all the columns, but no data. This should be used for importing
125 125
 	 * @return null kills execution
126 126
 	 */
127
-	function export_sample(){
127
+	function export_sample() {
128 128
 		$event = EEM_Event::instance()->get_one();
129 129
 		$this->_req_data['EVT_ID'] = $event->ID();
130 130
 		$this->export_all_event_data();
@@ -150,23 +150,23 @@  discard block
 block discarded – undo
150 150
 		$state_country_query_params = array();
151 151
 		$question_group_query_params = array();
152 152
 		$question_query_params = array();
153
-		if ( isset( $this->_req_data['EVT_ID'] )) {
153
+		if (isset($this->_req_data['EVT_ID'])) {
154 154
 			// do we have an array of IDs ?
155 155
 
156
-			if ( is_array( $this->_req_data['EVT_ID'] )) {
157
-				$EVT_IDs =  array_map( 'sanitize_text_field', $this->_req_data['EVT_ID'] );
158
-				$value_to_equal = array('IN',$EVT_IDs);
156
+			if (is_array($this->_req_data['EVT_ID'])) {
157
+				$EVT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_ID']);
158
+				$value_to_equal = array('IN', $EVT_IDs);
159 159
 				$filename = 'events';
160 160
 			} else {
161 161
 				// generate regular where = clause
162
-				$EVT_ID = absint( $this->_req_data['EVT_ID'] );
162
+				$EVT_ID = absint($this->_req_data['EVT_ID']);
163 163
 				$value_to_equal = $EVT_ID;
164 164
 				$event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($EVT_ID);
165 165
 
166
-				$filename = 'event-' . ( $event instanceof EE_Event ? $event->slug() : __( 'unknown', 'event_espresso' ) );
166
+				$filename = 'event-'.($event instanceof EE_Event ? $event->slug() : __('unknown', 'event_espresso'));
167 167
 
168 168
 			}
169
-			$event_query_params[0]['EVT_ID'] =$value_to_equal;
169
+			$event_query_params[0]['EVT_ID'] = $value_to_equal;
170 170
 			$related_models_query_params[0]['Event.EVT_ID'] = $value_to_equal;
171 171
 			$related_through_reg_query_params[0]['Registration.EVT_ID'] = $value_to_equal;
172 172
 			$datetime_ticket_query_params[0]['Datetime.EVT_ID'] = $value_to_equal;
@@ -210,42 +210,42 @@  discard block
 block discarded – undo
210 210
 
211 211
 			);
212 212
 
213
-		$model_data = $this->_get_export_data_for_models( $models_to_export );
213
+		$model_data = $this->_get_export_data_for_models($models_to_export);
214 214
 
215
-		$filename = $this->generate_filename ( $filename );
215
+		$filename = $this->generate_filename($filename);
216 216
 
217
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data )) {
218
-			EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
217
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data)) {
218
+			EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
219 219
 		}
220 220
 	}
221 221
 
222
-	function report_attendees(){
222
+	function report_attendees() {
223 223
 		$attendee_rows = EEM_Attendee::instance()->get_all_wpdb_results( 
224 224
 			array( 
225
-				'force_join' => array( 'State', 'Country' ), 
225
+				'force_join' => array('State', 'Country'), 
226 226
 				'caps' => EEM_Base::caps_read_admin 
227 227
 			) 
228 228
 		);
229 229
 		$csv_data = array();
230
-		foreach( $attendee_rows as $attendee_row ){
230
+		foreach ($attendee_rows as $attendee_row) {
231 231
 			$csv_row = array();
232
-			foreach( EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
233
-				if( $field_name == 'STA_ID' ){
234
-					$state_name_field = EEM_State::instance()->field_settings_for( 'STA_name' );
235
-					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
236
-				}elseif( $field_name == 'CNT_ISO' ){
237
-					$country_name_field = EEM_Country::instance()->field_settings_for( 'CNT_name' );
238
-					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
239
-				}else{
240
-					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
232
+			foreach (EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) {
233
+				if ($field_name == 'STA_ID') {
234
+					$state_name_field = EEM_State::instance()->field_settings_for('STA_name');
235
+					$csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()];
236
+				}elseif ($field_name == 'CNT_ISO') {
237
+					$country_name_field = EEM_Country::instance()->field_settings_for('CNT_name');
238
+					$csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()];
239
+				} else {
240
+					$csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()];
241 241
 				}
242 242
 			}
243 243
 			$csv_data[] = $csv_row;
244 244
 		}
245 245
 
246
-		$filename = $this->generate_filename ( 'contact-list-report' );
246
+		$filename = $this->generate_filename('contact-list-report');
247 247
 
248
-		$handle = $this->EE_CSV->begin_sending_csv( $filename);
248
+		$handle = $this->EE_CSV->begin_sending_csv($filename);
249 249
 		$this->EE_CSV->write_data_array_to_csv($handle, $csv_data);
250 250
 		$this->EE_CSV->end_sending_csv($handle);
251 251
 	}
@@ -262,18 +262,18 @@  discard block
 block discarded – undo
262 262
 		$countries_that_have_an_attendee = EEM_Country::instance()->get_all(array(0=>array('Attendee.ATT_ID'=>array('IS NOT NULL'))));
263 263
 //		$states_to_export_query_params
264 264
 		$models_to_export = array(
265
-			'Country'=>array(array('CNT_ISO'=>array('IN',array_keys($countries_that_have_an_attendee)))),
266
-			'State'=>array(array('STA_ID'=>array('IN',array_keys($states_that_have_an_attendee)))),
265
+			'Country'=>array(array('CNT_ISO'=>array('IN', array_keys($countries_that_have_an_attendee)))),
266
+			'State'=>array(array('STA_ID'=>array('IN', array_keys($states_that_have_an_attendee)))),
267 267
 			'Attendee'=>array(),
268 268
 		);
269 269
 
270 270
 
271 271
 
272
-		$model_data = $this->_get_export_data_for_models( $models_to_export );
273
-		$filename = $this->generate_filename ( 'all-attendees' );
272
+		$model_data = $this->_get_export_data_for_models($models_to_export);
273
+		$filename = $this->generate_filename('all-attendees');
274 274
 
275
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data )) {
276
-			EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
275
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data)) {
276
+			EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
277 277
 		}
278 278
 	}
279 279
 
@@ -285,19 +285,19 @@  discard block
 block discarded – undo
285 285
 	 * @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
286 286
 	 * @return string
287 287
 	 */
288
-	protected function _prepare_value_from_db_for_display( $model, $field_name,  $raw_db_value, $pretty_schema = true ) {
289
-		$field_obj = $model->field_settings_for( $field_name );
290
-		$value_on_model_obj = $field_obj->prepare_for_set_from_db( $raw_db_value );
291
-		if( $field_obj instanceof EE_Datetime_Field ) {
292
-			$field_obj->set_date_format( EE_CSV::instance()->get_date_format_for_csv( $field_obj->get_date_format( $pretty_schema ) ), $pretty_schema );
293
-			$field_obj->set_time_format( EE_CSV::instance()->get_time_format_for_csv( $field_obj->get_time_format( $pretty_schema ) ), $pretty_schema );
288
+	protected function _prepare_value_from_db_for_display($model, $field_name, $raw_db_value, $pretty_schema = true) {
289
+		$field_obj = $model->field_settings_for($field_name);
290
+		$value_on_model_obj = $field_obj->prepare_for_set_from_db($raw_db_value);
291
+		if ($field_obj instanceof EE_Datetime_Field) {
292
+			$field_obj->set_date_format(EE_CSV::instance()->get_date_format_for_csv($field_obj->get_date_format($pretty_schema)), $pretty_schema);
293
+			$field_obj->set_time_format(EE_CSV::instance()->get_time_format_for_csv($field_obj->get_time_format($pretty_schema)), $pretty_schema);
294 294
 		}
295
-		if( $pretty_schema === true){
296
-			return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj );
297
-		}elseif( is_string( $pretty_schema ) ) {
298
-			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema );
299
-		}else{
300
-			return $field_obj->prepare_for_get( $value_on_model_obj );
295
+		if ($pretty_schema === true) {
296
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj);
297
+		}elseif (is_string($pretty_schema)) {
298
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema);
299
+		} else {
300
+			return $field_obj->prepare_for_get($value_on_model_obj);
301 301
 		}
302 302
 	}
303 303
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * and the questions associated with the registrations
307 307
 	 * @param int $event_id
308 308
 	 */
309
-	function report_registrations_for_event( $event_id = NULL ){
309
+	function report_registrations_for_event($event_id = NULL) {
310 310
 		$reg_fields_to_include = array(
311 311
 				'TXN_ID',
312 312
 				'ATT_ID',
@@ -338,126 +338,126 @@  discard block
 block discarded – undo
338 338
 				array(
339 339
 					'OR' => array(
340 340
 						//don't include registrations from failed or abandoned transactions...
341
-						'Transaction.STS_ID' => array( 'NOT IN', array( EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code ) ),
341
+						'Transaction.STS_ID' => array('NOT IN', array(EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code)),
342 342
 						//unless the registration is approved, in which case include it regardless of transaction status
343 343
 						'STS_ID' => EEM_Registration::status_id_approved
344 344
 						),
345
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
345
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
346 346
 					),
347
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
348
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ),
347
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
348
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
349 349
 				'caps' => EEM_Base::caps_read_admin
350 350
 			),
351 351
 			$event_id
352 352
 		);
353
-		if( $event_id ){
354
-			$query_params[0]['EVT_ID'] =  $event_id;
355
-		}else{
356
-			$query_params[ 'force_join' ][] = 'Event';
353
+		if ($event_id) {
354
+			$query_params[0]['EVT_ID'] = $event_id;
355
+		} else {
356
+			$query_params['force_join'][] = 'Event';
357 357
 		}
358
-		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
358
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
359 359
 		//get all questions which relate to someone in this group
360 360
 		$registration_ids = array();
361
-		foreach( $registration_rows as $reg_row ) {
362
-			$registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] );
361
+		foreach ($registration_rows as $reg_row) {
362
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
363 363
 		}
364 364
 //		EEM_Question::instance()->show_next_x_db_queries();
365
-		$questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN',$registration_ids))));
366
-		foreach($registration_rows as $reg_row){
367
-			if ( is_array( $reg_row ) ) {
365
+		$questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN', $registration_ids))));
366
+		foreach ($registration_rows as $reg_row) {
367
+			if (is_array($reg_row)) {
368 368
 				$reg_csv_array = array();
369
-				if( ! $event_id ){
369
+				if ( ! $event_id) {
370 370
 					//get the event's name and Id
371
-					$reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), $this->_prepare_value_from_db_for_display( EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] );
371
+					$reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), $this->_prepare_value_from_db_for_display(EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
372 372
 				}
373
-				$is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false;
373
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
374 374
 				/*@var $reg_row EE_Registration */
375
-				foreach($reg_fields_to_include as $field_name){
375
+				foreach ($reg_fields_to_include as $field_name) {
376 376
 					$field = $reg_model->field_settings_for($field_name);
377
-					if($field_name == 'REG_final_price'){
378
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
379
-					}elseif( $field_name == 'REG_count' ){
380
-						$value = sprintf( __( '%s of %s', 'event_espresso' ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) );
381
-					}elseif( $field_name == 'REG_date' ) {
382
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
383
-					}else{
384
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
377
+					if ($field_name == 'REG_final_price') {
378
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float');
379
+					}elseif ($field_name == 'REG_count') {
380
+						$value = sprintf(__('%s of %s', 'event_espresso'), $this->_prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), $this->_prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size']));
381
+					}elseif ($field_name == 'REG_date') {
382
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html');
383
+					} else {
384
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]);
385 385
 					}
386 386
 					$reg_csv_array[$this->_get_column_name_for_field($field)] = $value;
387
-					if($field_name == 'REG_final_price'){
387
+					if ($field_name == 'REG_final_price') {
388 388
 						//add a column named Currency after the final price
389 389
 						$reg_csv_array[__("Currency", "event_espresso")] = EE_Config::instance()->currency->code;
390 390
 					}
391 391
 				}
392 392
 				//get pretty status
393
-				$stati = EEM_Status::instance()->localized_status( array(
394
-					$reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ),
395
-					$reg_row[ 'TransactionTable.STS_ID' ] => __( 'unknown', 'event_espresso' ) ),
393
+				$stati = EEM_Status::instance()->localized_status(array(
394
+					$reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'),
395
+					$reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso') ),
396 396
 						FALSE,
397
-						'sentence' );
398
-				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ];
397
+						'sentence');
398
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
399 399
 				//get pretty trnasaction status
400
-				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'TransactionTable.STS_ID' ] ];
401
-				$reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? $this->_prepare_value_from_db_for_display( EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'TransactionTable.TXN_total' ], 'localized_float' ) : '0.00';
402
-				$reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? $this->_prepare_value_from_db_for_display( EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'TransactionTable.TXN_paid' ], 'localized_float' ) : '0.00';
400
+				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
401
+				$reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? $this->_prepare_value_from_db_for_display(EEM_Transaction::instance(), 'TXN_total', $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00';
402
+				$reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? $this->_prepare_value_from_db_for_display(EEM_Transaction::instance(), 'TXN_paid', $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00';
403 403
 				$payment_methods = array();
404 404
 				$gateway_txn_ids_etc = array();
405 405
 				$payment_times = array();
406
-				if( $is_primary_reg && $reg_row[ 'TransactionTable.TXN_ID' ] ){
406
+				if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
407 407
 					$payments_info = EEM_Payment::instance()->get_all_wpdb_results(
408 408
 							array(
409 409
 								array(
410
-									'TXN_ID' => $reg_row[ 'TransactionTable.TXN_ID' ],
410
+									'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
411 411
 									'STS_ID' => EEM_Payment::status_id_approved
412 412
 								),
413
-								'force_join' => array( 'Payment_Method' ),
413
+								'force_join' => array('Payment_Method'),
414 414
 
415 415
 							),
416 416
 							ARRAY_A,
417 417
 							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
418 418
 
419
-					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
420
-						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
421
-						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
422
-						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
419
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
420
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
421
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
422
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : '';
423 423
 					}
424 424
 
425 425
 				}
426
-				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
427
-				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
428
-				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );
426
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
427
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
428
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
429 429
 
430 430
 				//get whether or not the user has checked in
431
-				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' );
431
+				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
432 432
 				//get ticket of registration and its price
433 433
 				$ticket_model = EE_Registry::instance()->load_model('Ticket');
434
-				if( $reg_row[ 'Ticket.TKT_ID'] ) {
435
-					$ticket_name = $this->_prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] );
434
+				if ($reg_row['Ticket.TKT_ID']) {
435
+					$ticket_name = $this->_prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']);
436 436
 					$datetimes_strings = array();
437
-					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){
438
-						$datetimes_strings[] = $this->_prepare_value_from_db_for_display( EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] );
437
+					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) {
438
+						$datetimes_strings[] = $this->_prepare_value_from_db_for_display(EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
439 439
 					}
440 440
 
441 441
 				} else {
442
-					$ticket_name = __( 'Unknown', 'event_espresso' );
443
-					$datetimes_strings = array( __( 'Unknown', 'event_espresso' ) );
442
+					$ticket_name = __('Unknown', 'event_espresso');
443
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
444 444
 				}
445 445
 				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
446 446
 				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
447 447
 				//get datetime(s) of registration
448 448
 
449 449
 				//add attendee columns
450
-				foreach($att_fields_to_include as $att_field_name){
450
+				foreach ($att_fields_to_include as $att_field_name) {
451 451
 					$field_obj = EEM_Attendee::instance()->field_settings_for($att_field_name);
452
-					if( $reg_row[ 'Attendee_CPT.ID' ]){
453
-						if($att_field_name == 'STA_ID'){
454
-							$value = EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
455
-						}elseif($att_field_name == 'CNT_ISO'){
456
-							$value = EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
457
-						}else{
458
-							$value = $this->_prepare_value_from_db_for_display( EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
452
+					if ($reg_row['Attendee_CPT.ID']) {
453
+						if ($att_field_name == 'STA_ID') {
454
+							$value = EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name');
455
+						}elseif ($att_field_name == 'CNT_ISO') {
456
+							$value = EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name');
457
+						} else {
458
+							$value = $this->_prepare_value_from_db_for_display(EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
459 459
 						}
460
-					}else{
460
+					} else {
461 461
 						$value = '';
462 462
 					}
463 463
 
@@ -465,56 +465,56 @@  discard block
 block discarded – undo
465 465
 				}
466 466
 
467 467
 				//make sure each registration has the same questions in the same order
468
-				foreach($questions_for_these_regs_rows as $question_row){
469
-					if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){
470
-						$reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null;
468
+				foreach ($questions_for_these_regs_rows as $question_row) {
469
+					if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) {
470
+						$reg_csv_array[$question_row['Question.QST_admin_label']] = null;
471 471
 					}
472 472
 				}
473 473
 				//now fill out the questions THEY answered
474
-				foreach( EEM_Answer::instance()->get_all_wpdb_results( array( array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), 'force_join' => array( 'Question' ) ) ) as $answer_row){
474
+				foreach (EEM_Answer::instance()->get_all_wpdb_results(array(array('REG_ID' => $reg_row['Registration.REG_ID']), 'force_join' => array('Question'))) as $answer_row) {
475 475
 					/* @var $answer EE_Answer */
476
-					if( $answer_row[ 'Question.QST_ID' ] ){
477
-						$question_label = $this->_prepare_value_from_db_for_display( EEM_Question::instance(), 'QST_admin_label', $answer_row[ 'Question.QST_admin_label' ] );
478
-					}else{
479
-						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
476
+					if ($answer_row['Question.QST_ID']) {
477
+						$question_label = $this->_prepare_value_from_db_for_display(EEM_Question::instance(), 'QST_admin_label', $answer_row['Question.QST_admin_label']);
478
+					} else {
479
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
480 480
 					}
481
-                                        if( isset( $answer_row[ 'Question.QST_type'] ) && $answer_row[ 'Question.QST_type' ] == EEM_Question::QST_type_state ) {
482
-                                            $reg_csv_array[ $question_label ] = EEM_State::instance()->get_state_name_by_ID( $answer_row[ 'Answer.ANS_value' ] );
481
+                                        if (isset($answer_row['Question.QST_type']) && $answer_row['Question.QST_type'] == EEM_Question::QST_type_state) {
482
+                                            $reg_csv_array[$question_label] = EEM_State::instance()->get_state_name_by_ID($answer_row['Answer.ANS_value']);
483 483
                                         } else {
484
-                                            $reg_csv_array[ $question_label ] = $this->_prepare_value_from_db_for_display( EEM_Answer::instance(), 'ANS_value', $answer_row[ 'Answer.ANS_value' ] );
484
+                                            $reg_csv_array[$question_label] = $this->_prepare_value_from_db_for_display(EEM_Answer::instance(), 'ANS_value', $answer_row['Answer.ANS_value']);
485 485
                                         }
486 486
 				}
487
-				$registrations_csv_ready_array[] = apply_filters( 'FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row );
487
+				$registrations_csv_ready_array[] = apply_filters('FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row);
488 488
 			}
489 489
 		}
490 490
 
491 491
 		//if we couldn't export anything, we want to at least show the column headers
492
-		if(empty($registrations_csv_ready_array)){
492
+		if (empty($registrations_csv_ready_array)) {
493 493
 			$reg_csv_array = array();
494 494
 			$model_and_fields_to_include = array(
495 495
 				'Registration' => $reg_fields_to_include,
496 496
 				'Attendee' => $att_fields_to_include
497 497
 			);
498
-			foreach($model_and_fields_to_include as $model_name => $field_list){
498
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
499 499
 				$model = EE_Registry::instance()->load_model($model_name);
500
-				foreach($field_list as $field_name){
500
+				foreach ($field_list as $field_name) {
501 501
 					$field = $model->field_settings_for($field_name);
502
-					$reg_csv_array[$this->_get_column_name_for_field($field)] = null;//$registration->get($field->get_name());
502
+					$reg_csv_array[$this->_get_column_name_for_field($field)] = null; //$registration->get($field->get_name());
503 503
 				}
504 504
 			}
505 505
 			$registrations_csv_ready_array [] = $reg_csv_array;
506 506
 		}
507
-		if( $event_id ){
508
-			$event_slug =  EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' );
509
-			if( ! $event_slug ) {
510
-				$event_slug = __( 'unknown', 'event_espresso' );
507
+		if ($event_id) {
508
+			$event_slug = EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug');
509
+			if ( ! $event_slug) {
510
+				$event_slug = __('unknown', 'event_espresso');
511 511
 			}
512
-		}else{
513
-			$event_slug = __( 'all', 'event_espresso' );
512
+		} else {
513
+			$event_slug = __('all', 'event_espresso');
514 514
 		}
515
-		$filename = sprintf( "registrations-for-%s", $event_slug );
515
+		$filename = sprintf("registrations-for-%s", $event_slug);
516 516
 
517
-		$handle = $this->EE_CSV->begin_sending_csv( $filename);
517
+		$handle = $this->EE_CSV->begin_sending_csv($filename);
518 518
 		$this->EE_CSV->write_data_array_to_csv($handle, $registrations_csv_ready_array);
519 519
 		$this->EE_CSV->end_sending_csv($handle);
520 520
 	}
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	 * @param EE_Model_Field_Base $field
525 525
 	 * @return string
526 526
 	 */
527
-	protected function _get_column_name_for_field(EE_Model_Field_Base $field){
527
+	protected function _get_column_name_for_field(EE_Model_Field_Base $field) {
528 528
 		return $field->get_nicename()."[".$field->get_name()."]";
529 529
 	}
530 530
 
@@ -537,17 +537,17 @@  discard block
 block discarded – undo
537 537
 	function export_categories() {
538 538
 		// are any Event IDs set?
539 539
 		$query_params = array();
540
-		if ( isset( $this->_req_data['EVT_CAT_ID'] )) {
540
+		if (isset($this->_req_data['EVT_CAT_ID'])) {
541 541
 			// do we have an array of IDs ?
542
-			if ( is_array( $this->_req_data['EVT_CAT_ID'] )) {
542
+			if (is_array($this->_req_data['EVT_CAT_ID'])) {
543 543
 				// generate an "IN (CSV)" where clause
544
-				$EVT_CAT_IDs = array_map( 'sanitize_text_field', $this->_req_data['EVT_CAT_ID'] );
544
+				$EVT_CAT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_CAT_ID']);
545 545
 				$filename = 'event-categories';
546
-				$query_params[0]['term_taxonomy_id'] = array('IN',$EVT_CAT_IDs);
546
+				$query_params[0]['term_taxonomy_id'] = array('IN', $EVT_CAT_IDs);
547 547
 			} else {
548 548
 				// generate regular where = clause
549
-				$EVT_CAT_ID = absint( $this->_req_data['EVT_CAT_ID'] );
550
-				$filename = 'event-category#' . $EVT_CAT_ID;
549
+				$EVT_CAT_ID = absint($this->_req_data['EVT_CAT_ID']);
550
+				$filename = 'event-category#'.$EVT_CAT_ID;
551 551
 				$query_params[0]['term_taxonomy_id'] = $EVT_CAT_ID;
552 552
 			}
553 553
 		} else {
@@ -559,11 +559,11 @@  discard block
 block discarded – undo
559 559
 				'Term_Taxonomy' => $query_params
560 560
 			);
561 561
 
562
-		$table_data = $this->_get_export_data_for_models( $tables_to_export );
563
-		$filename = $this->generate_filename ( $filename );
562
+		$table_data = $this->_get_export_data_for_models($tables_to_export);
563
+		$filename = $this->generate_filename($filename);
564 564
 
565
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $table_data )) {
566
-			EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
565
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $table_data)) {
566
+			EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
567 567
 		}
568 568
 	}
569 569
 
@@ -574,13 +574,13 @@  discard block
 block discarded – undo
574 574
 	 *		  @param string - export_name
575 575
 	 *			@return string on success, FALSE on fail
576 576
 	 */
577
-	private function generate_filename ( $export_name = '' ) {
578
-		if ( $export_name != '' ) {
579
-			$filename = get_bloginfo('name') . '-' . $export_name;
580
-			$filename = sanitize_key( $filename ) . '-' . $this->today;
577
+	private function generate_filename($export_name = '') {
578
+		if ($export_name != '') {
579
+			$filename = get_bloginfo('name').'-'.$export_name;
580
+			$filename = sanitize_key($filename).'-'.$this->today;
581 581
 			return $filename;
582
-		}	 else {
583
-			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
582
+		} else {
583
+			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
584 584
 		}
585 585
 		return false;
586 586
 	}
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
 	 *	@param array $models_to_export keys are model names (eg 'Event', 'Attendee', etc.) and values are arrays of query params like on EEM_Base::get_all
594 594
 	 *	@return array on success, FALSE on fail
595 595
 	 */
596
-	private function _get_export_data_for_models( $models_to_export = array() ) {
596
+	private function _get_export_data_for_models($models_to_export = array()) {
597 597
 		$table_data = FALSE;
598
-		if ( is_array( $models_to_export ) ) {
599
-			foreach ( $models_to_export as $model_name => $query_params ) {
598
+		if (is_array($models_to_export)) {
599
+			foreach ($models_to_export as $model_name => $query_params) {
600 600
 				//check for a numerically-indexed array. in that case, $model_name is the value!!
601
-				if(is_int($model_name)){
601
+				if (is_int($model_name)) {
602 602
 					$model_name = $query_params;
603 603
 					$query_params = array();
604 604
 				}
@@ -606,17 +606,17 @@  discard block
 block discarded – undo
606 606
 				$model_objects = $model->get_all($query_params);
607 607
 
608 608
 				$table_data[$model_name] = array();
609
-				foreach($model_objects as $model_object){
609
+				foreach ($model_objects as $model_object) {
610 610
 					$model_data_array = array();
611 611
 					$fields = $model->field_settings();
612
-					foreach($fields as $field){
612
+					foreach ($fields as $field) {
613 613
 						$column_name = $field->get_nicename()."[".$field->get_name()."]";
614
-						if($field instanceof EE_Datetime_Field){
614
+						if ($field instanceof EE_Datetime_Field) {
615 615
 //							$field->set_date_format('Y-m-d');
616 616
 //							$field->set_time_format('H:i:s');
617
-							$model_data_array[$column_name] = $model_object->get_datetime($field->get_name(),'Y-m-d','H:i:s');
617
+							$model_data_array[$column_name] = $model_object->get_datetime($field->get_name(), 'Y-m-d', 'H:i:s');
618 618
 						}
619
-						else{
619
+						else {
620 620
 							$model_data_array[$column_name] = $model_object->get($field->get_name());
621 621
 						}
622 622
 					}
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/CPTs/EE_CPT_Strategy.core.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public static function instance() {
80 80
 		// check if class object is instantiated
81
-		if ( ! self::$_instance instanceof EE_CPT_Strategy ) {
81
+		if ( ! self::$_instance instanceof EE_CPT_Strategy) {
82 82
 			self::$_instance = new self();
83 83
 		}
84 84
 		return self::$_instance;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 //		d( $this->_CPT_endpoints );
102 102
 //		d( $this->_CPT_taxonomies );
103 103
 
104
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 );
104
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 5);
105 105
 	}
106 106
 
107 107
 
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	private function _set_CPT_endpoints() {
116 116
 		$_CPT_endpoints = array();
117
-		if ( is_array( $this->_CPTs )) {
118
-			foreach ( $this->_CPTs as $CPT_type => $CPT ) {
119
-				$_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type;
117
+		if (is_array($this->_CPTs)) {
118
+			foreach ($this->_CPTs as $CPT_type => $CPT) {
119
+				$_CPT_endpoints [$CPT['plural_slug']] = $CPT_type;
120 120
 			}
121 121
 		}
122 122
 		return $_CPT_endpoints;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @param WP_Query $WP_Query
132 132
 	 * @return void
133 133
 	 */
134
-	private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) {
134
+	private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) {
135 135
 		$WP_Query->is_espresso_event_single = FALSE;
136 136
 		$WP_Query->is_espresso_event_archive = FALSE;
137 137
 		$WP_Query->is_espresso_event_taxonomy = FALSE;
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	private function _set_CPT_taxonomies() {
160 160
 		// check if taxonomies have already been set
161
-		if ( empty( $this->_CPT_taxonomies )) {
161
+		if (empty($this->_CPT_taxonomies)) {
162 162
 			// and that this CPT has taxonomies registered for it
163
-			if ( isset( $this->CPT['args'] ) && isset( $this->CPT['args']['taxonomies'] )) {
163
+			if (isset($this->CPT['args']) && isset($this->CPT['args']['taxonomies'])) {
164 164
 				// if so then grab them, but we want the taxonomy name as the key
165
-				$taxonomies = array_flip( $this->CPT['args']['taxonomies'] );
165
+				$taxonomies = array_flip($this->CPT['args']['taxonomies']);
166 166
 				// then grab the list of ALL taxonomies
167 167
 				$all_taxonomies = EE_Register_CPTs::get_taxonomies();
168
-				foreach ( $taxonomies as $taxonomy => $details ) {
168
+				foreach ($taxonomies as $taxonomy => $details) {
169 169
 					// add details to our taxonomies if they exist
170
-					$taxonomies[ $taxonomy ] = isset( $all_taxonomies[ $taxonomy ] ) ? $all_taxonomies[ $taxonomy ] : NULL;
170
+					$taxonomies[$taxonomy] = isset($all_taxonomies[$taxonomy]) ? $all_taxonomies[$taxonomy] : NULL;
171 171
 				}
172 172
 				$this->_CPT_taxonomies = $taxonomies;
173 173
 			}
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 	 * @return void
193 193
 	 */
194 194
 	private function _set_CPT_terms() {
195
-		if ( empty( $this->_CPT_terms )) {
195
+		if (empty($this->_CPT_terms)) {
196 196
 			$terms = EEM_Term::instance()->get_all_CPT_post_tags();
197
-			foreach ( $terms as $term ) {
198
-				if ( $term instanceof EE_Term ) {
199
-					$this->_CPT_terms[ $term->slug() ] = $term;
197
+			foreach ($terms as $term) {
198
+				if ($term instanceof EE_Term) {
199
+					$this->_CPT_terms[$term->slug()] = $term;
200 200
 				}
201 201
 			}
202 202
 		}
@@ -211,24 +211,24 @@  discard block
 block discarded – undo
211 211
 	 * @param $WP_Query
212 212
 	 * @return void
213 213
 	 */
214
-	private function _set_post_type_for_terms( WP_Query $WP_Query ) {
214
+	private function _set_post_type_for_terms(WP_Query $WP_Query) {
215 215
 		// is a tag set ?
216
-		if ( isset( $WP_Query->query['tag'] )) {
216
+		if (isset($WP_Query->query['tag'])) {
217 217
 			// set post_tags
218 218
 			$this->_set_CPT_terms();
219 219
 			// is this tag archive term in the list of terms used by our CPTs ?
220
-			$term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL;
220
+			$term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL;
221 221
 			// verify the term
222
-			if ( $term instanceof EE_Term ) {
223
-				$term->post_type  = array_merge( array( 'post', 'page' ), (array)$term->post_type );
224
-				$term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term );
222
+			if ($term instanceof EE_Term) {
223
+				$term->post_type = array_merge(array('post', 'page'), (array) $term->post_type);
224
+				$term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term);
225 225
 				// if a post type is already set
226
-				if ( isset( $WP_Query->query_vars['post_type'] )) {
226
+				if (isset($WP_Query->query_vars['post_type'])) {
227 227
 						// add to existing array
228
-						$term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type );
228
+						$term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type);
229 229
 				}
230 230
 				// just set post_type to our CPT
231
-				$WP_Query->set( 'post_type', $term->post_type );
231
+				$WP_Query->set('post_type', $term->post_type);
232 232
 			}
233 233
 		}
234 234
 	}
@@ -243,17 +243,17 @@  discard block
 block discarded – undo
243 243
 	 * in order for is_archive() and is_single() methods to work properly.
244 244
 	 * @return void
245 245
 	 */
246
-	public function _possibly_set_ee_request_var(){
246
+	public function _possibly_set_ee_request_var() {
247 247
 		// check if ee action var has been set
248
-		if ( ! EE_Registry::instance()->REQ->is_set( 'ee' )) {
248
+		if ( ! EE_Registry::instance()->REQ->is_set('ee')) {
249 249
 			// check that route exists for CPT archive slug
250
-			if ( is_archive() && EE_Config::get_route( $this->CPT['plural_slug'] )) {
250
+			if (is_archive() && EE_Config::get_route($this->CPT['plural_slug'])) {
251 251
 				// ie: set "ee" to "events"
252
-				EE_Registry::instance()->REQ->set( 'ee', $this->CPT['plural_slug'] );
252
+				EE_Registry::instance()->REQ->set('ee', $this->CPT['plural_slug']);
253 253
 			// or does it match a single page CPT like /event/
254
-			} else if ( is_single() && EE_Config::get_route( $this->CPT['singular_slug'] )) {
254
+			} else if (is_single() && EE_Config::get_route($this->CPT['singular_slug'])) {
255 255
 				// ie: set "ee" to "event"
256
-				EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] );
256
+				EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']);
257 257
 			}
258 258
 		}
259 259
 	}
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
 	 * @param WP_Query $WP_Query
268 268
 	 * @return void
269 269
 	 */
270
-	public function _set_paging( $WP_Query ) {
271
-		if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) {
272
-			$page = ( get_query_var('page') ) ? get_query_var('page') : NULL;
273
-			$paged = ( get_query_var('paged') ) ? get_query_var('paged') : $page;
274
-			$WP_Query->set( 'paged', $paged );
270
+	public function _set_paging($WP_Query) {
271
+		if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) {
272
+			$page = (get_query_var('page')) ? get_query_var('page') : NULL;
273
+			$paged = (get_query_var('paged')) ? get_query_var('paged') : $page;
274
+			$WP_Query->set('paged', $paged);
275 275
 		}
276 276
 	}
277 277
 
@@ -288,35 +288,35 @@  discard block
 block discarded – undo
288 288
 	 * @param WP_Query $WP_Query
289 289
 	 * @return void
290 290
 	 */
291
-	public function pre_get_posts( $WP_Query ) {
291
+	public function pre_get_posts($WP_Query) {
292 292
 		// check that post-type is set
293
-		if ( ! $WP_Query instanceof WP_Query ) {
293
+		if ( ! $WP_Query instanceof WP_Query) {
294 294
 			return;
295 295
 		}
296 296
 
297 297
 		// add our conditionals
298
-		$this->_set_EE_tags_on_WP_Query( $WP_Query );
298
+		$this->_set_EE_tags_on_WP_Query($WP_Query);
299 299
 		// check for terms
300
-		$this->_set_post_type_for_terms( $WP_Query );
300
+		$this->_set_post_type_for_terms($WP_Query);
301 301
 		// make sure paging is always set
302
-		$this->_set_paging( $WP_Query );
302
+		$this->_set_paging($WP_Query);
303 303
 
304 304
 		// is a taxonomy set ?
305
-		if ( $WP_Query->is_tax ) {
305
+		if ($WP_Query->is_tax) {
306 306
 			// loop thru our taxonomies
307
-			foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) {
307
+			foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) {
308 308
 				// check if one of our taxonomies is set as a query var
309
-				if ( isset( $WP_Query->query[ $CPT_taxonomy ] )) {
309
+				if (isset($WP_Query->query[$CPT_taxonomy])) {
310 310
 					// but which CPT does that correspond to??? hmmm... guess we gotta go looping
311
-					foreach ( $this->_CPTs as $post_type => $CPT ) {
311
+					foreach ($this->_CPTs as $post_type => $CPT) {
312 312
 						// verify our CPT has args, is public and has taxonomies set
313
-						if ( isset( $CPT['args'] ) && $CPT['args']['public'] && ! empty( $CPT['args']['taxonomies'] )) {
313
+						if (isset($CPT['args']) && $CPT['args']['public'] && ! empty($CPT['args']['taxonomies'])) {
314 314
 							// does the captured taxonomy belong to this CPT ?
315
-							if ( in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )) {
315
+							if (in_array($CPT_taxonomy, $CPT['args']['taxonomies'])) {
316 316
 								// if so, then add this CPT post_type to the current query's array of post_types'
317
-								$WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] ) ? (array)$WP_Query->query_vars['post_type'] : array();
317
+								$WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type']) ? (array) $WP_Query->query_vars['post_type'] : array();
318 318
 								$WP_Query->query_vars['post_type'][] = $post_type;
319
-								switch( $post_type ) {
319
+								switch ($post_type) {
320 320
 									case 'espresso_events' :
321 321
 										$WP_Query->is_espresso_event_taxonomy = TRUE;
322 322
 										break;
@@ -337,27 +337,27 @@  discard block
 block discarded – undo
337 337
 //		d( $CPT_taxonomy );
338 338
 //		d( $WP_Query );
339 339
 
340
-		if ( isset( $WP_Query->query_vars['post_type'] )) {
340
+		if (isset($WP_Query->query_vars['post_type'])) {
341 341
 			// loop thru post_types as array
342
-			foreach ( (array)$WP_Query->query_vars['post_type'] as $post_type ) {
342
+			foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) {
343 343
 
344 344
 				// is current query for an EE CPT ?
345
-				if ( isset( $this->_CPTs[ $post_type ] )) {
345
+				if (isset($this->_CPTs[$post_type])) {
346 346
 					// is EE on or off ?
347
-					if ( EE_Maintenance_Mode::instance()->level() ) {
347
+					if (EE_Maintenance_Mode::instance()->level()) {
348 348
 						// reroute CPT template view to maintenance_mode.template.php
349
-						if( ! has_filter( 'template_include',array( 'EE_Maintenance_Mode', 'template_include' ))){
350
-							add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 );
349
+						if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) {
350
+							add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999);
351 351
 						}
352
-						if( has_filter( 'the_content',array( EE_Maintenance_Mode::instance(), 'the_content' ) ) ) {
353
-							add_filter( 'the_content', array( $this, 'inject_EE_shortcode_placeholder' ), 1 );
352
+						if (has_filter('the_content', array(EE_Maintenance_Mode::instance(), 'the_content'))) {
353
+							add_filter('the_content', array($this, 'inject_EE_shortcode_placeholder'), 1);
354 354
 						}
355 355
 						return;
356 356
 					}
357 357
 					// load EE_Request_Handler (this was added as a result of https://events.codebasehq.com/projects/event-espresso/tickets/9037
358
-					EE_Registry::instance()->load_core( 'Request_Handler' );
358
+					EE_Registry::instance()->load_core('Request_Handler');
359 359
 					// grab details for the CPT the current query is for
360
-					$this->CPT = $this->_CPTs[ $post_type ];
360
+					$this->CPT = $this->_CPTs[$post_type];
361 361
 					// set post type
362 362
 					$this->CPT['post_type'] = $post_type;
363 363
 					// set taxonomies
@@ -365,27 +365,27 @@  discard block
 block discarded – undo
365 365
 					// the post or category or term that is triggering EE
366 366
 					$this->CPT['espresso_page'] = EE_Registry::instance()->REQ->is_espresso_page();
367 367
 					// requested post name
368
-					$this->CPT['post_name'] = EE_Registry::instance()->REQ->get( 'post_name' );
368
+					$this->CPT['post_name'] = EE_Registry::instance()->REQ->get('post_name');
369 369
 					//d( $this->CPT );
370 370
 					// add support for viewing 'private', 'draft', or 'pending' posts
371
-					if ( is_user_logged_in() && isset( $WP_Query->query_vars['p'] ) && $WP_Query->query_vars['p'] != 0 && current_user_can( 'edit_post', $WP_Query->query_vars['p'] )) {
371
+					if (is_user_logged_in() && isset($WP_Query->query_vars['p']) && $WP_Query->query_vars['p'] != 0 && current_user_can('edit_post', $WP_Query->query_vars['p'])) {
372 372
 						// we can just inject directly into the WP_Query object
373
-						$WP_Query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' );
373
+						$WP_Query->query['post_status'] = array('publish', 'private', 'draft', 'pending');
374 374
 						// now set the main 'ee' request var so that the appropriate module can load the appropriate template(s)
375
-						EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] );
375
+						EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']);
376 376
 					}
377 377
 					$this->_possibly_set_ee_request_var();
378 378
 					// convert post_type to model name
379
-					$model_name = str_replace( 'EE_', '', $this->CPT['class_name'] );
379
+					$model_name = str_replace('EE_', '', $this->CPT['class_name']);
380 380
 					// get CPT table data via CPT Model
381
-					$this->CPT_model = EE_Registry::instance()->load_model( $model_name );
381
+					$this->CPT_model = EE_Registry::instance()->load_model($model_name);
382 382
 					$this->CPT['tables'] = $this->CPT_model->get_tables();
383 383
 					// is there a Meta Table for this CPT?
384
-					$this->CPT['meta_table'] = isset( $this->CPT['tables'][ $model_name . '_Meta' ] ) ? $this->CPT['tables'][ $model_name . '_Meta' ] : FALSE;
384
+					$this->CPT['meta_table'] = isset($this->CPT['tables'][$model_name.'_Meta']) ? $this->CPT['tables'][$model_name.'_Meta'] : FALSE;
385 385
 					// creates classname like:  CPT_Event_Strategy
386
-					$CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy';
386
+					$CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy';
387 387
 					// load and instantiate
388
-					 $CPT_Strategy = EE_Registry::instance()->load_core ( $CPT_Strategy_class_name, array( 'WP_Query' => $WP_Query, 'CPT' => $this->CPT ));
388
+					 $CPT_Strategy = EE_Registry::instance()->load_core($CPT_Strategy_class_name, array('WP_Query' => $WP_Query, 'CPT' => $this->CPT));
389 389
 
390 390
 					// !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
391 391
 					// here's the list of available filters in the WP_Query object
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
 					// 'post_limits'
398 398
 					// 'posts_fields'
399 399
 					// 'posts_join'
400
-					add_filter( 'posts_fields', array( $this, 'posts_fields' ));
401
-					add_filter( 'posts_join',	array( $this, 'posts_join' ));
402
-					add_filter( 'get_' . $this->CPT['post_type'] . '_metadata', array( $CPT_Strategy, 'get_EE_post_type_metadata' ), 1, 4 );
403
-					add_filter( 'the_posts',	array( $this, 'the_posts' ), 1, 1 );
404
-					add_filter( 'get_edit_post_link', array( $this, 'get_edit_post_link' ), 10, 2 );
400
+					add_filter('posts_fields', array($this, 'posts_fields'));
401
+					add_filter('posts_join', array($this, 'posts_join'));
402
+					add_filter('get_'.$this->CPT['post_type'].'_metadata', array($CPT_Strategy, 'get_EE_post_type_metadata'), 1, 4);
403
+					add_filter('the_posts', array($this, 'the_posts'), 1, 1);
404
+					add_filter('get_edit_post_link', array($this, 'get_edit_post_link'), 10, 2);
405 405
 
406
-					$this->_do_template_filters( $WP_Query );
406
+					$this->_do_template_filters($WP_Query);
407 407
 				}
408 408
 			}
409 409
 		}
@@ -418,13 +418,13 @@  discard block
 block discarded – undo
418 418
 	 * @param $SQL
419 419
 	 * @return    string
420 420
 	 */
421
-	public function posts_fields( $SQL ) {
421
+	public function posts_fields($SQL) {
422 422
 		// does this CPT have a meta table ?
423
-		if ( ! empty( $this->CPT['meta_table'] )) {
423
+		if ( ! empty($this->CPT['meta_table'])) {
424 424
 			// adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement
425
-			$SQL .= ', ' . $this->CPT['meta_table']->get_table_name() . '.* ' ;
425
+			$SQL .= ', '.$this->CPT['meta_table']->get_table_name().'.* ';
426 426
 		}
427
-		remove_filter( 'posts_fields', array( $this, 'posts_fields' ));
427
+		remove_filter('posts_fields', array($this, 'posts_fields'));
428 428
 		return $SQL;
429 429
 	}
430 430
 
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
 	 * @param $SQL
453 453
 	 * @return    string
454 454
 	 */
455
-	public function posts_join( $SQL ) {
455
+	public function posts_join($SQL) {
456 456
 		// does this CPT have a meta table ?
457
-		if ( ! empty( $this->CPT['meta_table'] )) {
457
+		if ( ! empty($this->CPT['meta_table'])) {
458 458
 			global $wpdb;
459 459
 			// adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
460
-			$SQL .= ' LEFT JOIN ' . $this->CPT['meta_table']->get_table_name() . ' ON ( ' . $this->CPT['meta_table']->get_table_name() . '.' . $this->CPT['meta_table']->get_fk_on_table() . ' = ' . $wpdb->posts . '.ID ) ';
460
+			$SQL .= ' LEFT JOIN '.$this->CPT['meta_table']->get_table_name().' ON ( '.$this->CPT['meta_table']->get_table_name().'.'.$this->CPT['meta_table']->get_fk_on_table().' = '.$wpdb->posts.'.ID ) ';
461 461
 		}
462
-		remove_filter( 'posts_join',	array( $this, 'posts_join' ));
462
+		remove_filter('posts_join', array($this, 'posts_join'));
463 463
 		return $SQL;
464 464
 	}
465 465
 
@@ -472,18 +472,18 @@  discard block
 block discarded – undo
472 472
 	 * @param 	\WP_Post[] 	$posts
473 473
 	 * @return 	\WP_Post[]
474 474
 	 */
475
-	public function the_posts( $posts ) {
475
+	public function the_posts($posts) {
476 476
 //		d( $posts );
477 477
 		$CPT_class = $this->CPT['class_name'];
478 478
 		// loop thru posts
479
-		if ( is_array( $posts )) {
480
-			foreach( $posts as $key => $post ) {
481
-				if ( isset( $this->_CPTs[ $post->post_type ] )) {
482
-					$post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object( $post );
479
+		if (is_array($posts)) {
480
+			foreach ($posts as $key => $post) {
481
+				if (isset($this->_CPTs[$post->post_type])) {
482
+					$post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object($post);
483 483
 				}
484 484
 			}
485 485
 		}
486
-		remove_filter( 'the_posts',	array( $this, 'the_posts' ), 1 );
486
+		remove_filter('the_posts', array($this, 'the_posts'), 1);
487 487
 		return $posts;
488 488
 	}
489 489
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
 	 * @param $ID
495 495
 	 * @return string
496 496
 	 */
497
-	function get_edit_post_link( $url, $ID ) {
497
+	function get_edit_post_link($url, $ID) {
498 498
 		//need to make sure we only edit links if our cpt
499 499
 		global $post;
500
-		if ( ! isset( $this->_CPTs[ $post->post_type ] )) {
500
+		if ( ! isset($this->_CPTs[$post->post_type])) {
501 501
 			return $url;
502 502
 		}
503 503
 		//k made it here so all is good.
504 504
 		$scheme = is_ssl() ? 'https' : 'http';
505
-		$url = get_admin_url( EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme );
505
+		$url = get_admin_url(EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme);
506 506
 		// http://example.com/wp-admin/admin.php?page=espresso_events&action=edit&post=205&edit_nonce=0d403530d6
507
-		return wp_nonce_url( add_query_arg( array( 'page' => $post->post_type, 'post' =>$ID, 'action' =>'edit' ), $url ), 'edit', 'edit_nonce' );
507
+		return wp_nonce_url(add_query_arg(array('page' => $post->post_type, 'post' =>$ID, 'action' =>'edit'), $url), 'edit', 'edit_nonce');
508 508
 	}
509 509
 
510 510
 
@@ -518,11 +518,11 @@  discard block
 block discarded – undo
518 518
 	 * @param WP_Query $WP_Query
519 519
 	 * @return void
520 520
 	 */
521
-	protected function _do_template_filters( WP_Query $WP_Query ) {
521
+	protected function _do_template_filters(WP_Query $WP_Query) {
522 522
 		// if it's the main query  and requested cpt supports page_templates,
523
-		if ( $WP_Query->is_main_query() && ! empty( $this->CPT['args']['page_templates'] ) ) {
523
+		if ($WP_Query->is_main_query() && ! empty($this->CPT['args']['page_templates'])) {
524 524
 			// then let's hook into the appropriate query_template hook
525
-			add_filter( 'single_template', array( $this, 'single_cpt_template' ) );
525
+			add_filter('single_template', array($this, 'single_cpt_template'));
526 526
 		}
527 527
 	}
528 528
 
@@ -536,17 +536,17 @@  discard block
 block discarded – undo
536 536
 	 * @param string $current_template Existing default template path derived for this page call.
537 537
 	 * @return string the path to the full template file.
538 538
 	 */
539
-	public function single_cpt_template( $current_template ) {
539
+	public function single_cpt_template($current_template) {
540 540
 		$object = get_queried_object();
541 541
 		//does this called object HAVE a page template set that is something other than the default.
542
-		$template = get_post_meta( $object->ID, '_wp_page_template', true );
542
+		$template = get_post_meta($object->ID, '_wp_page_template', true);
543 543
 
544 544
 		//exit early if default or not set or invalid path (accounts for theme changes)
545
-		if ( $template == 'default' || empty( $template ) || ! is_readable( get_stylesheet_directory() . '/' . $template ) ) {
545
+		if ($template == 'default' || empty($template) || ! is_readable(get_stylesheet_directory().'/'.$template)) {
546 546
 			return $current_template;
547 547
 		}
548 548
 		//made it here so we SHOULD be able to just locate the template and then return it.
549
-		$template = locate_template( array($template)  );
549
+		$template = locate_template(array($template));
550 550
 
551 551
 		return $template;
552 552
 	}
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 	 * @param 	array 	$arguments
595 595
 	 * @return 	\EE_CPT_Default_Strategy
596 596
 	 */
597
-	public function __construct( $arguments = array() ) {
598
-		$this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL;
599
-		$WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL;
597
+	public function __construct($arguments = array()) {
598
+		$this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL;
599
+		$WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL;
600 600
 		//EEH_Debug_Tools::printr( $this->CPT, '$this->CPT  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
601 601
 //		add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 );
602 602
 //		add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 );
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 	 * @param 	\WP_Query $WP_Query
612 612
 	 * @return 	\WP_Query
613 613
 	 */
614
-	public function pre_get_posts(  WP_Query $WP_Query  ) {
614
+	public function pre_get_posts(WP_Query $WP_Query) {
615 615
 		//EEH_Debug_Tools::printr( $WP_Query, '$WP_Query  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
616
-		if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) {
616
+		if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) {
617 617
 			return $WP_Query;
618 618
 		}
619 619
 //		$WP_Query->set( 'post_type', array( $this->CPT['post_type'] ));
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	 * @param 	\WP_Query $WP_Query
632 632
 	 * @return 	\WP_Post[]
633 633
 	 */
634
-	public function the_posts(  $posts, WP_Query $WP_Query ) {
634
+	public function the_posts($posts, WP_Query $WP_Query) {
635 635
 		return $posts;
636 636
 	}
637 637
 
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 	 * @param 	string 	$single
648 648
 	 * @return 	mixed
649 649
 	 */
650
-	public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) {
650
+	public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) {
651 651
 		return $meta_value;
652 652
 	}
653 653
 
Please login to merge, or discard this patch.