Completed
Branch BUG-8698-ticket-sellouts (4c4ee4)
by
unknown
463:26 queued 449:22
created
public/template_tags.php 1 patch
Spacing   +303 added lines, -303 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
  * @param int | \EE_Event $event
28 28
  * @return bool
29 29
  */
30
-function is_espresso_event( $event = NULL ) {
31
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
30
+function is_espresso_event($event = NULL) {
31
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
32 32
 		// load event view helper
33
-		EE_Registry::instance()->load_helper( 'Event_View' );
33
+		EE_Registry::instance()->load_helper('Event_View');
34 34
 		// extract EE_Event object from passed param regardless of what it is (within reason of course)
35
-		$event = EEH_Event_View::get_event( $event );
35
+		$event = EEH_Event_View::get_event($event);
36 36
 		// do we have a valid event ?
37
-		return $event instanceof EE_Event  ? TRUE : FALSE;
37
+		return $event instanceof EE_Event ? TRUE : FALSE;
38 38
 	}
39 39
 	return FALSE;
40 40
 }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  * @return bool
47 47
  */
48 48
 function is_espresso_event_single() {
49
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
49
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
50 50
 		global $wp_query;
51 51
 		// return conditionals set by CPTs
52 52
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : FALSE;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
  * @return bool
62 62
  */
63 63
 function is_espresso_event_archive() {
64
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
64
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
65 65
 		global $wp_query;
66 66
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : FALSE;
67 67
 	}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
  * @return bool
76 76
  */
77 77
 function is_espresso_event_taxonomy() {
78
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
78
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
79 79
 		global $wp_query;
80 80
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : FALSE;
81 81
 	}
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
  * @param int | \EE_Venue $venue
90 90
  * @return bool
91 91
  */
92
-function is_espresso_venue( $venue = NULL ) {
93
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
92
+function is_espresso_venue($venue = NULL) {
93
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
94 94
 		// load event view helper
95
-		EE_Registry::instance()->load_helper( 'Venue_View' );
95
+		EE_Registry::instance()->load_helper('Venue_View');
96 96
 		// extract EE_Venue object from passed param regardless of what it is (within reason of course)
97
-		$venue = EEH_Venue_View::get_venue( $venue, FALSE );
97
+		$venue = EEH_Venue_View::get_venue($venue, FALSE);
98 98
 		// do we have a valid event ?
99 99
 		return $venue instanceof EE_Venue ? TRUE : FALSE;
100 100
 	}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
  * @return bool
109 109
  */
110 110
 function is_espresso_venue_single() {
111
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
111
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
112 112
 		global $wp_query;
113 113
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : FALSE;
114 114
 	}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
  * @return bool
123 123
  */
124 124
 function is_espresso_venue_archive() {
125
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
125
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
126 126
 		global $wp_query;
127 127
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : FALSE;
128 128
 	}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
  * @return bool
137 137
  */
138 138
 function is_espresso_venue_taxonomy() {
139
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
139
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
140 140
 		global $wp_query;
141 141
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : FALSE;
142 142
 	}
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
  * @param $conditional_tag
151 151
  * @return bool
152 152
  */
153
-function can_use_espresso_conditionals( $conditional_tag ) {
154
-	if ( ! did_action( 'AHEE__EE_System__initialize' )) {
153
+function can_use_espresso_conditionals($conditional_tag) {
154
+	if ( ! did_action('AHEE__EE_System__initialize')) {
155 155
 		EE_Error::doing_it_wrong(
156 156
 			__FUNCTION__,
157 157
 			sprintf(
158
-				__( 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.','event_espresso'),
158
+				__('The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', 'event_espresso'),
159 159
 				$conditional_tag
160 160
 			),
161 161
 			'4.4.0'
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 
171 171
 /*************************** Event Queries ***************************/
172 172
 
173
-if ( ! function_exists( 'espresso_get_events' )) {
173
+if ( ! function_exists('espresso_get_events')) {
174 174
 	/**
175 175
 	 * 	espresso_get_events
176 176
 	 * @param array $params
177 177
 	 * @return array
178 178
 	 */
179
-	function espresso_get_events( $params = array() ) {
179
+	function espresso_get_events($params = array()) {
180 180
 		//set default params
181 181
 		$default_espresso_events_params = array(
182 182
 			'limit' => 10,
@@ -187,18 +187,18 @@  discard block
 block discarded – undo
187 187
 			'sort' => 'ASC'
188 188
 		);
189 189
 		// allow the defaults to be filtered
190
-		$default_espresso_events_params = apply_filters( 'espresso_get_events__default_espresso_events_params', $default_espresso_events_params );
190
+		$default_espresso_events_params = apply_filters('espresso_get_events__default_espresso_events_params', $default_espresso_events_params);
191 191
 		// grab params and merge with defaults, then extract
192
-		$params = array_merge( $default_espresso_events_params, $params );
192
+		$params = array_merge($default_espresso_events_params, $params);
193 193
 		// run the query
194
-		$events_query = new EE_Event_List_Query( $params );
194
+		$events_query = new EE_Event_List_Query($params);
195 195
 		// assign results to a variable so we can return it
196 196
 		$events = $events_query->have_posts() ? $events_query->posts : array();
197 197
 		// but first reset the query and postdata
198 198
 		wp_reset_query();
199 199
 		wp_reset_postdata();
200 200
 		EED_Events_Archive::remove_all_events_archive_filters();
201
-		unset( $events_query );
201
+		unset($events_query);
202 202
 		return $events;
203 203
 	}
204 204
 }
@@ -212,32 +212,32 @@  discard block
 block discarded – undo
212 212
  * espresso_load_ticket_selector
213 213
  */
214 214
 function espresso_load_ticket_selector() {
215
-	EE_Registry::instance()->load_file( EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module' );
215
+	EE_Registry::instance()->load_file(EE_MODULES.'ticket_selector', 'EED_Ticket_Selector', 'module');
216 216
 }
217 217
 
218
-if ( ! function_exists( 'espresso_ticket_selector' )) {
218
+if ( ! function_exists('espresso_ticket_selector')) {
219 219
 	/**
220 220
 	 * espresso_ticket_selector
221 221
 	 * @param null $event
222 222
 	 */
223
-	function espresso_ticket_selector( $event = NULL ) {
224
-		if (  ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) {
223
+	function espresso_ticket_selector($event = NULL) {
224
+		if ( ! apply_filters('FHEE_disable_espresso_ticket_selector', FALSE)) {
225 225
 			espresso_load_ticket_selector();
226
-			echo EED_Ticket_Selector::display_ticket_selector( $event );
226
+			echo EED_Ticket_Selector::display_ticket_selector($event);
227 227
 		}
228 228
 	}
229 229
 }
230 230
 
231 231
 
232
-	if ( ! function_exists( 'espresso_view_details_btn' )) {
232
+	if ( ! function_exists('espresso_view_details_btn')) {
233 233
 	/**
234 234
 	 * espresso_view_details_btn
235 235
 	 * @param null $event
236 236
 	 */
237
-	function espresso_view_details_btn( $event = NULL ) {
238
-		if (  ! apply_filters( 'FHEE_disable_espresso_view_details_btn', FALSE ) ) {
237
+	function espresso_view_details_btn($event = NULL) {
238
+		if ( ! apply_filters('FHEE_disable_espresso_view_details_btn', FALSE)) {
239 239
 			espresso_load_ticket_selector();
240
-			echo EED_Ticket_Selector::display_ticket_selector( $event, TRUE );
240
+			echo EED_Ticket_Selector::display_ticket_selector($event, TRUE);
241 241
 		}
242 242
 	}
243 243
 }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
 /*************************** EEH_Event_View ***************************/
249 249
 
250
-if ( ! function_exists( 'espresso_load_event_list_assets' )) {
250
+if ( ! function_exists('espresso_load_event_list_assets')) {
251 251
 	/**
252 252
 	 * espresso_load_event_list_assets
253 253
 	 * ensures that event list styles and scripts are loaded
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	function espresso_load_event_list_assets() {
258 258
 		$event_list = EED_Events_Archive::instance();
259
-		add_action( 'AHEE__EE_System__initialize_last', array( $event_list, 'load_event_list_assets' ), 10 );
260
-		add_filter( 'FHEE_enable_default_espresso_css', '__return_true' );
259
+		add_action('AHEE__EE_System__initialize_last', array($event_list, 'load_event_list_assets'), 10);
260
+		add_filter('FHEE_enable_default_espresso_css', '__return_true');
261 261
 	}
262 262
 }
263 263
 
264 264
 
265
-if ( ! function_exists( 'espresso_event_reg_button' )) {
265
+if ( ! function_exists('espresso_event_reg_button')) {
266 266
 	/**
267 267
 	 * espresso_event_reg_button
268 268
 	 * returns the "Register Now" button if event is active,
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
 	 * @param bool $EVT_ID
275 275
 	 * @return string
276 276
 	 */
277
-	function espresso_event_reg_button( $btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE ) {
278
-		EE_Registry::instance()->load_helper( 'Event_View' );
279
-		$event_status = EEH_Event_View::event_active_status( $EVT_ID );
280
-		switch ( $event_status ) {
277
+	function espresso_event_reg_button($btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE) {
278
+		EE_Registry::instance()->load_helper('Event_View');
279
+		$event_status = EEH_Event_View::event_active_status($EVT_ID);
280
+		switch ($event_status) {
281 281
 			case EE_Datetime::sold_out :
282 282
 				$btn_text = __('Sold Out', 'event_espresso');
283 283
 				$class = 'ee-pink';
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 			case EE_Datetime::upcoming :
294 294
 			case EE_Datetime::active :
295 295
 			default :
296
-				$btn_text =! empty( $btn_text_if_active ) ? $btn_text_if_active : __( 'Register Now', 'event_espresso' );
296
+				$btn_text = ! empty($btn_text_if_active) ? $btn_text_if_active : __('Register Now', 'event_espresso');
297 297
 				$class = 'ee-green';
298 298
 		}
299
-		if ( $event_status < 1 && ! empty( $btn_text_if_inactive )) {
299
+		if ($event_status < 1 && ! empty($btn_text_if_inactive)) {
300 300
 			$btn_text = $btn_text_if_inactive;
301 301
 			$class = 'ee-grey';
302 302
 		}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 
311 311
 
312 312
 
313
-if ( ! function_exists( 'espresso_display_ticket_selector' )) {
313
+if ( ! function_exists('espresso_display_ticket_selector')) {
314 314
 	/**
315 315
 	 * espresso_display_ticket_selector
316 316
 	 * whether or not to display the Ticket Selector for an event
@@ -318,15 +318,15 @@  discard block
 block discarded – undo
318 318
 	 * @param bool $EVT_ID
319 319
 	 * @return boolean
320 320
 	 */
321
-	function espresso_display_ticket_selector( $EVT_ID = FALSE ) {
322
-		EE_Registry::instance()->load_helper( 'Event_View' );
323
-		return EEH_Event_View::display_ticket_selector( $EVT_ID );
321
+	function espresso_display_ticket_selector($EVT_ID = FALSE) {
322
+		EE_Registry::instance()->load_helper('Event_View');
323
+		return EEH_Event_View::display_ticket_selector($EVT_ID);
324 324
 	}
325 325
 }
326 326
 
327 327
 
328 328
 
329
-if ( ! function_exists( 'espresso_event_status_banner' )) {
329
+if ( ! function_exists('espresso_event_status_banner')) {
330 330
 	/**
331 331
 	 * espresso_event_status
332 332
 	 * returns a banner showing the event status if it is sold out, expired, or inactive
@@ -334,14 +334,14 @@  discard block
 block discarded – undo
334 334
 	 * @param bool $EVT_ID
335 335
 	 * @return string
336 336
 	 */
337
-	function espresso_event_status_banner( $EVT_ID = FALSE ) {
338
-		EE_Registry::instance()->load_helper( 'Event_View' );
339
-		return EEH_Event_View::event_status( $EVT_ID );
337
+	function espresso_event_status_banner($EVT_ID = FALSE) {
338
+		EE_Registry::instance()->load_helper('Event_View');
339
+		return EEH_Event_View::event_status($EVT_ID);
340 340
 	}
341 341
 }
342 342
 
343 343
 
344
-if ( ! function_exists( 'espresso_event_status' )) {
344
+if ( ! function_exists('espresso_event_status')) {
345 345
 	/**
346 346
 	 * espresso_event_status
347 347
 	 * returns the event status if it is sold out, expired, or inactive
@@ -350,18 +350,18 @@  discard block
 block discarded – undo
350 350
 	 * @param bool $echo
351 351
 	 * @return string
352 352
 	 */
353
-	function espresso_event_status( $EVT_ID = 0, $echo = TRUE ) {
354
-		EE_Registry::instance()->load_helper( 'Event_View' );
355
-		if ( $echo ) {
356
-			echo EEH_Event_View::event_active_status( $EVT_ID );
353
+	function espresso_event_status($EVT_ID = 0, $echo = TRUE) {
354
+		EE_Registry::instance()->load_helper('Event_View');
355
+		if ($echo) {
356
+			echo EEH_Event_View::event_active_status($EVT_ID);
357 357
 			return '';
358 358
 		}
359
-		return EEH_Event_View::event_active_status( $EVT_ID );
359
+		return EEH_Event_View::event_active_status($EVT_ID);
360 360
 	}
361 361
 }
362 362
 
363 363
 
364
-if ( ! function_exists( 'espresso_event_categories' )) {
364
+if ( ! function_exists('espresso_event_categories')) {
365 365
 	/**
366 366
 	 * espresso_event_categories
367 367
 	 * returns the terms associated with an event
@@ -371,18 +371,18 @@  discard block
 block discarded – undo
371 371
 	 * @param bool $echo
372 372
 	 * @return string
373 373
 	 */
374
-	function espresso_event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) {
375
-		EE_Registry::instance()->load_helper( 'Event_View' );
376
-		if ( $echo ) {
377
-			echo EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized );
374
+	function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) {
375
+		EE_Registry::instance()->load_helper('Event_View');
376
+		if ($echo) {
377
+			echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized);
378 378
 			return '';
379 379
 		}
380
-		return EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized );
380
+		return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized);
381 381
 	}
382 382
 }
383 383
 
384 384
 
385
-if ( ! function_exists( 'espresso_event_tickets_available' )) {
385
+if ( ! function_exists('espresso_event_tickets_available')) {
386 386
 	/**
387 387
 	 * espresso_event_tickets_available
388 388
 	 * returns the ticket types available for purchase for an event
@@ -392,27 +392,27 @@  discard block
 block discarded – undo
392 392
 	 * @param bool $format
393 393
 	 * @return string
394 394
 	 */
395
-	function espresso_event_tickets_available( $EVT_ID = 0, $echo = TRUE, $format = TRUE ) {
396
-		EE_Registry::instance()->load_helper( 'Event_View' );
397
-		$tickets = EEH_Event_View::event_tickets_available( $EVT_ID );
398
-		if ( is_array( $tickets ) && ! empty( $tickets )) {
395
+	function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE) {
396
+		EE_Registry::instance()->load_helper('Event_View');
397
+		$tickets = EEH_Event_View::event_tickets_available($EVT_ID);
398
+		if (is_array($tickets) && ! empty($tickets)) {
399 399
 			// if formatting then $html will be a string, else it will be an array of ticket objects
400
-			$html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array();
401
-			foreach ( $tickets as $ticket ) {
402
-				if ( $ticket instanceof EE_Ticket ) {
403
-					if ( $format ) {
404
-						$html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">';
405
-						$html .= $ticket->name() . ' ' . EEH_Template::format_currency( $ticket->get_ticket_total_with_taxes() );
400
+			$html = $format ? '<ul id="ee-event-tickets-ul-'.$EVT_ID.'" class="ee-event-tickets-ul">' : array();
401
+			foreach ($tickets as $ticket) {
402
+				if ($ticket instanceof EE_Ticket) {
403
+					if ($format) {
404
+						$html .= '<li id="ee-event-tickets-li-'.$ticket->ID().'" class="ee-event-tickets-li">';
405
+						$html .= $ticket->name().' '.EEH_Template::format_currency($ticket->get_ticket_total_with_taxes());
406 406
 						$html .= '</li>';
407 407
 					} else {
408 408
 						$html[] = $ticket;
409 409
 					}
410 410
 				}
411 411
 			}
412
-			if ( $format ) {
412
+			if ($format) {
413 413
 				$html .= '</ul>';
414 414
 			}
415
-			if ( $echo && ! $format ) {
415
+			if ($echo && ! $format) {
416 416
 				echo $html;
417 417
 				return '';
418 418
 			}
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	}
423 423
 }
424 424
 
425
-if ( ! function_exists( 'espresso_event_date_obj' )) {
425
+if ( ! function_exists('espresso_event_date_obj')) {
426 426
 	/**
427 427
 	 * espresso_event_date_obj
428 428
 	 * returns the primary date object for an event
@@ -430,14 +430,14 @@  discard block
 block discarded – undo
430 430
 	 * @param bool $EVT_ID
431 431
 	 * @return object
432 432
 	 */
433
-	function espresso_event_date_obj( $EVT_ID = FALSE ) {
434
-		EE_Registry::instance()->load_helper( 'Event_View' );
435
-		return EEH_Event_View::get_primary_date_obj( $EVT_ID );
433
+	function espresso_event_date_obj($EVT_ID = FALSE) {
434
+		EE_Registry::instance()->load_helper('Event_View');
435
+		return EEH_Event_View::get_primary_date_obj($EVT_ID);
436 436
 	}
437 437
 }
438 438
 
439 439
 
440
-if ( ! function_exists( 'espresso_event_date' )) {
440
+if ( ! function_exists('espresso_event_date')) {
441 441
 	/**
442 442
 	 * espresso_event_date
443 443
 	 * returns the primary date for an event
@@ -448,23 +448,23 @@  discard block
 block discarded – undo
448 448
 	 * @param bool $echo
449 449
 	 * @return string
450 450
 	 */
451
-	function espresso_event_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) {
452
-		$date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' );
453
-		$time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' );
454
-		$date_format = apply_filters( 'FHEE__espresso_event_date__date_format', $date_format );
455
-		$time_format = apply_filters( 'FHEE__espresso_event_date__time_format', $time_format );
456
-		EE_Registry::instance()->load_helper( 'Event_View' );
457
-		if($echo){
458
-			echo EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID );
451
+	function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) {
452
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
453
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
454
+		$date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format);
455
+		$time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format);
456
+		EE_Registry::instance()->load_helper('Event_View');
457
+		if ($echo) {
458
+			echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID);
459 459
 			return '';
460 460
 		}
461
-		return EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID );
461
+		return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID);
462 462
 
463 463
 	}
464 464
 }
465 465
 
466 466
 
467
-if ( ! function_exists( 'espresso_list_of_event_dates' )) {
467
+if ( ! function_exists('espresso_list_of_event_dates')) {
468 468
 	/**
469 469
 	 * espresso_list_of_event_dates
470 470
 	 * returns a unordered list of dates for an event
@@ -479,41 +479,41 @@  discard block
 block discarded – undo
479 479
 	 * @param null   $limit
480 480
 	 * @return string
481 481
 	 */
482
-	function espresso_list_of_event_dates( $EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL ) {
483
-		$date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' );
484
-		$time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' );
485
-		$date_format = apply_filters( 'FHEE__espresso_list_of_event_dates__date_format', $date_format );
486
-		$time_format = apply_filters( 'FHEE__espresso_list_of_event_dates__time_format', $time_format );
487
-		EE_Registry::instance()->load_helper( 'Event_View' );
488
-		$datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired, FALSE, $limit );
489
-		if ( ! $format ) {
490
-			return apply_filters( 'FHEE__espresso_list_of_event_dates__datetimes', $datetimes );
482
+	function espresso_list_of_event_dates($EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL) {
483
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
484
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
485
+		$date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format);
486
+		$time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format);
487
+		EE_Registry::instance()->load_helper('Event_View');
488
+		$datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, FALSE, $limit);
489
+		if ( ! $format) {
490
+			return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes);
491 491
 		}
492 492
 		//d( $datetimes );
493
-		if ( is_array( $datetimes ) && ! empty( $datetimes )) {
493
+		if (is_array($datetimes) && ! empty($datetimes)) {
494 494
 			global $post;
495
-			$html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul ee-clearfix">' : '';
496
-			foreach ( $datetimes as $datetime ) {
497
-				if ( $datetime instanceof EE_Datetime ) {
498
-					$html .= '<li id="ee-event-datetimes-li-' . $datetime->ID();
499
-					$html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-' . $datetime->get_active_status() . '">';
495
+			$html = $format ? '<ul id="ee-event-datetimes-ul-'.$post->ID.'" class="ee-event-datetimes-ul ee-clearfix">' : '';
496
+			foreach ($datetimes as $datetime) {
497
+				if ($datetime instanceof EE_Datetime) {
498
+					$html .= '<li id="ee-event-datetimes-li-'.$datetime->ID();
499
+					$html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-'.$datetime->get_active_status().'">';
500 500
 					$datetime_name = $datetime->name();
501
-					$html .= ! empty( $datetime_name ) ? '<strong>' . $datetime_name . '</strong>' : '';
502
-					$html .= ! empty( $datetime_name )  && $add_breaks ? '<br />' : '';
503
-					$html .= '<span class="dashicons dashicons-calendar"></span>' . $datetime->date_range( $date_format ) . '<br/>';
504
-					$html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->time_range( $time_format );
501
+					$html .= ! empty($datetime_name) ? '<strong>'.$datetime_name.'</strong>' : '';
502
+					$html .= ! empty($datetime_name) && $add_breaks ? '<br />' : '';
503
+					$html .= '<span class="dashicons dashicons-calendar"></span>'.$datetime->date_range($date_format).'<br/>';
504
+					$html .= '<span class="dashicons dashicons-clock"></span>'.$datetime->time_range($time_format);
505 505
 					$datetime_description = $datetime->description();
506
-					$html .= ! empty( $datetime_description )  && $add_breaks ? '<br />' : '';
507
-					$html .= ! empty( $datetime_description ) ? ' - ' . $datetime_description : '';
508
-					$html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime );
506
+					$html .= ! empty($datetime_description) && $add_breaks ? '<br />' : '';
507
+					$html .= ! empty($datetime_description) ? ' - '.$datetime_description : '';
508
+					$html = apply_filters('FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime);
509 509
 					$html .= '</li>';
510 510
 				}
511 511
 			}
512 512
 			$html .= $format ? '</ul>' : '';
513 513
 		} else {
514
-			$html = $format ?  '<p><span class="dashicons dashicons-marker pink-text"></span>' . __( 'There are no upcoming dates for this event.', 'event_espresso' ) . '</p><br/>' : '';
514
+			$html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>'.__('There are no upcoming dates for this event.', 'event_espresso').'</p><br/>' : '';
515 515
 		}
516
-		if ( $echo ) {
516
+		if ($echo) {
517 517
 			echo $html;
518 518
 			return '';
519 519
 		}
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 }
523 523
 
524 524
 
525
-if ( ! function_exists( 'espresso_event_end_date' )) {
525
+if ( ! function_exists('espresso_event_end_date')) {
526 526
 	/**
527 527
 	 * espresso_event_end_date
528 528
 	 * returns the last date for an event
@@ -533,21 +533,21 @@  discard block
 block discarded – undo
533 533
 	 * @param bool   $echo
534 534
 	 * @return string
535 535
 	 */
536
-	function espresso_event_end_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) {
537
-		$date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' );
538
-		$time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' );
539
-		$date_format = apply_filters( 'FHEE__espresso_event_end_date__date_format', $date_format );
540
-		$time_format = apply_filters( 'FHEE__espresso_event_end_date__time_format', $time_format );
541
-		EE_Registry::instance()->load_helper( 'Event_View' );
542
-		if($echo){
543
-			echo EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID );
536
+	function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) {
537
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
538
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
539
+		$date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format);
540
+		$time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format);
541
+		EE_Registry::instance()->load_helper('Event_View');
542
+		if ($echo) {
543
+			echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID);
544 544
 			return '';
545 545
 		}
546
-		return EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID );
546
+		return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID);
547 547
 	}
548 548
 }
549 549
 
550
-if ( ! function_exists( 'espresso_event_date_range' )) {
550
+if ( ! function_exists('espresso_event_date_range')) {
551 551
 	/**
552 552
 	 * espresso_event_date_range
553 553
 	 * returns the first and last chronologically ordered dates for an event (if different)
@@ -559,32 +559,32 @@  discard block
 block discarded – undo
559 559
 	 * @param bool   $EVT_ID
560 560
 	 * @return string
561 561
 	 */
562
-	function espresso_event_date_range( $date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE ) {
563
-		EE_Registry::instance()->load_helper( 'Event_View' );
562
+	function espresso_event_date_range($date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE) {
563
+		EE_Registry::instance()->load_helper('Event_View');
564 564
 		// set and filter date and time formats when a range is returned
565
-		$date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' );
566
-		$date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', $date_format );
565
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
566
+		$date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format);
567 567
 		// get the start and end date with NO time portion
568
-		$the_event_date = EEH_Event_View::the_earliest_event_date( $date_format, '', $EVT_ID );
569
-		$the_event_end_date = EEH_Event_View::the_latest_event_date( $date_format, '', $EVT_ID );
568
+		$the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID);
569
+		$the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID);
570 570
 		// now we can determine if date range spans more than one day
571
-		if ( $the_event_date != $the_event_end_date ) {
572
-			$time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' );
573
-			$time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', $time_format );
571
+		if ($the_event_date != $the_event_end_date) {
572
+			$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
573
+			$time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format);
574 574
 			$html = sprintf(
575
-				__( '%1$s - %2$s', 'event_espresso' ),
576
-				EEH_Event_View::the_earliest_event_date( $date_format, $time_format, $EVT_ID ),
577
-				EEH_Event_View::the_latest_event_date( $date_format, $time_format, $EVT_ID )
575
+				__('%1$s - %2$s', 'event_espresso'),
576
+				EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID),
577
+				EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID)
578 578
 			);
579 579
 		} else {
580 580
 			// set and filter date and time formats when only a single datetime is returned
581
-			$single_date_format = ! empty( $single_date_format ) ? $single_date_format : get_option( 'date_format' );
582
-			$single_time_format = ! empty( $single_time_format ) ? $single_time_format : get_option( 'time_format' );
583
-			$single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', $single_date_format );
584
-			$single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', $single_time_format );
585
-			$html = EEH_Event_View::the_earliest_event_date( $single_date_format, $single_time_format, $EVT_ID );
581
+			$single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format');
582
+			$single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format');
583
+			$single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format);
584
+			$single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format);
585
+			$html = EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID);
586 586
 		}
587
-		if ( $echo ) {
587
+		if ($echo) {
588 588
 			echo $html;
589 589
 			return '';
590 590
 		}
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 }
594 594
 
595 595
 
596
-if ( ! function_exists( 'espresso_event_date_as_calendar_page' )) {
596
+if ( ! function_exists('espresso_event_date_as_calendar_page')) {
597 597
 	/**
598 598
 	 * espresso_event_date_as_calendar_page
599 599
 	 * returns the primary date for an event, stylized to appear as the page of a calendar
@@ -601,16 +601,16 @@  discard block
 block discarded – undo
601 601
 	 * @param bool $EVT_ID
602 602
 	 * @return string
603 603
 	 */
604
-	function espresso_event_date_as_calendar_page( $EVT_ID = FALSE ) {
605
-		EE_Registry::instance()->load_helper( 'Event_View' );
606
-		EEH_Event_View::event_date_as_calendar_page( $EVT_ID );
604
+	function espresso_event_date_as_calendar_page($EVT_ID = FALSE) {
605
+		EE_Registry::instance()->load_helper('Event_View');
606
+		EEH_Event_View::event_date_as_calendar_page($EVT_ID);
607 607
 	}
608 608
 }
609 609
 
610 610
 
611 611
 
612 612
 
613
-if ( ! function_exists( 'espresso_event_link_url' )) {
613
+if ( ! function_exists('espresso_event_link_url')) {
614 614
 	/**
615 615
 	 * espresso_event_link_url
616 616
 	 *
@@ -618,19 +618,19 @@  discard block
 block discarded – undo
618 618
 	 * @param bool $echo
619 619
 	 * @return string
620 620
 	 */
621
-	function espresso_event_link_url( $EVT_ID = 0, $echo = TRUE ) {
622
-		EE_Registry::instance()->load_helper( 'Event_View' );
623
-		if ( $echo ) {
624
-			echo EEH_Event_View::event_link_url( $EVT_ID );
621
+	function espresso_event_link_url($EVT_ID = 0, $echo = TRUE) {
622
+		EE_Registry::instance()->load_helper('Event_View');
623
+		if ($echo) {
624
+			echo EEH_Event_View::event_link_url($EVT_ID);
625 625
 			return '';
626 626
 		}
627
-		return EEH_Event_View::event_link_url( $EVT_ID );
627
+		return EEH_Event_View::event_link_url($EVT_ID);
628 628
 	}
629 629
 }
630 630
 
631 631
 
632 632
 
633
-if ( ! function_exists( 'espresso_event_has_content_or_excerpt' )) {
633
+if ( ! function_exists('espresso_event_has_content_or_excerpt')) {
634 634
 	/**
635 635
 	 *    espresso_event_has_content_or_excerpt
636 636
 	 *
@@ -638,16 +638,16 @@  discard block
 block discarded – undo
638 638
 	 * @param bool $EVT_ID
639 639
 	 * @return    boolean
640 640
 	 */
641
-	function espresso_event_has_content_or_excerpt( $EVT_ID = FALSE ) {
642
-		EE_Registry::instance()->load_helper( 'Event_View' );
643
-		return EEH_Event_View::event_has_content_or_excerpt( $EVT_ID );
641
+	function espresso_event_has_content_or_excerpt($EVT_ID = FALSE) {
642
+		EE_Registry::instance()->load_helper('Event_View');
643
+		return EEH_Event_View::event_has_content_or_excerpt($EVT_ID);
644 644
 	}
645 645
 }
646 646
 
647 647
 
648 648
 
649 649
 
650
-if ( ! function_exists( 'espresso_event_content_or_excerpt' )) {
650
+if ( ! function_exists('espresso_event_content_or_excerpt')) {
651 651
 	/**
652 652
 	 * espresso_event_content_or_excerpt
653 653
 	 *
@@ -656,19 +656,19 @@  discard block
 block discarded – undo
656 656
 	 * @param bool $echo
657 657
 	 * @return string
658 658
 	 */
659
-	function espresso_event_content_or_excerpt( $num_words = 55, $more = NULL, $echo = TRUE ) {
660
-		EE_Registry::instance()->load_helper( 'Event_View' );
661
-		if ( $echo ) {
662
-			echo EEH_Event_View::event_content_or_excerpt( $num_words, $more );
659
+	function espresso_event_content_or_excerpt($num_words = 55, $more = NULL, $echo = TRUE) {
660
+		EE_Registry::instance()->load_helper('Event_View');
661
+		if ($echo) {
662
+			echo EEH_Event_View::event_content_or_excerpt($num_words, $more);
663 663
 			return '';
664 664
 		}
665
-		return EEH_Event_View::event_content_or_excerpt( $num_words, $more );
665
+		return EEH_Event_View::event_content_or_excerpt($num_words, $more);
666 666
 	}
667 667
 }
668 668
 
669 669
 
670 670
 
671
-if ( ! function_exists( 'espresso_event_phone' )) {
671
+if ( ! function_exists('espresso_event_phone')) {
672 672
 	/**
673 673
 	 * espresso_event_phone
674 674
 	 *
@@ -676,19 +676,19 @@  discard block
 block discarded – undo
676 676
 	 * @param bool $echo
677 677
 	 * @return string
678 678
 	 */
679
-	function espresso_event_phone( $EVT_ID = 0, $echo = TRUE ) {
680
-		EE_Registry::instance()->load_helper( 'Event_View' );
681
-		if ( $echo ) {
682
-			echo EEH_Event_View::event_phone( $EVT_ID );
679
+	function espresso_event_phone($EVT_ID = 0, $echo = TRUE) {
680
+		EE_Registry::instance()->load_helper('Event_View');
681
+		if ($echo) {
682
+			echo EEH_Event_View::event_phone($EVT_ID);
683 683
 			return '';
684 684
 		}
685
-		return EEH_Event_View::event_phone( $EVT_ID );
685
+		return EEH_Event_View::event_phone($EVT_ID);
686 686
 	}
687 687
 }
688 688
 
689 689
 
690 690
 
691
-if ( ! function_exists( 'espresso_edit_event_link' )) {
691
+if ( ! function_exists('espresso_edit_event_link')) {
692 692
 	/**
693 693
 	 * espresso_edit_event_link
694 694
 	 * returns a link to edit an event
@@ -697,41 +697,41 @@  discard block
 block discarded – undo
697 697
 	 * @param bool $echo
698 698
 	 * @return string
699 699
 	 */
700
-	function espresso_edit_event_link( $EVT_ID = 0, $echo = TRUE ) {
701
-		EE_Registry::instance()->load_helper( 'Event_View' );
702
-		if ( $echo ) {
703
-			echo EEH_Event_View::edit_event_link( $EVT_ID );
700
+	function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) {
701
+		EE_Registry::instance()->load_helper('Event_View');
702
+		if ($echo) {
703
+			echo EEH_Event_View::edit_event_link($EVT_ID);
704 704
 			return '';
705 705
 		}
706
-		return EEH_Event_View::edit_event_link( $EVT_ID );
706
+		return EEH_Event_View::edit_event_link($EVT_ID);
707 707
 	}
708 708
 }
709 709
 
710 710
 
711
-if ( ! function_exists( 'espresso_organization_name' )) {
711
+if ( ! function_exists('espresso_organization_name')) {
712 712
 	/**
713 713
 	 * espresso_organization_name
714 714
 	 * @param bool $echo
715 715
 	 * @return string
716 716
 	 */
717 717
 	function espresso_organization_name($echo = TRUE) {
718
-		if($echo){
719
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'name' );
718
+		if ($echo) {
719
+			echo EE_Registry::instance()->CFG->organization->get_pretty('name');
720 720
 			return '';
721 721
 		}
722
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'name' );
722
+		return EE_Registry::instance()->CFG->organization->get_pretty('name');
723 723
 	}
724 724
 }
725 725
 
726
-if ( ! function_exists( 'espresso_organization_address' )) {
726
+if ( ! function_exists('espresso_organization_address')) {
727 727
 	/**
728 728
 	 * espresso_organization_address
729 729
 	 * @param string $type
730 730
 	 * @return string
731 731
 	 */
732
-	function espresso_organization_address( $type = 'inline' ) {
733
-		if ( EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ) {
734
-			EE_Registry::instance()->load_helper( 'Formatter' );
732
+	function espresso_organization_address($type = 'inline') {
733
+		if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) {
734
+			EE_Registry::instance()->load_helper('Formatter');
735 735
 			$address = new EE_Generic_Address(
736 736
 				EE_Registry::instance()->CFG->organization->address_1,
737 737
 				EE_Registry::instance()->CFG->organization->address_2,
@@ -740,129 +740,129 @@  discard block
 block discarded – undo
740 740
 				EE_Registry::instance()->CFG->organization->zip,
741 741
 				EE_Registry::instance()->CFG->organization->CNT_ISO
742 742
 			);
743
-			return EEH_Address::format( $address, $type );
743
+			return EEH_Address::format($address, $type);
744 744
 		}
745 745
 		return '';
746 746
 	}
747 747
 }
748 748
 
749
-if ( ! function_exists( 'espresso_organization_email' )) {
749
+if ( ! function_exists('espresso_organization_email')) {
750 750
 	/**
751 751
 	 * espresso_organization_email
752 752
 	 * @param bool $echo
753 753
 	 * @return string
754 754
 	 */
755
-	function espresso_organization_email( $echo = TRUE ) {
756
-		if($echo){
757
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'email' );
755
+	function espresso_organization_email($echo = TRUE) {
756
+		if ($echo) {
757
+			echo EE_Registry::instance()->CFG->organization->get_pretty('email');
758 758
 			return '';
759 759
 		}
760
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'email' );
760
+		return EE_Registry::instance()->CFG->organization->get_pretty('email');
761 761
 	}
762 762
 }
763 763
 
764
-if ( ! function_exists( 'espresso_organization_logo_url' )) {
764
+if ( ! function_exists('espresso_organization_logo_url')) {
765 765
 	/**
766 766
 	 * espresso_organization_logo_url
767 767
 	 * @param bool $echo
768 768
 	 * @return string
769 769
 	 */
770
-	function espresso_organization_logo_url( $echo = TRUE ) {
771
-		if($echo){
772
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' );
770
+	function espresso_organization_logo_url($echo = TRUE) {
771
+		if ($echo) {
772
+			echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
773 773
 			return '';
774 774
 		}
775
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' );
775
+		return EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
776 776
 	}
777 777
 }
778 778
 
779
-if ( ! function_exists( 'espresso_organization_facebook' )) {
779
+if ( ! function_exists('espresso_organization_facebook')) {
780 780
 	/**
781 781
 	 * espresso_organization_facebook
782 782
 	 * @param bool $echo
783 783
 	 * @return string
784 784
 	 */
785
-	function espresso_organization_facebook( $echo = TRUE ) {
786
-		if($echo){
787
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' );
785
+	function espresso_organization_facebook($echo = TRUE) {
786
+		if ($echo) {
787
+			echo EE_Registry::instance()->CFG->organization->get_pretty('facebook');
788 788
 			return '';
789 789
 		}
790
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' );
790
+		return EE_Registry::instance()->CFG->organization->get_pretty('facebook');
791 791
 	}
792 792
 }
793 793
 
794
-if ( ! function_exists( 'espresso_organization_twitter' )) {
794
+if ( ! function_exists('espresso_organization_twitter')) {
795 795
 	/**
796 796
 	 * espresso_organization_twitter
797 797
 	 * @param bool $echo
798 798
 	 * @return string
799 799
 	 */
800
-	function espresso_organization_twitter( $echo = TRUE ) {
801
-		if($echo){
802
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' );
800
+	function espresso_organization_twitter($echo = TRUE) {
801
+		if ($echo) {
802
+			echo EE_Registry::instance()->CFG->organization->get_pretty('twitter');
803 803
 			return '';
804 804
 		}
805
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' );
805
+		return EE_Registry::instance()->CFG->organization->get_pretty('twitter');
806 806
 	}
807 807
 }
808 808
 
809
-if ( ! function_exists( 'espresso_organization_linkedin' )) {
809
+if ( ! function_exists('espresso_organization_linkedin')) {
810 810
 	/**
811 811
 	 * espresso_organization_linkedin
812 812
 	 * @param bool $echo
813 813
 	 * @return string
814 814
 	 */
815
-	function espresso_organization_linkedin( $echo = TRUE ) {
816
-		if($echo){
817
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' );
815
+	function espresso_organization_linkedin($echo = TRUE) {
816
+		if ($echo) {
817
+			echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
818 818
 			return '';
819 819
 		}
820
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' );
820
+		return EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
821 821
 	}
822 822
 }
823 823
 
824
-if ( ! function_exists( 'espresso_organization_pinterest' )) {
824
+if ( ! function_exists('espresso_organization_pinterest')) {
825 825
 	/**
826 826
 	 * espresso_organization_pinterest
827 827
 	 * @param bool $echo
828 828
 	 * @return string
829 829
 	 */
830
-	function espresso_organization_pinterest( $echo = TRUE ) {
831
-		if($echo){
832
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' );
830
+	function espresso_organization_pinterest($echo = TRUE) {
831
+		if ($echo) {
832
+			echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
833 833
 			return '';
834 834
 		}
835
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' );
835
+		return EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
836 836
 	}
837 837
 }
838 838
 
839
-if ( ! function_exists( 'espresso_organization_google' )) {
839
+if ( ! function_exists('espresso_organization_google')) {
840 840
 	/**
841 841
 	 * espresso_organization_google
842 842
 	 * @param bool $echo
843 843
 	 * @return string
844 844
 	 */
845
-	function espresso_organization_google( $echo = TRUE ) {
846
-		if($echo){
847
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'google' );
845
+	function espresso_organization_google($echo = TRUE) {
846
+		if ($echo) {
847
+			echo EE_Registry::instance()->CFG->organization->get_pretty('google');
848 848
 			return '';
849 849
 		}
850
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'google' );
850
+		return EE_Registry::instance()->CFG->organization->get_pretty('google');
851 851
 	}
852 852
 }
853 853
 
854
-if ( ! function_exists( 'espresso_organization_instagram' )) {
854
+if ( ! function_exists('espresso_organization_instagram')) {
855 855
 	/**
856 856
 	 * espresso_organization_instagram
857 857
 	 * @param bool $echo
858 858
 	 * @return string
859 859
 	 */
860
-	function espresso_organization_instagram( $echo = TRUE ) {
861
-		if($echo){
862
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' );
860
+	function espresso_organization_instagram($echo = TRUE) {
861
+		if ($echo) {
862
+			echo EE_Registry::instance()->CFG->organization->get_pretty('instagram');
863 863
 			return '';
864 864
 		}
865
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' );
865
+		return EE_Registry::instance()->CFG->organization->get_pretty('instagram');
866 866
 	}
867 867
 }
868 868
 
@@ -872,14 +872,14 @@  discard block
 block discarded – undo
872 872
 
873 873
 
874 874
 
875
-if ( ! function_exists( 'espresso_event_venues' )) {
875
+if ( ! function_exists('espresso_event_venues')) {
876 876
 	/**
877 877
 	 * espresso_event_venues
878 878
 	 *
879 879
 	 * @return array  all venues related to an event
880 880
 	 */
881 881
 	function espresso_event_venues() {
882
-		EE_Registry::instance()->load_helper( 'Venue_View' );
882
+		EE_Registry::instance()->load_helper('Venue_View');
883 883
 		return EEH_Venue_View::get_event_venues();
884 884
 	}
885 885
 }
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 
888 888
 
889 889
 
890
-if ( ! function_exists( 'espresso_venue_id' )) {
890
+if ( ! function_exists('espresso_venue_id')) {
891 891
 	/**
892 892
 	 *    espresso_venue_name
893 893
 	 *
@@ -895,16 +895,16 @@  discard block
 block discarded – undo
895 895
 	 * @param     int $EVT_ID
896 896
 	 * @return    string
897 897
 	 */
898
-	function espresso_venue_id( $EVT_ID = 0 ) {
899
-		EE_Registry::instance()->load_helper( 'Venue_View' );
900
-		$venue = EEH_Venue_View::get_venue( $EVT_ID );
898
+	function espresso_venue_id($EVT_ID = 0) {
899
+		EE_Registry::instance()->load_helper('Venue_View');
900
+		$venue = EEH_Venue_View::get_venue($EVT_ID);
901 901
 		return $venue instanceof EE_Venue ? $venue->ID() : 0;
902 902
 	}
903 903
 }
904 904
 
905 905
 
906 906
 
907
-if ( ! function_exists( 'espresso_is_venue_private' ) ) {
907
+if ( ! function_exists('espresso_is_venue_private')) {
908 908
 	/**
909 909
 	 * Return whether a venue is private or not.
910 910
 	 * @see EEH_Venue_View::get_venue() for more info on expected return results.
@@ -913,16 +913,16 @@  discard block
 block discarded – undo
913 913
 	 *
914 914
 	 * @return bool | null
915 915
 	 */
916
-	function espresso_is_venue_private( $VNU_ID = 0 ) {
917
-		EE_Registry::instance()->load_helper( 'Venue_View' );
918
-		return EEH_Venue_View::is_venue_private( $VNU_ID );
916
+	function espresso_is_venue_private($VNU_ID = 0) {
917
+		EE_Registry::instance()->load_helper('Venue_View');
918
+		return EEH_Venue_View::is_venue_private($VNU_ID);
919 919
 	}
920 920
 }
921 921
 
922 922
 
923 923
 
924 924
 
925
-if ( ! function_exists( 'espresso_venue_name' )) {
925
+if ( ! function_exists('espresso_venue_name')) {
926 926
 	/**
927 927
 	 *    espresso_venue_name
928 928
 	 *
@@ -932,20 +932,20 @@  discard block
 block discarded – undo
932 932
 	 * @param bool   $echo
933 933
 	 * @return    string
934 934
 	 */
935
-	function espresso_venue_name( $VNU_ID = 0, $link_to = 'details', $echo = TRUE ) {
936
-		EE_Registry::instance()->load_helper( 'Venue_View' );
937
-		if($echo){
938
-			echo EEH_Venue_View::venue_name( $link_to, $VNU_ID );
935
+	function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = TRUE) {
936
+		EE_Registry::instance()->load_helper('Venue_View');
937
+		if ($echo) {
938
+			echo EEH_Venue_View::venue_name($link_to, $VNU_ID);
939 939
 			return '';
940 940
 		}
941
-		return EEH_Venue_View::venue_name( $link_to, $VNU_ID );
941
+		return EEH_Venue_View::venue_name($link_to, $VNU_ID);
942 942
 	}
943 943
 }
944 944
 
945 945
 
946 946
 
947 947
 
948
-if ( ! function_exists( 'espresso_venue_link' )) {
948
+if ( ! function_exists('espresso_venue_link')) {
949 949
 	/**
950 950
 	 * 	espresso_venue_link
951 951
 	 *
@@ -954,15 +954,15 @@  discard block
 block discarded – undo
954 954
 	 *  @param 	string 	$text
955 955
 	 *  @return 	string
956 956
 	 */
957
-	function espresso_venue_link( $VNU_ID = 0, $text = '' ) {
958
-		EE_Registry::instance()->load_helper( 'Venue_View' );
959
-		return EEH_Venue_View::venue_details_link( $VNU_ID, $text );
957
+	function espresso_venue_link($VNU_ID = 0, $text = '') {
958
+		EE_Registry::instance()->load_helper('Venue_View');
959
+		return EEH_Venue_View::venue_details_link($VNU_ID, $text);
960 960
 	}
961 961
 }
962 962
 
963 963
 
964 964
 
965
-if ( ! function_exists( 'espresso_venue_description' )) {
965
+if ( ! function_exists('espresso_venue_description')) {
966 966
 	/**
967 967
 	 *    espresso_venue_description
968 968
 	 *
@@ -971,18 +971,18 @@  discard block
 block discarded – undo
971 971
 	 * @param bool $echo
972 972
 	 * @return    string
973 973
 	 */
974
-	function espresso_venue_description( $VNU_ID = FALSE, $echo = TRUE ) {
975
-		EE_Registry::instance()->load_helper( 'Venue_View' );
976
-		if($echo){
977
-			echo EEH_Venue_View::venue_description( $VNU_ID );
974
+	function espresso_venue_description($VNU_ID = FALSE, $echo = TRUE) {
975
+		EE_Registry::instance()->load_helper('Venue_View');
976
+		if ($echo) {
977
+			echo EEH_Venue_View::venue_description($VNU_ID);
978 978
 			return '';
979 979
 		}
980
-		return EEH_Venue_View::venue_description( $VNU_ID );
980
+		return EEH_Venue_View::venue_description($VNU_ID);
981 981
 	}
982 982
 }
983 983
 
984 984
 
985
-if ( ! function_exists( 'espresso_venue_excerpt' )) {
985
+if ( ! function_exists('espresso_venue_excerpt')) {
986 986
 	/**
987 987
 	 *    espresso_venue_excerpt
988 988
 	 *
@@ -991,19 +991,19 @@  discard block
 block discarded – undo
991 991
 	 * @param bool $echo
992 992
 	 * @return    string
993 993
 	 */
994
-	function espresso_venue_excerpt( $VNU_ID = 0,  $echo = TRUE ) {
995
-		EE_Registry::instance()->load_helper( 'Venue_View' );
996
-		if ( $echo ) {
997
-			echo EEH_Venue_View::venue_excerpt( $VNU_ID,  $echo );
994
+	function espresso_venue_excerpt($VNU_ID = 0, $echo = TRUE) {
995
+		EE_Registry::instance()->load_helper('Venue_View');
996
+		if ($echo) {
997
+			echo EEH_Venue_View::venue_excerpt($VNU_ID, $echo);
998 998
 			return '';
999 999
 		}
1000
-		return EEH_Venue_View::venue_excerpt( $VNU_ID,  $echo );
1000
+		return EEH_Venue_View::venue_excerpt($VNU_ID, $echo);
1001 1001
 	}
1002 1002
 }
1003 1003
 
1004 1004
 
1005 1005
 
1006
-if ( ! function_exists( 'espresso_venue_categories' )) {
1006
+if ( ! function_exists('espresso_venue_categories')) {
1007 1007
 	/**
1008 1008
 	 * espresso_venue_categories
1009 1009
 	 * returns the terms associated with a venue
@@ -1013,18 +1013,18 @@  discard block
 block discarded – undo
1013 1013
 	 * @param bool $echo
1014 1014
 	 * @return string
1015 1015
 	 */
1016
-	function espresso_venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE,  $echo = TRUE ) {
1017
-		EE_Registry::instance()->load_helper( 'Venue_View' );
1018
-		if ( $echo ) {
1019
-			echo EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized );
1016
+	function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) {
1017
+		EE_Registry::instance()->load_helper('Venue_View');
1018
+		if ($echo) {
1019
+			echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized);
1020 1020
 			return '';
1021 1021
 		}
1022
-		return EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized );
1022
+		return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized);
1023 1023
 	}
1024 1024
 }
1025 1025
 
1026 1026
 
1027
-if ( ! function_exists( 'espresso_venue_address' )) {
1027
+if ( ! function_exists('espresso_venue_address')) {
1028 1028
 	/**
1029 1029
 	 * espresso_venue_address
1030 1030
 	 * returns a formatted block of html  for displaying a venue's address
@@ -1034,18 +1034,18 @@  discard block
 block discarded – undo
1034 1034
 	 * @param bool   $echo
1035 1035
 	 * @return string
1036 1036
 	 */
1037
-	function espresso_venue_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) {
1038
-		EE_Registry::instance()->load_helper( 'Venue_View' );
1039
-		if ( $echo ) {
1040
-			echo EEH_Venue_View::venue_address( $type, $VNU_ID );
1037
+	function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) {
1038
+		EE_Registry::instance()->load_helper('Venue_View');
1039
+		if ($echo) {
1040
+			echo EEH_Venue_View::venue_address($type, $VNU_ID);
1041 1041
 			return '';
1042 1042
 		}
1043
-		return EEH_Venue_View::venue_address( $type, $VNU_ID );
1043
+		return EEH_Venue_View::venue_address($type, $VNU_ID);
1044 1044
 	}
1045 1045
 }
1046 1046
 
1047 1047
 
1048
-if ( ! function_exists( 'espresso_venue_raw_address' )) {
1048
+if ( ! function_exists('espresso_venue_raw_address')) {
1049 1049
 	/**
1050 1050
 	 * espresso_venue_address
1051 1051
 	 * returns an UN-formatted string containing a venue's address
@@ -1055,18 +1055,18 @@  discard block
 block discarded – undo
1055 1055
 	 * @param bool     $echo
1056 1056
 	 * @return string
1057 1057
 	 */
1058
-	function espresso_venue_raw_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) {
1059
-		EE_Registry::instance()->load_helper( 'Venue_View' );
1060
-		if ( $echo ) {
1061
-			echo EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE );
1058
+	function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) {
1059
+		EE_Registry::instance()->load_helper('Venue_View');
1060
+		if ($echo) {
1061
+			echo EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE);
1062 1062
 			return '';
1063 1063
 		}
1064
-		return EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE );
1064
+		return EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE);
1065 1065
 	}
1066 1066
 }
1067 1067
 
1068 1068
 
1069
-if ( ! function_exists( 'espresso_venue_has_address' )) {
1069
+if ( ! function_exists('espresso_venue_has_address')) {
1070 1070
 	/**
1071 1071
 	 * espresso_venue_has_address
1072 1072
 	 * returns TRUE or FALSE if a Venue has address information
@@ -1074,14 +1074,14 @@  discard block
 block discarded – undo
1074 1074
 	 * @param int $VNU_ID
1075 1075
 	 * @return bool
1076 1076
 	 */
1077
-	function espresso_venue_has_address( $VNU_ID = 0 ) {
1078
-		EE_Registry::instance()->load_helper( 'Venue_View' );
1079
-		return EEH_Venue_View::venue_has_address( $VNU_ID );
1077
+	function espresso_venue_has_address($VNU_ID = 0) {
1078
+		EE_Registry::instance()->load_helper('Venue_View');
1079
+		return EEH_Venue_View::venue_has_address($VNU_ID);
1080 1080
 	}
1081 1081
 }
1082 1082
 
1083 1083
 
1084
-if ( ! function_exists( 'espresso_venue_gmap' )) {
1084
+if ( ! function_exists('espresso_venue_gmap')) {
1085 1085
 	/**
1086 1086
 	 * espresso_venue_gmap
1087 1087
 	 * returns a google map for the venue address
@@ -1092,18 +1092,18 @@  discard block
 block discarded – undo
1092 1092
 	 * @param bool     $echo
1093 1093
 	 * @return string
1094 1094
 	 */
1095
-	function espresso_venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE  ) {
1096
-		EE_Registry::instance()->load_helper( 'Venue_View' );
1097
-		if ( $echo ) {
1098
-			echo EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap );
1095
+	function espresso_venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE) {
1096
+		EE_Registry::instance()->load_helper('Venue_View');
1097
+		if ($echo) {
1098
+			echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap);
1099 1099
 			return '';
1100 1100
 		}
1101
-		return EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap );
1101
+		return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap);
1102 1102
 	}
1103 1103
 }
1104 1104
 
1105 1105
 
1106
-if ( ! function_exists( 'espresso_venue_phone' )) {
1106
+if ( ! function_exists('espresso_venue_phone')) {
1107 1107
 	/**
1108 1108
 	 * espresso_venue_phone
1109 1109
 	 *
@@ -1111,19 +1111,19 @@  discard block
 block discarded – undo
1111 1111
 	 * @param bool $echo
1112 1112
 	 * @return string
1113 1113
 	 */
1114
-	function espresso_venue_phone( $VNU_ID = 0, $echo = TRUE ) {
1115
-		EE_Registry::instance()->load_helper( 'Venue_View' );
1116
-		if ( $echo ) {
1117
-			echo EEH_Venue_View::venue_phone( $VNU_ID );
1114
+	function espresso_venue_phone($VNU_ID = 0, $echo = TRUE) {
1115
+		EE_Registry::instance()->load_helper('Venue_View');
1116
+		if ($echo) {
1117
+			echo EEH_Venue_View::venue_phone($VNU_ID);
1118 1118
 			return '';
1119 1119
 		}
1120
-		return EEH_Venue_View::venue_phone( $VNU_ID );
1120
+		return EEH_Venue_View::venue_phone($VNU_ID);
1121 1121
 	}
1122 1122
 }
1123 1123
 
1124 1124
 
1125 1125
 
1126
-if ( ! function_exists( 'espresso_venue_website' )) {
1126
+if ( ! function_exists('espresso_venue_website')) {
1127 1127
 	/**
1128 1128
 	 * espresso_venue_website
1129 1129
 	 *
@@ -1131,19 +1131,19 @@  discard block
 block discarded – undo
1131 1131
 	 * @param bool $echo
1132 1132
 	 * @return string
1133 1133
 	 */
1134
-	function espresso_venue_website( $VNU_ID = 0, $echo = TRUE ) {
1135
-		EE_Registry::instance()->load_helper( 'Venue_View' );
1136
-		if ( $echo ) {
1137
-			echo EEH_Venue_View::venue_website_link( $VNU_ID );
1134
+	function espresso_venue_website($VNU_ID = 0, $echo = TRUE) {
1135
+		EE_Registry::instance()->load_helper('Venue_View');
1136
+		if ($echo) {
1137
+			echo EEH_Venue_View::venue_website_link($VNU_ID);
1138 1138
 			return '';
1139 1139
 		}
1140
-		return EEH_Venue_View::venue_website_link( $VNU_ID );
1140
+		return EEH_Venue_View::venue_website_link($VNU_ID);
1141 1141
 	}
1142 1142
 }
1143 1143
 
1144 1144
 
1145 1145
 
1146
-if ( ! function_exists( 'espresso_edit_venue_link' )) {
1146
+if ( ! function_exists('espresso_edit_venue_link')) {
1147 1147
 	/**
1148 1148
 	 * espresso_edit_venue_link
1149 1149
 	 *
@@ -1151,13 +1151,13 @@  discard block
 block discarded – undo
1151 1151
 	 * @param bool $echo
1152 1152
 	 * @return string
1153 1153
 	 */
1154
-	function espresso_edit_venue_link( $VNU_ID = 0, $echo = TRUE ) {
1155
-		EE_Registry::instance()->load_helper( 'Venue_View' );
1156
-		if($echo){
1157
-			echo EEH_Venue_View::edit_venue_link( $VNU_ID );
1154
+	function espresso_edit_venue_link($VNU_ID = 0, $echo = TRUE) {
1155
+		EE_Registry::instance()->load_helper('Venue_View');
1156
+		if ($echo) {
1157
+			echo EEH_Venue_View::edit_venue_link($VNU_ID);
1158 1158
 			return '';
1159 1159
 		}
1160
-		return EEH_Venue_View::edit_venue_link( $VNU_ID );
1160
+		return EEH_Venue_View::edit_venue_link($VNU_ID);
1161 1161
 	}
1162 1162
 }
1163 1163
 
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Credit_Card_Month_Input.input.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('No direct script access allowed');
4 4
 
5 5
 /**
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * ------------------------------------------------------------------------
26 26
  */
27
-class EE_Credit_Card_Month_Input extends EE_Month_Input{
27
+class EE_Credit_Card_Month_Input extends EE_Month_Input {
28 28
 
29 29
 	/**
30 30
 	 * @param bool  $leading_zero
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 		$leading_zero = false, 
36 36
 		$input_settings = array(), 
37 37
 		$january_is_month_1 = true 
38
-	){
39
-		$this->set_sensitive_data_removal_strategy( new EE_All_Sensitive_Data_Removal() );
38
+	) {
39
+		$this->set_sensitive_data_removal_strategy(new EE_All_Sensitive_Data_Removal());
40 40
 		parent::__construct(
41 41
 			$leading_zero,
42 42
 			$input_settings, 
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Month_Input.input.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,21 +6,21 @@  discard block
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Month_Input extends EE_Select_Input{
9
+class EE_Month_Input extends EE_Select_Input {
10 10
 
11 11
 	/**
12 12
 	 * @param bool  $leading_zero
13 13
 	 * @param array $input_settings
14 14
 	 * @param bool $january_is_month_1 whether january should have value of 1; or it should be month 0
15 15
 	 */
16
-	function __construct( $leading_zero = false, $input_settings = array(), $january_is_month_1 = true){
16
+	function __construct($leading_zero = false, $input_settings = array(), $january_is_month_1 = true) {
17 17
 		$key_begin_range = $january_is_month_1 ? 1 : 0;
18
-		$key_range = range($key_begin_range, $key_begin_range + 11 );
19
-		if($leading_zero){
20
-			array_walk( $key_range, array( $this, '_zero_pad' ) );	
18
+		$key_range = range($key_begin_range, $key_begin_range + 11);
19
+		if ($leading_zero) {
20
+			array_walk($key_range, array($this, '_zero_pad'));	
21 21
 		}
22
-		$value_range = range( 1, 12 );
23
-		array_walk( $value_range, array( $this, '_zero_pad' ) );
22
+		$value_range = range(1, 12);
23
+		array_walk($value_range, array($this, '_zero_pad'));
24 24
 		parent::__construct(
25 25
 			array_combine( 
26 26
 				$key_range, 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param int $input
36 36
 	 * @param mixed $key
37 37
 	 */
38
-	protected function _zero_pad( &$input, $key ) {
39
-		$input = str_pad( $input, 2, '0', STR_PAD_LEFT );
38
+	protected function _zero_pad(&$input, $key) {
39
+		$input = str_pad($input, 2, '0', STR_PAD_LEFT);
40 40
 	}
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_Offsite_Gateway.lib.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * ------------------------------------------------------------------------
26 26
  */
27
-abstract class EE_Offsite_Gateway extends EE_Gateway{
27
+abstract class EE_Offsite_Gateway extends EE_Gateway {
28 28
 
29 29
 	/**
30 30
 	 * whether or not the gateway uses an IPN
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @param string     $cancel_url URL to send the user to after a cancelled payment attempt on teh payment provider's website
62 62
 	 * @return EE_Payment
63 63
 	 */
64
-	public abstract function set_redirection_info( $payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL);
64
+	public abstract function set_redirection_info($payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL);
65 65
 
66 66
 
67 67
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @param EEI_Transaction $transaction
75 75
 	 * @return EEI_Payment updated
76 76
 	 */
77
-	public abstract function handle_payment_update($update_info,$transaction);
77
+	public abstract function handle_payment_update($update_info, $transaction);
78 78
 
79 79
 
80 80
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 * @access protected
102 102
 	 * @param boolean $uses_separate_IPN_request
103 103
 	 */
104
-	protected function set_uses_separate_IPN_request( $uses_separate_IPN_request ) {
105
-		$this->_uses_separate_IPN_request = filter_var( $uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN );
104
+	protected function set_uses_separate_IPN_request($uses_separate_IPN_request) {
105
+		$this->_uses_separate_IPN_request = filter_var($uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN);
106 106
 	}
107 107
 	
108 108
 	/**
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 * @param boolean $separate_IPN_request
117 117
 	 * @return boolean
118 118
 	 */
119
-	public function handle_IPN_in_this_request( $request_data, $separate_IPN_request ) {
120
-		if( $separate_IPN_request ) {
119
+	public function handle_IPN_in_this_request($request_data, $separate_IPN_request) {
120
+		if ($separate_IPN_request) {
121 121
 			return $this->_uses_separate_IPN_request;
122 122
 		} else {
123 123
 			//it's a request where the user returned from an offsite gateway
Please login to merge, or discard this patch.
caffeinated/payment_methods/Aim/EE_PMT_Aim.pm.php 1 patch
Spacing   +47 added lines, -47 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
 							)),
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 	 */
202 202
 	public function billing_input_names() {
203 203
 		return array(
204
-			'first_name' => __( 'First Name', 'event_espresso' ),
204
+			'first_name' => __('First Name', 'event_espresso'),
205 205
 			'last_name' => __('Last Name', 'event_espresso'),
206
-			'email' => __( 'Email', 'event_espresso' ),
207
-			'company' => __( 'Company', 'event_espresso' ),
206
+			'email' => __('Email', 'event_espresso'),
207
+			'company' => __('Company', 'event_espresso'),
208 208
 			'address' => __('Address', 'event_espresso'),
209 209
 			'address2' => __('Address2', 'event_espresso'),
210 210
 			'city' => __('City', 'event_espresso'),
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 			'country' => __('Country', 'event_espresso'),
213 213
 			'zip' =>  __('Zip', 'event_espresso'),
214 214
 			'phone' => __('Phone', 'event_espresso'),
215
-			'fax' => __( 'Fax', 'event_espresso' ),
215
+			'fax' => __('Fax', 'event_espresso'),
216 216
 			'cvv' => __('CVV', 'event_espresso')
217 217
 		);
218 218
 	}
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	 * @param type $billing_form
224 224
 	 * @return array
225 225
 	 */
226
-	protected function _get_billing_values_from_form( $billing_form ){
226
+	protected function _get_billing_values_from_form($billing_form) {
227 227
 		$all_billing_values_empty = array();
228
-		foreach( array_keys( $this->billing_input_names() ) as $input_name ) {
229
-			$all_billing_values_empty[ $input_name ] = '';
228
+		foreach (array_keys($this->billing_input_names()) as $input_name) {
229
+			$all_billing_values_empty[$input_name] = '';
230 230
 		}
231 231
 		return array_merge(
232 232
 				$all_billing_values_empty,
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 * @see EE_PMT_Base::help_tabs_config()
242 242
 	 * @return array
243 243
 	 */
244
-	public function help_tabs_config(){
244
+	public function help_tabs_config() {
245 245
 		return array(
246 246
 			$this->get_help_tab_name() => array(
247 247
 				'title' => __('Authorize.net AIM Settings', 'event_espresso'),
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_PMT_Base.lib.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @since 				$VID:$
15 15
  *
16 16
  */
17
-abstract class EE_PMT_Base{
17
+abstract class EE_PMT_Base {
18 18
 
19 19
 	const onsite = 'on-site';
20 20
 	const offsite = 'off-site';
@@ -95,34 +95,34 @@  discard block
 block discarded – undo
95 95
 	 * @return EE_PMT_Base
96 96
 	 */
97 97
 	function __construct($pm_instance = NULL) {
98
-		if ( $pm_instance instanceof EE_Payment_Method ){
98
+		if ($pm_instance instanceof EE_Payment_Method) {
99 99
 			$this->set_instance($pm_instance);
100 100
 		}
101
-		if($this->_gateway){
102
-			$this->_gateway->set_payment_model( EEM_Payment::instance() );
103
-			$this->_gateway->set_payment_log( EEM_Change_Log::instance() );
104
-			EE_Registry::instance()->load_helper( 'Template' );
105
-			$this->_gateway->set_template_helper( new EEH_Template() );
106
-			EE_Registry::instance()->load_helper( 'Line_Item' );
107
-			$this->_gateway->set_line_item_helper( new EEH_Line_Item() );
108
-			EE_Registry::instance()->load_helper( 'Money' );
109
-			$this->_gateway->set_money_helper( new EEH_Money() );
101
+		if ($this->_gateway) {
102
+			$this->_gateway->set_payment_model(EEM_Payment::instance());
103
+			$this->_gateway->set_payment_log(EEM_Change_Log::instance());
104
+			EE_Registry::instance()->load_helper('Template');
105
+			$this->_gateway->set_template_helper(new EEH_Template());
106
+			EE_Registry::instance()->load_helper('Line_Item');
107
+			$this->_gateway->set_line_item_helper(new EEH_Line_Item());
108
+			EE_Registry::instance()->load_helper('Money');
109
+			$this->_gateway->set_money_helper(new EEH_Money());
110 110
 		}
111
-		if ( ! isset( $this->_has_billing_form ) ) {
111
+		if ( ! isset($this->_has_billing_form)) {
112 112
 			// by default, On Site gateways have a billing form
113
-			if ( $this->payment_occurs() == EE_PMT_Base::onsite ) {
114
-				$this->set_has_billing_form( true );
113
+			if ($this->payment_occurs() == EE_PMT_Base::onsite) {
114
+				$this->set_has_billing_form(true);
115 115
 			} else {
116
-				$this->set_has_billing_form( false );
116
+				$this->set_has_billing_form(false);
117 117
 			}
118 118
 		}
119 119
 
120
-		if( ! $this->_pretty_name){
120
+		if ( ! $this->_pretty_name) {
121 121
 			throw new EE_Error(sprintf(__("You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", "event_espresso")));
122 122
 		}
123 123
 		//if the child didn't specify a default button, use the credit card one
124
-		if( $this->_default_button_url === NULL){
125
-			$this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png';
124
+		if ($this->_default_button_url === NULL) {
125
+			$this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png';
126 126
 		}
127 127
 	}
128 128
 
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 	/**
132 132
 	 * @param boolean $has_billing_form
133 133
 	 */
134
-	public function set_has_billing_form( $has_billing_form ) {
135
-		$this->_has_billing_form = filter_var( $has_billing_form, FILTER_VALIDATE_BOOLEAN );
134
+	public function set_has_billing_form($has_billing_form) {
135
+		$this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN);
136 136
 	}
137 137
 
138 138
 
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 	/**
141 141
 	 * sets the file_folder property
142 142
 	 */
143
-	protected function _set_file_folder(){
143
+	protected function _set_file_folder() {
144 144
 		$reflector = new ReflectionClass(get_class($this));
145 145
 		$fn = $reflector->getFileName();
146
-		$this->_file_folder =  dirname($fn).DS;
146
+		$this->_file_folder = dirname($fn).DS;
147 147
 	}
148 148
 
149 149
 
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 	/**
152 152
 	 * sets the file URL with a trailing slash for this PMT
153 153
 	 */
154
-	protected function _set_file_url(){
155
-		$plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR);
156
-		$file_folder_fixed = str_replace('\\',DS,$this->file_folder());
157
-		$file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed);
154
+	protected function _set_file_url() {
155
+		$plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR);
156
+		$file_folder_fixed = str_replace('\\', DS, $this->file_folder());
157
+		$file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed);
158 158
 		$this->_file_url = $file_path;
159 159
 	}
160 160
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 * Gets the default description on all payment methods of this type
163 163
 	 * @return string
164 164
 	 */
165
-	public function default_description(){
165
+	public function default_description() {
166 166
 		return $this->_default_description;
167 167
 	}
168 168
 
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 * Returns the folder containing the PMT child class, with a trailing slash
173 173
 	 * @return string
174 174
 	 */
175
-	public function file_folder(){
176
-		if( ! $this->_file_folder ) {
175
+	public function file_folder() {
176
+		if ( ! $this->_file_folder) {
177 177
 			$this->_set_file_folder();
178 178
 		}
179 179
 		return $this->_file_folder;
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 	/**
185 185
 	 * @return string
186 186
 	 */
187
-	public function file_url(){
188
-		if( ! $this->_file_url ) {
187
+	public function file_url() {
188
+		if ( ! $this->_file_url) {
189 189
 			$this->_set_file_url();
190 190
 		}
191 191
 		return $this->_file_url;
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 	 * Its important teh payment method instance is set before
199 199
 	 * @param EE_Payment_Method $payment_method_instance
200 200
 	 */
201
-	function set_instance($payment_method_instance){
201
+	function set_instance($payment_method_instance) {
202 202
 		$this->_pm_instance = $payment_method_instance;
203 203
 		//if they have already requested the settings form, make sure its
204 204
 		//data matches this model object
205
-		if($this->_settings_form){
205
+		if ($this->_settings_form) {
206 206
 			$this->settings_form()->populate_model_obj($payment_method_instance);
207 207
 		}
208
-		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
208
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
209 209
 			$this->_gateway->set_settings($payment_method_instance->settings_array());
210 210
 		}
211 211
 	}
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
 	 * Gets teh form for displaying to admins where they setup the payment method
217 217
 	 * @return EE_Payment_Method_Form
218 218
 	 */
219
-	function settings_form(){
220
-		if( ! $this->_settings_form){
219
+	function settings_form() {
220
+		if ( ! $this->_settings_form) {
221 221
 			$this->_settings_form = $this->generate_new_settings_form();
222
-			$this->_settings_form->set_payment_method_type( $this );
223
-			$this->_settings_form->_construct_finalize(NULL, NULL );
222
+			$this->_settings_form->set_payment_method_type($this);
223
+			$this->_settings_form->_construct_finalize(NULL, NULL);
224 224
 			//if we have already assigned a model object to this pmt, make
225 225
 			//sure its reflected in teh form we just generated
226
-			if($this->_pm_instance){
226
+			if ($this->_pm_instance) {
227 227
 				$this->_settings_form->populate_model_obj($this->_pm_instance);
228 228
 			}
229 229
 		}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 * this payment method type's settings form later in the request
250 250
 	 * @param EE_Payment_Method_Form $form
251 251
 	 */
252
-	public function set_settings_form($form){
252
+	public function set_settings_form($form) {
253 253
 		$this->_settings_form = $form;
254 254
 	}
255 255
 
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 	 * @param array $extra_args
273 273
 	 * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null
274 274
 	 */
275
-	public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){
275
+	public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) {
276 276
 		// has billing form already been regenerated ? or overwrite cache?
277
-		if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){
278
-			$this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args );
277
+		if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) {
278
+			$this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args);
279 279
 		}
280 280
 		//if we know who the attendee is, and this is a billing form
281 281
 		//that uses attendee info, populate it
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 			$transaction instanceof EE_Transaction &&
285 285
 			$transaction->primary_registration() instanceof EE_Registration &&
286 286
 			$transaction->primary_registration()->attendee() instanceof EE_Attendee
287
-		){
288
-			$this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() );
287
+		) {
288
+			$this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee());
289 289
 		}
290 290
 		return $this->_billing_form;
291 291
 	}
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 * @param \EE_Transaction $transaction
297 297
 	 * @return \EE_Billing_Info_Form
298 298
 	 */
299
-	abstract function generate_new_billing_form( EE_Transaction $transaction = NULL );
299
+	abstract function generate_new_billing_form(EE_Transaction $transaction = NULL);
300 300
 
301 301
 
302 302
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 * @param \EE_Billing_Info_Form $billing_form
308 308
 	 * @return \EE_Billing_Info_Form
309 309
 	 */
310
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
310
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
311 311
 		return $billing_form;
312 312
 	}
313 313
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * if you have form
319 319
 	 * @param EE_Payment_Method $form
320 320
 	 */
321
-	public function set_billing_form($form){
321
+	public function set_billing_form($form) {
322 322
 		$this->_billing_form = $form;
323 323
 	}
324 324
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 * Returns whether or not this payment method requires HTTPS to be used
329 329
 	 * @return boolean
330 330
 	 */
331
-	function requires_https(){
331
+	function requires_https() {
332 332
 		return $this->_requires_https;
333 333
 	}
334 334
 
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 	 * @return EE_Payment
347 347
 	 * @throws EE_Error
348 348
 	 */
349
-	function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){
349
+	function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) {
350 350
 		// @todo: add surcharge for the payment method, if any
351
-		if ( $this->_gateway ) {
351
+		if ($this->_gateway) {
352 352
 			//there is a gateway, so we're going to make a payment object
353 353
 			//but wait! do they already have a payment in progress that we thought was failed?
354 354
 			$duplicate_properties = array(
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
 				'PAY_amount' 					=> $amount !== null ? $amount : $transaction->remaining(),
360 360
 				'PAY_gateway_response' 	=> null,
361 361
 			);
362
-			$payment = EEM_Payment::instance()->get_one( array( $duplicate_properties ));
362
+			$payment = EEM_Payment::instance()->get_one(array($duplicate_properties));
363 363
 			//if we didn't already have a payment in progress for the same thing,
364 364
 			//then we actually want to make a new payment
365
-			if ( ! $payment instanceof EE_Payment ){
365
+			if ( ! $payment instanceof EE_Payment) {
366 366
 				$payment = EE_Payment::new_instance(
367 367
 					array_merge(
368 368
 						$duplicate_properties,
@@ -378,10 +378,10 @@  discard block
 block discarded – undo
378 378
 			}
379 379
 			//make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it
380 380
 			$payment->save();
381
-			$billing_values = $this->_get_billing_values_from_form( $billing_info );
381
+			$billing_values = $this->_get_billing_values_from_form($billing_info);
382 382
 
383 383
 			//  Offsite Gateway
384
-			if( $this->_gateway instanceof EE_Offsite_Gateway ){
384
+			if ($this->_gateway instanceof EE_Offsite_Gateway) {
385 385
 
386 386
 				$payment = $this->_gateway->set_redirection_info(
387 387
 					$payment,
@@ -397,17 +397,17 @@  discard block
 block discarded – undo
397 397
 				);
398 398
 				$payment->save();
399 399
 			//  Onsite Gateway
400
-			} elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) {
400
+			} elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
401 401
 
402
-				$payment = $this->_gateway->do_direct_payment($payment,$billing_values);
402
+				$payment = $this->_gateway->do_direct_payment($payment, $billing_values);
403 403
 				$payment->save();
404 404
 
405 405
 			} else {
406 406
 				throw new EE_Error(
407 407
 					sprintf(
408
-						__('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso' ),
408
+						__('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso'),
409 409
 						get_class($this),
410
-						gettype( $this->_gateway )
410
+						gettype($this->_gateway)
411 411
 					)
412 412
 				);
413 413
 			}
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 		}
430 430
 
431 431
 		// if there is billing info, clean it and save it now
432
-		if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){
433
-			$this->_save_billing_info_to_attendee( $billing_info, $transaction );
432
+		if ($billing_info instanceof EE_Billing_Attendee_Info_Form) {
433
+			$this->_save_billing_info_to_attendee($billing_info, $transaction);
434 434
 		}
435 435
 
436 436
 		return $payment;
@@ -443,10 +443,10 @@  discard block
 block discarded – undo
443 443
 	 * @param EE_Billing_Info_Form $billing_form
444 444
 	 * @return array
445 445
 	 */
446
-	protected function _get_billing_values_from_form( $billing_form ){
447
-		if($billing_form instanceof EE_Form_Section_Proper ){
448
-			return $billing_form->input_pretty_values( true );
449
-		}else{
446
+	protected function _get_billing_values_from_form($billing_form) {
447
+		if ($billing_form instanceof EE_Form_Section_Proper) {
448
+			return $billing_form->input_pretty_values(true);
449
+		} else {
450 450
 			return NULL;
451 451
 		}
452 452
 	}
@@ -460,13 +460,13 @@  discard block
 block discarded – undo
460 460
 	 * @return EE_Payment
461 461
 	 * @throws EE_Error
462 462
 	 */
463
-	public function handle_ipn($req_data,$transaction){
463
+	public function handle_ipn($req_data, $transaction) {
464 464
 		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
465
-		if( ! $this->_gateway instanceof EE_Offsite_Gateway){
466
-			throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE )));
465
+		if ( ! $this->_gateway instanceof EE_Offsite_Gateway) {
466
+			throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE)));
467 467
 
468 468
 		}
469
-		$payment = $this->_gateway->handle_payment_update( $req_data, $transaction );
469
+		$payment = $this->_gateway->handle_payment_update($req_data, $transaction);
470 470
 		return $payment;
471 471
 	}
472 472
 
@@ -479,22 +479,22 @@  discard block
 block discarded – undo
479 479
 	 * @param EE_Transaction $transaction
480 480
 	 * @return boolean success
481 481
 	 */
482
-	protected function _save_billing_info_to_attendee($billing_form, $transaction){
483
-		if( ! $transaction || ! $transaction instanceof EE_Transaction){
482
+	protected function _save_billing_info_to_attendee($billing_form, $transaction) {
483
+		if ( ! $transaction || ! $transaction instanceof EE_Transaction) {
484 484
 			EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
485 485
 			return false;
486 486
 		}
487 487
 		$primary_reg = $transaction->primary_registration();
488
-		if( ! $primary_reg ){
488
+		if ( ! $primary_reg) {
489 489
 			EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
490 490
 			return false;
491 491
 		}
492 492
 		$attendee = $primary_reg->attendee();
493
-		if( ! $attendee ){
493
+		if ( ! $attendee) {
494 494
 			EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
495 495
 			return false;
496 496
 		}
497
-		return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() );
497
+		return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method());
498 498
 
499 499
 	}
500 500
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	 * @param array $req_data
508 508
 	 * @return EE_Payment
509 509
 	 */
510
-	protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){
510
+	protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) {
511 511
 		return $transaction->last_payment();
512 512
 	}
513 513
 
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
 	 * and identifies the IPN as being for this payment method (not just fo ra payment method of this type)
525 525
 	 * @throws EE_Error
526 526
 	 */
527
-	public function handle_unclaimed_ipn( $req_data = array() ){
528
-		throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) ));
527
+	public function handle_unclaimed_ipn($req_data = array()) {
528
+		throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this)));
529 529
 	}
530 530
 
531 531
 
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 	 * @param EE_Transaction $transaction
542 542
 	 * @return EE_Payment
543 543
 	 */
544
-	public function finalize_payment_for($transaction){
544
+	public function finalize_payment_for($transaction) {
545 545
 		return $transaction->last_payment();
546 546
 	}
547 547
 
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
 	 * Whether or not this payment method's gateway supports sending refund requests
552 552
 	 * @return boolean
553 553
 	 */
554
-	public function supports_sending_refunds(){
555
-		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
554
+	public function supports_sending_refunds() {
555
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
556 556
 			return $this->_gateway->supports_sending_refunds();
557
-		}else{
557
+		} else {
558 558
 			return false;
559 559
 		}
560 560
 	}
@@ -568,14 +568,14 @@  discard block
 block discarded – undo
568 568
 	 * @throws EE_Error
569 569
 	 * @return EE_Payment
570 570
 	 */
571
-	public function process_refund( EE_Payment $payment, $refund_info = array()){
572
-		if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) {
573
-			return $this->_gateway->do_direct_refund( $payment, $refund_info );
571
+	public function process_refund(EE_Payment $payment, $refund_info = array()) {
572
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
573
+			return $this->_gateway->do_direct_refund($payment, $refund_info);
574 574
 		} else {
575 575
 			throw new EE_Error(
576 576
 				sprintf(
577
-					__( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ),
578
-					get_class( $this )
577
+					__('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'),
578
+					get_class($this)
579 579
 				)
580 580
 			);
581 581
 		}
@@ -589,15 +589,15 @@  discard block
 block discarded – undo
589 589
 	 * @return string
590 590
 	 * @throws EE_Error
591 591
 	 */
592
-	public function payment_occurs(){
593
-		if( ! $this->_gateway){
592
+	public function payment_occurs() {
593
+		if ( ! $this->_gateway) {
594 594
 			return EE_PMT_Base::offline;
595
-		}elseif($this->_gateway instanceof EE_Onsite_Gateway){
595
+		}elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
596 596
 			return EE_PMT_Base::onsite;
597
-		}elseif($this->_gateway instanceof EE_Offsite_Gateway){
597
+		}elseif ($this->_gateway instanceof EE_Offsite_Gateway) {
598 598
 			return EE_PMT_Base::offsite;
599
-		}else{
600
-			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this)));
599
+		} else {
600
+			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"), get_class($this)));
601 601
 		}
602 602
 	}
603 603
 
@@ -610,9 +610,9 @@  discard block
 block discarded – undo
610 610
 	 * @param EE_Payment $payment
611 611
 	 * @return string
612 612
 	 */
613
-	public function payment_overview_content(EE_Payment $payment){
613
+	public function payment_overview_content(EE_Payment $payment) {
614 614
 		EE_Registry::instance()->load_helper('Template');
615
-		return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance,'payment'=>$payment) , true);
615
+		return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance, 'payment'=>$payment), true);
616 616
 	}
617 617
 
618 618
 
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 	 *	@type array $template_args any arguments you want passed to the template file while rendering. 
626 626
 	 *				Keys will be variable names and values with be their values.
627 627
 	 */
628
-	public function help_tabs_config(){
628
+	public function help_tabs_config() {
629 629
 		return array();
630 630
 	}
631 631
 
@@ -636,9 +636,9 @@  discard block
 block discarded – undo
636 636
 	 * the payment method's table's PMT_type column)
637 637
 	 * @return string
638 638
 	 */
639
-	public function system_name(){
639
+	public function system_name() {
640 640
 		$classname = get_class($this);
641
-		return str_replace("EE_PMT_",'',$classname);
641
+		return str_replace("EE_PMT_", '', $classname);
642 642
 	}
643 643
 
644 644
 
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 	 * A pretty i18n version of the PMT name
648 648
 	 * @return string
649 649
 	 */
650
-	public function pretty_name(){
650
+	public function pretty_name() {
651 651
 		return $this->_pretty_name;
652 652
 	}
653 653
 
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 	 * Gets the default absolute URL to the payment method type's button
658 658
 	 * @return string
659 659
 	 */
660
-	public function default_button_url(){
660
+	public function default_button_url() {
661 661
 		return $this->_default_button_url;
662 662
 	}
663 663
 
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	 * Gets the gateway used by this payment method (if any)
668 668
 	 * @return EE_Gateway
669 669
 	 */
670
-	public function get_gateway(){
670
+	public function get_gateway() {
671 671
 		return $this->_gateway;
672 672
 	}
673 673
 
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
 	/**
677 677
 	 * @return string html for the link to a help tab
678 678
 	 */
679
-	public function get_help_tab_link(){
680
-		EE_Registry::instance()->load_helper( 'Template' );
681
-		return EEH_Template::get_help_tab_link( $this->get_help_tab_name() );
679
+	public function get_help_tab_link() {
680
+		EE_Registry::instance()->load_helper('Template');
681
+		return EEH_Template::get_help_tab_link($this->get_help_tab_name());
682 682
 	}
683 683
 
684 684
 
@@ -687,8 +687,8 @@  discard block
 block discarded – undo
687 687
 	 * Returns the name of the help tab for this PMT
688 688
 	 * @return string
689 689
 	 */
690
-	public function get_help_tab_name(){
691
-		return 'ee_' . strtolower( $this->system_name() ) . '_help_tab';
690
+	public function get_help_tab_name() {
691
+		return 'ee_'.strtolower($this->system_name()).'_help_tab';
692 692
 	}
693 693
 
694 694
 	/**
@@ -696,8 +696,8 @@  discard block
 block discarded – undo
696 696
 	 * this PMT by an admin
697 697
 	 * @return string
698 698
 	 */
699
-	public function cap_name(){
700
-		return 'ee_payment_method_' . strtolower( $this->system_name() );
699
+	public function cap_name() {
700
+		return 'ee_payment_method_'.strtolower($this->system_name());
701 701
 	}
702 702
 
703 703
 	/**
@@ -709,9 +709,9 @@  discard block
 block discarded – undo
709 709
 	 * @param EE_Payment $payment
710 710
 	 * @return void
711 711
 	 */
712
-	public function update_txn_based_on_payment( $payment ){
713
-		if( $this->_gateway instanceof EE_Gateway ){
714
-			$this->_gateway->update_txn_based_on_payment( $payment );
712
+	public function update_txn_based_on_payment($payment) {
713
+		if ($this->_gateway instanceof EE_Gateway) {
714
+			$this->_gateway->update_txn_based_on_payment($payment);
715 715
 		}
716 716
 	}
717 717
 
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_Payment_Method_Manager.lib.php 2 patches
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  *
4 4
  * Class EE_Payment_Method_Manager
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function instance() {
37 37
 		// check if class object is instantiated, and instantiated properly
38
-		if ( ! self::$_instance instanceof EE_Payment_Method_Manager ) {
38
+		if ( ! self::$_instance instanceof EE_Payment_Method_Manager) {
39 39
 			self::$_instance = new self();
40 40
 		}
41 41
 		EE_Registry::instance()->load_lib('PMT_Base');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * Resets the instance and returns a new one
47 47
 	 * @return EE_Payment_Method_Manager
48 48
 	 */
49
-	public static function reset(){
49
+	public static function reset() {
50 50
 		self::$_instance = NULL;
51 51
 		return self::instance();
52 52
 	}
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 * or just re-use the PMTs we found last time we checked during this request (if
58 58
 	 * we have not yet checked during this request, then we need to check anyways)
59 59
 	 */
60
-	public function maybe_register_payment_methods( $force_recheck = FALSE ){
61
-		if( ! $this->_payment_method_types || $force_recheck ){
60
+	public function maybe_register_payment_methods($force_recheck = FALSE) {
61
+		if ( ! $this->_payment_method_types || $force_recheck) {
62 62
 			$this->_register_payment_methods();
63 63
 			//if in admin lets ensure caps are set.
64
-			if ( is_admin() ) {
65
-				add_filter( 'FHEE__EE_Capabilities__init_caps_map__caps', array( $this, 'add_payment_method_caps' ) );
64
+			if (is_admin()) {
65
+				add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array($this, 'add_payment_method_caps'));
66 66
 				EE_Registry::instance()->CAP->init_caps();
67 67
 			}
68 68
 		}
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function _register_payment_methods() {
77 77
 		// grab list of installed modules
78
-		$pm_to_register = glob( EE_PAYMENT_METHODS . '*', GLOB_ONLYDIR );
78
+		$pm_to_register = glob(EE_PAYMENT_METHODS.'*', GLOB_ONLYDIR);
79 79
 		// filter list of modules to register
80
-		$pm_to_register = apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register );
80
+		$pm_to_register = apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register);
81 81
 
82 82
 		// loop through folders
83
-		foreach ( $pm_to_register as $pm_path ) {
84
-				$this->register_payment_method( $pm_path );
83
+		foreach ($pm_to_register as $pm_path) {
84
+				$this->register_payment_method($pm_path);
85 85
 		}
86
-		do_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' );
86
+		do_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods');
87 87
 		// filter list of installed modules
88 88
 		//keep them organized alphabetically by the payment method type's name
89
-		ksort( $this->_payment_method_types );
90
-		return apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types );
89
+		ksort($this->_payment_method_types);
90
+		return apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types);
91 91
 	}
92 92
 
93 93
 
@@ -99,35 +99,35 @@  discard block
 block discarded – undo
99 99
 	 * @param string $payment_method_path - full path up to and including payment method folder
100 100
 	 * @return boolean
101 101
 	 */
102
-	public function register_payment_method( $payment_method_path = '' ) {
103
-		do_action( 'AHEE__EE_Payment_Method_Manager__register_payment_method__begin',$payment_method_path );
102
+	public function register_payment_method($payment_method_path = '') {
103
+		do_action('AHEE__EE_Payment_Method_Manager__register_payment_method__begin', $payment_method_path);
104 104
 		$module_ext = '.pm.php';
105 105
 		// make all separators match
106
-		$payment_method_path = rtrim( str_replace( '/\\', DS, $payment_method_path ), DS );
106
+		$payment_method_path = rtrim(str_replace('/\\', DS, $payment_method_path), DS);
107 107
 		// grab and sanitize module name
108
-		$module_dir = basename( $payment_method_path );
108
+		$module_dir = basename($payment_method_path);
109 109
 		// create classname from module directory name
110
-		$module = str_replace( ' ', '_', str_replace( '_', ' ', $module_dir ));
110
+		$module = str_replace(' ', '_', str_replace('_', ' ', $module_dir));
111 111
 		// add class prefix
112
-		$module_class = 'EE_PMT_' . $module;
112
+		$module_class = 'EE_PMT_'.$module;
113 113
 		// does the module exist ?
114
-		if ( ! is_readable( $payment_method_path . DS . $module_class . $module_ext )) {
115
-			$msg = sprintf( __( 'The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
116
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
114
+		if ( ! is_readable($payment_method_path.DS.$module_class.$module_ext)) {
115
+			$msg = sprintf(__('The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
116
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
117 117
 			return FALSE;
118 118
 		}
119
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->start_timer(); }
119
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->start_timer(); }
120 120
 		// load the module class file
121
-		require_once( $payment_method_path . DS . $module_class . $module_ext );
122
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
121
+		require_once($payment_method_path.DS.$module_class.$module_ext);
122
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
123 123
 		// verify that class exists
124
-		if ( ! class_exists( $module_class )) {
125
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
126
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
124
+		if ( ! class_exists($module_class)) {
125
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
126
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
127 127
 			return FALSE;
128 128
 		}
129 129
 		// add to array of registered modules
130
-		$this->_payment_method_types[ $module ] = $payment_method_path . DS . $module_class . $module_ext;
130
+		$this->_payment_method_types[$module] = $payment_method_path.DS.$module_class.$module_ext;
131 131
 		return TRUE;
132 132
 	}
133 133
 	/**
@@ -136,18 +136,18 @@  discard block
 block discarded – undo
136 136
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
137 137
 	 * @return boolean
138 138
 	 */
139
-	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE){
139
+	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE) {
140 140
 		if (
141 141
 			$force_recheck
142
-			|| ! is_array( $this->_payment_method_types )
143
-			|| ! isset( $this->_payment_method_types[$payment_method_name] )
142
+			|| ! is_array($this->_payment_method_types)
143
+			|| ! isset($this->_payment_method_types[$payment_method_name])
144 144
 		) {
145 145
 			$this->maybe_register_payment_methods($force_recheck);
146 146
 		}
147
-		if(isset($this->_payment_method_types[$payment_method_name])){
147
+		if (isset($this->_payment_method_types[$payment_method_name])) {
148 148
 			require_once($this->_payment_method_types[$payment_method_name]);
149 149
 			return true;
150
-		}else{
150
+		} else {
151 151
 			return false;
152 152
 		}
153 153
 	}
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
159 159
 	 * @return array
160 160
 	 */
161
-	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE ){
161
+	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE) {
162 162
 		$this->maybe_register_payment_methods($force_recheck);
163
-		if($with_prefixes){
163
+		if ($with_prefixes) {
164 164
 			$classnames = array_keys($this->_payment_method_types);
165 165
 			$payment_methods = array();
166
-			foreach($classnames as $classname){
166
+			foreach ($classnames as $classname) {
167 167
 				$payment_methods[] = $this->payment_method_class_from_type($classname);
168 168
 			}
169 169
 			return $payment_methods;
170
-		}else{
170
+		} else {
171 171
 			return array_keys($this->_payment_method_types);
172 172
 		}
173 173
 	}
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
178 178
 	 * @return EE_PMT_Base[]
179 179
 	 */
180
-	public function payment_method_types( $force_recheck = FALSE ){
180
+	public function payment_method_types($force_recheck = FALSE) {
181 181
 		$this->maybe_register_payment_methods($force_recheck);
182 182
 		$pmt_objs = array();
183
-		foreach($this->payment_method_type_names(true) as $classname){
183
+		foreach ($this->payment_method_type_names(true) as $classname) {
184 184
 			$pmt_objs[] = new $classname;
185 185
 		}
186 186
 		return $pmt_objs;
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * @param string $classname
193 193
 	 * @return string
194 194
 	 */
195
-	public function payment_method_type_sans_class_prefix($classname){
196
-		return str_replace( "EE_PMT_", "", $classname );
195
+	public function payment_method_type_sans_class_prefix($classname) {
196
+		return str_replace("EE_PMT_", "", $classname);
197 197
 	}
198 198
 
199 199
 	/**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @param string $type
202 202
 	 * @return string
203 203
 	 */
204
-	public function payment_method_class_from_type($type){
204
+	public function payment_method_class_from_type($type) {
205 205
 		$this->maybe_register_payment_methods();
206 206
 		return "EE_PMT_".$type;
207 207
 	}
@@ -215,38 +215,38 @@  discard block
 block discarded – undo
215 215
 	 * @return \EE_Payment_Method
216 216
 	 * @throws \EE_Error
217 217
 	 */
218
-	public function activate_a_payment_method_of_type( $payment_method_type ){
218
+	public function activate_a_payment_method_of_type($payment_method_type) {
219 219
 		$payment_method = EEM_Payment_Method::instance()->get_one_of_type($payment_method_type);
220
-		if( ! $payment_method instanceof EE_Payment_Method ){
220
+		if ( ! $payment_method instanceof EE_Payment_Method) {
221 221
 			$pm_type_class = $this->payment_method_class_from_type($payment_method_type);
222
-			if(class_exists($pm_type_class)){
222
+			if (class_exists($pm_type_class)) {
223 223
 				/** @var $pm_type_obj EE_PMT_Base */
224 224
 				$pm_type_obj = new $pm_type_class;
225 225
 				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug($pm_type_obj->system_name());
226
-				if( ! $payment_method){
227
-					$payment_method = $this->create_payment_method_of_type( $pm_type_obj );
226
+				if ( ! $payment_method) {
227
+					$payment_method = $this->create_payment_method_of_type($pm_type_obj);
228 228
 				}
229
-				$payment_method->set_type( $payment_method_type );
230
-				$this->initialize_payment_method( $payment_method );
229
+				$payment_method->set_type($payment_method_type);
230
+				$this->initialize_payment_method($payment_method);
231 231
 			} else {
232 232
 				throw new EE_Error(
233 233
 					sprintf(
234
-						__( 'There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
234
+						__('There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
235 235
 						$pm_type_class )
236 236
 				);
237 237
 			}
238 238
 		}
239 239
 		$payment_method->set_active();
240 240
 		$payment_method->save();
241
-		$this->set_usable_currencies_on_payment_method( $payment_method );
242
-		if( $payment_method->type() === 'Invoice' ){
243
-			$messages = EE_Registry::instance()->load_lib( 'messages' );
244
-			$messages->ensure_message_type_is_active( 'invoice', 'html' );
245
-			$messages->ensure_messenger_is_active( 'pdf' );
241
+		$this->set_usable_currencies_on_payment_method($payment_method);
242
+		if ($payment_method->type() === 'Invoice') {
243
+			$messages = EE_Registry::instance()->load_lib('messages');
244
+			$messages->ensure_message_type_is_active('invoice', 'html');
245
+			$messages->ensure_messenger_is_active('pdf');
246 246
 			EE_Error::add_attention(
247 247
 				sprintf(
248
-					__( 'Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso' ),
249
-					'<a href="' . admin_url( 'admin.php?page=espresso_messages') . '">',
248
+					__('Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso'),
249
+					'<a href="'.admin_url('admin.php?page=espresso_messages').'">',
250 250
 					'</a>'
251 251
 				)
252 252
 			);
@@ -264,17 +264,17 @@  discard block
 block discarded – undo
264 264
 	 * @return EE_Payment_Method
265 265
 	 * @throws \EE_Error
266 266
 	 */
267
-	public function create_payment_method_of_type( $pm_type_obj ) {
267
+	public function create_payment_method_of_type($pm_type_obj) {
268 268
 		global $current_user;
269 269
 		$payment_method = EE_Payment_Method::new_instance(
270 270
 			array(
271 271
 				'PMD_type' 		 => $pm_type_obj->system_name(),
272 272
 				'PMD_name' 		 => $pm_type_obj->pretty_name(),
273 273
 				'PMD_admin_name' => $pm_type_obj->pretty_name(),
274
-				'PMD_slug' 		 => $pm_type_obj->system_name(),//automatically converted to slug
274
+				'PMD_slug' 		 => $pm_type_obj->system_name(), //automatically converted to slug
275 275
 				'PMD_wp_user' 	 => $current_user->ID,
276 276
 				'PMD_order' 	 => EEM_Payment_Method::instance()->count(
277
-						array( array( 'PMD_type' => array( '!=', 'Admin_Only' )))
277
+						array(array('PMD_type' => array('!=', 'Admin_Only')))
278 278
 					) * 10,
279 279
 			)
280 280
 		);
@@ -290,21 +290,21 @@  discard block
 block discarded – undo
290 290
 	 * @return EE_Payment_Method
291 291
 	 * @throws \EE_Error
292 292
 	 */
293
-	public function initialize_payment_method( $payment_method ) {
293
+	public function initialize_payment_method($payment_method) {
294 294
 		$pm_type_obj = $payment_method->type_obj();
295
-		$payment_method->set_description( $pm_type_obj->default_description() );
296
-		if( ! $payment_method->button_url() ){
297
-			$payment_method->set_button_url( $pm_type_obj->default_button_url() );
295
+		$payment_method->set_description($pm_type_obj->default_description());
296
+		if ( ! $payment_method->button_url()) {
297
+			$payment_method->set_button_url($pm_type_obj->default_button_url());
298 298
 		}
299 299
 		//now add setup its default extra meta properties
300 300
 		$extra_metas = $pm_type_obj->settings_form()->extra_meta_inputs();
301
-		if ( ! empty( $extra_metas ) ) {
301
+		if ( ! empty($extra_metas)) {
302 302
 			//verify the payment method has an ID before adding extra meta
303
-			if ( ! $payment_method->ID() ) {
303
+			if ( ! $payment_method->ID()) {
304 304
 				$payment_method->save();
305 305
 			}
306
-			foreach ( $extra_metas as $meta_name => $input ) {
307
-				$payment_method->update_extra_meta( $meta_name, $input->raw_value() );
306
+			foreach ($extra_metas as $meta_name => $input) {
307
+				$payment_method->update_extra_meta($meta_name, $input->raw_value());
308 308
 			}
309 309
 		}
310 310
 		return $payment_method;
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 	 * @return EE_Payment_Method
320 320
 	 * @throws \EE_Error
321 321
 	 */
322
-	public function set_usable_currencies_on_payment_method( $payment_method ) {
323
-		foreach($payment_method->get_all_usable_currencies() as $currency_obj){
322
+	public function set_usable_currencies_on_payment_method($payment_method) {
323
+		foreach ($payment_method->get_all_usable_currencies() as $currency_obj) {
324 324
 			$payment_method->_add_relation_to($currency_obj, 'Currency');
325 325
 		}
326 326
 		return $payment_method;
@@ -338,19 +338,19 @@  discard block
 block discarded – undo
338 338
 	 *
339 339
 	 * @return int count of rows updated.
340 340
 	 */
341
-	public function deactivate_payment_method( $payment_method_slug ) {
341
+	public function deactivate_payment_method($payment_method_slug) {
342 342
 		EE_Log::instance()->log(
343 343
 				__FILE__,
344 344
 				__FUNCTION__,
345 345
 				sprintf(
346
-					__( 'Payment method with slug %1$s is being deactivated by site admin', 'event_espresso' ),
346
+					__('Payment method with slug %1$s is being deactivated by site admin', 'event_espresso'),
347 347
 					$payment_method_slug
348 348
 				),
349 349
 				'payment_method_change'
350 350
 			);
351 351
 		$count_updated = EEM_Payment_Method::instance()->update(
352
-			array( 'PMD_scope' => array() ),
353
-			array( array( 'PMD_slug' => $payment_method_slug ) )
352
+			array('PMD_scope' => array()),
353
+			array(array('PMD_slug' => $payment_method_slug))
354 354
 		);
355 355
 		return $count_updated;
356 356
 	}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 * @param array $caps capabilities being filtered
365 365
 	 * @return array
366 366
 	 */
367
-	public function add_payment_method_caps( $caps ) {
367
+	public function add_payment_method_caps($caps) {
368 368
 		/* add dynamic caps from payment methods
369 369
 		 * at the time of writing, october 20 2014, these are the caps added:
370 370
 		 * ee_payment_method_admin_only
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 		 * their related capability automatically added too, so long as they are
380 380
 		 * registered properly using EE_Register_Payment_Method::register()
381 381
 		 */
382
-		foreach( $this->payment_method_types() as $payment_method_type_obj ){
382
+		foreach ($this->payment_method_types() as $payment_method_type_obj) {
383 383
 			$caps['administrator'][] = $payment_method_type_obj->cap_name();
384 384
 		}
385 385
 		return $caps;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				$validation_error_message = $default_validation_strategy->get_validation_error_message();
43 43
 			}
44 44
 			throw new EE_Validation_Error( $validation_error_message, 'float_only' );
45
-		}else{
45
+		} else{
46 46
 			return floatval($normalized_value);
47 47
 		}
48 48
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	public function unnormalize($normalized_value) {
56 56
 		if( empty( $normalized_value ) ){
57 57
 			return '0.00';
58
-		}else{
58
+		} else{
59 59
 			return "$normalized_value";
60 60
 		}
61 61
 	}
Please login to merge, or discard this patch.
core/db_classes/EE_Payment_Method.class.php 1 patch
Spacing   +51 added lines, -51 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
  * Event Espresso
5 5
  *
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * ------------------------------------------------------------------------
25 25
  */
26
-class EE_Payment_Method extends EE_Base_Class{
26
+class EE_Payment_Method extends EE_Base_Class {
27 27
 
28 28
 	/**
29 29
 	 * Payment Method type object, which has all the info about this type of payment method,
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 * @return EE_Payment_Method
40 40
 	 * @throws \EE_Error
41 41
 	 */
42
-	public static function new_instance( $props_n_values = array()) {
43
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
44
-		return $has_object ? $has_object : new self( $props_n_values, FALSE );
42
+	public static function new_instance($props_n_values = array()) {
43
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
44
+		return $has_object ? $has_object : new self($props_n_values, FALSE);
45 45
 	}
46 46
 
47 47
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 * @return EE_Payment_Method
52 52
 	 * @throws \EE_Error
53 53
 	 */
54
-	public static function new_instance_from_db ( $props_n_values = array()) {
55
-		return new self( $props_n_values, TRUE );
54
+	public static function new_instance_from_db($props_n_values = array()) {
55
+		return new self($props_n_values, TRUE);
56 56
 	}
57 57
 
58 58
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @return boolean
82 82
 	 */
83 83
 	public function active() {
84
-		return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()),$this->scope());
84
+		return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()), $this->scope());
85 85
 	}
86 86
 
87 87
 
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @throws \EE_Error
94 94
 	 */
95
-	public function set_active(){
95
+	public function set_active() {
96 96
 		$default_scopes = array(EEM_Payment_Method::scope_cart);
97
-		if($this->type_obj() &&
98
-			$this->type_obj()->payment_occurs() === EE_PMT_Base::offline){
97
+		if ($this->type_obj() &&
98
+			$this->type_obj()->payment_occurs() === EE_PMT_Base::offline) {
99 99
 			$default_scopes[] = EEM_Payment_Method::scope_admin;
100 100
 		}
101 101
 		$this->set_scope($default_scopes);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	/**
107 107
 	 * Makes this payment method apply to NO scopes at all. DOES NOT SAVE it.
108 108
 	 */
109
-	public function deactivate(){
109
+	public function deactivate() {
110 110
 		$this->set_scope(array());
111 111
 	}
112 112
 
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * @param mixed $field_value
298 298
 	 * @param boolean $use_default
299 299
 	 */
300
-	public function set( $field_name, $field_value, $use_default = FALSE ){
301
-		if( $field_name === 'PMD_type' ){
300
+	public function set($field_name, $field_value, $use_default = FALSE) {
301
+		if ($field_name === 'PMD_type') {
302 302
 			//the type has probably changed, so forget about its old type object
303 303
 			$this->_type_obj = NULL;
304 304
 		}
@@ -372,26 +372,26 @@  discard block
 block discarded – undo
372 372
 	 * @return EE_PMT_Base
373 373
 	 * @throws EE_Error
374 374
 	 */
375
-	public function type_obj(){
376
-		if( ! $this->_type_obj ) {
377
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
378
-			if ( EE_Payment_Method_Manager::instance()->payment_method_type_exists( $this->type() )) {
379
-				$class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type( $this->type() );
380
-				if ( ! class_exists( $class_name )) {
375
+	public function type_obj() {
376
+		if ( ! $this->_type_obj) {
377
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
378
+			if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($this->type())) {
379
+				$class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type($this->type());
380
+				if ( ! class_exists($class_name)) {
381 381
 					throw new EE_Error(
382 382
 						sprintf(
383
-							__( 'An attempt to use the "%1$s" payment method failed, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated? It can be reactivated on the %3$sPlugins Admin Page%4$s', 'event_espresso' ),
383
+							__('An attempt to use the "%1$s" payment method failed, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated? It can be reactivated on the %3$sPlugins Admin Page%4$s', 'event_espresso'),
384 384
 							$class_name,
385 385
 							'<br />',
386
-							'<a href="' . admin_url('plugins.php') . '">',
386
+							'<a href="'.admin_url('plugins.php').'">',
387 387
 							'</a>'
388 388
 						)
389 389
 					);
390 390
 				}
391
-				$r = new ReflectionClass( $class_name );
392
-					$this->_type_obj = $r->newInstanceArgs( array( $this ));
391
+				$r = new ReflectionClass($class_name);
392
+					$this->_type_obj = $r->newInstanceArgs(array($this));
393 393
 			} else {
394
-				throw new EE_Error( sprintf( __( 'A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', 'event_espresso' ), $this->type(), implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names() ) ) );
394
+				throw new EE_Error(sprintf(__('A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', 'event_espresso'), $this->type(), implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names())));
395 395
 			}
396 396
 		}
397 397
 		return $this->_type_obj;
@@ -404,18 +404,18 @@  discard block
 block discarded – undo
404 404
 	 * and the extra meta. Mostly used for passing off ot gateways.	 *
405 405
 	 * @return array
406 406
 	 */
407
-	public function settings_array(){
407
+	public function settings_array() {
408 408
 		$fields = $this->model_field_array();
409 409
 		$extra_meta = $this->all_extra_meta_array();
410 410
 		//remove the model's prefix from the fields
411 411
 		$combined_settings_array = array();
412
-		foreach($fields as $key => $value){
413
-			if(strpos($key, 'PMD_')===0){
412
+		foreach ($fields as $key => $value) {
413
+			if (strpos($key, 'PMD_') === 0) {
414 414
 				$key_sans_model_prefix = str_replace('PMD_', '', $key);
415 415
 				$combined_settings_array [$key_sans_model_prefix] = $value;
416 416
 			}
417 417
 		}
418
-		$combined_settings_array = array_merge( $extra_meta,$combined_settings_array );
418
+		$combined_settings_array = array_merge($extra_meta, $combined_settings_array);
419 419
 		return $combined_settings_array;
420 420
 	}
421 421
 
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
 	 * @return string of HTML for displaying the button
430 430
 	 * @throws \EE_Error
431 431
 	 */
432
-	public function button_html( $url = '', $css_class = '' ){
432
+	public function button_html($url = '', $css_class = '') {
433 433
 		$payment_occurs = $this->type_obj()->payment_occurs();
434 434
 		return '
435
-		 <div id="' . $this->slug() . '-payment-option-dv" class="'. $payment_occurs .'-payment-gateway reg-page-payment-option-dv' . $css_class . '">
436
-			<a id="payment-gateway-button-' . $this->slug() . '" class="reg-page-payment-option-lnk" rel="' . $this->slug() . '" href="' . $url . '" >
437
-				<img src="' . $this->button_url() . '" alt="' . sprintf( esc_attr__( 'Pay using %s', 'event_espresso' ), $this->get_pretty('PMD_name','form_input') ) . '" />
435
+		 <div id="' . $this->slug().'-payment-option-dv" class="'.$payment_occurs.'-payment-gateway reg-page-payment-option-dv'.$css_class.'">
436
+			<a id="payment-gateway-button-' . $this->slug().'" class="reg-page-payment-option-lnk" rel="'.$this->slug().'" href="'.$url.'" >
437
+				<img src="' . $this->button_url().'" alt="'.sprintf(esc_attr__('Pay using %s', 'event_espresso'), $this->get_pretty('PMD_name', 'form_input')).'" />
438 438
 			</a>
439 439
 		</div>
440 440
 ';
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 	 * @return EE_Currency[]
450 450
 	 * @throws \EE_Error
451 451
 	 */
452
-	public function get_all_usable_currencies(){
452
+	public function get_all_usable_currencies() {
453 453
 		return EEM_Currency::instance()->get_all_currencies_usable_by($this->type_obj());
454 454
 	}
455 455
 
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
 	 * @return boolean
463 463
 	 * @throws \EE_Error
464 464
 	 */
465
-	public function usable_for_currency( $currency_code ) {
466
-		foreach( $this->get_all_usable_currencies() as $currency_obj ) {
467
-			if( $currency_obj->ID() === $currency_code ){
465
+	public function usable_for_currency($currency_code) {
466
+		foreach ($this->get_all_usable_currencies() as $currency_obj) {
467
+			if ($currency_obj->ID() === $currency_code) {
468 468
 				return TRUE;
469 469
 			}
470 470
 		}
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	 * @return bool
480 480
 	 * @throws \EE_Error
481 481
 	 */
482
-	public function is_on_site(){
482
+	public function is_on_site() {
483 483
 		return $this->type_obj()->payment_occurs() === EE_PMT_Base::onsite;
484 484
 	}
485 485
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	 * @return bool
492 492
 	 * @throws \EE_Error
493 493
 	 */
494
-	public function is_off_site(){
494
+	public function is_off_site() {
495 495
 		return $this->type_obj()->payment_occurs() === EE_PMT_Base::offsite;
496 496
 	}
497 497
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	 * @return bool
504 504
 	 * @throws \EE_Error
505 505
 	 */
506
-	public function is_off_line(){
506
+	public function is_off_line() {
507 507
 		return $this->type_obj()->payment_occurs() === EE_PMT_Base::offline;
508 508
 	}
509 509
 
@@ -513,10 +513,10 @@  discard block
 block discarded – undo
513 513
 	 * to load the required classes, and don't need them at the time of unserialization
514 514
 	 * @return array
515 515
 	 */
516
-	public function __sleep(){
517
-		$properties =  get_object_vars( $this );
518
-		unset( $properties[ '_type_obj' ] );
519
-		return array_keys( $properties );
516
+	public function __sleep() {
517
+		$properties = get_object_vars($this);
518
+		unset($properties['_type_obj']);
519
+		return array_keys($properties);
520 520
 	}
521 521
 
522 522
 
@@ -528,17 +528,17 @@  discard block
 block discarded – undo
528 528
 	 * @return int @see EE_Base_Class::save()
529 529
 	 * @throws \EE_Error
530 530
 	 */
531
-	public function save( $set_cols_n_values = array() ) {
532
-		$results =  parent::save( $set_cols_n_values );
533
-		if( $this->get_original( 'PMD_scope' ) !== $this->get( 'PMD_scope' ) ) {
531
+	public function save($set_cols_n_values = array()) {
532
+		$results = parent::save($set_cols_n_values);
533
+		if ($this->get_original('PMD_scope') !== $this->get('PMD_scope')) {
534 534
 			EE_Log::instance()->log(
535 535
 				__FILE__,
536 536
 				__FUNCTION__,
537 537
 				sprintf(
538
-					__( 'Set new scope on payment method %1$s to %2$s from %3$s on URL %4$s', 'event_espresso' ),
538
+					__('Set new scope on payment method %1$s to %2$s from %3$s on URL %4$s', 'event_espresso'),
539 539
 					$this->name(),
540
-					serialize( $this->get_original(  'PMD_scope' ) ),
541
-					serialize( $this->get( 'PMD_scope' ) ),
540
+					serialize($this->get_original('PMD_scope')),
541
+					serialize($this->get('PMD_scope')),
542 542
 					EE_Registry::instance()->REQ->get_current_page_permalink()
543 543
 				),
544 544
 				'payment_method_change'
Please login to merge, or discard this patch.
core/db_models/EEM_Registration.model.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
3
-require_once ( EE_CLASSES . 'EE_Registration.class.php' );
2
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
3
+require_once (EE_CLASSES.'EE_Registration.class.php');
4 4
 /**
5 5
  *
6 6
  * Registration Model
@@ -92,31 +92,31 @@  discard block
 block discarded – undo
92 92
 	 *    Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
93 93
 	 * @return \EEM_Registration
94 94
 	 */
95
-	protected function __construct( $timezone ) {
96
-		$this->singular_item = __('Registration','event_espresso');
97
-		$this->plural_item = __('Registrations','event_espresso');
95
+	protected function __construct($timezone) {
96
+		$this->singular_item = __('Registration', 'event_espresso');
97
+		$this->plural_item = __('Registrations', 'event_espresso');
98 98
 
99 99
 		$this->_tables = array(
100
-			'Registration'=>new EE_Primary_Table('esp_registration','REG_ID')
100
+			'Registration'=>new EE_Primary_Table('esp_registration', 'REG_ID')
101 101
 		);
102 102
 		$this->_fields = array(
103 103
 			'Registration'=>array(
104
-				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID','event_espresso')),
105
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
106
-				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID','event_espresso'), false, 0, 'Attendee'),
107
-				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'),
108
-				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso'), false, 0, 'Ticket'),
109
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
110
-				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred','event_espresso'), false, time(), $timezone ),
111
-				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total','event_espresso'), false, 0),
112
-				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration','event_espresso'), false, 0),
113
-				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''),
114
-				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''),
115
-				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''),
116
-				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1),
117
-				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1),
118
-				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false),
119
-				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false )
104
+				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')),
105
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
106
+				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'),
107
+				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'),
108
+				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'),
109
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
110
+				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, time(), $timezone),
111
+				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total', 'event_espresso'), false, 0),
112
+				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0),
113
+				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''),
114
+				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''),
115
+				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''),
116
+				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1),
117
+				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1),
118
+				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false),
119
+				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false)
120 120
 			)
121 121
 		);
122 122
 		$this->_model_relations = array(
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 			'Answer'=>new EE_Has_Many_Relation(),
129 129
 			'Checkin'=>new EE_Has_Many_Relation(),
130 130
 			'Registration_Payment' => new EE_Has_Many_Relation(),
131
-			'Payment'=>new EE_HABTM_Relation( 'Registration_Payment' ),
131
+			'Payment'=>new EE_HABTM_Relation('Registration_Payment'),
132 132
 		);
133 133
 		$this->_model_chain_to_wp_user = 'Event';
134 134
 
135
-		parent::__construct( $timezone );
135
+		parent::__construct($timezone);
136 136
 	}
137 137
 
138 138
 
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 *		@param bool  $translated If true will return the values as singular localized strings
166 166
 	 *		@return array
167 167
 	 */
168
-	public static function reg_status_array( $exclude = array(), $translated = FALSE ) {
169
-		EEM_Registration::instance()->_get_registration_status_array( $exclude );
170
-		return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
168
+	public static function reg_status_array($exclude = array(), $translated = FALSE) {
169
+		EEM_Registration::instance()->_get_registration_status_array($exclude);
170
+		return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
171 171
 	}
172 172
 
173 173
 
@@ -178,19 +178,19 @@  discard block
 block discarded – undo
178 178
 	 * @param array $exclude
179 179
 	 * @return array
180 180
 	 */
181
-	private function _get_registration_status_array( $exclude = array() ) {
181
+	private function _get_registration_status_array($exclude = array()) {
182 182
 		//in the very rare circumstance that we are deleting a model's table's data
183 183
 		//and the table hasn't actually been created, this could have an error
184 184
 		/** @type WPDB $wpdb */
185 185
 		global $wpdb;
186
-		EE_Registry::instance()->load_helper( 'Activation' );
187
-		if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){
188
-			$SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"';
189
-			$results = $wpdb->get_results( $SQL );
186
+		EE_Registry::instance()->load_helper('Activation');
187
+		if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) {
188
+			$SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"';
189
+			$results = $wpdb->get_results($SQL);
190 190
 			self::$_reg_status = array();
191
-			foreach ( $results as $status ) {
192
-				if ( ! in_array( $status->STS_ID, $exclude )) {
193
-					self::$_reg_status[ $status->STS_ID ] = $status->STS_code;
191
+			foreach ($results as $status) {
192
+				if ( ! in_array($status->STS_ID, $exclude)) {
193
+					self::$_reg_status[$status->STS_ID] = $status->STS_code;
194 194
 				}
195 195
 			}
196 196
 		}
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
 	 * @param  array  $where_params Array of query_params as described in the comments for EEM_Base::get_all()
206 206
 	 * @return wpdb results array
207 207
 	 */
208
-	public function get_reg_months_and_years( $where_params ) {
208
+	public function get_reg_months_and_years($where_params) {
209 209
 		$query_params[0] = $where_params;
210 210
 		$query_params['group_by'] = array('reg_year', 'reg_month');
211
-		$query_params['order_by'] = array( 'REG_date' => 'DESC' );
211
+		$query_params['order_by'] = array('REG_date' => 'DESC');
212 212
 		$columns_to_select = array(
213 213
 			'reg_year' => array('YEAR(REG_date)', '%s'),
214 214
 			'reg_month' => array('MONTHNAME(REG_date)', '%s')
215 215
 			);
216
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
216
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
217 217
 	}
218 218
 
219 219
 
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 	* 		@param		int		$ATT_ID
226 226
 	*		@return 	EE_Registration[]
227 227
 	*/
228
-	public function get_all_registrations_for_attendee( $ATT_ID = 0 ) {
229
-		if ( ! $ATT_ID ) {
228
+	public function get_all_registrations_for_attendee($ATT_ID = 0) {
229
+		if ( ! $ATT_ID) {
230 230
 			return FALSE;
231 231
 		}
232
-		return $this->get_all( array( array( 'ATT_ID' => $ATT_ID )));
232
+		return $this->get_all(array(array('ATT_ID' => $ATT_ID)));
233 233
 	}
234 234
 
235 235
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 * @param string $REG_url_link
241 241
 	 * @return EE_Registration
242 242
 	 */
243
-	public function get_registration_for_reg_url_link($REG_url_link){
244
-		if(!$REG_url_link){
243
+	public function get_registration_for_reg_url_link($REG_url_link) {
244
+		if ( ! $REG_url_link) {
245 245
 			return false;
246 246
 		}
247 247
 		return $this->get_one(array(array('REG_url_link'=>$REG_url_link)));
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 	* 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
260 260
 	*		@return 		mixed		array on success, FALSE on fail
261 261
 	*/
262
-	public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) {
262
+	public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) {
263 263
 		return $this->get_one(array(
264 264
 			array(
265 265
 				'TXN_ID'=>$TXN_ID,
266 266
 				'ATT_ID'=>$ATT_ID
267 267
 			),
268
-			'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 )
268
+			'limit'=>array(min(($att_nmbr - 1), 0), 1)
269 269
 		));
270 270
 	}
271 271
 
@@ -277,17 +277,17 @@  discard block
 block discarded – undo
277 277
 	 *		@param $period string which can be passed to php's strtotime function (eg "-1 month")
278 278
 	 *		@return stdClass[] with properties regDate and total
279 279
 	*/
280
-	public function get_registrations_per_day_report( $period = '-1 month' ) {
280
+	public function get_registrations_per_day_report($period = '-1 month') {
281 281
 
282
-		$sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' );
283
-		$where = array( 'REG_date' => array( '>=', $sql_date ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
282
+		$sql_date = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC');
283
+		$where = array('REG_date' => array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
284 284
 
285
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) {
285
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) {
286 286
 			$where['Event.EVT_wp_user'] = get_current_user_id();
287 287
 		}
288 288
 
289
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
290
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'REG_date' );
289
+		EE_Registry::instance()->load_helper('DTT_Helper');
290
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'REG_date');
291 291
 
292 292
 		$results = $this->_get_all_wpdb_results(
293 293
 				array(
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 				),
298 298
 				OBJECT,
299 299
 				array(
300
-					'regDate'=>array( 'DATE(' . $query_interval . ')','%s'),
301
-					'total'=>array('count(REG_ID)','%d')
300
+					'regDate'=>array('DATE('.$query_interval.')', '%s'),
301
+					'total'=>array('count(REG_ID)', '%d')
302 302
 				));
303 303
 		return $results;
304 304
 	}
@@ -313,23 +313,23 @@  discard block
 block discarded – undo
313 313
 	 * @return stdClass[] with properties Registration_REG_date and a column for each registration status as the STS_ID
314 314
 	 *                    (i.e. RAP)
315 315
 	 */
316
-	public function get_registrations_per_day_and_per_status_report( $period = '-1 month' ) {
316
+	public function get_registrations_per_day_and_per_status_report($period = '-1 month') {
317 317
 		global $wpdb;
318
-		$registration_table = $wpdb->prefix . 'esp_registration';
318
+		$registration_table = $wpdb->prefix.'esp_registration';
319 319
 		$event_table = $wpdb->posts;
320
-		$sql_date = date("Y-m-d H:i:s", strtotime($period) );
320
+		$sql_date = date("Y-m-d H:i:s", strtotime($period));
321 321
 
322 322
 		//prepare the query interval for displaying offset
323
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
324
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'dates.REG_date' );
323
+		EE_Registry::instance()->load_helper('DTT_Helper');
324
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'dates.REG_date');
325 325
 
326 326
 		//inner date query
327 327
 		$inner_date_query = "SELECT DISTINCT REG_date from $registration_table ";
328 328
 		$inner_where = " WHERE";
329 329
 		//exclude events not authored by user if permissions in effect
330
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
330
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
331 331
 			$inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID";
332
-			$inner_where .= " post_author = " . get_current_user_id() . " AND";
332
+			$inner_where .= " post_author = ".get_current_user_id()." AND";
333 333
 		}
334 334
 		$inner_where .= " REG_date >= '$sql_date'";
335 335
 		$inner_date_query .= $inner_where;
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 		$select_parts = array();
342 342
 
343 343
 		//loop through registration stati to do parts for each status.
344
-		foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) {
345
-			if ( $STS_ID === EEM_Registration::status_id_incomplete ) {
344
+		foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) {
345
+			if ($STS_ID === EEM_Registration::status_id_incomplete) {
346 346
 				continue;
347 347
 			}
348 348
 			$select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID";
@@ -350,14 +350,14 @@  discard block
 block discarded – undo
350 350
 		}
351 351
 
352 352
 		//setup the selects
353
-		$select .= implode(', ', $select_parts );
353
+		$select .= implode(', ', $select_parts);
354 354
 		$select .= " FROM ($inner_date_query) AS dates LEFT JOIN ";
355 355
 
356 356
 		//setup the joins
357
-		$join .= implode( " LEFT JOIN ", $join_parts );
357
+		$join .= implode(" LEFT JOIN ", $join_parts);
358 358
 
359 359
 		//now let's put it all together
360
-		$query = $select . $join . ' GROUP BY Registration_REG_date';
360
+		$query = $select.$join.' GROUP BY Registration_REG_date';
361 361
 
362 362
 		//and execute it
363 363
 		$results = $wpdb->get_results(
@@ -378,23 +378,23 @@  discard block
 block discarded – undo
378 378
 	 * @param $period string which can be passed to php's strtotime function (eg "-1 month")
379 379
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
380 380
 	*/
381
-	public function get_registrations_per_event_report( $period = '-1 month' ) {
381
+	public function get_registrations_per_event_report($period = '-1 month') {
382 382
 
383
-		$date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' );
384
-		$where = array( 'REG_date' => array( '>=', $date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
383
+		$date_sql = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC');
384
+		$where = array('REG_date' => array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
385 385
 
386
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
386
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
387 387
 			$where['Event.EVT_wp_user'] = get_current_user_id();
388 388
 		}
389 389
 		$results = $this->_get_all_wpdb_results(array(
390 390
 			$where,
391 391
 			'group_by'=>'Event.EVT_name',
392 392
 			'order_by'=>'Event.EVT_name',
393
-			'limit'=>array(0,24)),
393
+			'limit'=>array(0, 24)),
394 394
 			OBJECT,
395 395
 			array(
396
-				'event_name'=>array('Event_CPT.post_title','%s'),
397
-				'total'=>array('COUNT(REG_ID)','%s')
396
+				'event_name'=>array('Event_CPT.post_title', '%s'),
397
+				'total'=>array('COUNT(REG_ID)', '%s')
398 398
 			)
399 399
 		);
400 400
 
@@ -412,19 +412,19 @@  discard block
 block discarded – undo
412 412
 	 * @return stdClass[] with properties `Registration_Event` and a column for each registration status as the STS_ID
413 413
 	 *                    (i.e. RAP)
414 414
 	 */
415
-	public function get_registrations_per_event_and_per_status_report( $period = '-1 month' ) {
415
+	public function get_registrations_per_event_and_per_status_report($period = '-1 month') {
416 416
 		global $wpdb;
417
-		$registration_table = $wpdb->prefix . 'esp_registration';
417
+		$registration_table = $wpdb->prefix.'esp_registration';
418 418
 		$event_table = $wpdb->posts;
419
-		$sql_date = date("Y-m-d H:i:s", strtotime($period) );
419
+		$sql_date = date("Y-m-d H:i:s", strtotime($period));
420 420
 
421 421
 		//inner date query
422 422
 		$inner_date_query = "SELECT DISTINCT EVT_ID, REG_date from $registration_table ";
423 423
 		$inner_where = " WHERE";
424 424
 		//exclude events not authored by user if permissions in effect
425
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
425
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
426 426
 			$inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID";
427
-			$inner_where .= " post_author = " . get_current_user_id() . " AND";
427
+			$inner_where .= " post_author = ".get_current_user_id()." AND";
428 428
 		}
429 429
 		$inner_where .= " REG_date >= '$sql_date'";
430 430
 		$inner_date_query .= $inner_where;
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 		$select_parts = array();
437 437
 
438 438
 		//loop through registration stati to do parts for each status.
439
-		foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) {
440
-			if ( $STS_ID === EEM_Registration::status_id_incomplete ) {
439
+		foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) {
440
+			if ($STS_ID === EEM_Registration::status_id_incomplete) {
441 441
 				continue;
442 442
 			}
443 443
 			$select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID";
@@ -445,14 +445,14 @@  discard block
 block discarded – undo
445 445
 		}
446 446
 
447 447
 		//setup the selects
448
-		$select .= implode( ', ', $select_parts );
448
+		$select .= implode(', ', $select_parts);
449 449
 		$select .= " FROM ($inner_date_query) AS dates LEFT JOIN $event_table as Event ON Event.ID = dates.EVT_ID LEFT JOIN ";
450 450
 
451 451
 		//setup remaining joins
452
-		$join .= implode( " LEFT JOIN ", $join_parts );
452
+		$join .= implode(" LEFT JOIN ", $join_parts);
453 453
 
454 454
 		//now put it all together
455
-		$query = $select . $join . ' GROUP BY Registration_Event';
455
+		$query = $select.$join.' GROUP BY Registration_Event';
456 456
 
457 457
 		//and execute
458 458
 		$results = $wpdb->get_results(
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
 	 * @param int $TXN_ID
469 469
 	 * @return EE_Registration
470 470
 	 */
471
-	public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){
472
-		if( ! $TXN_ID ){
471
+	public function get_primary_registration_for_transaction_ID($TXN_ID = 0) {
472
+		if ( ! $TXN_ID) {
473 473
 			return false;
474 474
 		}
475
-		return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
475
+		return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
476 476
 	}
477 477
 
478 478
 
@@ -484,11 +484,11 @@  discard block
 block discarded – undo
484 484
 	 *		@param boolean $for_incomplete_payments
485 485
 	 *		@return int
486 486
 	 */
487
-	public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) {
487
+	public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) {
488 488
 		// we only count approved registrations towards registration limits
489
-		$query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) );
490
-		if( $for_incomplete_payments ){
491
-			$query_params[0]['Transaction.STS_ID']=array('!=',  EEM_Transaction::complete_status_code);
489
+		$query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved));
490
+		if ($for_incomplete_payments) {
491
+			$query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code);
492 492
 		}
493 493
 
494 494
 		return $this->count($query_params);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 		/** @type WPDB $wpdb */
505 505
 		global $wpdb;
506 506
 		return $wpdb->query(
507
-				'DELETE r FROM ' . $this->table() . ' r LEFT JOIN ' . EEM_Transaction::instance()->table() . ' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
507
+				'DELETE r FROM '.$this->table().' r LEFT JOIN '.EEM_Transaction::instance()->table().' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
508 508
 	}
509 509
 
510 510
 	/**
@@ -514,17 +514,17 @@  discard block
 block discarded – undo
514 514
 	 * @param boolean $checked_in whether to count registrations checked IN or OUT
515 515
 	 * @return int
516 516
 	 */
517
-	public function count_registrations_checked_into_datetime( $DTT_ID, $checked_in = true) {
517
+	public function count_registrations_checked_into_datetime($DTT_ID, $checked_in = true) {
518 518
 		global $wpdb;
519 519
 		//subquery to get latest checkin
520 520
 		$query = $wpdb->prepare(
521 521
 			'SELECT '
522 522
 				. 'COUNT( DISTINCT checkins.REG_ID ) '
523
-			. 'FROM ' . EEM_Checkin::instance()->table() . ' AS checkins INNER JOIN'
523
+			. 'FROM '.EEM_Checkin::instance()->table().' AS checkins INNER JOIN'
524 524
 				. '( SELECT '
525 525
 					. 'max( CHK_timestamp ) AS latest_checkin, '
526 526
 					. 'REG_ID AS REG_ID '
527
-				. 'FROM ' . EEM_Checkin::instance()->table() . ' '
527
+				. 'FROM '.EEM_Checkin::instance()->table().' '
528 528
 				. 'WHERE DTT_ID=%d '
529 529
 				. 'GROUP BY REG_ID'
530 530
 			. ') AS most_recent_checkin_per_reg '
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 			$DTT_ID,
536 536
 			$checked_in
537 537
 		);
538
-		return (int)$wpdb->get_var( $query );
538
+		return (int) $wpdb->get_var($query);
539 539
 	}
540 540
 
541 541
 	/**
@@ -545,18 +545,18 @@  discard block
 block discarded – undo
545 545
 	 * @param boolean $checked_in whether to count registrations checked IN or OUT
546 546
 	 * @return int
547 547
 	 */
548
-	public function count_registrations_checked_into_event( $EVT_ID, $checked_in = true ) {
548
+	public function count_registrations_checked_into_event($EVT_ID, $checked_in = true) {
549 549
 		global $wpdb;
550 550
 		//subquery to get latest checkin
551 551
 		$query = $wpdb->prepare(
552 552
 			'SELECT '
553 553
 				. 'COUNT( DISTINCT checkins.REG_ID ) '
554
-			. 'FROM ' . EEM_Checkin::instance()->table() . ' AS checkins INNER JOIN'
554
+			. 'FROM '.EEM_Checkin::instance()->table().' AS checkins INNER JOIN'
555 555
 				. '( SELECT '
556 556
 					. 'max( CHK_timestamp ) AS latest_checkin, '
557 557
 					. 'REG_ID AS REG_ID '
558
-				. 'FROM ' . EEM_Checkin::instance()->table() . ' AS c '
559
-				. 'INNER JOIN ' . EEM_Datetime::instance()->table() . ' AS d '
558
+				. 'FROM '.EEM_Checkin::instance()->table().' AS c '
559
+				. 'INNER JOIN '.EEM_Datetime::instance()->table().' AS d '
560 560
 				. 'ON c.DTT_ID=d.DTT_ID '
561 561
 				. 'WHERE d.EVT_ID=%d '
562 562
 				. 'GROUP BY REG_ID'
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 			$EVT_ID,
569 569
 			$checked_in
570 570
 		);
571
-		return (int)$wpdb->get_var( $query );
571
+		return (int) $wpdb->get_var($query);
572 572
 	}
573 573
 
574 574
 
@@ -583,15 +583,15 @@  discard block
 block discarded – undo
583 583
 	 * @param array $attendee_ids
584 584
 	 * @return EE_Registration[]
585 585
 	 */
586
-	public function get_latest_registration_for_each_of_given_contacts( $attendee_ids = array() ) {
586
+	public function get_latest_registration_for_each_of_given_contacts($attendee_ids = array()) {
587 587
 		//first do a native wp_query to get the latest REG_ID's matching these attendees.
588 588
 		global $wpdb;
589
-		$registration_table = $wpdb->prefix . 'esp_registration';
589
+		$registration_table = $wpdb->prefix.'esp_registration';
590 590
 		$attendee_table = $wpdb->posts;
591
-		$attendee_ids = is_array( $attendee_ids )
592
-			? array_map( 'absint', $attendee_ids )
593
-			: array( (int) $attendee_ids );
594
-		$attendee_ids = implode( ',', $attendee_ids );
591
+		$attendee_ids = is_array($attendee_ids)
592
+			? array_map('absint', $attendee_ids)
593
+			: array((int) $attendee_ids);
594
+		$attendee_ids = implode(',', $attendee_ids);
595 595
 
596 596
 
597 597
 		//first we do a query to get the registration ids
@@ -616,24 +616,24 @@  discard block
 block discarded – undo
616 616
 			ARRAY_A
617 617
 		);
618 618
 
619
-		if ( empty( $registration_ids ) ) {
619
+		if (empty($registration_ids)) {
620 620
 			return array();
621 621
 		}
622 622
 
623 623
 		$ids_for_model_query = array();
624 624
 		//let's flatten the ids so they can be used in the model query.
625
-		foreach ( $registration_ids as $registration_id ) {
626
-			if ( isset( $registration_id['registration_id'] ) ) {
625
+		foreach ($registration_ids as $registration_id) {
626
+			if (isset($registration_id['registration_id'])) {
627 627
 				$ids_for_model_query[] = $registration_id['registration_id'];
628 628
 			}
629 629
 		}
630 630
 
631 631
 		//construct query
632 632
 		$_where = array(
633
-			'REG_ID' => array( 'IN', $ids_for_model_query )
633
+			'REG_ID' => array('IN', $ids_for_model_query)
634 634
 		);
635 635
 
636
-		return $this->get_all( array( $_where ) );
636
+		return $this->get_all(array($_where));
637 637
 	}
638 638
 
639 639
 
Please login to merge, or discard this patch.