@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | * (either the question's ID or a question object) |
803 | 803 | * @param EE_Question|int $question |
804 | 804 | * @param bool $pretty_value |
805 | - * @return array|string if pretty_value= true, the result will always be a string |
|
805 | + * @return string if pretty_value= true, the result will always be a string |
|
806 | 806 | * (because the answer might be an array of answer values, so passing pretty_value=true |
807 | 807 | * will convert it into some kind of string) |
808 | 808 | */ |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | /** |
902 | 902 | * Sets deleted |
903 | 903 | * @param boolean $deleted |
904 | - * @return boolean |
|
904 | + * @return boolean|null |
|
905 | 905 | */ |
906 | 906 | public function set_deleted($deleted) { |
907 | 907 | $this->set( 'REG_deleted', $deleted ); |
@@ -945,6 +945,7 @@ discard block |
||
945 | 945 | * |
946 | 946 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
947 | 947 | * @param bool $check_approved This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access. |
948 | + * @param integer $DTT_OR_ID |
|
948 | 949 | * |
949 | 950 | * @return bool |
950 | 951 | */ |
@@ -1305,7 +1306,7 @@ discard block |
||
1305 | 1306 | * This grabs the payment method corresponding to the last payment made for the amount owing on the registration. |
1306 | 1307 | * Note: if there are no payments on the registration there will be no payment method returned. |
1307 | 1308 | * |
1308 | - * @return EE_Payment_Method|null |
|
1309 | + * @return EE_Base_Class|null |
|
1309 | 1310 | */ |
1310 | 1311 | public function payment_method() { |
1311 | 1312 | return EEM_Payment_Method::instance()->get_last_used_for_registration( $this ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_Registration class |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | * date_format and the second value is the time format |
42 | 42 | * @return EE_Registration |
43 | 43 | */ |
44 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
45 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
46 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
44 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
45 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
46 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * the website will be used. |
55 | 55 | * @return EE_Registration |
56 | 56 | */ |
57 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
58 | - return new self( $props_n_values, TRUE, $timezone ); |
|
57 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
58 | + return new self($props_n_values, TRUE, $timezone); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @access public |
67 | 67 | * @param int $EVT_ID Event ID |
68 | 68 | */ |
69 | - public function set_event( $EVT_ID = 0 ) { |
|
70 | - $this->set( 'EVT_ID', $EVT_ID ); |
|
69 | + public function set_event($EVT_ID = 0) { |
|
70 | + $this->set('EVT_ID', $EVT_ID); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -78,18 +78,18 @@ discard block |
||
78 | 78 | * @param mixed $field_value |
79 | 79 | * @param bool $use_default |
80 | 80 | */ |
81 | - public function set( $field_name, $field_value, $use_default = FALSE ) { |
|
82 | - switch( $field_name ) { |
|
81 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
82 | + switch ($field_name) { |
|
83 | 83 | case 'REG_code' : |
84 | - if ( ! empty( $field_value ) && $this->reg_code() == '' ) { |
|
85 | - $this->set_reg_code( $field_value, $use_default ); |
|
84 | + if ( ! empty($field_value) && $this->reg_code() == '') { |
|
85 | + $this->set_reg_code($field_value, $use_default); |
|
86 | 86 | } |
87 | 87 | break; |
88 | 88 | case 'STS_ID' : |
89 | - $this->set_status( $field_value, $use_default ); |
|
89 | + $this->set_status($field_value, $use_default); |
|
90 | 90 | break; |
91 | 91 | default : |
92 | - parent::set( $field_name, $field_value, $use_default ); |
|
92 | + parent::set($field_name, $field_value, $use_default); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -106,30 +106,30 @@ discard block |
||
106 | 106 | * @param boolean $use_default |
107 | 107 | * @return bool |
108 | 108 | */ |
109 | - public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) { |
|
109 | + public function set_status($new_STS_ID = NULL, $use_default = FALSE) { |
|
110 | 110 | // get current REG_Status |
111 | 111 | $old_STS_ID = $this->status_ID(); |
112 | 112 | // if status has changed |
113 | - if ( $old_STS_ID != $new_STS_ID ) { |
|
113 | + if ($old_STS_ID != $new_STS_ID) { |
|
114 | 114 | // TO approved |
115 | - if ( $new_STS_ID == EEM_Registration::status_id_approved ) { |
|
115 | + if ($new_STS_ID == EEM_Registration::status_id_approved) { |
|
116 | 116 | // reserve a space by incrementing ticket and datetime sold values |
117 | 117 | $this->_reserve_registration_space(); |
118 | - do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
118 | + do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID); |
|
119 | 119 | // OR FROM approved |
120 | - } else if ( $old_STS_ID == EEM_Registration::status_id_approved ) { |
|
120 | + } else if ($old_STS_ID == EEM_Registration::status_id_approved) { |
|
121 | 121 | // release a space by decrementing ticket and datetime sold values |
122 | 122 | $this->_release_registration_space(); |
123 | - do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
123 | + do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID); |
|
124 | 124 | } |
125 | 125 | // update status |
126 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
127 | - do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
|
126 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
127 | + do_action('AHEE__EE_Registration__set_status__after_update', $this); |
|
128 | 128 | return TRUE; |
129 | - }else{ |
|
129 | + } else { |
|
130 | 130 | //even though the old value matches the new value, it's still good to |
131 | 131 | //allow the parent set method to have a say |
132 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
132 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
133 | 133 | return TRUE; |
134 | 134 | } |
135 | 135 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @access public |
142 | 142 | */ |
143 | 143 | public function status_ID() { |
144 | - return $this->get( 'STS_ID' ); |
|
144 | + return $this->get('STS_ID'); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * @param boolean $include_archived whether to include archived tickets or not. |
167 | 167 | * @return EE_Ticket |
168 | 168 | */ |
169 | - public function ticket( $include_archived = TRUE ) { |
|
169 | + public function ticket($include_archived = TRUE) { |
|
170 | 170 | $query_params = array(); |
171 | - if ( $include_archived ) { |
|
172 | - $query_params[ 'default_where_conditions' ] = 'none'; |
|
171 | + if ($include_archived) { |
|
172 | + $query_params['default_where_conditions'] = 'none'; |
|
173 | 173 | } |
174 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
174 | + return $this->get_first_related('Ticket', $query_params); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return EE_Event |
182 | 182 | */ |
183 | 183 | public function event() { |
184 | - return $this->get_first_related( 'Event' ); |
|
184 | + return $this->get_first_related('Event'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function wp_user() { |
197 | 197 | $event = $this->event(); |
198 | - if ( $event instanceof EE_Event ) { |
|
198 | + if ($event instanceof EE_Event) { |
|
199 | 199 | return $event->wp_user(); |
200 | 200 | } |
201 | 201 | return 0; |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | * @access public |
222 | 222 | * @param int $ATT_ID Attendee ID |
223 | 223 | */ |
224 | - public function set_attendee_id( $ATT_ID = 0 ) { |
|
225 | - $this->set( 'ATT_ID', $ATT_ID ); |
|
224 | + public function set_attendee_id($ATT_ID = 0) { |
|
225 | + $this->set('ATT_ID', $ATT_ID); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * @access public |
234 | 234 | * @param int $TXN_ID Transaction ID |
235 | 235 | */ |
236 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
237 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
236 | + public function set_transaction_id($TXN_ID = 0) { |
|
237 | + $this->set('TXN_ID', $TXN_ID); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | * @access public |
246 | 246 | * @param string $REG_session PHP Session ID |
247 | 247 | */ |
248 | - public function set_session( $REG_session = '' ) { |
|
249 | - $this->set( 'REG_session', $REG_session ); |
|
248 | + public function set_session($REG_session = '') { |
|
249 | + $this->set('REG_session', $REG_session); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | * @access public |
258 | 258 | * @param string $REG_url_link Registration URL Link |
259 | 259 | */ |
260 | - public function set_reg_url_link( $REG_url_link = '' ) { |
|
261 | - $this->set( 'REG_url_link', $REG_url_link ); |
|
260 | + public function set_reg_url_link($REG_url_link = '') { |
|
261 | + $this->set('REG_url_link', $REG_url_link); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | * @access public |
270 | 270 | * @param int $REG_count Primary Attendee |
271 | 271 | */ |
272 | - public function set_count( $REG_count = 1 ) { |
|
273 | - $this->set( 'REG_count', $REG_count ); |
|
272 | + public function set_count($REG_count = 1) { |
|
273 | + $this->set('REG_count', $REG_count); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @access public |
282 | 282 | * @param boolean $REG_group_size Group Registration |
283 | 283 | */ |
284 | - public function set_group_size( $REG_group_size = FALSE ) { |
|
285 | - $this->set( 'REG_group_size', $REG_group_size ); |
|
284 | + public function set_group_size($REG_group_size = FALSE) { |
|
285 | + $this->set('REG_group_size', $REG_group_size); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @access public |
366 | 366 | * @param mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date |
367 | 367 | */ |
368 | - public function set_reg_date( $REG_date = FALSE ) { |
|
369 | - $this->set( 'REG_date', $REG_date ); |
|
368 | + public function set_reg_date($REG_date = FALSE) { |
|
369 | + $this->set('REG_date', $REG_date); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | * @access public |
378 | 378 | * @param float $REG_final_price |
379 | 379 | */ |
380 | - public function set_final_price( $REG_final_price = 0.00 ) { |
|
381 | - $this->set( 'REG_final_price', $REG_final_price ); |
|
380 | + public function set_final_price($REG_final_price = 0.00) { |
|
381 | + $this->set('REG_final_price', $REG_final_price); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | * @access public |
390 | 390 | * @param float $REG_paid |
391 | 391 | */ |
392 | - public function set_paid( $REG_paid = 0.00 ) { |
|
393 | - $this->set( 'REG_paid', $REG_paid ); |
|
392 | + public function set_paid($REG_paid = 0.00) { |
|
393 | + $this->set('REG_paid', $REG_paid); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | * @access public |
402 | 402 | * @param boolean $REG_att_is_going Attendee Is Going |
403 | 403 | */ |
404 | - public function set_att_is_going( $REG_att_is_going = FALSE ) { |
|
405 | - $this->set( 'REG_att_is_going', $REG_att_is_going ); |
|
404 | + public function set_att_is_going($REG_att_is_going = FALSE) { |
|
405 | + $this->set('REG_att_is_going', $REG_att_is_going); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return EE_Attendee |
413 | 413 | */ |
414 | 414 | public function attendee() { |
415 | - return $this->get_first_related( 'Attendee' ); |
|
415 | + return $this->get_first_related('Attendee'); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @access public |
423 | 423 | */ |
424 | 424 | public function event_ID() { |
425 | - return $this->get( 'EVT_ID' ); |
|
425 | + return $this->get('EVT_ID'); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | */ |
434 | 434 | public function event_name() { |
435 | 435 | $event = $this->event_obj(); |
436 | - if ( $event ) { |
|
436 | + if ($event) { |
|
437 | 437 | return $event->name(); |
438 | 438 | } else { |
439 | 439 | return NULL; |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * @return EE_Event |
448 | 448 | */ |
449 | 449 | public function event_obj() { |
450 | - return $this->get_first_related( 'Event' ); |
|
450 | + return $this->get_first_related('Event'); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @access public |
458 | 458 | */ |
459 | 459 | public function attendee_ID() { |
460 | - return $this->get( 'ATT_ID' ); |
|
460 | + return $this->get('ATT_ID'); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | * @access public |
468 | 468 | */ |
469 | 469 | public function session_ID() { |
470 | - return $this->get( 'REG_session' ); |
|
470 | + return $this->get('REG_session'); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
478 | 478 | * @return string |
479 | 479 | */ |
480 | - public function receipt_url( $messenger = 'html' ) { |
|
480 | + public function receipt_url($messenger = 'html') { |
|
481 | 481 | |
482 | 482 | /** |
483 | 483 | * The below will be deprecated one version after this. We check first if there is a custom receipt template already in use on old system. If there is then we just return the standard url for it. |
@@ -485,12 +485,12 @@ discard block |
||
485 | 485 | * @since 4.5.0 |
486 | 486 | */ |
487 | 487 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php'; |
488 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
488 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
489 | 489 | |
490 | - if ( $has_custom ) { |
|
491 | - return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) ); |
|
490 | + if ($has_custom) { |
|
491 | + return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch')); |
|
492 | 492 | } |
493 | - return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' ); |
|
493 | + return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt'); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | |
@@ -501,28 +501,28 @@ discard block |
||
501 | 501 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
502 | 502 | * @return string |
503 | 503 | */ |
504 | - public function invoice_url( $messenger = 'html' ) { |
|
504 | + public function invoice_url($messenger = 'html') { |
|
505 | 505 | /** |
506 | 506 | * The below will be deprecated one version after this. We check first if there is a custom invoice template already in use on old system. If there is then we just return the standard url for it. |
507 | 507 | * |
508 | 508 | * @since 4.5.0 |
509 | 509 | */ |
510 | 510 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php'; |
511 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
511 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
512 | 512 | |
513 | - if ( $has_custom ) { |
|
514 | - if ( $messenger == 'html' ) { |
|
515 | - return $this->invoice_url( 'launch' ); |
|
513 | + if ($has_custom) { |
|
514 | + if ($messenger == 'html') { |
|
515 | + return $this->invoice_url('launch'); |
|
516 | 516 | } |
517 | 517 | $route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice'; |
518 | 518 | |
519 | - $query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() ); |
|
520 | - if ( $messenger == 'html' ) { |
|
519 | + $query_args = array('ee' => $route, 'id' => $this->reg_url_link()); |
|
520 | + if ($messenger == 'html') { |
|
521 | 521 | $query_args['html'] = TRUE; |
522 | 522 | } |
523 | - return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) ); |
|
523 | + return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id)); |
|
524 | 524 | } |
525 | - return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' ); |
|
525 | + return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice'); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | * @throws \EE_Error |
536 | 536 | */ |
537 | 537 | public function reg_url_link() { |
538 | - return (string)$this->get( 'REG_url_link' ); |
|
538 | + return (string) $this->get('REG_url_link'); |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | |
@@ -545,8 +545,8 @@ discard block |
||
545 | 545 | * @param string $type 'download','launch', or 'html' (default is 'launch') |
546 | 546 | * @return void |
547 | 547 | */ |
548 | - public function e_invoice_url( $type = 'launch' ) { |
|
549 | - echo $this->invoice_url( $type ); |
|
548 | + public function e_invoice_url($type = 'launch') { |
|
549 | + echo $this->invoice_url($type); |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | * @return string |
567 | 567 | */ |
568 | 568 | public function payment_overview_url() { |
569 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
569 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * @return string |
578 | 578 | */ |
579 | 579 | public function edit_attendee_information_url() { |
580 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
580 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | * @return string |
588 | 588 | */ |
589 | 589 | public function get_admin_edit_url() { |
590 | - return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) ); |
|
590 | + return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php')); |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @access public |
598 | 598 | */ |
599 | 599 | public function is_primary_registrant() { |
600 | - return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE; |
|
600 | + return $this->get('REG_count') == 1 ? TRUE : FALSE; |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | |
@@ -606,12 +606,12 @@ discard block |
||
606 | 606 | * This returns the primary registration object for this registration group (which may be this object). |
607 | 607 | * @return EE_Registration |
608 | 608 | */ |
609 | - public function get_primary_registration() { |
|
610 | - if ( $this->is_primary_registrant() ) |
|
609 | + public function get_primary_registration() { |
|
610 | + if ($this->is_primary_registrant()) |
|
611 | 611 | return $this; |
612 | 612 | |
613 | 613 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
614 | - $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
|
614 | + $primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1))); |
|
615 | 615 | return $primary_registrant; |
616 | 616 | } |
617 | 617 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * @access public |
623 | 623 | */ |
624 | 624 | public function count() { |
625 | - return $this->get( 'REG_count' ); |
|
625 | + return $this->get('REG_count'); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @access public |
633 | 633 | */ |
634 | 634 | public function group_size() { |
635 | - return $this->get( 'REG_group_size' ); |
|
635 | + return $this->get('REG_group_size'); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | * @access public |
643 | 643 | */ |
644 | 644 | public function date() { |
645 | - return $this->get( 'REG_date' ); |
|
645 | + return $this->get('REG_date'); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -653,8 +653,8 @@ discard block |
||
653 | 653 | * @param string $time_format |
654 | 654 | * @return string |
655 | 655 | */ |
656 | - public function pretty_date( $date_format = NULL, $time_format = NULL ) { |
|
657 | - return $this->get_datetime( 'REG_date', $date_format, $time_format ); |
|
656 | + public function pretty_date($date_format = NULL, $time_format = NULL) { |
|
657 | + return $this->get_datetime('REG_date', $date_format, $time_format); |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | * @return float |
668 | 668 | */ |
669 | 669 | public function final_price() { |
670 | - return $this->get( 'REG_final_price' ); |
|
670 | + return $this->get('REG_final_price'); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | * @return string |
679 | 679 | */ |
680 | 680 | public function pretty_final_price() { |
681 | - return $this->get_pretty( 'REG_final_price' ); |
|
681 | + return $this->get_pretty('REG_final_price'); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | * @return float |
690 | 690 | */ |
691 | 691 | public function paid() { |
692 | - return $this->get( 'REG_paid' ); |
|
692 | + return $this->get('REG_paid'); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * @return float |
701 | 701 | */ |
702 | 702 | public function pretty_paid() { |
703 | - return $this->get_pretty( 'REG_paid' ); |
|
703 | + return $this->get_pretty('REG_paid'); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | |
@@ -712,11 +712,11 @@ discard block |
||
712 | 712 | * @param array $requires_payment |
713 | 713 | * @return bool |
714 | 714 | */ |
715 | - public function owes_monies_and_can_pay( $requires_payment = array()) { |
|
715 | + public function owes_monies_and_can_pay($requires_payment = array()) { |
|
716 | 716 | // these reg statuses require payment (if event is not free) |
717 | - $requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
717 | + $requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
718 | 718 | if ( |
719 | - in_array( $this->status_ID(), $requires_payment ) && |
|
719 | + in_array($this->status_ID(), $requires_payment) && |
|
720 | 720 | $this->final_price() != 0 && |
721 | 721 | $this->final_price() != $this->paid() |
722 | 722 | ) { |
@@ -733,8 +733,8 @@ discard block |
||
733 | 733 | * @param bool $show_icons |
734 | 734 | * @return void |
735 | 735 | */ |
736 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
737 | - echo $this->pretty_status( $show_icons ); |
|
736 | + public function e_pretty_status($show_icons = FALSE) { |
|
737 | + echo $this->pretty_status($show_icons); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | |
@@ -745,10 +745,10 @@ discard block |
||
745 | 745 | * @param bool $show_icons |
746 | 746 | * @return string |
747 | 747 | */ |
748 | - public function pretty_status( $show_icons = FALSE ) { |
|
749 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
748 | + public function pretty_status($show_icons = FALSE) { |
|
749 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
750 | 750 | $icon = ''; |
751 | - switch ( $this->status_ID() ) { |
|
751 | + switch ($this->status_ID()) { |
|
752 | 752 | case EEM_Registration::status_id_approved: |
753 | 753 | $icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : ''; |
754 | 754 | break; |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | $icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : ''; |
769 | 769 | break; |
770 | 770 | } |
771 | - return $icon . $status[ $this->status_ID() ]; |
|
771 | + return $icon.$status[$this->status_ID()]; |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | * @access public |
779 | 779 | */ |
780 | 780 | public function att_is_going() { |
781 | - return $this->get( 'REG_att_is_going' ); |
|
781 | + return $this->get('REG_att_is_going'); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -788,8 +788,8 @@ discard block |
||
788 | 788 | * @param array $query_params like EEM_Base::get_all |
789 | 789 | * @return EE_Answer[] |
790 | 790 | */ |
791 | - public function answers( $query_params = NULL ) { |
|
792 | - return $this->get_many_related( 'Answer', $query_params ); |
|
791 | + public function answers($query_params = NULL) { |
|
792 | + return $this->get_many_related('Answer', $query_params); |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | |
@@ -803,9 +803,9 @@ discard block |
||
803 | 803 | * (because the answer might be an array of answer values, so passing pretty_value=true |
804 | 804 | * will convert it into some kind of string) |
805 | 805 | */ |
806 | - public function answer_value_to_question( $question, $pretty_value=true ) { |
|
806 | + public function answer_value_to_question($question, $pretty_value = true) { |
|
807 | 807 | $question_id = EEM_Question::instance()->ensure_is_ID($question); |
808 | - return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value); |
|
808 | + return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value); |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | |
@@ -818,13 +818,13 @@ discard block |
||
818 | 818 | */ |
819 | 819 | public function question_groups() { |
820 | 820 | $question_groups = array(); |
821 | - if ( $this->event() instanceof EE_Event ) { |
|
821 | + if ($this->event() instanceof EE_Event) { |
|
822 | 822 | $question_groups = $this->event()->question_groups( |
823 | 823 | array( |
824 | 824 | array( |
825 | 825 | 'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false |
826 | 826 | ), |
827 | - 'order_by' => array( 'QSG_order' => 'ASC' ) |
|
827 | + 'order_by' => array('QSG_order' => 'ASC') |
|
828 | 828 | ) |
829 | 829 | ); |
830 | 830 | } |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | */ |
842 | 842 | public function count_question_groups() { |
843 | 843 | $qg_count = 0; |
844 | - if ( $this->event() instanceof EE_Event ) { |
|
844 | + if ($this->event() instanceof EE_Event) { |
|
845 | 845 | $qg_count = $this->event()->count_related( |
846 | 846 | 'Question_Group', |
847 | 847 | array( |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | * @return string |
863 | 863 | */ |
864 | 864 | public function reg_date() { |
865 | - return $this->get_datetime( 'REG_date' ); |
|
865 | + return $this->get_datetime('REG_date'); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | * @return EE_Datetime_Ticket |
875 | 875 | */ |
876 | 876 | public function datetime_ticket() { |
877 | - return $this->get_first_related( 'Datetime_Ticket' ); |
|
877 | + return $this->get_first_related('Datetime_Ticket'); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | |
@@ -884,15 +884,15 @@ discard block |
||
884 | 884 | * @param EE_Datetime_Ticket $datetime_ticket |
885 | 885 | * @return EE_Datetime_Ticket |
886 | 886 | */ |
887 | - public function set_datetime_ticket( $datetime_ticket ) { |
|
888 | - return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' ); |
|
887 | + public function set_datetime_ticket($datetime_ticket) { |
|
888 | + return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket'); |
|
889 | 889 | } |
890 | 890 | /** |
891 | 891 | * Gets deleted |
892 | 892 | * @return boolean |
893 | 893 | */ |
894 | 894 | public function deleted() { |
895 | - return $this->get( 'REG_deleted' ); |
|
895 | + return $this->get('REG_deleted'); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | /** |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | * @return boolean |
902 | 902 | */ |
903 | 903 | public function set_deleted($deleted) { |
904 | - $this->set( 'REG_deleted', $deleted ); |
|
904 | + $this->set('REG_deleted', $deleted); |
|
905 | 905 | } |
906 | 906 | |
907 | 907 | |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | * @return EE_Status |
912 | 912 | */ |
913 | 913 | public function status_obj() { |
914 | - return $this->get_first_related( 'Status' ); |
|
914 | + return $this->get_first_related('Status'); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | * @return int |
923 | 923 | */ |
924 | 924 | public function count_checkins() { |
925 | - return $this->get_model()->count_related( $this, 'Checkin' ); |
|
925 | + return $this->get_model()->count_related($this, 'Checkin'); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | * @return int |
933 | 933 | */ |
934 | 934 | public function count_checkins_not_checkedout() { |
935 | - return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) ); |
|
935 | + return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1))); |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | |
@@ -945,20 +945,20 @@ discard block |
||
945 | 945 | * |
946 | 946 | * @return bool |
947 | 947 | */ |
948 | - public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) { |
|
949 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
948 | + public function can_checkin($DTT_OR_ID, $check_approved = TRUE) { |
|
949 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
950 | 950 | |
951 | 951 | //first check registration status |
952 | - if ( ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) { |
|
952 | + if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) { |
|
953 | 953 | return false; |
954 | 954 | } |
955 | 955 | //is there a datetime ticket that matches this dtt_ID? |
956 | - if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) { |
|
956 | + if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) { |
|
957 | 957 | return false; |
958 | 958 | } |
959 | 959 | |
960 | 960 | //final check is against TKT_uses |
961 | - return $this->verify_can_checkin_against_TKT_uses( $DTT_ID ); |
|
961 | + return $this->verify_can_checkin_against_TKT_uses($DTT_ID); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | |
@@ -971,10 +971,10 @@ discard block |
||
971 | 971 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
972 | 972 | * @return bool true means can checkin. false means cannot checkin. |
973 | 973 | */ |
974 | - public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) { |
|
975 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
974 | + public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) { |
|
975 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
976 | 976 | |
977 | - if ( ! $DTT_ID ) { |
|
977 | + if ( ! $DTT_ID) { |
|
978 | 978 | return false; |
979 | 979 | } |
980 | 980 | |
@@ -982,23 +982,23 @@ discard block |
||
982 | 982 | |
983 | 983 | // if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in |
984 | 984 | // or not. |
985 | - if ( ! $max_uses || $max_uses === EE_INF ) { |
|
985 | + if ( ! $max_uses || $max_uses === EE_INF) { |
|
986 | 986 | return true; |
987 | 987 | } |
988 | 988 | |
989 | 989 | //does this datetime have a checkin record? If so, then the dtt count has already been verified so we can just |
990 | 990 | //go ahead and toggle. |
991 | - if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) { |
|
991 | + if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) { |
|
992 | 992 | return true; |
993 | 993 | } |
994 | 994 | |
995 | 995 | //made it here so the last check is whether the number of checkins per unique datetime on this registration |
996 | 996 | //disallows further check-ins. |
997 | - $count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true ); |
|
997 | + $count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true); |
|
998 | 998 | // checkins have already reached their max number of uses |
999 | 999 | // so registrant can NOT checkin |
1000 | - if ( $count_unique_dtt_checkins >= $max_uses ) { |
|
1001 | - EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1000 | + if ($count_unique_dtt_checkins >= $max_uses) { |
|
1001 | + EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1002 | 1002 | return false; |
1003 | 1003 | } |
1004 | 1004 | return true; |
@@ -1019,15 +1019,15 @@ discard block |
||
1019 | 1019 | * @param bool $verify If true then can_checkin() is used to verify whether the person can be checked in or not. Otherwise this forces change in checkin status. |
1020 | 1020 | * @return int|BOOL the chk_in status toggled to OR false if nothing got changed. |
1021 | 1021 | */ |
1022 | - public function toggle_checkin_status( $DTT_ID = null, $verify = false ) { |
|
1023 | - if ( empty( $DTT_ID ) ) { |
|
1022 | + public function toggle_checkin_status($DTT_ID = null, $verify = false) { |
|
1023 | + if (empty($DTT_ID)) { |
|
1024 | 1024 | $datetime = $this->get_related_primary_datetime(); |
1025 | 1025 | $DTT_ID = $datetime->ID(); |
1026 | 1026 | // verify the registration can checkin for the given DTT_ID |
1027 | - } elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) { |
|
1027 | + } elseif ( ! $this->can_checkin($DTT_ID, $verify)) { |
|
1028 | 1028 | EE_Error::add_error( |
1029 | 1029 | sprintf( |
1030 | - __( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'), |
|
1030 | + __('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'), |
|
1031 | 1031 | $this->ID(), |
1032 | 1032 | $DTT_ID |
1033 | 1033 | ), |
@@ -1041,8 +1041,8 @@ discard block |
||
1041 | 1041 | EE_Registration::checkin_status_out => EE_Registration::checkin_status_in |
1042 | 1042 | ); |
1043 | 1043 | //start by getting the current status so we know what status we'll be changing to. |
1044 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL ); |
|
1045 | - $status_to = $status_paths[ $cur_status ]; |
|
1044 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL); |
|
1045 | + $status_to = $status_paths[$cur_status]; |
|
1046 | 1046 | // database only records true for checked IN or false for checked OUT |
1047 | 1047 | // no record ( null ) means checked in NEVER, but we obviously don't save that |
1048 | 1048 | $new_status = $status_to == EE_Registration::checkin_status_in ? true : false; |
@@ -1050,24 +1050,24 @@ discard block |
||
1050 | 1050 | // because we are keeping track of Check-ins over time. |
1051 | 1051 | // Eventually we'll probably want to show a list table |
1052 | 1052 | // for the individual Check-ins so that they can be managed. |
1053 | - $checkin = EE_Checkin::new_instance( array( |
|
1053 | + $checkin = EE_Checkin::new_instance(array( |
|
1054 | 1054 | 'REG_ID' => $this->ID(), |
1055 | 1055 | 'DTT_ID' => $DTT_ID, |
1056 | 1056 | 'CHK_in' => $new_status |
1057 | - ) ); |
|
1057 | + )); |
|
1058 | 1058 | // if the record could not be saved then return false |
1059 | - if ( $checkin->save() === 0 ) { |
|
1060 | - if ( WP_DEBUG ) { |
|
1059 | + if ($checkin->save() === 0) { |
|
1060 | + if (WP_DEBUG) { |
|
1061 | 1061 | global $wpdb; |
1062 | 1062 | $error = sprintf( |
1063 | - __( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ), |
|
1063 | + __('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'), |
|
1064 | 1064 | '<br />', |
1065 | 1065 | $wpdb->last_error |
1066 | 1066 | ); |
1067 | 1067 | } else { |
1068 | - $error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' ); |
|
1068 | + $error = __('Registration check in update failed because of an unknown database error', 'event_espresso'); |
|
1069 | 1069 | } |
1070 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
1070 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
1071 | 1071 | return false; |
1072 | 1072 | } |
1073 | 1073 | return $status_to; |
@@ -1091,19 +1091,19 @@ discard block |
||
1091 | 1091 | * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id. |
1092 | 1092 | * @return int Integer representing Check-in status. |
1093 | 1093 | */ |
1094 | - public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) { |
|
1095 | - if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) { |
|
1094 | + public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) { |
|
1095 | + if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) { |
|
1096 | 1096 | $datetime = $this->get_related_primary_datetime(); |
1097 | - if ( ! $datetime instanceof EE_Datetime ) { |
|
1097 | + if ( ! $datetime instanceof EE_Datetime) { |
|
1098 | 1098 | return 0; |
1099 | 1099 | } |
1100 | 1100 | $DTT_ID = $datetime->ID(); |
1101 | 1101 | //verify the registration can checkin for the given DTT_ID |
1102 | 1102 | } |
1103 | 1103 | //get checkin object (if exists) |
1104 | - $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) ); |
|
1105 | - if ( $checkin instanceof EE_Checkin ) { |
|
1106 | - if ( $checkin->get( 'CHK_in' ) ) { |
|
1104 | + $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC'))); |
|
1105 | + if ($checkin instanceof EE_Checkin) { |
|
1106 | + if ($checkin->get('CHK_in')) { |
|
1107 | 1107 | return EE_Registration::checkin_status_in; //checked in |
1108 | 1108 | } else { |
1109 | 1109 | return EE_Registration::checkin_status_out; //had checked in but is now checked out. |
@@ -1121,28 +1121,28 @@ discard block |
||
1121 | 1121 | * @param bool $error This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name. |
1122 | 1122 | * @return string internationalized message |
1123 | 1123 | */ |
1124 | - public function get_checkin_msg( $DTT_ID, $error = FALSE ) { |
|
1124 | + public function get_checkin_msg($DTT_ID, $error = FALSE) { |
|
1125 | 1125 | //let's get the attendee first so we can include the name of the attendee |
1126 | - $attendee = $this->get_first_related( 'Attendee' ); |
|
1127 | - if ( $attendee instanceof EE_Attendee ) { |
|
1128 | - if ( $error ) { |
|
1129 | - return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() ); |
|
1126 | + $attendee = $this->get_first_related('Attendee'); |
|
1127 | + if ($attendee instanceof EE_Attendee) { |
|
1128 | + if ($error) { |
|
1129 | + return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name()); |
|
1130 | 1130 | } |
1131 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID ); |
|
1131 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID); |
|
1132 | 1132 | //what is the status message going to be? |
1133 | - switch ( $cur_status ) { |
|
1133 | + switch ($cur_status) { |
|
1134 | 1134 | case EE_Registration::checkin_status_never : |
1135 | - return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() ); |
|
1135 | + return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name()); |
|
1136 | 1136 | break; |
1137 | 1137 | case EE_Registration::checkin_status_in : |
1138 | - return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() ); |
|
1138 | + return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name()); |
|
1139 | 1139 | break; |
1140 | 1140 | case EE_Registration::checkin_status_out : |
1141 | - return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() ); |
|
1141 | + return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name()); |
|
1142 | 1142 | break; |
1143 | 1143 | } |
1144 | 1144 | } |
1145 | - return __( "The check-in status could not be determined.", "event_espresso" ); |
|
1145 | + return __("The check-in status could not be determined.", "event_espresso"); |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | * @return EE_Transaction |
1153 | 1153 | */ |
1154 | 1154 | public function transaction() { |
1155 | - return $this->get_first_related( 'Transaction' ); |
|
1155 | + return $this->get_first_related('Transaction'); |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @access public |
1164 | 1164 | */ |
1165 | 1165 | public function reg_code() { |
1166 | - return $this->get( 'REG_code' ); |
|
1166 | + return $this->get('REG_code'); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | * @access public |
1174 | 1174 | */ |
1175 | 1175 | public function transaction_ID() { |
1176 | - return $this->get( 'TXN_ID' ); |
|
1176 | + return $this->get('TXN_ID'); |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | * @return int |
1183 | 1183 | */ |
1184 | 1184 | public function ticket_ID() { |
1185 | - return $this->get( 'TKT_ID' ); |
|
1185 | + return $this->get('TKT_ID'); |
|
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | |
@@ -1194,17 +1194,17 @@ discard block |
||
1194 | 1194 | * @param string $REG_code Registration Code |
1195 | 1195 | * @param boolean $use_default |
1196 | 1196 | */ |
1197 | - public function set_reg_code( $REG_code, $use_default = FALSE ) { |
|
1198 | - if ( empty( $REG_code )) { |
|
1199 | - EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1197 | + public function set_reg_code($REG_code, $use_default = FALSE) { |
|
1198 | + if (empty($REG_code)) { |
|
1199 | + EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1200 | 1200 | return; |
1201 | 1201 | } |
1202 | - if ( ! $this->reg_code() ) { |
|
1203 | - parent::set( 'REG_code', $REG_code, $use_default ); |
|
1202 | + if ( ! $this->reg_code()) { |
|
1203 | + parent::set('REG_code', $REG_code, $use_default); |
|
1204 | 1204 | } else { |
1205 | 1205 | EE_Error::doing_it_wrong( |
1206 | - __CLASS__ . '::' . __FUNCTION__, |
|
1207 | - __( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ), |
|
1206 | + __CLASS__.'::'.__FUNCTION__, |
|
1207 | + __('Can not change a registration REG_code once it has been set.', 'event_espresso'), |
|
1208 | 1208 | '4.6.0' |
1209 | 1209 | ); |
1210 | 1210 | } |
@@ -1224,17 +1224,17 @@ discard block |
||
1224 | 1224 | * @return EE_Registration[] or empty array if this isn't a group registration. |
1225 | 1225 | */ |
1226 | 1226 | public function get_all_other_registrations_in_group() { |
1227 | - if ( $this->group_size() < 2 ) { |
|
1227 | + if ($this->group_size() < 2) { |
|
1228 | 1228 | return array(); |
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | $query[0] = array( |
1232 | 1232 | 'TXN_ID' => $this->transaction_ID(), |
1233 | - 'REG_ID' => array( '!=', $this->ID() ), |
|
1233 | + 'REG_ID' => array('!=', $this->ID()), |
|
1234 | 1234 | 'TKT_ID' => $this->ticket_ID() |
1235 | 1235 | ); |
1236 | 1236 | |
1237 | - $registrations = $this->get_model()->get_all( $query ); |
|
1237 | + $registrations = $this->get_model()->get_all($query); |
|
1238 | 1238 | return $registrations; |
1239 | 1239 | } |
1240 | 1240 | |
@@ -1243,14 +1243,14 @@ discard block |
||
1243 | 1243 | * @return string |
1244 | 1244 | */ |
1245 | 1245 | public function get_admin_details_link() { |
1246 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
1246 | + EE_Registry::instance()->load_helper('URL'); |
|
1247 | 1247 | return EEH_URL::add_query_args_and_nonce( |
1248 | 1248 | array( |
1249 | 1249 | 'page' => 'espresso_registrations', |
1250 | 1250 | 'action' => 'view_registration', |
1251 | 1251 | '_REG_ID' => $this->ID() |
1252 | 1252 | ), |
1253 | - admin_url( 'admin.php' ) |
|
1253 | + admin_url('admin.php') |
|
1254 | 1254 | ); |
1255 | 1255 | } |
1256 | 1256 | |
@@ -1275,12 +1275,12 @@ discard block |
||
1275 | 1275 | * @return string |
1276 | 1276 | */ |
1277 | 1277 | public function get_admin_overview_link() { |
1278 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
1278 | + EE_Registry::instance()->load_helper('URL'); |
|
1279 | 1279 | return EEH_URL::add_query_args_and_nonce( |
1280 | 1280 | array( |
1281 | 1281 | 'page' => 'espresso_registrations' |
1282 | 1282 | ), |
1283 | - admin_url( 'admin.php' ) |
|
1283 | + admin_url('admin.php') |
|
1284 | 1284 | ); |
1285 | 1285 | } |
1286 | 1286 | |
@@ -1289,8 +1289,8 @@ discard block |
||
1289 | 1289 | * @param array $query_params |
1290 | 1290 | * @return \EE_Registration[] |
1291 | 1291 | */ |
1292 | - public function payments( $query_params = array() ) { |
|
1293 | - return $this->get_many_related( 'Payment', $query_params ); |
|
1292 | + public function payments($query_params = array()) { |
|
1293 | + return $this->get_many_related('Payment', $query_params); |
|
1294 | 1294 | } |
1295 | 1295 | |
1296 | 1296 | |
@@ -1299,8 +1299,8 @@ discard block |
||
1299 | 1299 | * @param array $query_params |
1300 | 1300 | * @return \EE_Registration[] |
1301 | 1301 | */ |
1302 | - public function registration_payments( $query_params = array() ) { |
|
1303 | - return $this->get_many_related( 'Registration_Payment', $query_params ); |
|
1302 | + public function registration_payments($query_params = array()) { |
|
1303 | + return $this->get_many_related('Registration_Payment', $query_params); |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | * @access public |
1312 | 1312 | */ |
1313 | 1313 | public function price_paid() { |
1314 | - EE_Error::doing_it_wrong( 'EE_Registration::price_paid()', __( 'This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1314 | + EE_Error::doing_it_wrong('EE_Registration::price_paid()', __('This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1315 | 1315 | return $this->final_price(); |
1316 | 1316 | } |
1317 | 1317 | |
@@ -1323,9 +1323,9 @@ discard block |
||
1323 | 1323 | * @access public |
1324 | 1324 | * @param float $REG_final_price |
1325 | 1325 | */ |
1326 | - public function set_price_paid( $REG_final_price = 0.00 ) { |
|
1327 | - EE_Error::doing_it_wrong( 'EE_Registration::set_price_paid()', __( 'This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1328 | - $this->set_final_price( $REG_final_price ); |
|
1326 | + public function set_price_paid($REG_final_price = 0.00) { |
|
1327 | + EE_Error::doing_it_wrong('EE_Registration::set_price_paid()', __('This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1328 | + $this->set_final_price($REG_final_price); |
|
1329 | 1329 | } |
1330 | 1330 | |
1331 | 1331 | |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | * @return string |
1337 | 1337 | */ |
1338 | 1338 | public function pretty_price_paid() { |
1339 | - EE_Error::doing_it_wrong( 'EE_Registration::pretty_price_paid()', __( 'This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1339 | + EE_Error::doing_it_wrong('EE_Registration::pretty_price_paid()', __('This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1340 | 1340 | return $this->pretty_final_price(); |
1341 | 1341 | } |
1342 | 1342 | |
@@ -1350,7 +1350,7 @@ discard block |
||
1350 | 1350 | * @return EE_Payment_Method|null |
1351 | 1351 | */ |
1352 | 1352 | public function payment_method() { |
1353 | - return EEM_Payment_Method::instance()->get_last_used_for_registration( $this ); |
|
1353 | + return EEM_Payment_Method::instance()->get_last_used_for_registration($this); |
|
1354 | 1354 | } |
1355 | 1355 | |
1356 | 1356 |
@@ -48,7 +48,7 @@ |
||
48 | 48 | * @param array $props_n_values incoming values from the database |
49 | 49 | * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
50 | 50 | * the website will be used. |
51 | - * @return EE_Attendee |
|
51 | + * @return EE_Venue |
|
52 | 52 | */ |
53 | 53 | public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
54 | 54 | return new self( $props_n_values, TRUE, $timezone ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | * date_format and the second value is the time format |
38 | 38 | * @return EE_Attendee |
39 | 39 | */ |
40 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
41 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
42 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
40 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
41 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
42 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * the website will be used. |
51 | 51 | * @return EE_Attendee |
52 | 52 | */ |
53 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
54 | - return new self( $props_n_values, TRUE, $timezone ); |
|
53 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
54 | + return new self($props_n_values, TRUE, $timezone); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return string |
62 | 62 | */ |
63 | 63 | function name() { |
64 | - return $this->get( 'VNU_name' ); |
|
64 | + return $this->get('VNU_name'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return string |
71 | 71 | */ |
72 | 72 | function phone() { |
73 | - return $this->get( 'VNU_phone' ); |
|
73 | + return $this->get('VNU_phone'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @return string |
81 | 81 | */ |
82 | 82 | function venue_url() { |
83 | - return $this->get( 'VNU_url' ); |
|
83 | + return $this->get('VNU_url'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return string |
90 | 90 | */ |
91 | 91 | function description() { |
92 | - return $this->get( 'VNU_desc' ); |
|
92 | + return $this->get('VNU_desc'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return string |
100 | 100 | */ |
101 | 101 | function excerpt() { |
102 | - return $this->get( 'VNU_short_desc' ); |
|
102 | + return $this->get('VNU_short_desc'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return string |
110 | 110 | */ |
111 | 111 | function identifier() { |
112 | - return $this->get( 'VNU_identifier' ); |
|
112 | + return $this->get('VNU_identifier'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return string |
120 | 120 | */ |
121 | 121 | function address() { |
122 | - return $this->get( 'VNU_address' ); |
|
122 | + return $this->get('VNU_address'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return string |
130 | 130 | */ |
131 | 131 | function address2() { |
132 | - return $this->get( 'VNU_address2' ); |
|
132 | + return $this->get('VNU_address2'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return string |
141 | 141 | */ |
142 | 142 | function city() { |
143 | - return $this->get( 'VNU_city' ); |
|
143 | + return $this->get('VNU_city'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return int |
149 | 149 | */ |
150 | 150 | function state_ID() { |
151 | - return $this->get( 'STA_ID' ); |
|
151 | + return $this->get('STA_ID'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @return string |
167 | 167 | */ |
168 | 168 | public function state_name() { |
169 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : ''; |
|
169 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : ''; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @return EE_State |
177 | 177 | */ |
178 | 178 | function state_obj() { |
179 | - return $this->get_first_related( 'State' ); |
|
179 | + return $this->get_first_related('State'); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @return string |
189 | 189 | */ |
190 | 190 | public function state() { |
191 | - if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) { |
|
191 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
192 | 192 | return $this->state_abbrev(); |
193 | 193 | } else { |
194 | 194 | return $this->state_name(); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return string |
203 | 203 | */ |
204 | 204 | function country_ID() { |
205 | - return $this->get( 'CNT_ISO' ); |
|
205 | + return $this->get('CNT_ISO'); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @return string |
212 | 212 | */ |
213 | 213 | public function country_name() { |
214 | - return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : ''; |
|
214 | + return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : ''; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return EE_Country |
222 | 222 | */ |
223 | 223 | function country_obj() { |
224 | - return $this->get_first_related( 'Country' ); |
|
224 | + return $this->get_first_related('Country'); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @return string |
234 | 234 | */ |
235 | 235 | public function country() { |
236 | - if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) { |
|
236 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
237 | 237 | return $this->country_ID(); |
238 | 238 | } else { |
239 | 239 | return $this->country_name(); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * @return string |
248 | 248 | */ |
249 | 249 | function zip() { |
250 | - return $this->get( 'VNU_zip' ); |
|
250 | + return $this->get('VNU_zip'); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @return int |
258 | 258 | */ |
259 | 259 | function capacity() { |
260 | - return $this->get_pretty( 'VNU_capacity', 'symbol' ); |
|
260 | + return $this->get_pretty('VNU_capacity', 'symbol'); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @return string |
268 | 268 | */ |
269 | 269 | function created() { |
270 | - return $this->get( 'VNU_created' ); |
|
270 | + return $this->get('VNU_created'); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @return string |
278 | 278 | */ |
279 | 279 | function modified() { |
280 | - return $this->get( 'VNU_modified' ); |
|
280 | + return $this->get('VNU_modified'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @return int |
288 | 288 | */ |
289 | 289 | function order() { |
290 | - return $this->get( 'VNU_order' ); |
|
290 | + return $this->get('VNU_order'); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @return int |
298 | 298 | */ |
299 | 299 | function wp_user() { |
300 | - return $this->get( 'VNU_wp_user' ); |
|
300 | + return $this->get('VNU_wp_user'); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @return string |
307 | 307 | */ |
308 | 308 | function virtual_phone() { |
309 | - return $this->get( 'VNU_virtual_phone' ); |
|
309 | + return $this->get('VNU_virtual_phone'); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @return string |
316 | 316 | */ |
317 | 317 | function virtual_url() { |
318 | - return $this->get( 'VNU_virtual_url' ); |
|
318 | + return $this->get('VNU_virtual_url'); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @return bool |
325 | 325 | */ |
326 | 326 | function enable_for_gmap() { |
327 | - return $this->get( 'VNU_enable_for_gmap' ); |
|
327 | + return $this->get('VNU_enable_for_gmap'); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @return string |
334 | 334 | */ |
335 | 335 | function google_map_link() { |
336 | - return $this->get( 'VNU_google_map_link' ); |
|
336 | + return $this->get('VNU_google_map_link'); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -345,16 +345,16 @@ discard block |
||
345 | 345 | * @param bool $upcoming |
346 | 346 | * @return EE_Event[] |
347 | 347 | */ |
348 | - function events( $query_params = array(), $upcoming = FALSE ) { |
|
349 | - if ( $upcoming ) { |
|
348 | + function events($query_params = array(), $upcoming = FALSE) { |
|
349 | + if ($upcoming) { |
|
350 | 350 | $query_params = array( |
351 | 351 | array( |
352 | 352 | 'status' => 'publish', |
353 | - 'Datetime.DTT_EVT_start' => array( '>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ) |
|
353 | + 'Datetime.DTT_EVT_start' => array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')) |
|
354 | 354 | ) |
355 | 355 | ); |
356 | 356 | } |
357 | - return $this->get_many_related( 'Event', $query_params ); |
|
357 | + return $this->get_many_related('Event', $query_params); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * Sets address |
374 | 374 | */ |
375 | - function set_address( $address = '' ) { |
|
376 | - $this->set( 'VNU_address', $address ); |
|
375 | + function set_address($address = '') { |
|
376 | + $this->set('VNU_address', $address); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | /** |
382 | 382 | * @param string $address2 |
383 | 383 | */ |
384 | - function set_address2( $address2 = '' ) { |
|
385 | - $this->set( 'VNU_address2', $address2 ); |
|
384 | + function set_address2($address2 = '') { |
|
385 | + $this->set('VNU_address2', $address2); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | /** |
391 | 391 | * @param string $city |
392 | 392 | */ |
393 | - function set_city( $city = '' ) { |
|
394 | - $this->set( 'VNU_city', $city ); |
|
393 | + function set_city($city = '') { |
|
394 | + $this->set('VNU_city', $city); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | /** |
400 | 400 | * @param int $state |
401 | 401 | */ |
402 | - function set_state_ID( $state = 0 ) { |
|
403 | - $this->set( 'STA_ID', $state ); |
|
402 | + function set_state_ID($state = 0) { |
|
403 | + $this->set('STA_ID', $state); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | * @param EE_State /int $state_id_or_obj |
412 | 412 | * @return EE_State |
413 | 413 | */ |
414 | - function set_state_obj( $state_id_or_obj ) { |
|
415 | - return $this->_add_relation_to( $state_id_or_obj, 'State' ); |
|
414 | + function set_state_obj($state_id_or_obj) { |
|
415 | + return $this->_add_relation_to($state_id_or_obj, 'State'); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * @param int $country_ID |
422 | 422 | */ |
423 | - function set_country_ID( $country_ID = 0 ) { |
|
424 | - $this->set( 'CNT_ISO', $country_ID ); |
|
423 | + function set_country_ID($country_ID = 0) { |
|
424 | + $this->set('CNT_ISO', $country_ID); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * @param EE_Country /string $country_id_or_obj |
431 | 431 | * @return EE_Country |
432 | 432 | */ |
433 | - function set_country_obj( $country_id_or_obj ) { |
|
433 | + function set_country_obj($country_id_or_obj) { |
|
434 | 434 | return $this->_add_relation_to($country_id_or_obj, 'Country'); |
435 | 435 | } |
436 | 436 | |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | /** |
440 | 440 | * @param string $zip |
441 | 441 | */ |
442 | - function set_zip( $zip = '' ) { |
|
443 | - $this->set( 'VNU_zip', $zip ); |
|
442 | + function set_zip($zip = '') { |
|
443 | + $this->set('VNU_zip', $zip); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | /** |
449 | 449 | * @param int $capacity |
450 | 450 | */ |
451 | - function set_capacity( $capacity = 0 ) { |
|
452 | - $this->set( 'VNU_capacity', $capacity ); |
|
451 | + function set_capacity($capacity = 0) { |
|
452 | + $this->set('VNU_capacity', $capacity); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * @param string $created |
459 | 459 | */ |
460 | - function set_created( $created = '' ) { |
|
461 | - $this->set( 'VNU_created', $created ); |
|
460 | + function set_created($created = '') { |
|
461 | + $this->set('VNU_created', $created); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | /** |
467 | 467 | * @param string $desc |
468 | 468 | */ |
469 | - function set_description( $desc = '' ) { |
|
470 | - $this->set( 'VNU_desc', $desc ); |
|
469 | + function set_description($desc = '') { |
|
470 | + $this->set('VNU_desc', $desc); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | /** |
476 | 476 | * @param string $identifier |
477 | 477 | */ |
478 | - function set_identifier( $identifier = '' ) { |
|
479 | - $this->set( 'VNU_identifier', $identifier ); |
|
478 | + function set_identifier($identifier = '') { |
|
479 | + $this->set('VNU_identifier', $identifier); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | /** |
485 | 485 | * @param string $modified |
486 | 486 | */ |
487 | - function set_modified( $modified = '' ) { |
|
488 | - $this->set( 'VNU_modified', $modified ); |
|
487 | + function set_modified($modified = '') { |
|
488 | + $this->set('VNU_modified', $modified); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -493,8 +493,8 @@ discard block |
||
493 | 493 | /** |
494 | 494 | * @param string $name |
495 | 495 | */ |
496 | - function set_name( $name = '' ) { |
|
497 | - $this->set( 'VNU_name', $name ); |
|
496 | + function set_name($name = '') { |
|
497 | + $this->set('VNU_name', $name); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | /** |
503 | 503 | * @param int $order |
504 | 504 | */ |
505 | - function set_order( $order = 0 ) { |
|
506 | - $this->set( 'VNU_order', $order ); |
|
505 | + function set_order($order = 0) { |
|
506 | + $this->set('VNU_order', $order); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -511,8 +511,8 @@ discard block |
||
511 | 511 | /** |
512 | 512 | * @param string $phone |
513 | 513 | */ |
514 | - function set_phone( $phone = '' ) { |
|
515 | - $this->set( 'VNU_phone', $phone ); |
|
514 | + function set_phone($phone = '') { |
|
515 | + $this->set('VNU_phone', $phone); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | /** |
521 | 521 | * @param int $wp_user |
522 | 522 | */ |
523 | - function set_wp_user( $wp_user = 1 ) { |
|
524 | - $this->set( 'VNU_wp_user', $wp_user ); |
|
523 | + function set_wp_user($wp_user = 1) { |
|
524 | + $this->set('VNU_wp_user', $wp_user); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | /** |
530 | 530 | * @param string $url |
531 | 531 | */ |
532 | - function set_venue_url( $url = '' ) { |
|
533 | - $this->set( 'VNU_url', $url ); |
|
532 | + function set_venue_url($url = '') { |
|
533 | + $this->set('VNU_url', $url); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | /** |
539 | 539 | * @param string $phone |
540 | 540 | */ |
541 | - function set_virtual_phone( $phone = '' ) { |
|
542 | - $this->set( 'VNU_virtual_phone', $phone ); |
|
541 | + function set_virtual_phone($phone = '') { |
|
542 | + $this->set('VNU_virtual_phone', $phone); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | /** |
548 | 548 | * @param string $url |
549 | 549 | */ |
550 | - function set_virtual_url( $url = '' ) { |
|
551 | - $this->set( 'VNU_virtual_url', $url ); |
|
550 | + function set_virtual_url($url = '') { |
|
551 | + $this->set('VNU_virtual_url', $url); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | /** |
557 | 557 | * @param string $enable |
558 | 558 | */ |
559 | - function set_enable_for_gmap( $enable = '' ) { |
|
560 | - $this->set( 'VNU_enable_for_gmap', $enable ); |
|
559 | + function set_enable_for_gmap($enable = '') { |
|
560 | + $this->set('VNU_enable_for_gmap', $enable); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | |
@@ -565,8 +565,8 @@ discard block |
||
565 | 565 | /** |
566 | 566 | * @param string $google_map_link |
567 | 567 | */ |
568 | - function set_google_map_link( $google_map_link = '' ) { |
|
569 | - $this->set( 'VNU_google_map_link', $google_map_link ); |
|
568 | + function set_google_map_link($google_map_link = '') { |
|
569 | + $this->set('VNU_google_map_link', $google_map_link); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @access public |
198 | 198 | * @param EE_Ticket $ticket |
199 | 199 | * @param int $qty |
200 | - * @return TRUE on success, FALSE on fail |
|
200 | + * @return boolean on success, FALSE on fail |
|
201 | 201 | */ |
202 | 202 | public function add_ticket_to_cart( EE_Ticket $ticket, $qty = 1 ) { |
203 | 203 | EEH_Line_Item::add_ticket_purchase( $this->get_grand_total(), $ticket, $qty ); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | /** |
285 | 285 | * @remove ALL items from cart and delete total as well |
286 | 286 | * @access public |
287 | - * @return bool |
|
287 | + * @return integer |
|
288 | 288 | */ |
289 | 289 | public function delete_cart() { |
290 | 290 | EE_Registry::instance()->load_helper( 'Line_Item' ); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * @save cart to session |
314 | 314 | * @access public |
315 | 315 | * @param bool $apply_taxes |
316 | - * @return TRUE on success, FALSE on fail |
|
316 | + * @return boolean on success, FALSE on fail |
|
317 | 317 | */ |
318 | 318 | public function save_cart( $apply_taxes = TRUE ) { |
319 | 319 | if ( $apply_taxes && $this->_grand_total instanceof EE_Line_Item ) { |
@@ -1,5 +1,5 @@ discard block |
||
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 | * |
@@ -67,24 +67,24 @@ discard block |
||
67 | 67 | * @param EE_Session $session |
68 | 68 | * @return \EE_Cart |
69 | 69 | */ |
70 | - public static function instance( EE_Line_Item $grand_total = null, EE_Session $session = null ) { |
|
71 | - if ( ! empty( $grand_total ) ){ |
|
72 | - self::$_instance = new self( $grand_total, $session ); |
|
70 | + public static function instance(EE_Line_Item $grand_total = null, EE_Session $session = null) { |
|
71 | + if ( ! empty($grand_total)) { |
|
72 | + self::$_instance = new self($grand_total, $session); |
|
73 | 73 | } |
74 | 74 | // or maybe retrieve an existing one ? |
75 | - if ( ! self::$_instance instanceof EE_Cart ) { |
|
75 | + if ( ! self::$_instance instanceof EE_Cart) { |
|
76 | 76 | // try getting the cart out of the session |
77 | 77 | $saved_cart = $session instanceof EE_Session ? $session->cart() : null; |
78 | - self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self( $grand_total, $session ); |
|
79 | - unset( $saved_cart ); |
|
78 | + self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total, $session); |
|
79 | + unset($saved_cart); |
|
80 | 80 | } |
81 | 81 | // verify that cart is ok and grand total line item exists |
82 | - if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item ) { |
|
83 | - self::$_instance = new self( $grand_total, $session ); |
|
82 | + if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) { |
|
83 | + self::$_instance = new self($grand_total, $session); |
|
84 | 84 | } |
85 | 85 | self::$_instance->get_grand_total(); |
86 | 86 | // once everything is all said and done, save the cart to the EE_Session |
87 | - add_action( 'shutdown', array( self::$_instance, 'save_cart' ), 90 ); |
|
87 | + add_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
88 | 88 | return self::$_instance; |
89 | 89 | } |
90 | 90 | |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * @param EE_Session $session |
99 | 99 | * @return \EE_Cart |
100 | 100 | */ |
101 | - private function __construct( EE_Line_Item $grand_total = null, EE_Session $session = null ) { |
|
102 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
103 | - $this->set_session( $session ); |
|
104 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
105 | - $this->set_grand_total_line_item( $grand_total ); |
|
101 | + private function __construct(EE_Line_Item $grand_total = null, EE_Session $session = null) { |
|
102 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
103 | + $this->set_session($session); |
|
104 | + if ($grand_total instanceof EE_Line_Item) { |
|
105 | + $this->set_grand_total_line_item($grand_total); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | * @param EE_Session $session |
115 | 115 | * @return EE_Cart |
116 | 116 | */ |
117 | - public static function reset( EE_Line_Item $grand_total = null, EE_Session $session = null ) { |
|
118 | - remove_action( 'shutdown', array( self::$_instance, 'save_cart' ), 90 ); |
|
119 | - if ( $session instanceof EE_Session ) { |
|
117 | + public static function reset(EE_Line_Item $grand_total = null, EE_Session $session = null) { |
|
118 | + remove_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
119 | + if ($session instanceof EE_Session) { |
|
120 | 120 | $session->reset_cart(); |
121 | 121 | } |
122 | 122 | self::$_instance = null; |
123 | - return self::instance( $grand_total, $session ); |
|
123 | + return self::instance($grand_total, $session); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @param EE_Session $session |
130 | 130 | */ |
131 | - public function set_session( EE_Session $session = null ) { |
|
132 | - $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core( 'Session' ); |
|
131 | + public function set_session(EE_Session $session = null) { |
|
132 | + $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core('Session'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * know the grand total line item on it |
140 | 140 | * @param EE_Line_Item $line_item |
141 | 141 | */ |
142 | - public function set_grand_total_line_item( EE_Line_Item $line_item ) { |
|
142 | + public function set_grand_total_line_item(EE_Line_Item $line_item) { |
|
143 | 143 | $this->_grand_total = $line_item; |
144 | 144 | } |
145 | 145 | |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | * @param EE_Session $session |
153 | 153 | * @return \EE_Cart |
154 | 154 | */ |
155 | - public static function get_cart_from_txn( EE_Transaction $transaction, EE_Session $session = null ) { |
|
155 | + public static function get_cart_from_txn(EE_Transaction $transaction, EE_Session $session = null) { |
|
156 | 156 | $grand_total = $transaction->total_line_item(); |
157 | 157 | $grand_total->get_items(); |
158 | 158 | $grand_total->tax_descendants(); |
159 | - return EE_Cart::instance( $grand_total, $session ); |
|
159 | + return EE_Cart::instance($grand_total, $session); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * Creates the total line item, and ensures it has its 'tickets' and 'taxes' sub-items |
166 | 166 | * @return EE_Line_Item |
167 | 167 | */ |
168 | - private function _create_grand_total(){ |
|
168 | + private function _create_grand_total() { |
|
169 | 169 | $this->_grand_total = EEH_Line_Item::create_total_line_item(); |
170 | 170 | return $this->_grand_total; |
171 | 171 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @return \EE_Line_Item[] |
179 | 179 | */ |
180 | 180 | public function get_tickets() { |
181 | - return EEH_Line_Item::get_ticket_line_items( $this->get_grand_total() ); |
|
181 | + return EEH_Line_Item::get_ticket_line_items($this->get_grand_total()); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function all_ticket_quantity_count() { |
193 | 193 | $tickets = $this->get_tickets(); |
194 | - if ( empty( $tickets )) { |
|
194 | + if (empty($tickets)) { |
|
195 | 195 | return 0; |
196 | 196 | } |
197 | 197 | $count = 0; |
198 | - foreach ( $tickets as $ticket ) { |
|
198 | + foreach ($tickets as $ticket) { |
|
199 | 199 | $count = $count + $ticket->get('LIN_quantity'); |
200 | 200 | } |
201 | 201 | return $count; |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | * Gets all the tax line items |
208 | 208 | * @return \EE_Line_Item[] |
209 | 209 | */ |
210 | - public function get_taxes(){ |
|
211 | - return EEH_Line_Item::get_taxes_subtotal( $this->_grand_total )->children(); |
|
210 | + public function get_taxes() { |
|
211 | + return EEH_Line_Item::get_taxes_subtotal($this->_grand_total)->children(); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * Gets the total line item (which is a parent of all other line items) on this cart |
218 | 218 | * @return EE_Line_Item |
219 | 219 | */ |
220 | - public function get_grand_total(){ |
|
220 | + public function get_grand_total() { |
|
221 | 221 | return $this->_grand_total instanceof EE_Line_Item ? $this->_grand_total : $this->_create_grand_total(); |
222 | 222 | } |
223 | 223 | |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | * @param int $qty |
231 | 231 | * @return TRUE on success, FALSE on fail |
232 | 232 | */ |
233 | - public function add_ticket_to_cart( EE_Ticket $ticket, $qty = 1 ) { |
|
234 | - EEH_Line_Item::add_ticket_purchase( $this->get_grand_total(), $ticket, $qty ); |
|
233 | + public function add_ticket_to_cart(EE_Ticket $ticket, $qty = 1) { |
|
234 | + EEH_Line_Item::add_ticket_purchase($this->get_grand_total(), $ticket, $qty); |
|
235 | 235 | return $this->save_cart() ? TRUE : FALSE; |
236 | 236 | } |
237 | 237 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @return float |
255 | 255 | */ |
256 | 256 | public function get_applied_taxes() { |
257 | - return EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
257 | + return EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @return float |
266 | 266 | */ |
267 | 267 | public function get_cart_grand_total() { |
268 | - EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
268 | + EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
269 | 269 | return $this->get_grand_total()->total(); |
270 | 270 | } |
271 | 271 | |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function recalculate_all_cart_totals() { |
280 | 280 | $pre_tax_total = $this->get_cart_total_before_tax(); |
281 | - $taxes_total = EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
282 | - $this->_grand_total->set_total( $pre_tax_total + $taxes_total ); |
|
281 | + $taxes_total = EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
282 | + $this->_grand_total->set_total($pre_tax_total + $taxes_total); |
|
283 | 283 | $this->_grand_total->save_this_and_descendants_to_txn(); |
284 | 284 | return $this->get_grand_total()->total(); |
285 | 285 | } |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | * @param array|bool|string $line_item_codes |
293 | 293 | * @return int on success, FALSE on fail |
294 | 294 | */ |
295 | - public function delete_items( $line_item_codes = FALSE ) { |
|
296 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
297 | - return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes ); |
|
295 | + public function delete_items($line_item_codes = FALSE) { |
|
296 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
297 | + return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | * @return bool |
306 | 306 | */ |
307 | 307 | public function empty_cart() { |
308 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
308 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
309 | 309 | $this->_grand_total = $this->_create_grand_total(); |
310 | - return $this->save_cart( TRUE ); |
|
310 | + return $this->save_cart(TRUE); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | * @return bool |
319 | 319 | */ |
320 | 320 | public function delete_cart() { |
321 | - $deleted = EEH_Line_Item::delete_all_child_items( $this->_grand_total ); |
|
322 | - if ( $deleted ) { |
|
321 | + $deleted = EEH_Line_Item::delete_all_child_items($this->_grand_total); |
|
322 | + if ($deleted) { |
|
323 | 323 | $deleted += $this->_grand_total->delete(); |
324 | 324 | $this->_grand_total = null; |
325 | 325 | } |
@@ -334,17 +334,17 @@ discard block |
||
334 | 334 | * @param bool $apply_taxes |
335 | 335 | * @return TRUE on success, FALSE on fail |
336 | 336 | */ |
337 | - public function save_cart( $apply_taxes = TRUE ) { |
|
338 | - if ( $apply_taxes && $this->_grand_total instanceof EE_Line_Item ) { |
|
339 | - EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
337 | + public function save_cart($apply_taxes = TRUE) { |
|
338 | + if ($apply_taxes && $this->_grand_total instanceof EE_Line_Item) { |
|
339 | + EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
340 | 340 | //make sure we don't cache the transaction because it can get stale |
341 | - if( $this->_grand_total->get_one_from_cache( 'Transaction' ) instanceof EE_Transaction && |
|
342 | - $this->_grand_total->get_one_from_cache( 'Transaction' )->ID()) { |
|
343 | - $this->_grand_total->clear_cache( 'Transaction', null, true ); |
|
341 | + if ($this->_grand_total->get_one_from_cache('Transaction') instanceof EE_Transaction && |
|
342 | + $this->_grand_total->get_one_from_cache('Transaction')->ID()) { |
|
343 | + $this->_grand_total->clear_cache('Transaction', null, true); |
|
344 | 344 | } |
345 | 345 | } |
346 | - if ( $this->_session instanceof EE_Session ) { |
|
347 | - return $this->_session->set_cart( $this ); |
|
346 | + if ($this->_session instanceof EE_Session) { |
|
347 | + return $this->_session->set_cart($this); |
|
348 | 348 | } else { |
349 | 349 | return false; |
350 | 350 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | * @since 4.6.0 |
557 | 557 | * @global WPDB $wpdb |
558 | 558 | * |
559 | - * @return mixed null|int WP_user ID or NULL |
|
559 | + * @return integer|null null|int WP_user ID or NULL |
|
560 | 560 | */ |
561 | 561 | public static function get_default_creator_id() { |
562 | 562 | global $wpdb; |
@@ -701,6 +701,7 @@ discard block |
||
701 | 701 | * @access public |
702 | 702 | * @static |
703 | 703 | * @param string $table_name, without prefixed $wpdb->prefix |
704 | + * @param string $table_name |
|
704 | 705 | * @return array of database column names |
705 | 706 | */ |
706 | 707 | public static function get_fields_on_table( $table_name = NULL ) { |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | if ( is_array( $hooks_to_fire_at_time ) ) { |
208 | 208 | foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
209 | 209 | if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
210 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
210 | + && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
211 | 211 | ) { |
212 | 212 | unset( $crons[ $timestamp ][ $hook_name ] ); |
213 | 213 | } |
@@ -1124,14 +1124,14 @@ discard block |
||
1124 | 1124 | $QSG_ID = reset( $id_col ); |
1125 | 1125 | } else { |
1126 | 1126 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
1127 | - EE_Log::instance()->log( |
|
1128 | - __FILE__, |
|
1129 | - __FUNCTION__, |
|
1130 | - sprintf( |
|
1131 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1132 | - $QST_ID ), |
|
1133 | - 'error' ); |
|
1134 | - continue; |
|
1127 | + EE_Log::instance()->log( |
|
1128 | + __FILE__, |
|
1129 | + __FUNCTION__, |
|
1130 | + sprintf( |
|
1131 | + __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1132 | + $QST_ID ), |
|
1133 | + 'error' ); |
|
1134 | + continue; |
|
1135 | 1135 | } |
1136 | 1136 | } |
1137 | 1137 | |
@@ -1139,8 +1139,8 @@ discard block |
||
1139 | 1139 | $wpdb->insert( |
1140 | 1140 | EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ), |
1141 | 1141 | array( 'QSG_ID' => $QSG_ID, |
1142 | - 'QST_ID' => $QST_ID, |
|
1143 | - 'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++ |
|
1142 | + 'QST_ID' => $QST_ID, |
|
1143 | + 'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++ |
|
1144 | 1144 | ), |
1145 | 1145 | array( '%d', '%d', '%d' ) |
1146 | 1146 | ); |
@@ -1678,8 +1678,8 @@ discard block |
||
1678 | 1678 | } |
1679 | 1679 | } |
1680 | 1680 | } |
1681 | - //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1682 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1681 | + //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1682 | + remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1683 | 1683 | |
1684 | 1684 | if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
1685 | 1685 | $db_update_sans_ee4 = array(); |
@@ -1,4 +1,4 @@ discard block |
||
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 | * EEH_Activation Helper |
4 | 4 | * |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | * @param $table_name |
49 | 49 | * @return string |
50 | 50 | */ |
51 | - public static function ensure_table_name_has_prefix( $table_name ) { |
|
51 | + public static function ensure_table_name_has_prefix($table_name) { |
|
52 | 52 | global $wpdb; |
53 | - return strpos( $table_name, $wpdb->base_prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name; |
|
53 | + return strpos($table_name, $wpdb->base_prefix) === 0 ? $table_name : $wpdb->prefix.$table_name; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return boolean success, whether the database and folders are setup properly |
79 | 79 | * @throws \EE_Error |
80 | 80 | */ |
81 | - public static function initialize_db_and_folders(){ |
|
81 | + public static function initialize_db_and_folders() { |
|
82 | 82 | $good_filesystem = EEH_Activation::create_upload_directories(); |
83 | 83 | $good_db = EEH_Activation::create_database_tables(); |
84 | 84 | return $good_filesystem && $good_db; |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @throws \EE_Error |
96 | 96 | */ |
97 | - public static function initialize_db_content(){ |
|
97 | + public static function initialize_db_content() { |
|
98 | 98 | //let's avoid doing all this logic repeatedly, especially when addons are requesting it |
99 | - if( EEH_Activation::$_initialized_db_content_already_in_this_request ) { |
|
99 | + if (EEH_Activation::$_initialized_db_content_already_in_this_request) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | EEH_Activation::$_initialized_db_content_already_in_this_request = true; |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | EEH_Activation::remove_cron_tasks(); |
114 | 114 | EEH_Activation::create_cron_tasks(); |
115 | 115 | // remove all TXN locks since that is being done via extra meta now |
116 | - delete_option( 'ee_locked_transactions' ); |
|
116 | + delete_option('ee_locked_transactions'); |
|
117 | 117 | //also, check for CAF default db content |
118 | - do_action( 'AHEE__EEH_Activation__initialize_db_content' ); |
|
118 | + do_action('AHEE__EEH_Activation__initialize_db_content'); |
|
119 | 119 | //also: EEM_Gateways::load_all_gateways() outputs a lot of success messages |
120 | 120 | //which users really won't care about on initial activation |
121 | 121 | EE_Error::overwrite_success(); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @return array |
136 | 136 | * @throws \EE_Error |
137 | 137 | */ |
138 | - public static function get_cron_tasks( $which_to_include ) { |
|
138 | + public static function get_cron_tasks($which_to_include) { |
|
139 | 139 | $cron_tasks = apply_filters( |
140 | 140 | 'FHEE__EEH_Activation__get_cron_tasks', |
141 | 141 | array( |
@@ -144,16 +144,16 @@ discard block |
||
144 | 144 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates |
145 | 145 | ) |
146 | 146 | ); |
147 | - if ( $which_to_include === 'old' ) { |
|
147 | + if ($which_to_include === 'old') { |
|
148 | 148 | $cron_tasks = array_filter( |
149 | 149 | $cron_tasks, |
150 | - function ( $value ) { |
|
150 | + function($value) { |
|
151 | 151 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
152 | 152 | } |
153 | 153 | ); |
154 | - } elseif ( $which_to_include === 'current' ) { |
|
155 | - $cron_tasks = array_filter( $cron_tasks ); |
|
156 | - } elseif ( WP_DEBUG && $which_to_include !== 'all' ) { |
|
154 | + } elseif ($which_to_include === 'current') { |
|
155 | + $cron_tasks = array_filter($cron_tasks); |
|
156 | + } elseif (WP_DEBUG && $which_to_include !== 'all') { |
|
157 | 157 | throw new EE_Error( |
158 | 158 | sprintf( |
159 | 159 | __( |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public static function create_cron_tasks() { |
178 | 178 | |
179 | - foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) { |
|
180 | - if( ! wp_next_scheduled( $hook_name ) ) { |
|
181 | - wp_schedule_event( time(), $frequency, $hook_name ); |
|
179 | + foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) { |
|
180 | + if ( ! wp_next_scheduled($hook_name)) { |
|
181 | + wp_schedule_event(time(), $frequency, $hook_name); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones |
193 | 193 | * @throws \EE_Error |
194 | 194 | */ |
195 | - public static function remove_cron_tasks( $remove_all = true ) { |
|
195 | + public static function remove_cron_tasks($remove_all = true) { |
|
196 | 196 | $cron_tasks_to_remove = $remove_all ? 'all' : 'old'; |
197 | 197 | $crons = _get_cron_array(); |
198 | - $crons = is_array( $crons ) ? $crons : array(); |
|
198 | + $crons = is_array($crons) ? $crons : array(); |
|
199 | 199 | /* reminder of what $crons look like: |
200 | 200 | * Top-level keys are timestamps, and their values are arrays. |
201 | 201 | * The 2nd level arrays have keys with each of the cron task hook names to run at that time |
@@ -213,23 +213,23 @@ discard block |
||
213 | 213 | * ... |
214 | 214 | * ... |
215 | 215 | */ |
216 | - $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ); |
|
217 | - foreach ( $crons as $timestamp => $hooks_to_fire_at_time ) { |
|
218 | - if ( is_array( $hooks_to_fire_at_time ) ) { |
|
219 | - foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
|
220 | - if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
221 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
216 | + $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks($cron_tasks_to_remove); |
|
217 | + foreach ($crons as $timestamp => $hooks_to_fire_at_time) { |
|
218 | + if (is_array($hooks_to_fire_at_time)) { |
|
219 | + foreach ($hooks_to_fire_at_time as $hook_name => $hook_actions) { |
|
220 | + if (isset($ee_cron_tasks_to_remove[$hook_name]) |
|
221 | + && is_array($ee_cron_tasks_to_remove[$hook_name]) |
|
222 | 222 | ) { |
223 | - unset( $crons[ $timestamp ][ $hook_name ] ); |
|
223 | + unset($crons[$timestamp][$hook_name]); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | //also take care of any empty cron timestamps. |
227 | - if ( empty( $hooks_to_fire_at_time ) ) { |
|
228 | - unset( $crons[ $timestamp ] ); |
|
227 | + if (empty($hooks_to_fire_at_time)) { |
|
228 | + unset($crons[$timestamp]); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | } |
232 | - _set_cron_array( $crons ); |
|
232 | + _set_cron_array($crons); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public static function CPT_initialization() { |
246 | 246 | // register Custom Post Types |
247 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
247 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
248 | 248 | flush_rewrite_rules(); |
249 | 249 | } |
250 | 250 | |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | * @return void |
263 | 263 | */ |
264 | 264 | public static function reset_and_update_config() { |
265 | - do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) ); |
|
266 | - add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 ); |
|
265 | + do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config')); |
|
266 | + add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3); |
|
267 | 267 | //EE_Config::reset(); |
268 | 268 | } |
269 | 269 | |
@@ -276,28 +276,28 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public static function load_calendar_config() { |
278 | 278 | // grab array of all plugin folders and loop thru it |
279 | - $plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR ); |
|
280 | - if ( empty( $plugins ) ) { |
|
279 | + $plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR); |
|
280 | + if (empty($plugins)) { |
|
281 | 281 | return; |
282 | 282 | } |
283 | - foreach ( $plugins as $plugin_path ) { |
|
283 | + foreach ($plugins as $plugin_path) { |
|
284 | 284 | // grab plugin folder name from path |
285 | - $plugin = basename( $plugin_path ); |
|
285 | + $plugin = basename($plugin_path); |
|
286 | 286 | // drill down to Espresso plugins |
287 | 287 | // then to calendar related plugins |
288 | 288 | if ( |
289 | - strpos( $plugin, 'espresso' ) !== FALSE |
|
290 | - || strpos( $plugin, 'Espresso' ) !== FALSE |
|
291 | - || strpos( $plugin, 'ee4' ) !== FALSE |
|
292 | - || strpos( $plugin, 'EE4' ) !== FALSE |
|
293 | - || strpos( $plugin, 'calendar' ) !== false |
|
289 | + strpos($plugin, 'espresso') !== FALSE |
|
290 | + || strpos($plugin, 'Espresso') !== FALSE |
|
291 | + || strpos($plugin, 'ee4') !== FALSE |
|
292 | + || strpos($plugin, 'EE4') !== FALSE |
|
293 | + || strpos($plugin, 'calendar') !== false |
|
294 | 294 | ) { |
295 | 295 | // this is what we are looking for |
296 | - $calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php'; |
|
296 | + $calendar_config = $plugin_path.DS.'EE_Calendar_Config.php'; |
|
297 | 297 | // does it exist in this folder ? |
298 | - if ( is_readable( $calendar_config )) { |
|
298 | + if (is_readable($calendar_config)) { |
|
299 | 299 | // YEAH! let's load it |
300 | - require_once( $calendar_config ); |
|
300 | + require_once($calendar_config); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | } |
@@ -313,21 +313,21 @@ discard block |
||
313 | 313 | * @param \EE_Config $EE_Config |
314 | 314 | * @return \stdClass |
315 | 315 | */ |
316 | - public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) { |
|
317 | - $convert_from_array = array( 'addons' ); |
|
316 | + public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) { |
|
317 | + $convert_from_array = array('addons'); |
|
318 | 318 | // in case old settings were saved as an array |
319 | - if ( is_array( $settings ) && in_array( $config, $convert_from_array )) { |
|
319 | + if (is_array($settings) && in_array($config, $convert_from_array)) { |
|
320 | 320 | // convert existing settings to an object |
321 | 321 | $config_array = $settings; |
322 | 322 | $settings = new stdClass(); |
323 | - foreach ( $config_array as $key => $value ){ |
|
324 | - if ( $key === 'calendar' && class_exists( 'EE_Calendar_Config' )) { |
|
325 | - $EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value ); |
|
323 | + foreach ($config_array as $key => $value) { |
|
324 | + if ($key === 'calendar' && class_exists('EE_Calendar_Config')) { |
|
325 | + $EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value); |
|
326 | 326 | } else { |
327 | 327 | $settings->{$key} = $value; |
328 | 328 | } |
329 | 329 | } |
330 | - add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' ); |
|
330 | + add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true'); |
|
331 | 331 | } |
332 | 332 | return $settings; |
333 | 333 | } |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | */ |
344 | 344 | public static function deactivate_event_espresso() { |
345 | 345 | // check permissions |
346 | - if ( current_user_can( 'activate_plugins' )) { |
|
347 | - deactivate_plugins( EE_PLUGIN_BASENAME, TRUE ); |
|
346 | + if (current_user_can('activate_plugins')) { |
|
347 | + deactivate_plugins(EE_PLUGIN_BASENAME, TRUE); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
@@ -366,25 +366,25 @@ discard block |
||
366 | 366 | $critical_pages = array( |
367 | 367 | array( |
368 | 368 | 'id' =>'reg_page_id', |
369 | - 'name' => __( 'Registration Checkout', 'event_espresso' ), |
|
369 | + 'name' => __('Registration Checkout', 'event_espresso'), |
|
370 | 370 | 'post' => NULL, |
371 | 371 | 'code' => 'ESPRESSO_CHECKOUT' |
372 | 372 | ), |
373 | 373 | array( |
374 | 374 | 'id' => 'txn_page_id', |
375 | - 'name' => __( 'Transactions', 'event_espresso' ), |
|
375 | + 'name' => __('Transactions', 'event_espresso'), |
|
376 | 376 | 'post' => NULL, |
377 | 377 | 'code' => 'ESPRESSO_TXN_PAGE' |
378 | 378 | ), |
379 | 379 | array( |
380 | 380 | 'id' => 'thank_you_page_id', |
381 | - 'name' => __( 'Thank You', 'event_espresso' ), |
|
381 | + 'name' => __('Thank You', 'event_espresso'), |
|
382 | 382 | 'post' => NULL, |
383 | 383 | 'code' => 'ESPRESSO_THANK_YOU' |
384 | 384 | ), |
385 | 385 | array( |
386 | 386 | 'id' => 'cancel_page_id', |
387 | - 'name' => __( 'Registration Cancelled', 'event_espresso' ), |
|
387 | + 'name' => __('Registration Cancelled', 'event_espresso'), |
|
388 | 388 | 'post' => NULL, |
389 | 389 | 'code' => 'ESPRESSO_CANCELLED' |
390 | 390 | ), |
@@ -392,62 +392,62 @@ discard block |
||
392 | 392 | |
393 | 393 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
394 | 394 | |
395 | - foreach ( $critical_pages as $critical_page ) { |
|
395 | + foreach ($critical_pages as $critical_page) { |
|
396 | 396 | // is critical page ID set in config ? |
397 | - if ( $EE_Core_Config->{$critical_page[ 'id' ]} !== FALSE ) { |
|
397 | + if ($EE_Core_Config->{$critical_page['id']} !== FALSE) { |
|
398 | 398 | // attempt to find post by ID |
399 | - $critical_page['post'] = get_post( $EE_Core_Config->{$critical_page[ 'id' ]} ); |
|
399 | + $critical_page['post'] = get_post($EE_Core_Config->{$critical_page['id']} ); |
|
400 | 400 | } |
401 | 401 | // no dice? |
402 | - if ( $critical_page['post'] === null ) { |
|
402 | + if ($critical_page['post'] === null) { |
|
403 | 403 | // attempt to find post by title |
404 | - $critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] ); |
|
404 | + $critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']); |
|
405 | 405 | // still nothing? |
406 | - if ( $critical_page['post'] === null ) { |
|
407 | - $critical_page = EEH_Activation::create_critical_page( $critical_page ); |
|
406 | + if ($critical_page['post'] === null) { |
|
407 | + $critical_page = EEH_Activation::create_critical_page($critical_page); |
|
408 | 408 | // REALLY? Still nothing ??!?!? |
409 | - if ( $critical_page['post'] === null ) { |
|
410 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
411 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
409 | + if ($critical_page['post'] === null) { |
|
410 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
411 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
412 | 412 | break; |
413 | 413 | } |
414 | 414 | } |
415 | 415 | } |
416 | 416 | // track post_shortcodes |
417 | - if ( $critical_page['post'] ) { |
|
418 | - EEH_Activation::_track_critical_page_post_shortcodes( $critical_page ); |
|
417 | + if ($critical_page['post']) { |
|
418 | + EEH_Activation::_track_critical_page_post_shortcodes($critical_page); |
|
419 | 419 | } |
420 | 420 | // check that Post ID matches critical page ID in config |
421 | 421 | if ( |
422 | - isset( $critical_page['post']->ID ) |
|
423 | - && $critical_page['post']->ID !== $EE_Core_Config->{$critical_page[ 'id' ]} |
|
422 | + isset($critical_page['post']->ID) |
|
423 | + && $critical_page['post']->ID !== $EE_Core_Config->{$critical_page['id']} |
|
424 | 424 | ) { |
425 | 425 | //update Config with post ID |
426 | - $EE_Core_Config->{$critical_page[ 'id' ]} = $critical_page['post']->ID; |
|
427 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) { |
|
428 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
429 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
426 | + $EE_Core_Config->{$critical_page['id']} = $critical_page['post']->ID; |
|
427 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
428 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
429 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | |
433 | 433 | $critical_page_problem = |
434 | - ! isset( $critical_page['post']->post_status ) |
|
434 | + ! isset($critical_page['post']->post_status) |
|
435 | 435 | || $critical_page['post']->post_status !== 'publish' |
436 | - || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE |
|
436 | + || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE |
|
437 | 437 | ? TRUE |
438 | 438 | : $critical_page_problem; |
439 | 439 | |
440 | 440 | } |
441 | 441 | |
442 | - if ( $critical_page_problem ) { |
|
442 | + if ($critical_page_problem) { |
|
443 | 443 | $msg = sprintf( |
444 | - __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ), |
|
445 | - '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>' |
|
444 | + __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'), |
|
445 | + '<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>' |
|
446 | 446 | ); |
447 | - EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg ); |
|
447 | + EE_Error::add_persistent_admin_notice('critical_page_problem', $msg); |
|
448 | 448 | } |
449 | - if ( EE_Error::has_notices() ) { |
|
450 | - EE_Error::get_notices( FALSE, TRUE, TRUE ); |
|
449 | + if (EE_Error::has_notices()) { |
|
450 | + EE_Error::get_notices(FALSE, TRUE, TRUE); |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
@@ -459,13 +459,13 @@ discard block |
||
459 | 459 | * parameter to the shortcode |
460 | 460 | * @return WP_Post or NULl |
461 | 461 | */ |
462 | - public static function get_page_by_ee_shortcode($ee_shortcode){ |
|
462 | + public static function get_page_by_ee_shortcode($ee_shortcode) { |
|
463 | 463 | global $wpdb; |
464 | 464 | $shortcode_and_opening_bracket = '['.$ee_shortcode; |
465 | 465 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
466 | - if($post_id){ |
|
466 | + if ($post_id) { |
|
467 | 467 | return get_post($post_id); |
468 | - }else{ |
|
468 | + } else { |
|
469 | 469 | return NULL; |
470 | 470 | } |
471 | 471 | |
@@ -482,32 +482,32 @@ discard block |
||
482 | 482 | * @param array $critical_page |
483 | 483 | * @return array |
484 | 484 | */ |
485 | - public static function create_critical_page( $critical_page ) { |
|
485 | + public static function create_critical_page($critical_page) { |
|
486 | 486 | |
487 | 487 | $post_args = array( |
488 | 488 | 'post_title' => $critical_page['name'], |
489 | 489 | 'post_status' => 'publish', |
490 | 490 | 'post_type' => 'page', |
491 | 491 | 'comment_status' => 'closed', |
492 | - 'post_content' => '[' . $critical_page['code'] . ']' |
|
492 | + 'post_content' => '['.$critical_page['code'].']' |
|
493 | 493 | ); |
494 | 494 | |
495 | - $post_id = wp_insert_post( $post_args ); |
|
496 | - if ( ! $post_id ) { |
|
495 | + $post_id = wp_insert_post($post_args); |
|
496 | + if ( ! $post_id) { |
|
497 | 497 | $msg = sprintf( |
498 | - __( 'The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso' ), |
|
498 | + __('The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso'), |
|
499 | 499 | $critical_page['name'] |
500 | 500 | ); |
501 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
501 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
502 | 502 | return $critical_page; |
503 | 503 | } |
504 | 504 | // get newly created post's details |
505 | - if ( ! $critical_page['post'] = get_post( $post_id )) { |
|
505 | + if ( ! $critical_page['post'] = get_post($post_id)) { |
|
506 | 506 | $msg = sprintf( |
507 | - __( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ), |
|
507 | + __('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'), |
|
508 | 508 | $critical_page['name'] |
509 | 509 | ); |
510 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
510 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | return $critical_page; |
@@ -526,35 +526,35 @@ discard block |
||
526 | 526 | * @param array $critical_page |
527 | 527 | * @return void |
528 | 528 | */ |
529 | - private static function _track_critical_page_post_shortcodes( $critical_page = array() ) { |
|
529 | + private static function _track_critical_page_post_shortcodes($critical_page = array()) { |
|
530 | 530 | // check the goods |
531 | - if ( ! $critical_page['post'] instanceof WP_Post ) { |
|
531 | + if ( ! $critical_page['post'] instanceof WP_Post) { |
|
532 | 532 | $msg = sprintf( |
533 | - __( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ), |
|
533 | + __('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'), |
|
534 | 534 | $critical_page['name'] |
535 | 535 | ); |
536 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
536 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
537 | 537 | return; |
538 | 538 | } |
539 | 539 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
540 | 540 | // map shortcode to post |
541 | - $EE_Core_Config->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID; |
|
541 | + $EE_Core_Config->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID; |
|
542 | 542 | // and make sure it's NOT added to the WP "Posts Page" |
543 | 543 | // name of the WP Posts Page |
544 | 544 | $posts_page = EE_Config::get_page_for_posts(); |
545 | - if ( isset( $EE_Core_Config->post_shortcodes[ $posts_page ] )) { |
|
546 | - unset( $EE_Core_Config->post_shortcodes[ $posts_page ][ $critical_page['code'] ] ); |
|
545 | + if (isset($EE_Core_Config->post_shortcodes[$posts_page])) { |
|
546 | + unset($EE_Core_Config->post_shortcodes[$posts_page][$critical_page['code']]); |
|
547 | 547 | } |
548 | - if ( $posts_page !== 'posts' && isset( $EE_Core_Config->post_shortcodes['posts'] )) { |
|
549 | - unset( $EE_Core_Config->post_shortcodes['posts'][ $critical_page['code'] ] ); |
|
548 | + if ($posts_page !== 'posts' && isset($EE_Core_Config->post_shortcodes['posts'])) { |
|
549 | + unset($EE_Core_Config->post_shortcodes['posts'][$critical_page['code']]); |
|
550 | 550 | } |
551 | 551 | // update post_shortcode CFG |
552 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) { |
|
552 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
553 | 553 | $msg = sprintf( |
554 | - __( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ), |
|
554 | + __('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'), |
|
555 | 555 | $critical_page['name'] |
556 | 556 | ); |
557 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
557 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
@@ -572,24 +572,24 @@ discard block |
||
572 | 572 | public static function get_default_creator_id() { |
573 | 573 | global $wpdb; |
574 | 574 | |
575 | - if ( ! empty( self::$_default_creator_id ) ) { |
|
575 | + if ( ! empty(self::$_default_creator_id)) { |
|
576 | 576 | return self::$_default_creator_id; |
577 | 577 | }/**/ |
578 | 578 | |
579 | - $role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' ); |
|
579 | + $role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator'); |
|
580 | 580 | |
581 | 581 | //let's allow pre_filtering for early exits by alternative methods for getting id. We check for truthy result and if so then exit early. |
582 | - $pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check ); |
|
583 | - if ( $pre_filtered_id !== false ) { |
|
582 | + $pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check); |
|
583 | + if ($pre_filtered_id !== false) { |
|
584 | 584 | return (int) $pre_filtered_id; |
585 | 585 | } |
586 | 586 | |
587 | - $capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' ); |
|
588 | - $query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' ); |
|
589 | - $user_id = $wpdb->get_var( $query ); |
|
590 | - $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id ); |
|
591 | - if ( $user_id && (int)$user_id ) { |
|
592 | - self::$_default_creator_id = (int)$user_id; |
|
587 | + $capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities'); |
|
588 | + $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%'); |
|
589 | + $user_id = $wpdb->get_var($query); |
|
590 | + $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id); |
|
591 | + if ($user_id && (int) $user_id) { |
|
592 | + self::$_default_creator_id = (int) $user_id; |
|
593 | 593 | return self::$_default_creator_id; |
594 | 594 | } else { |
595 | 595 | return NULL; |
@@ -616,29 +616,29 @@ discard block |
||
616 | 616 | * @return void |
617 | 617 | * @throws EE_Error if there are database errors |
618 | 618 | */ |
619 | - public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) { |
|
620 | - if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){ |
|
619 | + public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) { |
|
620 | + if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) { |
|
621 | 621 | return; |
622 | 622 | } |
623 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
624 | - if ( ! function_exists( 'dbDelta' )) { |
|
625 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
623 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
624 | + if ( ! function_exists('dbDelta')) { |
|
625 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
626 | 626 | } |
627 | 627 | /** @var WPDB $wpdb */ |
628 | 628 | global $wpdb; |
629 | - $wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
629 | + $wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
630 | 630 | // do we need to first delete an existing version of this table ? |
631 | - if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){ |
|
631 | + if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) { |
|
632 | 632 | // ok, delete the table... but ONLY if it's empty |
633 | - $deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name ); |
|
633 | + $deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name); |
|
634 | 634 | // table is NOT empty, are you SURE you want to delete this table ??? |
635 | - if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
|
636 | - EEH_Activation::delete_unused_db_table( $wp_table_name ); |
|
637 | - } else if ( ! $deleted_safely ) { |
|
635 | + if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) { |
|
636 | + EEH_Activation::delete_unused_db_table($wp_table_name); |
|
637 | + } else if ( ! $deleted_safely) { |
|
638 | 638 | // so we should be more cautious rather than just dropping tables so easily |
639 | 639 | EE_Error::add_persistent_admin_notice( |
640 | - 'bad_table_' . $wp_table_name . '_detected', |
|
641 | - sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ), |
|
640 | + 'bad_table_'.$wp_table_name.'_detected', |
|
641 | + sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'), |
|
642 | 642 | $wp_table_name, |
643 | 643 | "<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>", |
644 | 644 | '<b>wp-config.php</b>', |
@@ -647,25 +647,25 @@ discard block |
||
647 | 647 | } |
648 | 648 | } |
649 | 649 | // does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns ) |
650 | - if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) { |
|
650 | + if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) { |
|
651 | 651 | $SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; |
652 | 652 | //get $wpdb to echo errors, but buffer them. This way at least WE know an error |
653 | 653 | //happened. And then we can choose to tell the end user |
654 | - $old_show_errors_policy = $wpdb->show_errors( TRUE ); |
|
655 | - $old_error_suppression_policy = $wpdb->suppress_errors( FALSE ); |
|
654 | + $old_show_errors_policy = $wpdb->show_errors(TRUE); |
|
655 | + $old_error_suppression_policy = $wpdb->suppress_errors(FALSE); |
|
656 | 656 | ob_start(); |
657 | - dbDelta( $SQL ); |
|
657 | + dbDelta($SQL); |
|
658 | 658 | $output = ob_get_contents(); |
659 | 659 | ob_end_clean(); |
660 | - $wpdb->show_errors( $old_show_errors_policy ); |
|
661 | - $wpdb->suppress_errors( $old_error_suppression_policy ); |
|
662 | - if( ! empty( $output ) ){ |
|
663 | - throw new EE_Error( $output ); |
|
660 | + $wpdb->show_errors($old_show_errors_policy); |
|
661 | + $wpdb->suppress_errors($old_error_suppression_policy); |
|
662 | + if ( ! empty($output)) { |
|
663 | + throw new EE_Error($output); |
|
664 | 664 | } |
665 | 665 | } else { |
666 | 666 | throw new EE_Error( |
667 | 667 | sprintf( |
668 | - __( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ), |
|
668 | + __('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'), |
|
669 | 669 | '<br />', |
670 | 670 | $sql |
671 | 671 | ) |
@@ -688,15 +688,15 @@ discard block |
||
688 | 688 | * 'VARCHAR(10)' |
689 | 689 | * @return bool|int |
690 | 690 | */ |
691 | - public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){ |
|
692 | - if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){ |
|
691 | + public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') { |
|
692 | + if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) { |
|
693 | 693 | return FALSE; |
694 | 694 | } |
695 | 695 | global $wpdb; |
696 | - $full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
696 | + $full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
697 | 697 | $fields = self::get_fields_on_table($table_name); |
698 | - if (!in_array($column_name, $fields)){ |
|
699 | - $alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
698 | + if ( ! in_array($column_name, $fields)) { |
|
699 | + $alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
700 | 700 | //echo "alter query:$alter_query"; |
701 | 701 | return $wpdb->query($alter_query); |
702 | 702 | } |
@@ -715,14 +715,14 @@ discard block |
||
715 | 715 | * @param string $table_name, without prefixed $wpdb->prefix |
716 | 716 | * @return array of database column names |
717 | 717 | */ |
718 | - public static function get_fields_on_table( $table_name = NULL ) { |
|
718 | + public static function get_fields_on_table($table_name = NULL) { |
|
719 | 719 | global $wpdb; |
720 | - $table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
721 | - if ( ! empty( $table_name )) { |
|
720 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
721 | + if ( ! empty($table_name)) { |
|
722 | 722 | $columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name "); |
723 | 723 | if ($columns !== FALSE) { |
724 | 724 | $field_array = array(); |
725 | - foreach($columns as $column ){ |
|
725 | + foreach ($columns as $column) { |
|
726 | 726 | $field_array[] = $column->Field; |
727 | 727 | } |
728 | 728 | return $field_array; |
@@ -741,12 +741,12 @@ discard block |
||
741 | 741 | * @param string $table_name |
742 | 742 | * @return bool |
743 | 743 | */ |
744 | - public static function db_table_is_empty( $table_name ) { |
|
744 | + public static function db_table_is_empty($table_name) { |
|
745 | 745 | global $wpdb; |
746 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
747 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
748 | - $count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" ); |
|
749 | - return absint( $count ) === 0 ? true : false; |
|
746 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
747 | + if (EEH_Activation::table_exists($table_name)) { |
|
748 | + $count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name"); |
|
749 | + return absint($count) === 0 ? true : false; |
|
750 | 750 | } |
751 | 751 | return false; |
752 | 752 | } |
@@ -761,9 +761,9 @@ discard block |
||
761 | 761 | * @param string $table_name |
762 | 762 | * @return bool | int |
763 | 763 | */ |
764 | - public static function delete_db_table_if_empty( $table_name ) { |
|
765 | - if ( EEH_Activation::db_table_is_empty( $table_name ) ) { |
|
766 | - return EEH_Activation::delete_unused_db_table( $table_name ); |
|
764 | + public static function delete_db_table_if_empty($table_name) { |
|
765 | + if (EEH_Activation::db_table_is_empty($table_name)) { |
|
766 | + return EEH_Activation::delete_unused_db_table($table_name); |
|
767 | 767 | } |
768 | 768 | return false; |
769 | 769 | } |
@@ -778,11 +778,11 @@ discard block |
||
778 | 778 | * @param string $table_name |
779 | 779 | * @return bool | int |
780 | 780 | */ |
781 | - public static function delete_unused_db_table( $table_name ) { |
|
781 | + public static function delete_unused_db_table($table_name) { |
|
782 | 782 | global $wpdb; |
783 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
784 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
785 | - return $wpdb->query( "DROP TABLE IF EXISTS $table_name" ); |
|
783 | + if (EEH_Activation::table_exists($table_name)) { |
|
784 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
785 | + return $wpdb->query("DROP TABLE IF EXISTS $table_name"); |
|
786 | 786 | } |
787 | 787 | return false; |
788 | 788 | } |
@@ -798,18 +798,18 @@ discard block |
||
798 | 798 | * @param string $index_name |
799 | 799 | * @return bool | int |
800 | 800 | */ |
801 | - public static function drop_index( $table_name, $index_name ) { |
|
802 | - if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){ |
|
801 | + public static function drop_index($table_name, $index_name) { |
|
802 | + if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) { |
|
803 | 803 | return FALSE; |
804 | 804 | } |
805 | 805 | global $wpdb; |
806 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
806 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
807 | 807 | $index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'"; |
808 | 808 | if ( |
809 | - EEH_Activation::table_exists( $table_name ) |
|
810 | - && $wpdb->get_var( $index_exists_query ) === $table_name //using get_var with the $index_exists_query returns the table's name |
|
809 | + EEH_Activation::table_exists($table_name) |
|
810 | + && $wpdb->get_var($index_exists_query) === $table_name //using get_var with the $index_exists_query returns the table's name |
|
811 | 811 | ) { |
812 | - return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" ); |
|
812 | + return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name"); |
|
813 | 813 | } |
814 | 814 | return TRUE; |
815 | 815 | } |
@@ -825,27 +825,27 @@ discard block |
||
825 | 825 | * @return boolean success (whether database is setup properly or not) |
826 | 826 | */ |
827 | 827 | public static function create_database_tables() { |
828 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
828 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
829 | 829 | //find the migration script that sets the database to be compatible with the code |
830 | 830 | $dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms(); |
831 | - if( $dms_name ){ |
|
832 | - $current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name ); |
|
833 | - $current_data_migration_script->set_migrating( false ); |
|
831 | + if ($dms_name) { |
|
832 | + $current_data_migration_script = EE_Registry::instance()->load_dms($dms_name); |
|
833 | + $current_data_migration_script->set_migrating(false); |
|
834 | 834 | $current_data_migration_script->schema_changes_before_migration(); |
835 | 835 | $current_data_migration_script->schema_changes_after_migration(); |
836 | - if( $current_data_migration_script->get_errors() ){ |
|
837 | - if( WP_DEBUG ){ |
|
838 | - foreach( $current_data_migration_script->get_errors() as $error ){ |
|
839 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
|
836 | + if ($current_data_migration_script->get_errors()) { |
|
837 | + if (WP_DEBUG) { |
|
838 | + foreach ($current_data_migration_script->get_errors() as $error) { |
|
839 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
840 | 840 | } |
841 | - }else{ |
|
842 | - EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
|
841 | + } else { |
|
842 | + EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso')); |
|
843 | 843 | } |
844 | 844 | return false; |
845 | 845 | } |
846 | 846 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
847 | - }else{ |
|
848 | - EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
847 | + } else { |
|
848 | + EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
849 | 849 | return false; |
850 | 850 | } |
851 | 851 | return true; |
@@ -865,27 +865,27 @@ discard block |
||
865 | 865 | public static function initialize_system_questions() { |
866 | 866 | // QUESTION GROUPS |
867 | 867 | global $wpdb; |
868 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' ); |
|
868 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group'); |
|
869 | 869 | $SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0"; |
870 | 870 | // what we have |
871 | - $question_groups = $wpdb->get_col( $SQL ); |
|
871 | + $question_groups = $wpdb->get_col($SQL); |
|
872 | 872 | // check the response |
873 | - $question_groups = is_array( $question_groups ) ? $question_groups : array(); |
|
873 | + $question_groups = is_array($question_groups) ? $question_groups : array(); |
|
874 | 874 | // what we should have |
875 | - $QSG_systems = array( 1, 2 ); |
|
875 | + $QSG_systems = array(1, 2); |
|
876 | 876 | // loop thru what we should have and compare to what we have |
877 | - foreach ( $QSG_systems as $QSG_system ) { |
|
877 | + foreach ($QSG_systems as $QSG_system) { |
|
878 | 878 | // reset values array |
879 | 879 | $QSG_values = array(); |
880 | 880 | // if we don't have what we should have (but use $QST_system as as string because that's what we got from the db) |
881 | - if ( ! in_array( "$QSG_system", $question_groups )) { |
|
881 | + if ( ! in_array("$QSG_system", $question_groups)) { |
|
882 | 882 | // add it |
883 | - switch ( $QSG_system ) { |
|
883 | + switch ($QSG_system) { |
|
884 | 884 | |
885 | 885 | case 1: |
886 | 886 | $QSG_values = array( |
887 | - 'QSG_name' => __( 'Personal Information', 'event_espresso' ), |
|
888 | - 'QSG_identifier' => 'personal-information-' . time(), |
|
887 | + 'QSG_name' => __('Personal Information', 'event_espresso'), |
|
888 | + 'QSG_identifier' => 'personal-information-'.time(), |
|
889 | 889 | 'QSG_desc' => '', |
890 | 890 | 'QSG_order' => 1, |
891 | 891 | 'QSG_show_group_name' => 1, |
@@ -897,8 +897,8 @@ discard block |
||
897 | 897 | |
898 | 898 | case 2: |
899 | 899 | $QSG_values = array( |
900 | - 'QSG_name' => __( 'Address Information','event_espresso' ), |
|
901 | - 'QSG_identifier' => 'address-information-' . time(), |
|
900 | + 'QSG_name' => __('Address Information', 'event_espresso'), |
|
901 | + 'QSG_identifier' => 'address-information-'.time(), |
|
902 | 902 | 'QSG_desc' => '', |
903 | 903 | 'QSG_order' => 2, |
904 | 904 | 'QSG_show_group_name' => 1, |
@@ -910,14 +910,14 @@ discard block |
||
910 | 910 | |
911 | 911 | } |
912 | 912 | // make sure we have some values before inserting them |
913 | - if ( ! empty( $QSG_values )) { |
|
913 | + if ( ! empty($QSG_values)) { |
|
914 | 914 | // insert system question |
915 | 915 | $wpdb->insert( |
916 | 916 | $table_name, |
917 | 917 | $QSG_values, |
918 | - array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) |
|
918 | + array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d') |
|
919 | 919 | ); |
920 | - $QSG_IDs[ $QSG_system ] = $wpdb->insert_id; |
|
920 | + $QSG_IDs[$QSG_system] = $wpdb->insert_id; |
|
921 | 921 | } |
922 | 922 | } |
923 | 923 | } |
@@ -926,10 +926,10 @@ discard block |
||
926 | 926 | |
927 | 927 | // QUESTIONS |
928 | 928 | global $wpdb; |
929 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' ); |
|
929 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question'); |
|
930 | 930 | $SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''"; |
931 | 931 | // what we have |
932 | - $questions = $wpdb->get_col( $SQL ); |
|
932 | + $questions = $wpdb->get_col($SQL); |
|
933 | 933 | // what we should have |
934 | 934 | $QST_systems = array( |
935 | 935 | 'fname', |
@@ -946,25 +946,25 @@ discard block |
||
946 | 946 | $order_for_group_1 = 1; |
947 | 947 | $order_for_group_2 = 1; |
948 | 948 | // loop thru what we should have and compare to what we have |
949 | - foreach ( $QST_systems as $QST_system ) { |
|
949 | + foreach ($QST_systems as $QST_system) { |
|
950 | 950 | // reset values array |
951 | 951 | $QST_values = array(); |
952 | 952 | // if we don't have what we should have |
953 | - if ( ! in_array( $QST_system, $questions )) { |
|
953 | + if ( ! in_array($QST_system, $questions)) { |
|
954 | 954 | // add it |
955 | - switch ( $QST_system ) { |
|
955 | + switch ($QST_system) { |
|
956 | 956 | |
957 | 957 | case 'fname': |
958 | 958 | $QST_values = array( |
959 | - 'QST_display_text' => __( 'First Name', 'event_espresso' ), |
|
960 | - 'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ), |
|
959 | + 'QST_display_text' => __('First Name', 'event_espresso'), |
|
960 | + 'QST_admin_label' => __('First Name - System Question', 'event_espresso'), |
|
961 | 961 | 'QST_system' => 'fname', |
962 | 962 | 'QST_type' => 'TEXT', |
963 | 963 | 'QST_required' => 1, |
964 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
964 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
965 | 965 | 'QST_order' => 1, |
966 | 966 | 'QST_admin_only' => 0, |
967 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
967 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
968 | 968 | 'QST_wp_user' => self::get_default_creator_id(), |
969 | 969 | 'QST_deleted' => 0 |
970 | 970 | ); |
@@ -972,15 +972,15 @@ discard block |
||
972 | 972 | |
973 | 973 | case 'lname': |
974 | 974 | $QST_values = array( |
975 | - 'QST_display_text' => __( 'Last Name', 'event_espresso' ), |
|
976 | - 'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ), |
|
975 | + 'QST_display_text' => __('Last Name', 'event_espresso'), |
|
976 | + 'QST_admin_label' => __('Last Name - System Question', 'event_espresso'), |
|
977 | 977 | 'QST_system' => 'lname', |
978 | 978 | 'QST_type' => 'TEXT', |
979 | 979 | 'QST_required' => 1, |
980 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
980 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
981 | 981 | 'QST_order' => 2, |
982 | 982 | 'QST_admin_only' => 0, |
983 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
983 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
984 | 984 | 'QST_wp_user' => self::get_default_creator_id(), |
985 | 985 | 'QST_deleted' => 0 |
986 | 986 | ); |
@@ -988,15 +988,15 @@ discard block |
||
988 | 988 | |
989 | 989 | case 'email': |
990 | 990 | $QST_values = array( |
991 | - 'QST_display_text' => __( 'Email Address', 'event_espresso' ), |
|
992 | - 'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ), |
|
991 | + 'QST_display_text' => __('Email Address', 'event_espresso'), |
|
992 | + 'QST_admin_label' => __('Email Address - System Question', 'event_espresso'), |
|
993 | 993 | 'QST_system' => 'email', |
994 | 994 | 'QST_type' => 'EMAIL', |
995 | 995 | 'QST_required' => 1, |
996 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
996 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
997 | 997 | 'QST_order' => 3, |
998 | 998 | 'QST_admin_only' => 0, |
999 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
999 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1000 | 1000 | 'QST_wp_user' => self::get_default_creator_id(), |
1001 | 1001 | 'QST_deleted' => 0 |
1002 | 1002 | ); |
@@ -1004,15 +1004,15 @@ discard block |
||
1004 | 1004 | |
1005 | 1005 | case 'address': |
1006 | 1006 | $QST_values = array( |
1007 | - 'QST_display_text' => __( 'Address', 'event_espresso' ), |
|
1008 | - 'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ), |
|
1007 | + 'QST_display_text' => __('Address', 'event_espresso'), |
|
1008 | + 'QST_admin_label' => __('Address - System Question', 'event_espresso'), |
|
1009 | 1009 | 'QST_system' => 'address', |
1010 | 1010 | 'QST_type' => 'TEXT', |
1011 | 1011 | 'QST_required' => 0, |
1012 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1012 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1013 | 1013 | 'QST_order' => 4, |
1014 | 1014 | 'QST_admin_only' => 0, |
1015 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1015 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1016 | 1016 | 'QST_wp_user' => self::get_default_creator_id(), |
1017 | 1017 | 'QST_deleted' => 0 |
1018 | 1018 | ); |
@@ -1020,15 +1020,15 @@ discard block |
||
1020 | 1020 | |
1021 | 1021 | case 'address2': |
1022 | 1022 | $QST_values = array( |
1023 | - 'QST_display_text' => __( 'Address2', 'event_espresso' ), |
|
1024 | - 'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ), |
|
1023 | + 'QST_display_text' => __('Address2', 'event_espresso'), |
|
1024 | + 'QST_admin_label' => __('Address2 - System Question', 'event_espresso'), |
|
1025 | 1025 | 'QST_system' => 'address2', |
1026 | 1026 | 'QST_type' => 'TEXT', |
1027 | 1027 | 'QST_required' => 0, |
1028 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1028 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1029 | 1029 | 'QST_order' => 5, |
1030 | 1030 | 'QST_admin_only' => 0, |
1031 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1031 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1032 | 1032 | 'QST_wp_user' => self::get_default_creator_id(), |
1033 | 1033 | 'QST_deleted' => 0 |
1034 | 1034 | ); |
@@ -1036,15 +1036,15 @@ discard block |
||
1036 | 1036 | |
1037 | 1037 | case 'city': |
1038 | 1038 | $QST_values = array( |
1039 | - 'QST_display_text' => __( 'City', 'event_espresso' ), |
|
1040 | - 'QST_admin_label' => __( 'City - System Question', 'event_espresso' ), |
|
1039 | + 'QST_display_text' => __('City', 'event_espresso'), |
|
1040 | + 'QST_admin_label' => __('City - System Question', 'event_espresso'), |
|
1041 | 1041 | 'QST_system' => 'city', |
1042 | 1042 | 'QST_type' => 'TEXT', |
1043 | 1043 | 'QST_required' => 0, |
1044 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1044 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1045 | 1045 | 'QST_order' => 6, |
1046 | 1046 | 'QST_admin_only' => 0, |
1047 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1047 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1048 | 1048 | 'QST_wp_user' => self::get_default_creator_id(), |
1049 | 1049 | 'QST_deleted' => 0 |
1050 | 1050 | ); |
@@ -1052,12 +1052,12 @@ discard block |
||
1052 | 1052 | |
1053 | 1053 | case 'state': |
1054 | 1054 | $QST_values = array( |
1055 | - 'QST_display_text' => __( 'State/Province', 'event_espresso' ), |
|
1056 | - 'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ), |
|
1055 | + 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
1056 | + 'QST_admin_label' => __('State/Province - System Question', 'event_espresso'), |
|
1057 | 1057 | 'QST_system' => 'state', |
1058 | 1058 | 'QST_type' => 'STATE', |
1059 | 1059 | 'QST_required' => 0, |
1060 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1060 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1061 | 1061 | 'QST_order' => 7, |
1062 | 1062 | 'QST_admin_only' => 0, |
1063 | 1063 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1067,12 +1067,12 @@ discard block |
||
1067 | 1067 | |
1068 | 1068 | case 'country' : |
1069 | 1069 | $QST_values = array( |
1070 | - 'QST_display_text' => __( 'Country', 'event_espresso' ), |
|
1071 | - 'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ), |
|
1070 | + 'QST_display_text' => __('Country', 'event_espresso'), |
|
1071 | + 'QST_admin_label' => __('Country - System Question', 'event_espresso'), |
|
1072 | 1072 | 'QST_system' => 'country', |
1073 | 1073 | 'QST_type' => 'COUNTRY', |
1074 | 1074 | 'QST_required' => 0, |
1075 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1075 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1076 | 1076 | 'QST_order' => 8, |
1077 | 1077 | 'QST_admin_only' => 0, |
1078 | 1078 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1082,15 +1082,15 @@ discard block |
||
1082 | 1082 | |
1083 | 1083 | case 'zip': |
1084 | 1084 | $QST_values = array( |
1085 | - 'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ), |
|
1086 | - 'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ), |
|
1085 | + 'QST_display_text' => __('Zip/Postal Code', 'event_espresso'), |
|
1086 | + 'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'), |
|
1087 | 1087 | 'QST_system' => 'zip', |
1088 | 1088 | 'QST_type' => 'TEXT', |
1089 | 1089 | 'QST_required' => 0, |
1090 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1090 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1091 | 1091 | 'QST_order' => 9, |
1092 | 1092 | 'QST_admin_only' => 0, |
1093 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1093 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1094 | 1094 | 'QST_wp_user' => self::get_default_creator_id(), |
1095 | 1095 | 'QST_deleted' => 0 |
1096 | 1096 | ); |
@@ -1098,49 +1098,49 @@ discard block |
||
1098 | 1098 | |
1099 | 1099 | case 'phone': |
1100 | 1100 | $QST_values = array( |
1101 | - 'QST_display_text' => __( 'Phone Number', 'event_espresso' ), |
|
1102 | - 'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ), |
|
1101 | + 'QST_display_text' => __('Phone Number', 'event_espresso'), |
|
1102 | + 'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'), |
|
1103 | 1103 | 'QST_system' => 'phone', |
1104 | 1104 | 'QST_type' => 'TEXT', |
1105 | 1105 | 'QST_required' => 0, |
1106 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1106 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1107 | 1107 | 'QST_order' => 10, |
1108 | 1108 | 'QST_admin_only' => 0, |
1109 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1109 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1110 | 1110 | 'QST_wp_user' => self::get_default_creator_id(), |
1111 | 1111 | 'QST_deleted' => 0 |
1112 | 1112 | ); |
1113 | 1113 | break; |
1114 | 1114 | |
1115 | 1115 | } |
1116 | - if ( ! empty( $QST_values )) { |
|
1116 | + if ( ! empty($QST_values)) { |
|
1117 | 1117 | // insert system question |
1118 | 1118 | $wpdb->insert( |
1119 | 1119 | $table_name, |
1120 | 1120 | $QST_values, |
1121 | - array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' ) |
|
1121 | + array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d') |
|
1122 | 1122 | ); |
1123 | 1123 | $QST_ID = $wpdb->insert_id; |
1124 | 1124 | |
1125 | 1125 | // QUESTION GROUP QUESTIONS |
1126 | - if( in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) { |
|
1126 | + if (in_array($QST_system, array('fname', 'lname', 'email'))) { |
|
1127 | 1127 | $system_question_we_want = EEM_Question_Group::system_personal; |
1128 | 1128 | } else { |
1129 | 1129 | $system_question_we_want = EEM_Question_Group::system_address; |
1130 | 1130 | } |
1131 | - if( isset( $QSG_IDs[ $system_question_we_want ] ) ) { |
|
1132 | - $QSG_ID = $QSG_IDs[ $system_question_we_want ]; |
|
1131 | + if (isset($QSG_IDs[$system_question_we_want])) { |
|
1132 | + $QSG_ID = $QSG_IDs[$system_question_we_want]; |
|
1133 | 1133 | } else { |
1134 | - $id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) ); |
|
1135 | - if( is_array( $id_col ) ) { |
|
1136 | - $QSG_ID = reset( $id_col ); |
|
1134 | + $id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want))); |
|
1135 | + if (is_array($id_col)) { |
|
1136 | + $QSG_ID = reset($id_col); |
|
1137 | 1137 | } else { |
1138 | 1138 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
1139 | 1139 | EE_Log::instance()->log( |
1140 | 1140 | __FILE__, |
1141 | 1141 | __FUNCTION__, |
1142 | 1142 | sprintf( |
1143 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1143 | + __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1144 | 1144 | $QST_ID ), |
1145 | 1145 | 'error' ); |
1146 | 1146 | continue; |
@@ -1149,12 +1149,12 @@ discard block |
||
1149 | 1149 | |
1150 | 1150 | // add system questions to groups |
1151 | 1151 | $wpdb->insert( |
1152 | - EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ), |
|
1153 | - array( 'QSG_ID' => $QSG_ID, |
|
1152 | + EEH_Activation::ensure_table_name_has_prefix('esp_question_group_question'), |
|
1153 | + array('QSG_ID' => $QSG_ID, |
|
1154 | 1154 | 'QST_ID' => $QST_ID, |
1155 | - 'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++ |
|
1155 | + 'QGQ_order' => ($QSG_ID === 1) ? $order_for_group_1++ : $order_for_group_2++ |
|
1156 | 1156 | ), |
1157 | - array( '%d', '%d', '%d' ) |
|
1157 | + array('%d', '%d', '%d') |
|
1158 | 1158 | ); |
1159 | 1159 | } |
1160 | 1160 | } |
@@ -1170,11 +1170,11 @@ discard block |
||
1170 | 1170 | * |
1171 | 1171 | * @throws \EE_Error |
1172 | 1172 | */ |
1173 | - public static function insert_default_payment_methods(){ |
|
1174 | - if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
|
1175 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
1176 | - EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
1177 | - }else{ |
|
1173 | + public static function insert_default_payment_methods() { |
|
1174 | + if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) { |
|
1175 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
1176 | + EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
1177 | + } else { |
|
1178 | 1178 | EEM_Payment_Method::instance()->verify_button_urls(); |
1179 | 1179 | } |
1180 | 1180 | } |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | global $wpdb; |
1192 | 1192 | |
1193 | - if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) { |
|
1193 | + if (EEH_Activation::table_exists(EEM_Status::instance()->table())) { |
|
1194 | 1194 | |
1195 | 1195 | $table_name = EEM_Status::instance()->table(); |
1196 | 1196 | |
@@ -1265,33 +1265,33 @@ discard block |
||
1265 | 1265 | $folders = array( |
1266 | 1266 | EVENT_ESPRESSO_TEMPLATE_DIR, |
1267 | 1267 | EVENT_ESPRESSO_GATEWAY_DIR, |
1268 | - EVENT_ESPRESSO_UPLOAD_DIR . 'logs/', |
|
1269 | - EVENT_ESPRESSO_UPLOAD_DIR . 'css/', |
|
1270 | - EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/' |
|
1268 | + EVENT_ESPRESSO_UPLOAD_DIR.'logs/', |
|
1269 | + EVENT_ESPRESSO_UPLOAD_DIR.'css/', |
|
1270 | + EVENT_ESPRESSO_UPLOAD_DIR.'tickets/' |
|
1271 | 1271 | ); |
1272 | - foreach ( $folders as $folder ) { |
|
1272 | + foreach ($folders as $folder) { |
|
1273 | 1273 | try { |
1274 | - EEH_File::ensure_folder_exists_and_is_writable( $folder ); |
|
1275 | - @ chmod( $folder, 0755 ); |
|
1276 | - } catch( EE_Error $e ){ |
|
1274 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
1275 | + @ chmod($folder, 0755); |
|
1276 | + } catch (EE_Error $e) { |
|
1277 | 1277 | EE_Error::add_error( |
1278 | 1278 | sprintf( |
1279 | - __( 'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ), |
|
1279 | + __('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'), |
|
1280 | 1280 | $folder, |
1281 | - '<br />' . $e->getMessage() |
|
1281 | + '<br />'.$e->getMessage() |
|
1282 | 1282 | ), |
1283 | 1283 | __FILE__, __FUNCTION__, __LINE__ |
1284 | 1284 | ); |
1285 | 1285 | //indicate we'll need to fix this later |
1286 | - update_option( EEH_Activation::upload_directories_incomplete_option_name, true ); |
|
1286 | + update_option(EEH_Activation::upload_directories_incomplete_option_name, true); |
|
1287 | 1287 | return FALSE; |
1288 | 1288 | } |
1289 | 1289 | } |
1290 | 1290 | //just add the .htaccess file to the logs directory to begin with. Even if logging |
1291 | 1291 | //is disabled, there might be activation errors recorded in there |
1292 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' ); |
|
1292 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/'); |
|
1293 | 1293 | //remember EE's folders are all good |
1294 | - delete_option( EEH_Activation::upload_directories_incomplete_option_name ); |
|
1294 | + delete_option(EEH_Activation::upload_directories_incomplete_option_name); |
|
1295 | 1295 | return TRUE; |
1296 | 1296 | } |
1297 | 1297 | |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | * @return boolean |
1305 | 1305 | */ |
1306 | 1306 | public static function upload_directories_incomplete() { |
1307 | - return get_option( EEH_Activation::upload_directories_incomplete_option_name, false ); |
|
1307 | + return get_option(EEH_Activation::upload_directories_incomplete_option_name, false); |
|
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | |
@@ -1321,7 +1321,7 @@ discard block |
||
1321 | 1321 | */ |
1322 | 1322 | public static function generate_default_message_templates() { |
1323 | 1323 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
1324 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
1324 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
1325 | 1325 | /* |
1326 | 1326 | * This first method is taking care of ensuring any default messengers |
1327 | 1327 | * that should be made active and have templates generated are done. |
@@ -1357,22 +1357,22 @@ discard block |
||
1357 | 1357 | $active_messengers = $message_resource_manager->active_messengers(); |
1358 | 1358 | $installed_message_types = $message_resource_manager->installed_message_types(); |
1359 | 1359 | $templates_created = false; |
1360 | - foreach ( $active_messengers as $active_messenger ) { |
|
1360 | + foreach ($active_messengers as $active_messenger) { |
|
1361 | 1361 | $default_message_type_names_for_messenger = $active_messenger->get_default_message_types(); |
1362 | 1362 | $default_message_type_names_to_activate = array(); |
1363 | 1363 | // looping through each default message type reported by the messenger |
1364 | 1364 | // and setup the actual message types to activate. |
1365 | - foreach ( $default_message_type_names_for_messenger as $default_message_type_name_for_messenger ) { |
|
1365 | + foreach ($default_message_type_names_for_messenger as $default_message_type_name_for_messenger) { |
|
1366 | 1366 | // if already active or has already been activated before we skip |
1367 | 1367 | // (otherwise we might reactivate something user's intentionally deactivated.) |
1368 | 1368 | // we also skip if the message type is not installed. |
1369 | 1369 | if ( |
1370 | - $message_resource_manager->has_message_type_been_activated_for_messenger( $default_message_type_name_for_messenger, $active_messenger->name ) |
|
1370 | + $message_resource_manager->has_message_type_been_activated_for_messenger($default_message_type_name_for_messenger, $active_messenger->name) |
|
1371 | 1371 | || $message_resource_manager->is_message_type_active_for_messenger( |
1372 | 1372 | $active_messenger->name, |
1373 | 1373 | $default_message_type_name_for_messenger |
1374 | 1374 | ) |
1375 | - || ! isset( $installed_message_types[ $default_message_type_name_for_messenger ] ) |
|
1375 | + || ! isset($installed_message_types[$default_message_type_name_for_messenger]) |
|
1376 | 1376 | ) { |
1377 | 1377 | continue; |
1378 | 1378 | } |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | false |
1386 | 1386 | ); |
1387 | 1387 | //activate the templates for these message types |
1388 | - if ( ! empty( $default_message_type_names_to_activate ) ) { |
|
1388 | + if ( ! empty($default_message_type_names_to_activate)) { |
|
1389 | 1389 | $templates_created = EEH_MSG_Template::generate_new_templates( |
1390 | 1390 | $active_messenger->name, |
1391 | 1391 | $default_message_type_names_for_messenger, |
@@ -1412,18 +1412,18 @@ discard block |
||
1412 | 1412 | EE_Message_Resource_Manager $message_resource_manager |
1413 | 1413 | ) { |
1414 | 1414 | /** @type EE_messenger[] $messengers_to_generate */ |
1415 | - $messengers_to_generate = self::_get_default_messengers_to_generate_on_activation( $message_resource_manager ); |
|
1415 | + $messengers_to_generate = self::_get_default_messengers_to_generate_on_activation($message_resource_manager); |
|
1416 | 1416 | $installed_message_types = $message_resource_manager->installed_message_types(); |
1417 | 1417 | $templates_generated = false; |
1418 | - foreach ( $messengers_to_generate as $messenger_to_generate ) { |
|
1418 | + foreach ($messengers_to_generate as $messenger_to_generate) { |
|
1419 | 1419 | $default_message_type_names_for_messenger = $messenger_to_generate->get_default_message_types(); |
1420 | 1420 | //verify the default message types match an installed message type. |
1421 | - foreach ( $default_message_type_names_for_messenger as $key => $name ) { |
|
1421 | + foreach ($default_message_type_names_for_messenger as $key => $name) { |
|
1422 | 1422 | if ( |
1423 | - ! isset( $installed_message_types[ $name ] ) |
|
1424 | - || $message_resource_manager->has_message_type_been_activated_for_messenger( $name, $messenger_to_generate->name ) |
|
1423 | + ! isset($installed_message_types[$name]) |
|
1424 | + || $message_resource_manager->has_message_type_been_activated_for_messenger($name, $messenger_to_generate->name) |
|
1425 | 1425 | ) { |
1426 | - unset( $default_message_type_names_for_messenger[ $key ] ); |
|
1426 | + unset($default_message_type_names_for_messenger[$key]); |
|
1427 | 1427 | } |
1428 | 1428 | } |
1429 | 1429 | // in previous iterations, the active_messengers option in the db |
@@ -1437,7 +1437,7 @@ discard block |
||
1437 | 1437 | false |
1438 | 1438 | ); |
1439 | 1439 | //create any templates needing created (or will reactivate templates already generated as necessary). |
1440 | - if ( ! empty( $default_message_type_names_for_messenger ) ) { |
|
1440 | + if ( ! empty($default_message_type_names_for_messenger)) { |
|
1441 | 1441 | $templates_generated = EEH_MSG_Template::generate_new_templates( |
1442 | 1442 | $messenger_to_generate->name, |
1443 | 1443 | $default_message_type_names_for_messenger, |
@@ -1469,18 +1469,18 @@ discard block |
||
1469 | 1469 | $has_activated = $message_resource_manager->get_has_activated_messengers_option(); |
1470 | 1470 | |
1471 | 1471 | $messengers_to_generate = array(); |
1472 | - foreach ( $installed_messengers as $installed_messenger ) { |
|
1472 | + foreach ($installed_messengers as $installed_messenger) { |
|
1473 | 1473 | //if installed messenger is a messenger that should be activated on install |
1474 | 1474 | //and is not already active |
1475 | 1475 | //and has never been activated |
1476 | 1476 | if ( |
1477 | 1477 | ! $installed_messenger->activate_on_install |
1478 | - || isset( $active_messengers[ $installed_messenger->name ] ) |
|
1479 | - || isset( $has_activated[ $installed_messenger->name ] ) |
|
1478 | + || isset($active_messengers[$installed_messenger->name]) |
|
1479 | + || isset($has_activated[$installed_messenger->name]) |
|
1480 | 1480 | ) { |
1481 | 1481 | continue; |
1482 | 1482 | } |
1483 | - $messengers_to_generate[ $installed_messenger->name ] = $installed_messenger; |
|
1483 | + $messengers_to_generate[$installed_messenger->name] = $installed_messenger; |
|
1484 | 1484 | } |
1485 | 1485 | return $messengers_to_generate; |
1486 | 1486 | } |
@@ -1505,9 +1505,9 @@ discard block |
||
1505 | 1505 | */ |
1506 | 1506 | public static function validate_messages_system() { |
1507 | 1507 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
1508 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
1508 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
1509 | 1509 | $message_resource_manager->validate_active_message_types_are_installed(); |
1510 | - do_action( 'AHEE__EEH_Activation__validate_messages_system' ); |
|
1510 | + do_action('AHEE__EEH_Activation__validate_messages_system'); |
|
1511 | 1511 | } |
1512 | 1512 | |
1513 | 1513 | |
@@ -1520,12 +1520,12 @@ discard block |
||
1520 | 1520 | * @static |
1521 | 1521 | * @return void |
1522 | 1522 | */ |
1523 | - public static function create_no_ticket_prices_array(){ |
|
1523 | + public static function create_no_ticket_prices_array() { |
|
1524 | 1524 | // this creates an array for tracking events that have no active ticket prices created |
1525 | 1525 | // this allows us to warn admins of the situation so that it can be corrected |
1526 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE ); |
|
1527 | - if ( ! $espresso_no_ticket_prices ) { |
|
1528 | - add_option( 'ee_no_ticket_prices', array(), '', FALSE ); |
|
1526 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE); |
|
1527 | + if ( ! $espresso_no_ticket_prices) { |
|
1528 | + add_option('ee_no_ticket_prices', array(), '', FALSE); |
|
1529 | 1529 | } |
1530 | 1530 | } |
1531 | 1531 | |
@@ -1550,24 +1550,24 @@ discard block |
||
1550 | 1550 | * @global wpdb $wpdb |
1551 | 1551 | * @throws \EE_Error |
1552 | 1552 | */ |
1553 | - public static function delete_all_espresso_cpt_data(){ |
|
1553 | + public static function delete_all_espresso_cpt_data() { |
|
1554 | 1554 | global $wpdb; |
1555 | 1555 | //get all the CPT post_types |
1556 | 1556 | $ee_post_types = array(); |
1557 | - foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){ |
|
1558 | - if ( method_exists( $model_name, 'instance' )) { |
|
1559 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1560 | - if ( $model_obj instanceof EEM_CPT_Base ) { |
|
1561 | - $ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type()); |
|
1557 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1558 | + if (method_exists($model_name, 'instance')) { |
|
1559 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1560 | + if ($model_obj instanceof EEM_CPT_Base) { |
|
1561 | + $ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type()); |
|
1562 | 1562 | } |
1563 | 1563 | } |
1564 | 1564 | } |
1565 | 1565 | //get all our CPTs |
1566 | - $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")"; |
|
1566 | + $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")"; |
|
1567 | 1567 | $cpt_ids = $wpdb->get_col($query); |
1568 | 1568 | //delete each post meta and term relations too |
1569 | - foreach($cpt_ids as $post_id){ |
|
1570 | - wp_delete_post($post_id,true); |
|
1569 | + foreach ($cpt_ids as $post_id) { |
|
1570 | + wp_delete_post($post_id, true); |
|
1571 | 1571 | } |
1572 | 1572 | } |
1573 | 1573 | |
@@ -1581,18 +1581,18 @@ discard block |
||
1581 | 1581 | * @param bool $remove_all |
1582 | 1582 | * @return void |
1583 | 1583 | */ |
1584 | - public static function delete_all_espresso_tables_and_data( $remove_all = true ) { |
|
1584 | + public static function delete_all_espresso_tables_and_data($remove_all = true) { |
|
1585 | 1585 | global $wpdb; |
1586 | 1586 | $undeleted_tables = array(); |
1587 | 1587 | |
1588 | 1588 | // load registry |
1589 | - foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){ |
|
1590 | - if ( method_exists( $model_name, 'instance' )) { |
|
1591 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1592 | - if ( $model_obj instanceof EEM_Base ) { |
|
1593 | - foreach ( $model_obj->get_tables() as $table ) { |
|
1594 | - if ( strpos( $table->get_table_name(), 'esp_' )) { |
|
1595 | - switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) { |
|
1589 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1590 | + if (method_exists($model_name, 'instance')) { |
|
1591 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1592 | + if ($model_obj instanceof EEM_Base) { |
|
1593 | + foreach ($model_obj->get_tables() as $table) { |
|
1594 | + if (strpos($table->get_table_name(), 'esp_')) { |
|
1595 | + switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) { |
|
1596 | 1596 | case false : |
1597 | 1597 | $undeleted_tables[] = $table->get_table_name(); |
1598 | 1598 | break; |
@@ -1617,8 +1617,8 @@ discard block |
||
1617 | 1617 | 'esp_promotion_rule', |
1618 | 1618 | 'esp_rule' |
1619 | 1619 | ); |
1620 | - foreach( $tables_without_models as $table ){ |
|
1621 | - EEH_Activation::delete_db_table_if_empty( $table ); |
|
1620 | + foreach ($tables_without_models as $table) { |
|
1621 | + EEH_Activation::delete_db_table_if_empty($table); |
|
1622 | 1622 | } |
1623 | 1623 | |
1624 | 1624 | |
@@ -1656,58 +1656,58 @@ discard block |
||
1656 | 1656 | 'ee_job_parameters_' => false, |
1657 | 1657 | 'ee_upload_directories_incomplete' => true, |
1658 | 1658 | ); |
1659 | - if( is_main_site() ) { |
|
1660 | - $wp_options_to_delete[ 'ee_network_config' ] = true; |
|
1659 | + if (is_main_site()) { |
|
1660 | + $wp_options_to_delete['ee_network_config'] = true; |
|
1661 | 1661 | } |
1662 | 1662 | |
1663 | 1663 | $undeleted_options = array(); |
1664 | - foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) { |
|
1664 | + foreach ($wp_options_to_delete as $option_name => $no_wildcard) { |
|
1665 | 1665 | |
1666 | - if( $no_wildcard ){ |
|
1667 | - if( ! delete_option( $option_name ) ){ |
|
1666 | + if ($no_wildcard) { |
|
1667 | + if ( ! delete_option($option_name)) { |
|
1668 | 1668 | $undeleted_options[] = $option_name; |
1669 | 1669 | } |
1670 | - }else{ |
|
1671 | - $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
|
1672 | - foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
|
1673 | - if( ! delete_option( $option_name_from_wildcard ) ){ |
|
1670 | + } else { |
|
1671 | + $option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'"); |
|
1672 | + foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) { |
|
1673 | + if ( ! delete_option($option_name_from_wildcard)) { |
|
1674 | 1674 | $undeleted_options[] = $option_name_from_wildcard; |
1675 | 1675 | } |
1676 | 1676 | } |
1677 | 1677 | } |
1678 | 1678 | } |
1679 | 1679 | //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
1680 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1680 | + remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10); |
|
1681 | 1681 | |
1682 | - if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
|
1682 | + if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) { |
|
1683 | 1683 | $db_update_sans_ee4 = array(); |
1684 | - foreach($espresso_db_update as $version => $times_activated){ |
|
1685 | - if( (string)$version[0] === '3'){//if its NON EE4 |
|
1684 | + foreach ($espresso_db_update as $version => $times_activated) { |
|
1685 | + if ((string) $version[0] === '3') {//if its NON EE4 |
|
1686 | 1686 | $db_update_sans_ee4[$version] = $times_activated; |
1687 | 1687 | } |
1688 | 1688 | } |
1689 | - update_option( 'espresso_db_update', $db_update_sans_ee4 ); |
|
1689 | + update_option('espresso_db_update', $db_update_sans_ee4); |
|
1690 | 1690 | } |
1691 | 1691 | |
1692 | 1692 | $errors = ''; |
1693 | - if ( ! empty( $undeleted_tables )) { |
|
1693 | + if ( ! empty($undeleted_tables)) { |
|
1694 | 1694 | $errors .= sprintf( |
1695 | - __( 'The following tables could not be deleted: %s%s', 'event_espresso' ), |
|
1695 | + __('The following tables could not be deleted: %s%s', 'event_espresso'), |
|
1696 | 1696 | '<br/>', |
1697 | - implode( ',<br/>', $undeleted_tables ) |
|
1697 | + implode(',<br/>', $undeleted_tables) |
|
1698 | 1698 | ); |
1699 | 1699 | } |
1700 | - if ( ! empty( $undeleted_options )) { |
|
1701 | - $errors .= ! empty( $undeleted_tables ) ? '<br/>' : ''; |
|
1700 | + if ( ! empty($undeleted_options)) { |
|
1701 | + $errors .= ! empty($undeleted_tables) ? '<br/>' : ''; |
|
1702 | 1702 | $errors .= sprintf( |
1703 | - __( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ), |
|
1703 | + __('The following wp-options could not be deleted: %s%s', 'event_espresso'), |
|
1704 | 1704 | '<br/>', |
1705 | - implode( ',<br/>', $undeleted_options ) |
|
1705 | + implode(',<br/>', $undeleted_options) |
|
1706 | 1706 | ); |
1707 | 1707 | |
1708 | 1708 | } |
1709 | - if ( ! empty( $errors ) ) { |
|
1710 | - EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
1709 | + if ( ! empty($errors)) { |
|
1710 | + EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__); |
|
1711 | 1711 | } |
1712 | 1712 | } |
1713 | 1713 | |
@@ -1717,10 +1717,10 @@ discard block |
||
1717 | 1717 | */ |
1718 | 1718 | public static function last_wpdb_error_code() { |
1719 | 1719 | global $wpdb; |
1720 | - if( $wpdb->use_mysqli ) { |
|
1721 | - return mysqli_errno( $wpdb->dbh ); |
|
1720 | + if ($wpdb->use_mysqli) { |
|
1721 | + return mysqli_errno($wpdb->dbh); |
|
1722 | 1722 | } else { |
1723 | - return mysql_errno( $wpdb->dbh ); |
|
1723 | + return mysql_errno($wpdb->dbh); |
|
1724 | 1724 | } |
1725 | 1725 | } |
1726 | 1726 | |
@@ -1730,23 +1730,23 @@ discard block |
||
1730 | 1730 | * @param string $table_name with or without $wpdb->prefix |
1731 | 1731 | * @return boolean |
1732 | 1732 | */ |
1733 | - public static function table_exists( $table_name ){ |
|
1733 | + public static function table_exists($table_name) { |
|
1734 | 1734 | global $wpdb, $EZSQL_ERROR; |
1735 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
1735 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
1736 | 1736 | //ignore if this causes an sql error |
1737 | 1737 | $old_error = $wpdb->last_error; |
1738 | 1738 | $old_suppress_errors = $wpdb->suppress_errors(); |
1739 | - $old_show_errors_value = $wpdb->show_errors( FALSE ); |
|
1739 | + $old_show_errors_value = $wpdb->show_errors(FALSE); |
|
1740 | 1740 | $ezsql_error_cache = $EZSQL_ERROR; |
1741 | - $wpdb->get_results( "SELECT * from $table_name LIMIT 1"); |
|
1742 | - $wpdb->show_errors( $old_show_errors_value ); |
|
1743 | - $wpdb->suppress_errors( $old_suppress_errors ); |
|
1741 | + $wpdb->get_results("SELECT * from $table_name LIMIT 1"); |
|
1742 | + $wpdb->show_errors($old_show_errors_value); |
|
1743 | + $wpdb->suppress_errors($old_suppress_errors); |
|
1744 | 1744 | $new_error = $wpdb->last_error; |
1745 | 1745 | $wpdb->last_error = $old_error; |
1746 | 1746 | $EZSQL_ERROR = $ezsql_error_cache; |
1747 | 1747 | //if there was a table doesn't exist error |
1748 | - if( ! empty( $new_error ) ) { |
|
1749 | - if( |
|
1748 | + if ( ! empty($new_error)) { |
|
1749 | + if ( |
|
1750 | 1750 | in_array( |
1751 | 1751 | EEH_Activation::last_wpdb_error_code(), |
1752 | 1752 | array( |
@@ -1756,14 +1756,14 @@ discard block |
||
1756 | 1756 | ) |
1757 | 1757 | ) |
1758 | 1758 | || |
1759 | - preg_match( '~^Table .* doesn\'t exist~', $new_error ) //in case not using mysql and error codes aren't reliable, just check for this error string |
|
1759 | + preg_match('~^Table .* doesn\'t exist~', $new_error) //in case not using mysql and error codes aren't reliable, just check for this error string |
|
1760 | 1760 | ) { |
1761 | 1761 | return false; |
1762 | 1762 | } else { |
1763 | 1763 | //log this because that's weird. Just use the normal PHP error log |
1764 | 1764 | error_log( |
1765 | 1765 | sprintf( |
1766 | - __( 'Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso' ), |
|
1766 | + __('Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso'), |
|
1767 | 1767 | $new_error |
1768 | 1768 | ) |
1769 | 1769 | ); |
@@ -1775,7 +1775,7 @@ discard block |
||
1775 | 1775 | /** |
1776 | 1776 | * Resets the cache on EEH_Activation |
1777 | 1777 | */ |
1778 | - public static function reset(){ |
|
1778 | + public static function reset() { |
|
1779 | 1779 | self::$_default_creator_id = NULL; |
1780 | 1780 | self::$_initialized_db_content_already_in_this_request = false; |
1781 | 1781 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
466 | 466 | if($post_id){ |
467 | 467 | return get_post($post_id); |
468 | - }else{ |
|
468 | + } else{ |
|
469 | 469 | return NULL; |
470 | 470 | } |
471 | 471 | |
@@ -838,13 +838,13 @@ discard block |
||
838 | 838 | foreach( $current_data_migration_script->get_errors() as $error ){ |
839 | 839 | EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
840 | 840 | } |
841 | - }else{ |
|
841 | + } else{ |
|
842 | 842 | EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
843 | 843 | } |
844 | 844 | return false; |
845 | 845 | } |
846 | 846 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
847 | - }else{ |
|
847 | + } else{ |
|
848 | 848 | EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
849 | 849 | return false; |
850 | 850 | } |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
1175 | 1175 | EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
1176 | 1176 | EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
1177 | - }else{ |
|
1177 | + } else{ |
|
1178 | 1178 | EEM_Payment_Method::instance()->verify_button_urls(); |
1179 | 1179 | } |
1180 | 1180 | } |
@@ -1667,7 +1667,7 @@ discard block |
||
1667 | 1667 | if( ! delete_option( $option_name ) ){ |
1668 | 1668 | $undeleted_options[] = $option_name; |
1669 | 1669 | } |
1670 | - }else{ |
|
1670 | + } else{ |
|
1671 | 1671 | $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
1672 | 1672 | foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
1673 | 1673 | if( ! delete_option( $option_name_from_wildcard ) ){ |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | |
140 | 140 | /** |
141 | - * @return null |
|
141 | + * @return EE_Line_Item_Display |
|
142 | 142 | */ |
143 | 143 | public function line_item_display() { |
144 | 144 | return $this->line_item_display; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | |
149 | 149 | /** |
150 | - * @param null $line_item_display |
|
150 | + * @param EE_Line_Item_Display $line_item_display |
|
151 | 151 | */ |
152 | 152 | public function set_line_item_display( $line_item_display ) { |
153 | 153 | $this->line_item_display = $line_item_display; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | |
230 | 230 | /** |
231 | - * @return bool |
|
231 | + * @return EE_Form_Section_Proper |
|
232 | 232 | * @throws \EE_Error |
233 | 233 | */ |
234 | 234 | public function generate_reg_form() { |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | * _apply_registration_payments_to_amount_owing |
625 | 625 | * |
626 | 626 | * @access protected |
627 | - * @param array $registrations |
|
627 | + * @param EE_Base_Class[] $registrations |
|
628 | 628 | */ |
629 | 629 | protected function _apply_registration_payments_to_amount_owing( array $registrations ) { |
630 | 630 | $payments = array(); |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | * get_billing_form_html_for_payment_method |
898 | 898 | * |
899 | 899 | * @access public |
900 | - * @return string |
|
900 | + * @return boolean |
|
901 | 901 | * @throws \EE_Error |
902 | 902 | */ |
903 | 903 | public function get_billing_form_html_for_payment_method() { |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | * switch_payment_method |
1066 | 1066 | * |
1067 | 1067 | * @access public |
1068 | - * @return string |
|
1068 | + * @return boolean |
|
1069 | 1069 | * @throws \EE_Error |
1070 | 1070 | */ |
1071 | 1071 | public function switch_payment_method() { |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | /** |
1272 | 1272 | * process_reg_step |
1273 | 1273 | * |
1274 | - * @return boolean |
|
1274 | + * @return null|boolean |
|
1275 | 1275 | * @throws \EE_Error |
1276 | 1276 | */ |
1277 | 1277 | public function process_reg_step() { |
@@ -1366,7 +1366,7 @@ discard block |
||
1366 | 1366 | * update_reg_step |
1367 | 1367 | * this is the final step after a user revisits the site to retry a payment |
1368 | 1368 | * |
1369 | - * @return boolean |
|
1369 | + * @return null|boolean |
|
1370 | 1370 | * @throws \EE_Error |
1371 | 1371 | */ |
1372 | 1372 | public function update_reg_step() { |
@@ -1730,7 +1730,7 @@ discard block |
||
1730 | 1730 | * |
1731 | 1731 | * @access private |
1732 | 1732 | * @type EE_Payment_Method $payment_method |
1733 | - * @return mixed EE_Payment | boolean |
|
1733 | + * @return EE_Payment|null EE_Payment | boolean |
|
1734 | 1734 | * @throws \EE_Error |
1735 | 1735 | */ |
1736 | 1736 | private function _attempt_payment( EE_Payment_Method $payment_method ) { |
@@ -1940,6 +1940,7 @@ discard block |
||
1940 | 1940 | * @access private |
1941 | 1941 | * @type EE_Payment $payment |
1942 | 1942 | * @param string $payment_occurs |
1943 | + * @param EE_Payment|null $payment |
|
1943 | 1944 | * @return bool |
1944 | 1945 | * @throws \EE_Error |
1945 | 1946 | */ |
@@ -2050,7 +2051,7 @@ discard block |
||
2050 | 2051 | * or present the payment options again |
2051 | 2052 | * |
2052 | 2053 | * @access private |
2053 | - * @return EE_Payment | FALSE |
|
2054 | + * @return boolean | FALSE |
|
2054 | 2055 | * @throws \EE_Error |
2055 | 2056 | */ |
2056 | 2057 | public function process_gateway_response() { |
@@ -2112,7 +2113,7 @@ discard block |
||
2112 | 2113 | * _validate_return |
2113 | 2114 | * |
2114 | 2115 | * @access private |
2115 | - * @return bool |
|
2116 | + * @return boolean|null |
|
2116 | 2117 | * @throws \EE_Error |
2117 | 2118 | */ |
2118 | 2119 | private function _validate_offsite_return() { |
@@ -2183,8 +2184,8 @@ discard block |
||
2183 | 2184 | * _redirect_wayward_request |
2184 | 2185 | * |
2185 | 2186 | * @access private |
2186 | - * @param \EE_Registration|null $primary_registrant |
|
2187 | - * @return bool |
|
2187 | + * @param EE_Registration $primary_registrant |
|
2188 | + * @return false|null |
|
2188 | 2189 | * @throws \EE_Error |
2189 | 2190 | */ |
2190 | 2191 | private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
@@ -411,9 +411,9 @@ discard block |
||
411 | 411 | 'layout_strategy' => new EE_Template_Layout( |
412 | 412 | array( |
413 | 413 | 'layout_template_file' => SPCO_REG_STEPS_PATH |
414 | - . $this->_slug |
|
415 | - . DS |
|
416 | - . 'sold_out_events.template.php', |
|
414 | + . $this->_slug |
|
415 | + . DS |
|
416 | + . 'sold_out_events.template.php', |
|
417 | 417 | 'template_args' => apply_filters( |
418 | 418 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
419 | 419 | array( |
@@ -465,9 +465,9 @@ discard block |
||
465 | 465 | 'layout_strategy' => new EE_Template_Layout( |
466 | 466 | array( |
467 | 467 | 'layout_template_file' => SPCO_REG_STEPS_PATH |
468 | - . $this->_slug |
|
469 | - . DS |
|
470 | - . 'events_requiring_pre_approval.template.php', // layout_template |
|
468 | + . $this->_slug |
|
469 | + . DS |
|
470 | + . 'events_requiring_pre_approval.template.php', // layout_template |
|
471 | 471 | 'template_args' => apply_filters( |
472 | 472 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
473 | 473 | array( |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | 'layout_strategy' => new EE_Template_Layout( |
510 | 510 | array( |
511 | 511 | 'layout_template_file' => SPCO_REG_STEPS_PATH |
512 | - . $this->_slug |
|
513 | - . DS |
|
514 | - . 'no_payment_required.template.php', // layout_template |
|
512 | + . $this->_slug |
|
513 | + . DS |
|
514 | + . 'no_payment_required.template.php', // layout_template |
|
515 | 515 | 'template_args' => apply_filters( |
516 | 516 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args', |
517 | 517 | array( |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
742 | 742 | } |
743 | 743 | $payment_methods_billing_info[ $payment_method->slug() |
744 | - . '-info' ] = $this->_payment_method_billing_info( |
|
744 | + . '-info' ] = $this->_payment_method_billing_info( |
|
745 | 745 | $payment_method |
746 | 746 | ); |
747 | 747 | } |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | // fill form with attendee info if applicable |
930 | 930 | if ( |
931 | 931 | $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form |
932 | - && $this->checkout->transaction_has_primary_registrant() |
|
932 | + && $this->checkout->transaction_has_primary_registrant() |
|
933 | 933 | ) { |
934 | 934 | $payment_method_billing_form->populate_from_attendee( |
935 | 935 | $this->checkout->transaction->primary_registration()->attendee() |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | // and debug content |
939 | 939 | if ( |
940 | 940 | $payment_method_billing_form instanceof EE_Billing_Info_Form |
941 | - && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
941 | + && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
942 | 942 | ) { |
943 | 943 | $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( |
944 | 944 | $payment_method_billing_form |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | } |
1098 | 1098 | // fill form with attendee info if applicable |
1099 | 1099 | if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form |
1100 | - && $this->checkout->transaction_has_primary_registrant() |
|
1100 | + && $this->checkout->transaction_has_primary_registrant() |
|
1101 | 1101 | ) { |
1102 | 1102 | $this->checkout->billing_form->populate_from_attendee( |
1103 | 1103 | $this->checkout->transaction->primary_registration()->attendee() |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | } |
1106 | 1106 | // and debug content |
1107 | 1107 | if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form |
1108 | - && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
1108 | + && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
1109 | 1109 | ) { |
1110 | 1110 | $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( |
1111 | 1111 | $this->checkout->billing_form |
@@ -1238,8 +1238,8 @@ discard block |
||
1238 | 1238 | } |
1239 | 1239 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1240 | 1240 | if ( ! empty( $attendee_data['ATT_fname'] ) |
1241 | - && ! empty( $attendee_data['ATT_lname'] ) |
|
1242 | - && ! empty( $attendee_data['ATT_email'] ) |
|
1241 | + && ! empty( $attendee_data['ATT_lname'] ) |
|
1242 | + && ! empty( $attendee_data['ATT_email'] ) |
|
1243 | 1243 | ) { |
1244 | 1244 | $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( |
1245 | 1245 | array( |
@@ -1450,7 +1450,7 @@ discard block |
||
1450 | 1450 | $payment_status = $payment->status(); |
1451 | 1451 | if ( |
1452 | 1452 | $payment_status === EEM_Payment::status_id_approved |
1453 | - || $payment_status === EEM_Payment::status_id_pending |
|
1453 | + || $payment_status === EEM_Payment::status_id_pending |
|
1454 | 1454 | ) { |
1455 | 1455 | return true; |
1456 | 1456 | } else { |
@@ -1638,8 +1638,8 @@ discard block |
||
1638 | 1638 | return false; |
1639 | 1639 | } |
1640 | 1640 | if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) |
1641 | - instanceof |
|
1642 | - EE_Attendee |
|
1641 | + instanceof |
|
1642 | + EE_Attendee |
|
1643 | 1643 | ) { |
1644 | 1644 | EE_Error::add_error( |
1645 | 1645 | sprintf( |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -38,32 +38,32 @@ discard block |
||
38 | 38 | public static function set_hooks() { |
39 | 39 | add_filter( |
40 | 40 | 'FHEE__SPCO__EE_Line_Item_Filter_Collection', |
41 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) |
|
41 | + array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters') |
|
42 | 42 | ); |
43 | 43 | add_action( |
44 | 44 | 'wp_ajax_switch_spco_billing_form', |
45 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ) |
|
45 | + array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form') |
|
46 | 46 | ); |
47 | 47 | add_action( |
48 | 48 | 'wp_ajax_nopriv_switch_spco_billing_form', |
49 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ) |
|
49 | + array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form') |
|
50 | 50 | ); |
51 | - add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) ); |
|
51 | + add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
52 | 52 | add_action( |
53 | 53 | 'wp_ajax_nopriv_save_payer_details', |
54 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) |
|
54 | + array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details') |
|
55 | 55 | ); |
56 | 56 | add_action( |
57 | 57 | 'wp_ajax_get_transaction_details_for_gateways', |
58 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
58 | + array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
59 | 59 | ); |
60 | 60 | add_action( |
61 | 61 | 'wp_ajax_nopriv_get_transaction_details_for_gateways', |
62 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
62 | + array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
63 | 63 | ); |
64 | 64 | add_filter( |
65 | 65 | 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', |
66 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), |
|
66 | + array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), |
|
67 | 67 | 10, |
68 | 68 | 1 |
69 | 69 | ); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @throws \EE_Error |
78 | 78 | */ |
79 | 79 | public static function switch_spco_billing_form() { |
80 | - EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' ); |
|
80 | + EED_Single_Page_Checkout::process_ajax_request('switch_payment_method'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @throws \EE_Error |
89 | 89 | */ |
90 | 90 | public static function save_payer_details() { |
91 | - EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' ); |
|
91 | + EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @throws \EE_Error |
100 | 100 | */ |
101 | 101 | public static function get_transaction_details() { |
102 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
102 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | * @param EE_Checkout $checkout |
128 | 128 | * @return \EE_SPCO_Reg_Step_Payment_Options |
129 | 129 | */ |
130 | - public function __construct( EE_Checkout $checkout ) { |
|
130 | + public function __construct(EE_Checkout $checkout) { |
|
131 | 131 | $this->_slug = 'payment_options'; |
132 | - $this->_name = __( 'Payment Options', 'event_espresso' ); |
|
133 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php'; |
|
132 | + $this->_name = __('Payment Options', 'event_espresso'); |
|
133 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php'; |
|
134 | 134 | $this->checkout = $checkout; |
135 | 135 | $this->_reset_success_message(); |
136 | 136 | $this->set_instructions( |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | /** |
156 | 156 | * @param null $line_item_display |
157 | 157 | */ |
158 | - public function set_line_item_display( $line_item_display ) { |
|
158 | + public function set_line_item_display($line_item_display) { |
|
159 | 159 | $this->line_item_display = $line_item_display; |
160 | 160 | } |
161 | 161 | |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | /** |
174 | 174 | * @param boolean $handle_IPN_in_this_request |
175 | 175 | */ |
176 | - public function set_handle_IPN_in_this_request( $handle_IPN_in_this_request ) { |
|
177 | - $this->handle_IPN_in_this_request = filter_var( $handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN ); |
|
176 | + public function set_handle_IPN_in_this_request($handle_IPN_in_this_request) { |
|
177 | + $this->handle_IPN_in_this_request = filter_var($handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | public function enqueue_styles_and_scripts() { |
210 | 210 | $transaction = $this->checkout->transaction; |
211 | 211 | //if the transaction isn't set or nothing is owed on it, don't enqueue any JS |
212 | - if( ! $transaction instanceof EE_Transaction |
|
213 | - || EEH_Money::compare_floats( $transaction->remaining(), 0 ) ) { |
|
212 | + if ( ! $transaction instanceof EE_Transaction |
|
213 | + || EEH_Money::compare_floats($transaction->remaining(), 0)) { |
|
214 | 214 | return; |
215 | 215 | } |
216 | - foreach( EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ) as $payment_method ) { |
|
216 | + foreach (EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart) as $payment_method) { |
|
217 | 217 | $type_obj = $payment_method->type_obj(); |
218 | - if( $type_obj instanceof EE_PMT_Base ) { |
|
219 | - $billing_form = $type_obj->generate_new_billing_form( $transaction ); |
|
220 | - if( $billing_form instanceof EE_Form_Section_Proper ) { |
|
218 | + if ($type_obj instanceof EE_PMT_Base) { |
|
219 | + $billing_form = $type_obj->generate_new_billing_form($transaction); |
|
220 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
221 | 221 | $billing_form->enqueue_js(); |
222 | 222 | } |
223 | 223 | } |
@@ -242,20 +242,20 @@ discard block |
||
242 | 242 | // $ 0.00 transactions (no payment required) |
243 | 243 | ! $this->checkout->payment_required() |
244 | 244 | // but do NOT remove if current action being called belongs to this reg step |
245 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
245 | + && ! is_callable(array($this, $this->checkout->action)) |
|
246 | 246 | && ! $this->completed() |
247 | 247 | ) { |
248 | 248 | // and if so, then we no longer need the Payment Options step |
249 | - if ( $this->is_current_step() ) { |
|
249 | + if ($this->is_current_step()) { |
|
250 | 250 | $this->checkout->generate_reg_form = false; |
251 | 251 | } |
252 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
252 | + $this->checkout->remove_reg_step($this->_slug); |
|
253 | 253 | // DEBUG LOG |
254 | 254 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | // load EEM_Payment_Method |
258 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
258 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
259 | 259 | // get all active payment methods |
260 | 260 | $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
261 | 261 | $this->checkout->transaction, |
@@ -282,14 +282,14 @@ discard block |
||
282 | 282 | $reg_count = 0; |
283 | 283 | $no_payment_required = true; |
284 | 284 | // loop thru registrations to gather info |
285 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
286 | - foreach ( $registrations as $registration ) { |
|
285 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
286 | + foreach ($registrations as $registration) { |
|
287 | 287 | /** @var $registration EE_Registration */ |
288 | 288 | $reg_count++; |
289 | 289 | // registrant is NOT Approved |
290 | - if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) { |
|
290 | + if ($registration->status_ID() === EEM_Registration::status_id_not_approved) { |
|
291 | 291 | // add event to list of events with pre-approval reg status |
292 | - $registrations_requiring_pre_approval[ $registration->ID() ] = $registration; |
|
292 | + $registrations_requiring_pre_approval[$registration->ID()] = $registration; |
|
293 | 293 | do_action( |
294 | 294 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
295 | 295 | $registration->event(), |
@@ -303,10 +303,10 @@ discard block |
||
303 | 303 | // anything other than Approved |
304 | 304 | && $registration->status_ID() !== EEM_Registration::status_id_approved |
305 | 305 | // event hasn't sold out since initial visit |
306 | - && $registration->event()->is_sold_out( true ) |
|
306 | + && $registration->event()->is_sold_out(true) |
|
307 | 307 | ) { |
308 | 308 | // add event to list of events that are sold out |
309 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
309 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
310 | 310 | do_action( |
311 | 311 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
312 | 312 | $registration->event(), |
@@ -315,8 +315,8 @@ discard block |
||
315 | 315 | continue; |
316 | 316 | } |
317 | 317 | // are they allowed to pay now and is there monies owing? |
318 | - if ( $registration->owes_monies_and_can_pay() ) { |
|
319 | - $registrations_requiring_payment[ $registration->ID() ] = $registration; |
|
318 | + if ($registration->owes_monies_and_can_pay()) { |
|
319 | + $registrations_requiring_payment[$registration->ID()] = $registration; |
|
320 | 320 | do_action( |
321 | 321 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
322 | 322 | $registration->event(), |
@@ -327,23 +327,23 @@ discard block |
||
327 | 327 | && $registration->status_ID() !== EEM_Registration::status_id_not_approved |
328 | 328 | && $registration->ticket()->is_free() |
329 | 329 | ) { |
330 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
330 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | $subsections = array(); |
334 | 334 | // now decide which template to load |
335 | - if ( ! empty( $sold_out_events ) ) { |
|
336 | - $subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events ); |
|
335 | + if ( ! empty($sold_out_events)) { |
|
336 | + $subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events); |
|
337 | 337 | } |
338 | - if ( ! empty( $registrations_requiring_pre_approval ) ) { |
|
338 | + if ( ! empty($registrations_requiring_pre_approval)) { |
|
339 | 339 | $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( |
340 | 340 | $registrations_requiring_pre_approval |
341 | 341 | ); |
342 | 342 | } |
343 | - if ( ! empty( $registrations_for_free_events ) ) { |
|
344 | - $subsections['no_payment_required'] = $this->_no_payment_required( $registrations_for_free_events ); |
|
343 | + if ( ! empty($registrations_for_free_events)) { |
|
344 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
345 | 345 | } |
346 | - if ( ! empty( $registrations_requiring_payment ) ) { |
|
346 | + if ( ! empty($registrations_requiring_payment)) { |
|
347 | 347 | // autoload Line_Item_Display classes |
348 | 348 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
349 | 349 | $line_item_filter_processor = new EE_Line_Item_Filter_Processor( |
@@ -355,17 +355,17 @@ discard block |
||
355 | 355 | ); |
356 | 356 | /** @var EE_Line_Item $filtered_line_item_tree */ |
357 | 357 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
358 | - if ( $this->checkout->amount_owing > 0 ) { |
|
358 | + if ($this->checkout->amount_owing > 0) { |
|
359 | 359 | EEH_Autoloader::register_line_item_display_autoloaders(); |
360 | - $this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) ); |
|
360 | + $this->set_line_item_display(new EE_Line_Item_Display('spco')); |
|
361 | 361 | $subsections['payment_options'] = $this->_display_payment_options( |
362 | 362 | $this->line_item_display->display_line_item( |
363 | 363 | $filtered_line_item_tree, |
364 | - array( 'registrations' => $registrations ) |
|
364 | + array('registrations' => $registrations) |
|
365 | 365 | ) |
366 | 366 | ); |
367 | 367 | $this->checkout->amount_owing = $filtered_line_item_tree->total(); |
368 | - $this->_apply_registration_payments_to_amount_owing( $registrations ); |
|
368 | + $this->_apply_registration_payments_to_amount_owing($registrations); |
|
369 | 369 | } |
370 | 370 | $no_payment_required = false; |
371 | 371 | } else { |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | $this->_save_selected_method_of_payment(); |
375 | 375 | |
376 | 376 | $subsections['default_hidden_inputs'] = $this->reg_step_hidden_inputs(); |
377 | - $subsections['extra_hidden_inputs' ] = $this->_extra_hidden_inputs( $no_payment_required ); |
|
377 | + $subsections['extra_hidden_inputs'] = $this->_extra_hidden_inputs($no_payment_required); |
|
378 | 378 | |
379 | 379 | return new EE_Form_Section_Proper( |
380 | 380 | array( |
@@ -400,21 +400,21 @@ discard block |
||
400 | 400 | * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection |
401 | 401 | * @return \EE_Line_Item_Filter_Collection |
402 | 402 | */ |
403 | - public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) { |
|
404 | - if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
403 | + public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) { |
|
404 | + if ( ! EE_Registry::instance()->SSN instanceof EE_Session) { |
|
405 | 405 | return $line_item_filter_collection; |
406 | 406 | } |
407 | - if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout ) { |
|
407 | + if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout) { |
|
408 | 408 | return $line_item_filter_collection; |
409 | 409 | } |
410 | - if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction ) { |
|
410 | + if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction) { |
|
411 | 411 | return $line_item_filter_collection; |
412 | 412 | } |
413 | 413 | $registrations = EE_Registry::instance()->SSN->checkout()->transaction->registrations( |
414 | 414 | EE_Registry::instance()->SSN->checkout()->reg_cache_where_params |
415 | 415 | ); |
416 | - $line_item_filter_collection->add( new EE_Billable_Line_Item_Filter( $registrations ) ); |
|
417 | - $line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
416 | + $line_item_filter_collection->add(new EE_Billable_Line_Item_Filter($registrations)); |
|
417 | + $line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter()); |
|
418 | 418 | return $line_item_filter_collection; |
419 | 419 | } |
420 | 420 | |
@@ -428,8 +428,8 @@ discard block |
||
428 | 428 | * @return void |
429 | 429 | */ |
430 | 430 | protected function _hide_reg_step_submit_button_if_revisit() { |
431 | - if ( $this->checkout->revisit ) { |
|
432 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' ); |
|
431 | + if ($this->checkout->revisit) { |
|
432 | + add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string'); |
|
433 | 433 | } |
434 | 434 | } |
435 | 435 | |
@@ -442,13 +442,13 @@ discard block |
||
442 | 442 | * @return \EE_Form_Section_Proper |
443 | 443 | * @throws \EE_Error |
444 | 444 | */ |
445 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
445 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
446 | 446 | // set some defaults |
447 | 447 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
448 | 448 | $sold_out_events = ''; |
449 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
449 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
450 | 450 | $sold_out_events .= EEH_HTML::li( |
451 | - EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ) |
|
451 | + EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text') |
|
452 | 452 | ); |
453 | 453 | } |
454 | 454 | return new EE_Form_Section_Proper( |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | 'sold_out_events_msg' => apply_filters( |
467 | 467 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg', |
468 | 468 | sprintf( |
469 | - __( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso' ), |
|
469 | + __('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso'), |
|
470 | 470 | '<strong>', |
471 | 471 | '</strong>', |
472 | 472 | '<br />' |
@@ -489,17 +489,17 @@ discard block |
||
489 | 489 | * @return \EE_Form_Section_Proper |
490 | 490 | * @throws \EE_Error |
491 | 491 | */ |
492 | - private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array() ) { |
|
492 | + private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) { |
|
493 | 493 | $events_requiring_pre_approval = ''; |
494 | - foreach ( $registrations_requiring_pre_approval as $registration ) { |
|
495 | - if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) { |
|
496 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li( |
|
494 | + foreach ($registrations_requiring_pre_approval as $registration) { |
|
495 | + if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) { |
|
496 | + $events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li( |
|
497 | 497 | EEH_HTML::span( |
498 | 498 | '', |
499 | 499 | '', |
500 | 500 | 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
501 | 501 | ) |
502 | - . EEH_HTML::span( $registration->event()->name(), '', 'orange-text' ) |
|
502 | + . EEH_HTML::span($registration->event()->name(), '', 'orange-text') |
|
503 | 503 | ); |
504 | 504 | } |
505 | 505 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | 'template_args' => apply_filters( |
515 | 515 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
516 | 516 | array( |
517 | - 'events_requiring_pre_approval' => implode( '', $events_requiring_pre_approval ), |
|
517 | + 'events_requiring_pre_approval' => implode('', $events_requiring_pre_approval), |
|
518 | 518 | 'events_requiring_pre_approval_msg' => apply_filters( |
519 | 519 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
520 | 520 | __( |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | * @return \EE_Form_Section_Proper |
540 | 540 | * @throws \EE_Error |
541 | 541 | */ |
542 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
542 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
543 | 543 | // set some defaults |
544 | 544 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
545 | 545 | // generate no_payment_required form |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | 'ticket_count' => array(), |
560 | 560 | 'registrations_for_free_events' => $registrations_for_free_events, |
561 | 561 | 'no_payment_required_msg' => EEH_HTML::p( |
562 | - __( 'This is a free event, so no billing will occur.', 'event_espresso' ) |
|
562 | + __('This is a free event, so no billing will occur.', 'event_espresso') |
|
563 | 563 | ) |
564 | 564 | ) |
565 | 565 | ), |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | * @return \EE_Form_Section_Proper |
579 | 579 | * @throws \EE_Error |
580 | 580 | */ |
581 | - private function _display_payment_options( $transaction_details = '' ) { |
|
581 | + private function _display_payment_options($transaction_details = '') { |
|
582 | 582 | // has method_of_payment been set by no-js user? |
583 | 583 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
584 | 584 | // build payment options form |
@@ -590,14 +590,14 @@ discard block |
||
590 | 590 | 'before_payment_options' => apply_filters( |
591 | 591 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options', |
592 | 592 | new EE_Form_Section_Proper( |
593 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
593 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
594 | 594 | ) |
595 | 595 | ), |
596 | 596 | 'payment_options' => $this->_setup_payment_options(), |
597 | 597 | 'after_payment_options' => apply_filters( |
598 | 598 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options', |
599 | 599 | new EE_Form_Section_Proper( |
600 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
600 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
601 | 601 | ) |
602 | 602 | ), |
603 | 603 | ), |
@@ -628,10 +628,10 @@ discard block |
||
628 | 628 | * @return \EE_Form_Section_Proper |
629 | 629 | * @throws \EE_Error |
630 | 630 | */ |
631 | - private function _extra_hidden_inputs( $no_payment_required = true ) { |
|
631 | + private function _extra_hidden_inputs($no_payment_required = true) { |
|
632 | 632 | return new EE_Form_Section_Proper( |
633 | 633 | array( |
634 | - 'html_id' => 'ee-' . $this->slug() . '-extra-hidden-inputs', |
|
634 | + 'html_id' => 'ee-'.$this->slug().'-extra-hidden-inputs', |
|
635 | 635 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
636 | 636 | 'subsections' => array( |
637 | 637 | 'spco_no_payment_required' => new EE_Hidden_Input( |
@@ -663,16 +663,16 @@ discard block |
||
663 | 663 | * @access protected |
664 | 664 | * @param array $registrations |
665 | 665 | */ |
666 | - protected function _apply_registration_payments_to_amount_owing( array $registrations ) { |
|
666 | + protected function _apply_registration_payments_to_amount_owing(array $registrations) { |
|
667 | 667 | $payments = array(); |
668 | - foreach ( $registrations as $registration ) { |
|
669 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
668 | + foreach ($registrations as $registration) { |
|
669 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
670 | 670 | $payments += $registration->registration_payments(); |
671 | 671 | } |
672 | 672 | } |
673 | - if ( ! empty( $payments ) ) { |
|
674 | - foreach ( $payments as $payment ) { |
|
675 | - if ( $payment instanceof EE_Registration_Payment ) { |
|
673 | + if ( ! empty($payments)) { |
|
674 | + foreach ($payments as $payment) { |
|
675 | + if ($payment instanceof EE_Registration_Payment) { |
|
676 | 676 | $this->checkout->amount_owing -= $payment->amount(); |
677 | 677 | } |
678 | 678 | } |
@@ -688,11 +688,11 @@ discard block |
||
688 | 688 | * @param bool $force_reset |
689 | 689 | * @return void |
690 | 690 | */ |
691 | - private function _reset_selected_method_of_payment( $force_reset = false ) { |
|
691 | + private function _reset_selected_method_of_payment($force_reset = false) { |
|
692 | 692 | $reset_payment_method = $force_reset |
693 | 693 | ? true |
694 | - : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', false ) ); |
|
695 | - if ( $reset_payment_method ) { |
|
694 | + : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', false)); |
|
695 | + if ($reset_payment_method) { |
|
696 | 696 | $this->checkout->selected_method_of_payment = null; |
697 | 697 | $this->checkout->payment_method = null; |
698 | 698 | $this->checkout->billing_form = null; |
@@ -711,12 +711,12 @@ discard block |
||
711 | 711 | * @param string $selected_method_of_payment |
712 | 712 | * @return EE_Billing_Info_Form |
713 | 713 | */ |
714 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
715 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) |
|
714 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
715 | + $selected_method_of_payment = ! empty($selected_method_of_payment) |
|
716 | 716 | ? $selected_method_of_payment |
717 | 717 | : $this->checkout->selected_method_of_payment; |
718 | 718 | EE_Registry::instance()->SSN->set_session_data( |
719 | - array( 'selected_method_of_payment' => $selected_method_of_payment ) |
|
719 | + array('selected_method_of_payment' => $selected_method_of_payment) |
|
720 | 720 | ); |
721 | 721 | } |
722 | 722 | |
@@ -732,19 +732,19 @@ discard block |
||
732 | 732 | // load payment method classes |
733 | 733 | $this->checkout->available_payment_methods = $this->_get_available_payment_methods(); |
734 | 734 | // switch up header depending on number of available payment methods |
735 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
735 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
736 | 736 | ? apply_filters( |
737 | 737 | 'FHEE__registration_page_payment_options__method_of_payment_hdr', |
738 | - __( 'Please Select Your Method of Payment', 'event_espresso' ) |
|
738 | + __('Please Select Your Method of Payment', 'event_espresso') |
|
739 | 739 | ) |
740 | 740 | : apply_filters( |
741 | 741 | 'FHEE__registration_page_payment_options__method_of_payment_hdr', |
742 | - __( 'Method of Payment', 'event_espresso' ) |
|
742 | + __('Method of Payment', 'event_espresso') |
|
743 | 743 | ); |
744 | 744 | $available_payment_methods = array( |
745 | 745 | // display the "Payment Method" header |
746 | 746 | 'payment_method_header' => new EE_Form_Section_HTML( |
747 | - EEH_HTML::h4( $payment_method_header, 'method-of-payment-hdr' ) |
|
747 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
748 | 748 | ) |
749 | 749 | ); |
750 | 750 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
@@ -753,32 +753,32 @@ discard block |
||
753 | 753 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
754 | 754 | $payment_methods_billing_info = array( |
755 | 755 | new EE_Form_Section_HTML( |
756 | - EEH_HTML::div( '<br />', '', '', 'clear:both;' ) |
|
756 | + EEH_HTML::div('<br />', '', '', 'clear:both;') |
|
757 | 757 | ) |
758 | 758 | ); |
759 | 759 | // loop through payment methods |
760 | - foreach ( $this->checkout->available_payment_methods as $payment_method ) { |
|
761 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
760 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
761 | + if ($payment_method instanceof EE_Payment_Method) { |
|
762 | 762 | $payment_method_button = EEH_HTML::img( |
763 | 763 | $payment_method->button_url(), |
764 | 764 | $payment_method->name(), |
765 | - 'spco-payment-method-' . $payment_method->slug() . '-btn-img', |
|
765 | + 'spco-payment-method-'.$payment_method->slug().'-btn-img', |
|
766 | 766 | 'spco-payment-method-btn-img' |
767 | 767 | ); |
768 | 768 | // check if any payment methods are set as default |
769 | 769 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
770 | 770 | if ( |
771 | - ( $this->checkout->selected_method_of_payment === $payment_method->slug() ) |
|
772 | - || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() ) |
|
771 | + ($this->checkout->selected_method_of_payment === $payment_method->slug()) |
|
772 | + || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default()) |
|
773 | 773 | ) { |
774 | 774 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
775 | 775 | $this->_save_selected_method_of_payment(); |
776 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
776 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
777 | 777 | } else { |
778 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
778 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
779 | 779 | } |
780 | - $payment_methods_billing_info[ $payment_method->slug() |
|
781 | - . '-info' ] = $this->_payment_method_billing_info( |
|
780 | + $payment_methods_billing_info[$payment_method->slug() |
|
781 | + . '-info'] = $this->_payment_method_billing_info( |
|
782 | 782 | $payment_method |
783 | 783 | ); |
784 | 784 | } |
@@ -808,12 +808,12 @@ discard block |
||
808 | 808 | * @return EE_Payment_Method[] |
809 | 809 | */ |
810 | 810 | protected function _get_available_payment_methods() { |
811 | - if ( ! empty( $this->checkout->available_payment_methods ) ) { |
|
811 | + if ( ! empty($this->checkout->available_payment_methods)) { |
|
812 | 812 | return $this->checkout->available_payment_methods; |
813 | 813 | } |
814 | 814 | $available_payment_methods = array(); |
815 | 815 | // load EEM_Payment_Method |
816 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
816 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
817 | 817 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
818 | 818 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
819 | 819 | // get all active payment methods |
@@ -821,9 +821,9 @@ discard block |
||
821 | 821 | $this->checkout->transaction, |
822 | 822 | EEM_Payment_Method::scope_cart |
823 | 823 | ); |
824 | - foreach ( $payment_methods as $payment_method ) { |
|
825 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
826 | - $available_payment_methods[ $payment_method->slug() ] = $payment_method; |
|
824 | + foreach ($payment_methods as $payment_method) { |
|
825 | + if ($payment_method instanceof EE_Payment_Method) { |
|
826 | + $available_payment_methods[$payment_method->slug()] = $payment_method; |
|
827 | 827 | } |
828 | 828 | } |
829 | 829 | return $available_payment_methods; |
@@ -838,14 +838,14 @@ discard block |
||
838 | 838 | * @param array $available_payment_method_options |
839 | 839 | * @return \EE_Form_Section_Proper |
840 | 840 | */ |
841 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
841 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
842 | 842 | // generate inputs |
843 | 843 | return new EE_Form_Section_Proper( |
844 | 844 | array( |
845 | 845 | 'html_id' => 'ee-available-payment-method-inputs', |
846 | 846 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
847 | 847 | 'subsections' => array( |
848 | - '' => new EE_Radio_Button_Input ( |
|
848 | + '' => new EE_Radio_Button_Input( |
|
849 | 849 | $available_payment_method_options, |
850 | 850 | array( |
851 | 851 | 'html_name' => 'selected_method_of_payment', |
@@ -870,28 +870,28 @@ discard block |
||
870 | 870 | * @return \EE_Form_Section_Proper |
871 | 871 | * @throws \EE_Error |
872 | 872 | */ |
873 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
873 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
874 | 874 | $currently_selected = $this->checkout->selected_method_of_payment === $payment_method->slug() |
875 | 875 | ? true |
876 | 876 | : false; |
877 | 877 | // generate the billing form for payment method |
878 | 878 | $billing_form = $currently_selected |
879 | - ? $this->_get_billing_form_for_payment_method( $payment_method ) |
|
879 | + ? $this->_get_billing_form_for_payment_method($payment_method) |
|
880 | 880 | : new EE_Form_Section_HTML(); |
881 | 881 | $this->checkout->billing_form = $currently_selected |
882 | 882 | ? $billing_form |
883 | 883 | : $this->checkout->billing_form; |
884 | 884 | // it's all in the details |
885 | 885 | $info_html = EEH_HTML::h3( |
886 | - __( 'Important information regarding your payment', 'event_espresso' ), |
|
886 | + __('Important information regarding your payment', 'event_espresso'), |
|
887 | 887 | '', |
888 | 888 | 'spco-payment-method-hdr' |
889 | 889 | ); |
890 | 890 | // add some info regarding the step, either from what's saved in the admin, |
891 | 891 | // or a default string depending on whether the PM has a billing form or not |
892 | - if ( $payment_method->description() ) { |
|
892 | + if ($payment_method->description()) { |
|
893 | 893 | $payment_method_info = $payment_method->description(); |
894 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
894 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
895 | 895 | $payment_method_info = sprintf( |
896 | 896 | __( |
897 | 897 | 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | ); |
902 | 902 | } else { |
903 | 903 | $payment_method_info = sprintf( |
904 | - __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), |
|
904 | + __('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), |
|
905 | 905 | $this->submit_button_text() |
906 | 906 | ); |
907 | 907 | } |
@@ -915,13 +915,13 @@ discard block |
||
915 | 915 | ); |
916 | 916 | return new EE_Form_Section_Proper( |
917 | 917 | array( |
918 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
918 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
919 | 919 | 'html_class' => 'spco-payment-method-info-dv', |
920 | 920 | // only display the selected or default PM |
921 | 921 | 'html_style' => $currently_selected ? '' : 'display:none;', |
922 | 922 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
923 | 923 | 'subsections' => array( |
924 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
924 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
925 | 925 | 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML() |
926 | 926 | ) |
927 | 927 | ) |
@@ -939,15 +939,15 @@ discard block |
||
939 | 939 | */ |
940 | 940 | public function get_billing_form_html_for_payment_method() { |
941 | 941 | // how have they chosen to pay? |
942 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
942 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
943 | 943 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
944 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
944 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
945 | 945 | return false; |
946 | 946 | } |
947 | - if ( apply_filters( |
|
947 | + if (apply_filters( |
|
948 | 948 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
949 | 949 | false |
950 | - ) ) { |
|
950 | + )) { |
|
951 | 951 | EE_Error::add_success( |
952 | 952 | apply_filters( |
953 | 953 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | ); |
963 | 963 | } |
964 | 964 | // now generate billing form for selected method of payment |
965 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
965 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
966 | 966 | // fill form with attendee info if applicable |
967 | 967 | if ( |
968 | 968 | $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form |
@@ -984,10 +984,10 @@ discard block |
||
984 | 984 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper |
985 | 985 | ? $payment_method_billing_form->get_html() |
986 | 986 | : ''; |
987 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ) ); |
|
987 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
988 | 988 | // localize validation rules for main form |
989 | 989 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
990 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
990 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
991 | 991 | return true; |
992 | 992 | } |
993 | 993 | |
@@ -1001,18 +1001,18 @@ discard block |
||
1001 | 1001 | * @return \EE_Billing_Info_Form |
1002 | 1002 | * @throws \EE_Error |
1003 | 1003 | */ |
1004 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
1004 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
1005 | 1005 | $billing_form = $payment_method->type_obj()->billing_form( |
1006 | 1006 | $this->checkout->transaction, |
1007 | - array( 'amount_owing' => $this->checkout->amount_owing ) |
|
1007 | + array('amount_owing' => $this->checkout->amount_owing) |
|
1008 | 1008 | ); |
1009 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
1009 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
1010 | 1010 | if ( |
1011 | 1011 | apply_filters( |
1012 | 1012 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
1013 | 1013 | false |
1014 | 1014 | ) |
1015 | - && EE_Registry::instance()->REQ->is_set( 'payment_method' ) |
|
1015 | + && EE_Registry::instance()->REQ->is_set('payment_method') |
|
1016 | 1016 | ) { |
1017 | 1017 | EE_Error::add_success( |
1018 | 1018 | apply_filters( |
@@ -1054,15 +1054,15 @@ discard block |
||
1054 | 1054 | $request_param = 'selected_method_of_payment' |
1055 | 1055 | ) { |
1056 | 1056 | // is selected_method_of_payment set in the request ? |
1057 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, false ); |
|
1058 | - if ( $selected_method_of_payment ) { |
|
1057 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, false); |
|
1058 | + if ($selected_method_of_payment) { |
|
1059 | 1059 | // sanitize it |
1060 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) |
|
1061 | - ? array_shift( $selected_method_of_payment ) |
|
1060 | + $selected_method_of_payment = is_array($selected_method_of_payment) |
|
1061 | + ? array_shift($selected_method_of_payment) |
|
1062 | 1062 | : $selected_method_of_payment; |
1063 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
1063 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
1064 | 1064 | // store it in the session so that it's available for all subsequent requests including AJAX |
1065 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
1065 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
1066 | 1066 | } else { |
1067 | 1067 | // or is is set in the session ? |
1068 | 1068 | $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | ); |
1071 | 1071 | } |
1072 | 1072 | // do ya really really gotta have it? |
1073 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
1073 | + if (empty($selected_method_of_payment) && $required) { |
|
1074 | 1074 | EE_Error::add_error( |
1075 | 1075 | sprintf( |
1076 | 1076 | __( |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | ), |
1080 | 1080 | '<br/>', |
1081 | 1081 | '<br/>', |
1082 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1082 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1083 | 1083 | ), |
1084 | 1084 | __FILE__, |
1085 | 1085 | __FUNCTION__, |
@@ -1106,13 +1106,13 @@ discard block |
||
1106 | 1106 | * @throws \EE_Error |
1107 | 1107 | */ |
1108 | 1108 | public function switch_payment_method() { |
1109 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
1109 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
1110 | 1110 | return false; |
1111 | 1111 | } |
1112 | - if ( apply_filters( |
|
1112 | + if (apply_filters( |
|
1113 | 1113 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
1114 | 1114 | false |
1115 | - ) ) { |
|
1115 | + )) { |
|
1116 | 1116 | EE_Error::add_success( |
1117 | 1117 | apply_filters( |
1118 | 1118 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -1127,13 +1127,13 @@ discard block |
||
1127 | 1127 | ); |
1128 | 1128 | } |
1129 | 1129 | // generate billing form for selected method of payment if it hasn't been done already |
1130 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1130 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1131 | 1131 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1132 | 1132 | $this->checkout->payment_method |
1133 | 1133 | ); |
1134 | 1134 | } |
1135 | 1135 | // fill form with attendee info if applicable |
1136 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form |
|
1136 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form |
|
1137 | 1137 | && $this->checkout->transaction_has_primary_registrant() |
1138 | 1138 | ) { |
1139 | 1139 | $this->checkout->billing_form->populate_from_attendee( |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | ); |
1142 | 1142 | } |
1143 | 1143 | // and debug content |
1144 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form |
|
1144 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form |
|
1145 | 1145 | && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
1146 | 1146 | ) { |
1147 | 1147 | $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( |
@@ -1149,15 +1149,15 @@ discard block |
||
1149 | 1149 | ); |
1150 | 1150 | } |
1151 | 1151 | // get html and validation rules for form |
1152 | - if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) { |
|
1152 | + if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { |
|
1153 | 1153 | $this->checkout->json_response->set_return_data( |
1154 | - array( 'payment_method_info' => $this->checkout->billing_form->get_html() ) |
|
1154 | + array('payment_method_info' => $this->checkout->billing_form->get_html()) |
|
1155 | 1155 | ); |
1156 | 1156 | // localize validation rules for main form |
1157 | - $this->checkout->billing_form->localize_validation_rules( true ); |
|
1158 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
1157 | + $this->checkout->billing_form->localize_validation_rules(true); |
|
1158 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
1159 | 1159 | } else { |
1160 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ) ); |
|
1160 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); |
|
1161 | 1161 | } |
1162 | 1162 | //prevents advancement to next step |
1163 | 1163 | $this->checkout->continue_reg = false; |
@@ -1174,18 +1174,18 @@ discard block |
||
1174 | 1174 | */ |
1175 | 1175 | protected function _verify_payment_method_is_set() { |
1176 | 1176 | // generate billing form for selected method of payment if it hasn't been done already |
1177 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1177 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1178 | 1178 | // how have they chosen to pay? |
1179 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1179 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1180 | 1180 | } else { |
1181 | 1181 | // choose your own adventure based on method_of_payment |
1182 | - switch ( $this->checkout->selected_method_of_payment ) { |
|
1182 | + switch ($this->checkout->selected_method_of_payment) { |
|
1183 | 1183 | case 'events_sold_out' : |
1184 | 1184 | EE_Error::add_attention( |
1185 | 1185 | apply_filters( |
1186 | 1186 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__sold_out_events_msg', |
1187 | - __( 'It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.', |
|
1188 | - 'event_espresso' ) |
|
1187 | + __('It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.', |
|
1188 | + 'event_espresso') |
|
1189 | 1189 | ), |
1190 | 1190 | __FILE__, __FUNCTION__, __LINE__ |
1191 | 1191 | ); |
@@ -1195,7 +1195,7 @@ discard block |
||
1195 | 1195 | EE_Error::add_attention( |
1196 | 1196 | apply_filters( |
1197 | 1197 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__payments_closed_msg', |
1198 | - __( 'It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso' ) |
|
1198 | + __('It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso') |
|
1199 | 1199 | ), |
1200 | 1200 | __FILE__, __FUNCTION__, __LINE__ |
1201 | 1201 | ); |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | EE_Error::add_attention( |
1206 | 1206 | apply_filters( |
1207 | 1207 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__no_payment_required_msg', |
1208 | - __( 'It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso' ) |
|
1208 | + __('It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso') |
|
1209 | 1209 | ), |
1210 | 1210 | __FILE__, __FUNCTION__, __LINE__ |
1211 | 1211 | ); |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | } |
1216 | 1216 | } |
1217 | 1217 | // verify payment method |
1218 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
1218 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
1219 | 1219 | // get payment method for selected method of payment |
1220 | 1220 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
1221 | 1221 | } |
@@ -1234,25 +1234,25 @@ discard block |
||
1234 | 1234 | * @throws \EE_Error |
1235 | 1235 | */ |
1236 | 1236 | public function save_payer_details_via_ajax() { |
1237 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
1237 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
1238 | 1238 | return; |
1239 | 1239 | } |
1240 | 1240 | // generate billing form for selected method of payment if it hasn't been done already |
1241 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1241 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1242 | 1242 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1243 | 1243 | $this->checkout->payment_method |
1244 | 1244 | ); |
1245 | 1245 | } |
1246 | 1246 | // generate primary attendee from payer info if applicable |
1247 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
1247 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
1248 | 1248 | $attendee = $this->_create_attendee_from_request_data(); |
1249 | - if ( $attendee instanceof EE_Attendee ) { |
|
1250 | - foreach ( $this->checkout->transaction->registrations() as $registration ) { |
|
1251 | - if ( $registration->is_primary_registrant() ) { |
|
1249 | + if ($attendee instanceof EE_Attendee) { |
|
1250 | + foreach ($this->checkout->transaction->registrations() as $registration) { |
|
1251 | + if ($registration->is_primary_registrant()) { |
|
1252 | 1252 | $this->checkout->primary_attendee_obj = $attendee; |
1253 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1254 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1255 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1253 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1254 | + $registration->set_attendee_id($attendee->ID()); |
|
1255 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1256 | 1256 | } |
1257 | 1257 | } |
1258 | 1258 | } |
@@ -1269,50 +1269,50 @@ discard block |
||
1269 | 1269 | */ |
1270 | 1270 | protected function _create_attendee_from_request_data() { |
1271 | 1271 | // get State ID |
1272 | - $STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : ''; |
|
1273 | - if ( ! empty( $STA_ID ) ) { |
|
1272 | + $STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; |
|
1273 | + if ( ! empty($STA_ID)) { |
|
1274 | 1274 | // can we get state object from name ? |
1275 | - EE_Registry::instance()->load_model( 'State' ); |
|
1276 | - $state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1 ), 'STA_ID' ); |
|
1277 | - $STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID; |
|
1275 | + EE_Registry::instance()->load_model('State'); |
|
1276 | + $state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID'); |
|
1277 | + $STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID; |
|
1278 | 1278 | } |
1279 | 1279 | // get Country ISO |
1280 | - $CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : ''; |
|
1281 | - if ( ! empty( $CNT_ISO ) ) { |
|
1280 | + $CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; |
|
1281 | + if ( ! empty($CNT_ISO)) { |
|
1282 | 1282 | // can we get country object from name ? |
1283 | - EE_Registry::instance()->load_model( 'Country' ); |
|
1283 | + EE_Registry::instance()->load_model('Country'); |
|
1284 | 1284 | $country = EEM_Country::instance()->get_col( |
1285 | - array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1 ), |
|
1285 | + array(array('CNT_name' => $CNT_ISO), 'limit' => 1), |
|
1286 | 1286 | 'CNT_ISO' |
1287 | 1287 | ); |
1288 | - $CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO; |
|
1288 | + $CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO; |
|
1289 | 1289 | } |
1290 | 1290 | // grab attendee data |
1291 | 1291 | $attendee_data = array( |
1292 | - 'ATT_fname' => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '', |
|
1293 | - 'ATT_lname' => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '', |
|
1294 | - 'ATT_email' => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '', |
|
1295 | - 'ATT_address' => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '', |
|
1296 | - 'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '', |
|
1297 | - 'ATT_city' => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '', |
|
1292 | + 'ATT_fname' => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '', |
|
1293 | + 'ATT_lname' => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '', |
|
1294 | + 'ATT_email' => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '', |
|
1295 | + 'ATT_address' => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '', |
|
1296 | + 'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '', |
|
1297 | + 'ATT_city' => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '', |
|
1298 | 1298 | 'STA_ID' => $STA_ID, |
1299 | 1299 | 'CNT_ISO' => $CNT_ISO, |
1300 | - 'ATT_zip' => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '', |
|
1301 | - 'ATT_phone' => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '', |
|
1300 | + 'ATT_zip' => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '', |
|
1301 | + 'ATT_phone' => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '', |
|
1302 | 1302 | ); |
1303 | 1303 | // validate the email address since it is the most important piece of info |
1304 | - if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] !== $_REQUEST['email'] ) { |
|
1304 | + if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] !== $_REQUEST['email']) { |
|
1305 | 1305 | EE_Error::add_error( |
1306 | - __( 'An invalid email address was submitted.', 'event_espresso' ), |
|
1306 | + __('An invalid email address was submitted.', 'event_espresso'), |
|
1307 | 1307 | __FILE__, |
1308 | 1308 | __FUNCTION__, |
1309 | 1309 | __LINE__ |
1310 | 1310 | ); |
1311 | 1311 | } |
1312 | 1312 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1313 | - if ( ! empty( $attendee_data['ATT_fname'] ) |
|
1314 | - && ! empty( $attendee_data['ATT_lname'] ) |
|
1315 | - && ! empty( $attendee_data['ATT_email'] ) |
|
1313 | + if ( ! empty($attendee_data['ATT_fname']) |
|
1314 | + && ! empty($attendee_data['ATT_lname']) |
|
1315 | + && ! empty($attendee_data['ATT_email']) |
|
1316 | 1316 | ) { |
1317 | 1317 | $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( |
1318 | 1318 | array( |
@@ -1321,19 +1321,19 @@ discard block |
||
1321 | 1321 | 'ATT_email' => $attendee_data['ATT_email'] |
1322 | 1322 | ) |
1323 | 1323 | ); |
1324 | - if ( $existing_attendee instanceof EE_Attendee ) { |
|
1324 | + if ($existing_attendee instanceof EE_Attendee) { |
|
1325 | 1325 | return $existing_attendee; |
1326 | 1326 | } |
1327 | 1327 | } |
1328 | 1328 | // no existing attendee? kk let's create a new one |
1329 | 1329 | // kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist |
1330 | - $attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) |
|
1330 | + $attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) |
|
1331 | 1331 | ? $attendee_data['ATT_fname'] |
1332 | 1332 | : $attendee_data['ATT_email']; |
1333 | - $attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) |
|
1333 | + $attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) |
|
1334 | 1334 | ? $attendee_data['ATT_lname'] |
1335 | 1335 | : $attendee_data['ATT_email']; |
1336 | - return EE_Attendee::new_instance( $attendee_data ); |
|
1336 | + return EE_Attendee::new_instance($attendee_data); |
|
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | |
@@ -1351,26 +1351,26 @@ discard block |
||
1351 | 1351 | // how have they chosen to pay? |
1352 | 1352 | $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() |
1353 | 1353 | ? 'no_payment_required' |
1354 | - : $this->_get_selected_method_of_payment( true ); |
|
1354 | + : $this->_get_selected_method_of_payment(true); |
|
1355 | 1355 | // choose your own adventure based on method_of_payment |
1356 | - switch ( $this->checkout->selected_method_of_payment ) { |
|
1356 | + switch ($this->checkout->selected_method_of_payment) { |
|
1357 | 1357 | |
1358 | 1358 | case 'events_sold_out' : |
1359 | 1359 | $this->checkout->redirect = true; |
1360 | 1360 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
1361 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1361 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1362 | 1362 | // mark this reg step as completed |
1363 | 1363 | $this->set_completed(); |
1364 | 1364 | return false; |
1365 | 1365 | break; |
1366 | 1366 | |
1367 | 1367 | case 'payments_closed' : |
1368 | - if ( apply_filters( |
|
1368 | + if (apply_filters( |
|
1369 | 1369 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', |
1370 | 1370 | false |
1371 | - ) ) { |
|
1371 | + )) { |
|
1372 | 1372 | EE_Error::add_success( |
1373 | - __( 'no payment required at this time.', 'event_espresso' ), |
|
1373 | + __('no payment required at this time.', 'event_espresso'), |
|
1374 | 1374 | __FILE__, |
1375 | 1375 | __FUNCTION__, |
1376 | 1376 | __LINE__ |
@@ -1382,12 +1382,12 @@ discard block |
||
1382 | 1382 | break; |
1383 | 1383 | |
1384 | 1384 | case 'no_payment_required' : |
1385 | - if ( apply_filters( |
|
1385 | + if (apply_filters( |
|
1386 | 1386 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', |
1387 | 1387 | false |
1388 | - ) ) { |
|
1388 | + )) { |
|
1389 | 1389 | EE_Error::add_success( |
1390 | - __( 'no payment required.', 'event_espresso' ), |
|
1390 | + __('no payment required.', 'event_espresso'), |
|
1391 | 1391 | __FILE__, |
1392 | 1392 | __FUNCTION__, |
1393 | 1393 | __LINE__ |
@@ -1400,9 +1400,9 @@ discard block |
||
1400 | 1400 | |
1401 | 1401 | default: |
1402 | 1402 | $payment_successful = $this->_process_payment(); |
1403 | - if ( $payment_successful ) { |
|
1403 | + if ($payment_successful) { |
|
1404 | 1404 | $this->checkout->continue_reg = true; |
1405 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
1405 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
1406 | 1406 | } else { |
1407 | 1407 | $this->checkout->continue_reg = false; |
1408 | 1408 | } |
@@ -1421,8 +1421,8 @@ discard block |
||
1421 | 1421 | * @return void |
1422 | 1422 | * @throws \EE_Error |
1423 | 1423 | */ |
1424 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
1425 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1424 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
1425 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1426 | 1426 | case EE_PMT_Base::offsite : |
1427 | 1427 | break; |
1428 | 1428 | case EE_PMT_Base::onsite : |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | public function update_reg_step() { |
1446 | 1446 | $success = true; |
1447 | 1447 | // if payment required |
1448 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
1448 | + if ($this->checkout->transaction->total() > 0) { |
|
1449 | 1449 | do_action( |
1450 | 1450 | 'AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', |
1451 | 1451 | $this->checkout->transaction |
@@ -1453,13 +1453,13 @@ discard block |
||
1453 | 1453 | // attempt payment via payment method |
1454 | 1454 | $success = $this->process_reg_step(); |
1455 | 1455 | } |
1456 | - if ( $success && ! $this->checkout->redirect ) { |
|
1456 | + if ($success && ! $this->checkout->redirect) { |
|
1457 | 1457 | $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( |
1458 | 1458 | $this->checkout->transaction->ID() |
1459 | 1459 | ); |
1460 | 1460 | // set return URL |
1461 | 1461 | $this->checkout->redirect_url = add_query_arg( |
1462 | - array( 'e_reg_url_link' => $this->checkout->reg_url_link ), |
|
1462 | + array('e_reg_url_link' => $this->checkout->reg_url_link), |
|
1463 | 1463 | $this->checkout->thank_you_page_url |
1464 | 1464 | ); |
1465 | 1465 | } |
@@ -1477,36 +1477,36 @@ discard block |
||
1477 | 1477 | */ |
1478 | 1478 | private function _process_payment() { |
1479 | 1479 | // basically confirm that the event hasn't sold out since they hit the page |
1480 | - if ( ! $this->_last_second_ticket_verifications() ) { |
|
1480 | + if ( ! $this->_last_second_ticket_verifications()) { |
|
1481 | 1481 | return false; |
1482 | 1482 | } |
1483 | 1483 | // ya gotta make a choice man |
1484 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1484 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1485 | 1485 | $this->checkout->json_response->set_plz_select_method_of_payment( |
1486 | - __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
1486 | + __('Please select a method of payment before proceeding.', 'event_espresso') |
|
1487 | 1487 | ); |
1488 | 1488 | return false; |
1489 | 1489 | } |
1490 | 1490 | // get EE_Payment_Method object |
1491 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1491 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1492 | 1492 | return false; |
1493 | 1493 | } |
1494 | 1494 | // setup billing form |
1495 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1495 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1496 | 1496 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1497 | 1497 | $this->checkout->payment_method |
1498 | 1498 | ); |
1499 | 1499 | // bad billing form ? |
1500 | - if ( ! $this->_billing_form_is_valid() ) { |
|
1500 | + if ( ! $this->_billing_form_is_valid()) { |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | 1503 | } |
1504 | 1504 | // ensure primary registrant has been fully processed |
1505 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
1505 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
1506 | 1506 | return false; |
1507 | 1507 | } |
1508 | 1508 | // if session is close to expiring (under 10 minutes by default) |
1509 | - if ( ( time() - EE_Registry::instance()->SSN->expiration() ) < EE_Registry::instance()->SSN->extension() ) { |
|
1509 | + if ((time() - EE_Registry::instance()->SSN->expiration()) < EE_Registry::instance()->SSN->extension()) { |
|
1510 | 1510 | // add some time to session expiration so that payment can be completed |
1511 | 1511 | EE_Registry::instance()->SSN->extend_expiration(); |
1512 | 1512 | } |
@@ -1515,18 +1515,18 @@ discard block |
||
1515 | 1515 | // in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved |
1516 | 1516 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
1517 | 1517 | // attempt payment |
1518 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
1518 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
1519 | 1519 | // process results |
1520 | - $payment = $this->_validate_payment( $payment ); |
|
1521 | - $payment = $this->_post_payment_processing( $payment ); |
|
1520 | + $payment = $this->_validate_payment($payment); |
|
1521 | + $payment = $this->_post_payment_processing($payment); |
|
1522 | 1522 | // verify payment |
1523 | - if ( $payment instanceof EE_Payment ) { |
|
1523 | + if ($payment instanceof EE_Payment) { |
|
1524 | 1524 | // store that for later |
1525 | 1525 | $this->checkout->payment = $payment; |
1526 | 1526 | /** @type EE_Transaction_Processor $transaction_processor */ |
1527 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1527 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1528 | 1528 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1529 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1529 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1530 | 1530 | $payment_status = $payment->status(); |
1531 | 1531 | if ( |
1532 | 1532 | $payment_status === EEM_Payment::status_id_approved |
@@ -1536,7 +1536,7 @@ discard block |
||
1536 | 1536 | } else { |
1537 | 1537 | return false; |
1538 | 1538 | } |
1539 | - } else if ( $payment === true ) { |
|
1539 | + } else if ($payment === true) { |
|
1540 | 1540 | // please note that offline payment methods will NOT make a payment, |
1541 | 1541 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
1542 | 1542 | $this->checkout->payment = $payment; |
@@ -1556,22 +1556,22 @@ discard block |
||
1556 | 1556 | */ |
1557 | 1557 | protected function _last_second_ticket_verifications() { |
1558 | 1558 | // don't bother re-validating if not a return visit |
1559 | - if ( ! $this->checkout->revisit ) { |
|
1559 | + if ( ! $this->checkout->revisit) { |
|
1560 | 1560 | return true; |
1561 | 1561 | } |
1562 | 1562 | $registrations = $this->checkout->transaction->registrations(); |
1563 | - if ( empty( $registrations ) ) { |
|
1563 | + if (empty($registrations)) { |
|
1564 | 1564 | return false; |
1565 | 1565 | } |
1566 | - foreach ( $registrations as $registration ) { |
|
1567 | - if ( $registration instanceof EE_Registration ) { |
|
1566 | + foreach ($registrations as $registration) { |
|
1567 | + if ($registration instanceof EE_Registration) { |
|
1568 | 1568 | $event = $registration->event_obj(); |
1569 | - if ( $event instanceof EE_Event && $event->is_sold_out( true ) ) { |
|
1569 | + if ($event instanceof EE_Event && $event->is_sold_out(true)) { |
|
1570 | 1570 | EE_Error::add_error( |
1571 | 1571 | apply_filters( |
1572 | 1572 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___last_second_ticket_verifications__sold_out_events_msg', |
1573 | 1573 | sprintf( |
1574 | - __( 'It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' ), |
|
1574 | + __('It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso'), |
|
1575 | 1575 | $event->name() |
1576 | 1576 | ) |
1577 | 1577 | ), |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | ); |
1602 | 1602 | $html = $payment_method_billing_info->get_html_and_js(); |
1603 | 1603 | $html .= $this->checkout->redirect_form; |
1604 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
1604 | + EE_Registry::instance()->REQ->add_output($html); |
|
1605 | 1605 | return true; |
1606 | 1606 | } |
1607 | 1607 | |
@@ -1615,28 +1615,28 @@ discard block |
||
1615 | 1615 | * @throws \EE_Error |
1616 | 1616 | */ |
1617 | 1617 | private function _billing_form_is_valid() { |
1618 | - if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1618 | + if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1619 | 1619 | return true; |
1620 | 1620 | } |
1621 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
1622 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
1621 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
1622 | + if ($this->checkout->billing_form->was_submitted()) { |
|
1623 | 1623 | $this->checkout->billing_form->receive_form_submission(); |
1624 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
1624 | + if ($this->checkout->billing_form->is_valid()) { |
|
1625 | 1625 | return true; |
1626 | 1626 | } |
1627 | 1627 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
1628 | 1628 | $error_strings = array(); |
1629 | - foreach ( $validation_errors as $validation_error ) { |
|
1630 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1629 | + foreach ($validation_errors as $validation_error) { |
|
1630 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1631 | 1631 | $form_section = $validation_error->get_form_section(); |
1632 | - if ( $form_section instanceof EE_Form_Input_Base ) { |
|
1632 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
1633 | 1633 | $label = $form_section->html_label_text(); |
1634 | - } elseif ( $form_section instanceof EE_Form_Section_Base ) { |
|
1634 | + } elseif ($form_section instanceof EE_Form_Section_Base) { |
|
1635 | 1635 | $label = $form_section->name(); |
1636 | 1636 | } else { |
1637 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
1637 | + $label = __('Validation Error', 'event_espresso'); |
|
1638 | 1638 | } |
1639 | - $error_strings[] = sprintf( '%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
1639 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
1640 | 1640 | } |
1641 | 1641 | } |
1642 | 1642 | EE_Error::add_error( |
@@ -1646,7 +1646,7 @@ discard block |
||
1646 | 1646 | 'event_espresso' |
1647 | 1647 | ), |
1648 | 1648 | '<br/>', |
1649 | - implode( '<br/>', $error_strings ) |
|
1649 | + implode('<br/>', $error_strings) |
|
1650 | 1650 | ), |
1651 | 1651 | __FILE__, |
1652 | 1652 | __FUNCTION__, |
@@ -1665,7 +1665,7 @@ discard block |
||
1665 | 1665 | } |
1666 | 1666 | } else { |
1667 | 1667 | EE_Error::add_error( |
1668 | - __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), |
|
1668 | + __('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), |
|
1669 | 1669 | __FILE__, |
1670 | 1670 | __FUNCTION__, |
1671 | 1671 | __LINE__ |
@@ -1700,13 +1700,13 @@ discard block |
||
1700 | 1700 | // grab the primary_registration object |
1701 | 1701 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1702 | 1702 | /** @type EE_Transaction_Processor $transaction_processor */ |
1703 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1703 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1704 | 1704 | // at this point we'll consider a TXN to not have been failed |
1705 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1705 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1706 | 1706 | // save the TXN ( which clears cached copy of primary_registration) |
1707 | 1707 | $this->checkout->transaction->save(); |
1708 | 1708 | // grab TXN ID and save it to the primary_registration |
1709 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
1709 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
1710 | 1710 | // save what we have so far |
1711 | 1711 | $primary_registration->save(); |
1712 | 1712 | return true; |
@@ -1724,7 +1724,7 @@ discard block |
||
1724 | 1724 | private function _capture_primary_registration_data_from_billing_form() { |
1725 | 1725 | // convert billing form data into an attendee |
1726 | 1726 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
1727 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
1727 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
1728 | 1728 | EE_Error::add_error( |
1729 | 1729 | sprintf( |
1730 | 1730 | __( |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | 'event_espresso' |
1733 | 1733 | ), |
1734 | 1734 | '<br/>', |
1735 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1735 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1736 | 1736 | ), |
1737 | 1737 | __FILE__, |
1738 | 1738 | __FUNCTION__, |
@@ -1741,7 +1741,7 @@ discard block |
||
1741 | 1741 | return false; |
1742 | 1742 | } |
1743 | 1743 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1744 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
1744 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
1745 | 1745 | EE_Error::add_error( |
1746 | 1746 | sprintf( |
1747 | 1747 | __( |
@@ -1749,7 +1749,7 @@ discard block |
||
1749 | 1749 | 'event_espresso' |
1750 | 1750 | ), |
1751 | 1751 | '<br/>', |
1752 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1752 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1753 | 1753 | ), |
1754 | 1754 | __FILE__, |
1755 | 1755 | __FUNCTION__, |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | ); |
1758 | 1758 | return false; |
1759 | 1759 | } |
1760 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) |
|
1760 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') |
|
1761 | 1761 | instanceof |
1762 | 1762 | EE_Attendee |
1763 | 1763 | ) { |
@@ -1768,7 +1768,7 @@ discard block |
||
1768 | 1768 | 'event_espresso' |
1769 | 1769 | ), |
1770 | 1770 | '<br/>', |
1771 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1771 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1772 | 1772 | ), |
1773 | 1773 | __FILE__, |
1774 | 1774 | __FUNCTION__, |
@@ -1777,9 +1777,9 @@ discard block |
||
1777 | 1777 | return false; |
1778 | 1778 | } |
1779 | 1779 | /** @type EE_Registration_Processor $registration_processor */ |
1780 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1780 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1781 | 1781 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1782 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
1782 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
1783 | 1783 | return true; |
1784 | 1784 | } |
1785 | 1785 | |
@@ -1795,17 +1795,17 @@ discard block |
||
1795 | 1795 | */ |
1796 | 1796 | private function _get_payment_method_for_selected_method_of_payment() { |
1797 | 1797 | // get EE_Payment_Method object |
1798 | - if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] ) ) { |
|
1799 | - $payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ]; |
|
1798 | + if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) { |
|
1799 | + $payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment]; |
|
1800 | 1800 | } else { |
1801 | 1801 | // load EEM_Payment_Method |
1802 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
1802 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
1803 | 1803 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
1804 | 1804 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
1805 | - $payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
1805 | + $payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
1806 | 1806 | } |
1807 | 1807 | // verify $payment_method |
1808 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
1808 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
1809 | 1809 | // not a payment |
1810 | 1810 | EE_Error::add_error( |
1811 | 1811 | sprintf( |
@@ -1814,7 +1814,7 @@ discard block |
||
1814 | 1814 | 'event_espresso' |
1815 | 1815 | ), |
1816 | 1816 | '<br/>', |
1817 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1817 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1818 | 1818 | ), |
1819 | 1819 | __FILE__, |
1820 | 1820 | __FUNCTION__, |
@@ -1823,7 +1823,7 @@ discard block |
||
1823 | 1823 | return null; |
1824 | 1824 | } |
1825 | 1825 | // and verify it has a valid Payment_Method Type object |
1826 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
1826 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
1827 | 1827 | // not a payment |
1828 | 1828 | EE_Error::add_error( |
1829 | 1829 | sprintf( |
@@ -1832,7 +1832,7 @@ discard block |
||
1832 | 1832 | 'event_espresso' |
1833 | 1833 | ), |
1834 | 1834 | '<br/>', |
1835 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1835 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1836 | 1836 | ), |
1837 | 1837 | __FILE__, |
1838 | 1838 | __FUNCTION__, |
@@ -1853,29 +1853,29 @@ discard block |
||
1853 | 1853 | * @return mixed EE_Payment | boolean |
1854 | 1854 | * @throws \EE_Error |
1855 | 1855 | */ |
1856 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
1856 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
1857 | 1857 | $payment = null; |
1858 | 1858 | $this->checkout->transaction->save(); |
1859 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1860 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
1859 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1860 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
1861 | 1861 | return false; |
1862 | 1862 | } |
1863 | 1863 | try { |
1864 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
1864 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
1865 | 1865 | // generate payment object |
1866 | 1866 | $payment = $payment_processor->process_payment( |
1867 | 1867 | $payment_method, |
1868 | 1868 | $this->checkout->transaction, |
1869 | 1869 | $this->checkout->amount_owing, |
1870 | 1870 | $this->checkout->billing_form, |
1871 | - $this->_get_return_url( $payment_method ), |
|
1871 | + $this->_get_return_url($payment_method), |
|
1872 | 1872 | 'CART', |
1873 | 1873 | $this->checkout->admin_request, |
1874 | 1874 | true, |
1875 | 1875 | $this->reg_step_url() |
1876 | 1876 | ); |
1877 | - } catch ( Exception $e ) { |
|
1878 | - $this->_handle_payment_processor_exception( $e ); |
|
1877 | + } catch (Exception $e) { |
|
1878 | + $this->_handle_payment_processor_exception($e); |
|
1879 | 1879 | } |
1880 | 1880 | return $payment; |
1881 | 1881 | } |
@@ -1890,7 +1890,7 @@ discard block |
||
1890 | 1890 | * @return void |
1891 | 1891 | * @throws \EE_Error |
1892 | 1892 | */ |
1893 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
1893 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
1894 | 1894 | EE_Error::add_error( |
1895 | 1895 | sprintf( |
1896 | 1896 | __( |
@@ -1898,7 +1898,7 @@ discard block |
||
1898 | 1898 | 'event_espresso' |
1899 | 1899 | ), |
1900 | 1900 | '<br/>', |
1901 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
1901 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
1902 | 1902 | $e->getMessage(), |
1903 | 1903 | $e->getFile(), |
1904 | 1904 | $e->getLine() |
@@ -1919,9 +1919,9 @@ discard block |
||
1919 | 1919 | * @return string |
1920 | 1920 | * @throws \EE_Error |
1921 | 1921 | */ |
1922 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
1922 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
1923 | 1923 | $return_url = ''; |
1924 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1924 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1925 | 1925 | case EE_PMT_Base::offsite : |
1926 | 1926 | $return_url = add_query_arg( |
1927 | 1927 | array( |
@@ -1950,12 +1950,12 @@ discard block |
||
1950 | 1950 | * @return EE_Payment | FALSE |
1951 | 1951 | * @throws \EE_Error |
1952 | 1952 | */ |
1953 | - private function _validate_payment( $payment = null ) { |
|
1954 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
1953 | + private function _validate_payment($payment = null) { |
|
1954 | + if ($this->checkout->payment_method->is_off_line()) { |
|
1955 | 1955 | return true; |
1956 | 1956 | } |
1957 | 1957 | // verify payment object |
1958 | - if ( ! $payment instanceof EE_Payment ) { |
|
1958 | + if ( ! $payment instanceof EE_Payment) { |
|
1959 | 1959 | // not a payment |
1960 | 1960 | EE_Error::add_error( |
1961 | 1961 | sprintf( |
@@ -1964,7 +1964,7 @@ discard block |
||
1964 | 1964 | 'event_espresso' |
1965 | 1965 | ), |
1966 | 1966 | '<br/>', |
1967 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1967 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1968 | 1968 | ), |
1969 | 1969 | __FILE__, |
1970 | 1970 | __FUNCTION__, |
@@ -1985,27 +1985,27 @@ discard block |
||
1985 | 1985 | * @return bool |
1986 | 1986 | * @throws \EE_Error |
1987 | 1987 | */ |
1988 | - private function _post_payment_processing( $payment = null ) { |
|
1988 | + private function _post_payment_processing($payment = null) { |
|
1989 | 1989 | // Off-Line payment? |
1990 | - if ( $payment === true ) { |
|
1990 | + if ($payment === true) { |
|
1991 | 1991 | //$this->_setup_redirect_for_next_step(); |
1992 | 1992 | return true; |
1993 | 1993 | // On-Site payment? |
1994 | - } else if ( $this->checkout->payment_method->is_on_site() ) { |
|
1995 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite ) ) { |
|
1994 | + } else if ($this->checkout->payment_method->is_on_site()) { |
|
1995 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
1996 | 1996 | //$this->_setup_redirect_for_next_step(); |
1997 | 1997 | $this->checkout->continue_reg = false; |
1998 | 1998 | } |
1999 | 1999 | // Off-Site payment? |
2000 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
2000 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
2001 | 2001 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
2002 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ) { |
|
2003 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' ); |
|
2002 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
2003 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()'); |
|
2004 | 2004 | $this->checkout->redirect = true; |
2005 | 2005 | $this->checkout->redirect_form = $payment->redirect_form(); |
2006 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
2006 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
2007 | 2007 | // set JSON response |
2008 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
2008 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
2009 | 2009 | // set cron job for finalizing the TXN |
2010 | 2010 | // in case the user does not return from the off-site gateway |
2011 | 2011 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -2013,7 +2013,7 @@ discard block |
||
2013 | 2013 | $this->checkout->transaction->ID() |
2014 | 2014 | ); |
2015 | 2015 | // and lastly, let's bump the payment status to pending |
2016 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
2016 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
2017 | 2017 | $payment->save(); |
2018 | 2018 | } else { |
2019 | 2019 | // not a payment |
@@ -2025,7 +2025,7 @@ discard block |
||
2025 | 2025 | 'event_espresso' |
2026 | 2026 | ), |
2027 | 2027 | '<br/>', |
2028 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2028 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2029 | 2029 | ), |
2030 | 2030 | __FILE__, |
2031 | 2031 | __FUNCTION__, |
@@ -2063,21 +2063,21 @@ discard block |
||
2063 | 2063 | * @return bool |
2064 | 2064 | * @throws \EE_Error |
2065 | 2065 | */ |
2066 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
2066 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
2067 | 2067 | // off-line payment? carry on |
2068 | - if ( $payment_occurs === EE_PMT_Base::offline ) { |
|
2068 | + if ($payment_occurs === EE_PMT_Base::offline) { |
|
2069 | 2069 | return true; |
2070 | 2070 | } |
2071 | 2071 | // verify payment validity |
2072 | - if ( $payment instanceof EE_Payment ) { |
|
2073 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
2072 | + if ($payment instanceof EE_Payment) { |
|
2073 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
2074 | 2074 | $msg = $payment->gateway_response(); |
2075 | 2075 | // check results |
2076 | - switch ( $payment->status() ) { |
|
2076 | + switch ($payment->status()) { |
|
2077 | 2077 | // good payment |
2078 | 2078 | case EEM_Payment::status_id_approved : |
2079 | 2079 | EE_Error::add_success( |
2080 | - __( 'Your payment was processed successfully.', 'event_espresso' ), |
|
2080 | + __('Your payment was processed successfully.', 'event_espresso'), |
|
2081 | 2081 | __FILE__, |
2082 | 2082 | __FUNCTION__, |
2083 | 2083 | __LINE__ |
@@ -2086,45 +2086,45 @@ discard block |
||
2086 | 2086 | break; |
2087 | 2087 | // slow payment |
2088 | 2088 | case EEM_Payment::status_id_pending : |
2089 | - if ( empty( $msg ) ) { |
|
2089 | + if (empty($msg)) { |
|
2090 | 2090 | $msg = __( |
2091 | 2091 | 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', |
2092 | 2092 | 'event_espresso' |
2093 | 2093 | ); |
2094 | 2094 | } |
2095 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2095 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2096 | 2096 | return true; |
2097 | 2097 | break; |
2098 | 2098 | // don't wanna payment |
2099 | 2099 | case EEM_Payment::status_id_cancelled : |
2100 | - if ( empty( $msg ) ) { |
|
2100 | + if (empty($msg)) { |
|
2101 | 2101 | $msg = _n( |
2102 | 2102 | 'Payment cancelled. Please try again.', |
2103 | 2103 | 'Payment cancelled. Please try again or select another method of payment.', |
2104 | - count( $this->checkout->available_payment_methods ), |
|
2104 | + count($this->checkout->available_payment_methods), |
|
2105 | 2105 | 'event_espresso' |
2106 | 2106 | ); |
2107 | 2107 | } |
2108 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2108 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2109 | 2109 | return false; |
2110 | 2110 | break; |
2111 | 2111 | // not enough payment |
2112 | 2112 | case EEM_Payment::status_id_declined : |
2113 | - if ( empty( $msg ) ) { |
|
2113 | + if (empty($msg)) { |
|
2114 | 2114 | $msg = _n( |
2115 | 2115 | 'We\'re sorry but your payment was declined. Please try again.', |
2116 | 2116 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
2117 | - count( $this->checkout->available_payment_methods ), |
|
2117 | + count($this->checkout->available_payment_methods), |
|
2118 | 2118 | 'event_espresso' |
2119 | 2119 | ); |
2120 | 2120 | } |
2121 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2121 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2122 | 2122 | return false; |
2123 | 2123 | break; |
2124 | 2124 | // bad payment |
2125 | 2125 | case EEM_Payment::status_id_failed : |
2126 | - if ( ! empty( $msg ) ) { |
|
2127 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2126 | + if ( ! empty($msg)) { |
|
2127 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2128 | 2128 | return false; |
2129 | 2129 | } |
2130 | 2130 | // default to error below |
@@ -2133,7 +2133,7 @@ discard block |
||
2133 | 2133 | } |
2134 | 2134 | // off-site payment gateway responses are too unreliable, so let's just assume that |
2135 | 2135 | // the payment processing is just running slower than the registrant's request |
2136 | - if ( $payment_occurs === EE_PMT_Base::offsite ) { |
|
2136 | + if ($payment_occurs === EE_PMT_Base::offsite) { |
|
2137 | 2137 | return true; |
2138 | 2138 | } |
2139 | 2139 | EE_Error::add_error( |
@@ -2143,7 +2143,7 @@ discard block |
||
2143 | 2143 | 'event_espresso' |
2144 | 2144 | ), |
2145 | 2145 | '<br/>', |
2146 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2146 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2147 | 2147 | ), |
2148 | 2148 | __FILE__, |
2149 | 2149 | __FUNCTION__, |
@@ -2176,13 +2176,13 @@ discard block |
||
2176 | 2176 | public function process_gateway_response() { |
2177 | 2177 | $payment = null; |
2178 | 2178 | // how have they chosen to pay? |
2179 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
2179 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
2180 | 2180 | // get EE_Payment_Method object |
2181 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
2181 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
2182 | 2182 | $this->checkout->continue_reg = false; |
2183 | 2183 | return false; |
2184 | 2184 | } |
2185 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
2185 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
2186 | 2186 | return false; |
2187 | 2187 | } |
2188 | 2188 | $this->_validate_offsite_return(); |
@@ -2196,23 +2196,23 @@ discard block |
||
2196 | 2196 | // true |
2197 | 2197 | //); |
2198 | 2198 | // verify TXN |
2199 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
2199 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
2200 | 2200 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
2201 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
2201 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
2202 | 2202 | $this->checkout->continue_reg = false; |
2203 | 2203 | return false; |
2204 | 2204 | } |
2205 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
2206 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
2207 | - $payment = $this->_validate_payment( $payment ); |
|
2205 | + $payment = $this->_process_off_site_payment($gateway); |
|
2206 | + $payment = $this->_process_cancelled_payments($payment); |
|
2207 | + $payment = $this->_validate_payment($payment); |
|
2208 | 2208 | // if payment was not declined by the payment gateway or cancelled by the registrant |
2209 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
2209 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
2210 | 2210 | //$this->_setup_redirect_for_next_step(); |
2211 | 2211 | // store that for later |
2212 | 2212 | $this->checkout->payment = $payment; |
2213 | 2213 | // mark this reg step as completed, as long as gateway doesn't use a separate IPN request, |
2214 | 2214 | // because we will complete this step during the IPN processing then |
2215 | - if ( $gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request() ) { |
|
2215 | + if ($gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request()) { |
|
2216 | 2216 | $this->set_completed(); |
2217 | 2217 | } |
2218 | 2218 | return true; |
@@ -2236,21 +2236,21 @@ discard block |
||
2236 | 2236 | * @throws \EE_Error |
2237 | 2237 | */ |
2238 | 2238 | private function _validate_offsite_return() { |
2239 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
2240 | - if ( $TXN_ID !== $this->checkout->transaction->ID() ) { |
|
2239 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
2240 | + if ($TXN_ID !== $this->checkout->transaction->ID()) { |
|
2241 | 2241 | // Houston... we might have a problem |
2242 | 2242 | $invalid_TXN = false; |
2243 | 2243 | // first gather some info |
2244 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
2244 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
2245 | 2245 | $primary_registrant = $valid_TXN instanceof EE_Transaction |
2246 | 2246 | ? $valid_TXN->primary_registration() |
2247 | 2247 | : null; |
2248 | 2248 | // let's start by retrieving the cart for this TXN |
2249 | - $cart = $this->checkout->get_cart_for_transaction( $this->checkout->transaction ); |
|
2250 | - if ( $cart instanceof EE_Cart ) { |
|
2249 | + $cart = $this->checkout->get_cart_for_transaction($this->checkout->transaction); |
|
2250 | + if ($cart instanceof EE_Cart) { |
|
2251 | 2251 | // verify that the current cart has tickets |
2252 | 2252 | $tickets = $cart->get_tickets(); |
2253 | - if ( empty( $tickets ) ) { |
|
2253 | + if (empty($tickets)) { |
|
2254 | 2254 | $invalid_TXN = true; |
2255 | 2255 | } |
2256 | 2256 | } else { |
@@ -2260,39 +2260,39 @@ discard block |
||
2260 | 2260 | ? $primary_registrant->session_ID() |
2261 | 2261 | : null; |
2262 | 2262 | // validate current Session ID and compare against valid TXN session ID |
2263 | - if ( EE_Session::instance()->id() === null ) { |
|
2263 | + if (EE_Session::instance()->id() === null) { |
|
2264 | 2264 | $invalid_TXN = true; |
2265 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
2265 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
2266 | 2266 | // WARNING !!! |
2267 | 2267 | // this could be PayPal sending back duplicate requests (ya they do that) |
2268 | 2268 | // or it **could** mean someone is simply registering AGAIN after having just done so |
2269 | 2269 | // so now we need to determine if this current TXN looks valid or not |
2270 | 2270 | /** @type EE_Transaction_Processor $transaction_processor */ |
2271 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
2271 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
2272 | 2272 | // has this step even been started ? |
2273 | - if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false ) |
|
2273 | + if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false) |
|
2274 | 2274 | ) { |
2275 | 2275 | // really? you're half way through this reg step, but you never started it ? |
2276 | 2276 | $invalid_TXN = true; |
2277 | 2277 | } |
2278 | 2278 | } |
2279 | - if ( $invalid_TXN ) { |
|
2279 | + if ($invalid_TXN) { |
|
2280 | 2280 | // is the valid TXN completed ? |
2281 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
2281 | + if ($valid_TXN instanceof EE_Transaction) { |
|
2282 | 2282 | /** @type EE_Transaction_Processor $transaction_processor */ |
2283 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
2283 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
2284 | 2284 | // has this step even been started ? |
2285 | - $reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() ); |
|
2286 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
2285 | + $reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug()); |
|
2286 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
2287 | 2287 | // so it **looks** like this is a double request from PayPal |
2288 | 2288 | // so let's try to pick up where we left off |
2289 | 2289 | $this->checkout->transaction = $valid_TXN; |
2290 | - $this->checkout->refresh_all_entities( true ); |
|
2290 | + $this->checkout->refresh_all_entities(true); |
|
2291 | 2291 | return; |
2292 | 2292 | } |
2293 | 2293 | } |
2294 | 2294 | // you appear to be lost? |
2295 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
2295 | + $this->_redirect_wayward_request($primary_registrant); |
|
2296 | 2296 | } |
2297 | 2297 | } |
2298 | 2298 | } |
@@ -2307,14 +2307,14 @@ discard block |
||
2307 | 2307 | * @return bool |
2308 | 2308 | * @throws \EE_Error |
2309 | 2309 | */ |
2310 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
2311 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
2310 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
2311 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
2312 | 2312 | // try redirecting based on the current TXN |
2313 | 2313 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction |
2314 | 2314 | ? $this->checkout->transaction->primary_registration() |
2315 | 2315 | : null; |
2316 | 2316 | } |
2317 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
2317 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
2318 | 2318 | EE_Error::add_error( |
2319 | 2319 | sprintf( |
2320 | 2320 | __( |
@@ -2322,7 +2322,7 @@ discard block |
||
2322 | 2322 | 'event_espresso' |
2323 | 2323 | ), |
2324 | 2324 | '<br/>', |
2325 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2325 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2326 | 2326 | ), |
2327 | 2327 | __FILE__, |
2328 | 2328 | __FUNCTION__, |
@@ -2353,17 +2353,17 @@ discard block |
||
2353 | 2353 | * @return \EE_Payment |
2354 | 2354 | * @throws \EE_Error |
2355 | 2355 | */ |
2356 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
2356 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
2357 | 2357 | try { |
2358 | 2358 | $request_data = \EE_Registry::instance()->REQ->params(); |
2359 | 2359 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
2360 | 2360 | $this->set_handle_IPN_in_this_request( |
2361 | - $gateway->handle_IPN_in_this_request( $request_data, false ) |
|
2361 | + $gateway->handle_IPN_in_this_request($request_data, false) |
|
2362 | 2362 | ); |
2363 | - if ( $this->handle_IPN_in_this_request() ) { |
|
2363 | + if ($this->handle_IPN_in_this_request()) { |
|
2364 | 2364 | // get payment details and process results |
2365 | 2365 | /** @type EE_Payment_Processor $payment_processor */ |
2366 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
2366 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
2367 | 2367 | $payment = $payment_processor->process_ipn( |
2368 | 2368 | $request_data, |
2369 | 2369 | $this->checkout->transaction, |
@@ -2376,14 +2376,14 @@ discard block |
||
2376 | 2376 | $payment = $this->checkout->transaction->last_payment(); |
2377 | 2377 | //$payment_source = 'last_payment'; |
2378 | 2378 | } |
2379 | - } catch ( Exception $e ) { |
|
2379 | + } catch (Exception $e) { |
|
2380 | 2380 | // let's just eat the exception and try to move on using any previously set payment info |
2381 | 2381 | $payment = $this->checkout->transaction->last_payment(); |
2382 | 2382 | //$payment_source = 'last_payment after Exception'; |
2383 | 2383 | // but if we STILL don't have a payment object |
2384 | - if ( ! $payment instanceof EE_Payment ) { |
|
2384 | + if ( ! $payment instanceof EE_Payment) { |
|
2385 | 2385 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
2386 | - $this->_handle_payment_processor_exception( $e ); |
|
2386 | + $this->_handle_payment_processor_exception($e); |
|
2387 | 2387 | } |
2388 | 2388 | } |
2389 | 2389 | // DEBUG LOG |
@@ -2408,13 +2408,13 @@ discard block |
||
2408 | 2408 | * @return EE_Payment | FALSE |
2409 | 2409 | * @throws \EE_Error |
2410 | 2410 | */ |
2411 | - private function _process_cancelled_payments( $payment = null ) { |
|
2411 | + private function _process_cancelled_payments($payment = null) { |
|
2412 | 2412 | if ( |
2413 | 2413 | $payment instanceof EE_Payment |
2414 | - && isset( $_REQUEST['ee_cancel_payment'] ) |
|
2414 | + && isset($_REQUEST['ee_cancel_payment']) |
|
2415 | 2415 | && $payment->status() === EEM_Payment::status_id_failed |
2416 | 2416 | ) { |
2417 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
2417 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
2418 | 2418 | } |
2419 | 2419 | return $payment; |
2420 | 2420 | } |
@@ -2431,14 +2431,14 @@ discard block |
||
2431 | 2431 | public function get_transaction_details_for_gateways() { |
2432 | 2432 | $txn_details = array(); |
2433 | 2433 | // ya gotta make a choice man |
2434 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
2434 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
2435 | 2435 | $txn_details = array( |
2436 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
2436 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
2437 | 2437 | ); |
2438 | 2438 | } |
2439 | 2439 | // get EE_Payment_Method object |
2440 | 2440 | if ( |
2441 | - empty( $txn_details ) |
|
2441 | + empty($txn_details) |
|
2442 | 2442 | && |
2443 | 2443 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
2444 | 2444 | ) { |
@@ -2450,8 +2450,8 @@ discard block |
||
2450 | 2450 | ) |
2451 | 2451 | ); |
2452 | 2452 | } |
2453 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
2454 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
2453 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
2454 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
2455 | 2455 | $txn_details = array( |
2456 | 2456 | 'TXN_ID' => $this->checkout->transaction->ID(), |
2457 | 2457 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -2462,7 +2462,7 @@ discard block |
||
2462 | 2462 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
2463 | 2463 | 'payment_amount' => $this->checkout->amount_owing, |
2464 | 2464 | 'return_url' => $return_url, |
2465 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
2465 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
2466 | 2466 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
2467 | 2467 | array( |
2468 | 2468 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | ) |
2472 | 2472 | ); |
2473 | 2473 | } |
2474 | - echo json_encode( $txn_details ); |
|
2474 | + echo json_encode($txn_details); |
|
2475 | 2475 | exit(); |
2476 | 2476 | } |
2477 | 2477 |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Checkout |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Checkout |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_Checkout { |
15 | 15 | |
16 | 16 | /** |
@@ -792,10 +792,10 @@ discard block |
||
792 | 792 | */ |
793 | 793 | public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
794 | 794 | return ! $this->revisit |
795 | - || $this->primary_revisit |
|
796 | - || ( |
|
797 | - $this->revisit && $this->reg_url_link === $registration->reg_url_link() |
|
798 | - ) |
|
795 | + || $this->primary_revisit |
|
796 | + || ( |
|
797 | + $this->revisit && $this->reg_url_link === $registration->reg_url_link() |
|
798 | + ) |
|
799 | 799 | ? true |
800 | 800 | : false; |
801 | 801 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | /** |
253 | 253 | * returns true if ANY reg status was updated during checkout |
254 | - * @return array |
|
254 | + * @return boolean |
|
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | 257 | foreach ( $this->reg_status_updated as $reg_status ) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | /** |
278 | 278 | * @param $REG_ID |
279 | - * @param $reg_status |
|
279 | + * @param boolean $reg_status |
|
280 | 280 | */ |
281 | 281 | public function set_reg_status_updated( $REG_ID, $reg_status ) { |
282 | 282 | $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | * reset_reg_steps |
634 | 634 | * |
635 | 635 | * @access public |
636 | - * @return bool |
|
636 | + * @return boolean|null |
|
637 | 637 | */ |
638 | 638 | public function reset_reg_steps() { |
639 | 639 | $this->sort_reg_steps(); |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | * stores whether any updates were made to the TXN or it's related registrations |
749 | 749 | * |
750 | 750 | * @access public |
751 | - * @return bool |
|
751 | + * @return boolean|null |
|
752 | 752 | * @throws \EE_Error |
753 | 753 | */ |
754 | 754 | public function track_transaction_and_registration_status_updates() { |
@@ -1110,6 +1110,7 @@ discard block |
||
1110 | 1110 | * |
1111 | 1111 | * @param string | int $reg_cache_ID |
1112 | 1112 | * @param EE_Registration $registration |
1113 | + * @param integer $reg_cache_ID |
|
1113 | 1114 | * @return void |
1114 | 1115 | * @throws \EE_Error |
1115 | 1116 | */ |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | $this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url(); |
243 | 243 | $this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url(); |
244 | 244 | $this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url(); |
245 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE ); |
|
245 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE); |
|
246 | 246 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax; |
247 | - $this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
247 | + $this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC')); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | * @return array |
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | - foreach ( $this->reg_status_updated as $reg_status ) { |
|
258 | - if ( $reg_status ) { |
|
257 | + foreach ($this->reg_status_updated as $reg_status) { |
|
258 | + if ($reg_status) { |
|
259 | 259 | return true; |
260 | 260 | } |
261 | 261 | } |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | * @param $REG_ID |
269 | 269 | * @return array |
270 | 270 | */ |
271 | - public function reg_status_updated( $REG_ID ) { |
|
272 | - return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false; |
|
271 | + public function reg_status_updated($REG_ID) { |
|
272 | + return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | * @param $REG_ID |
279 | 279 | * @param $reg_status |
280 | 280 | */ |
281 | - public function set_reg_status_updated( $REG_ID, $reg_status ) { |
|
282 | - $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
|
281 | + public function set_reg_status_updated($REG_ID, $reg_status) { |
|
282 | + $this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * can ONLY be set by the Finalize_Registration reg step |
301 | 301 | */ |
302 | 302 | public function set_exit_spco() { |
303 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
303 | + if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
304 | 304 | $this->exit_spco = true; |
305 | 305 | } |
306 | 306 | } |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function reset_for_current_request() { |
319 | 319 | $this->process_form_submission = FALSE; |
320 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true ); |
|
320 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true); |
|
321 | 321 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
322 | 322 | $this->continue_reg = true; |
323 | 323 | $this->redirect = false; |
324 | 324 | // don't reset the cached redirect form if we're about to be asked to display it !!! |
325 | - if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) { |
|
325 | + if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') { |
|
326 | 326 | $this->redirect_form = ''; |
327 | 327 | } |
328 | 328 | $this->redirect_url = ''; |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_SPCO_Reg_Step $reg_step_obj |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
|
343 | - $this->reg_steps[ $reg_step_obj->slug() ] = $reg_step_obj; |
|
342 | + public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) { |
|
343 | + $this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -356,22 +356,22 @@ discard block |
||
356 | 356 | * @return void |
357 | 357 | * @throws \EE_Error |
358 | 358 | */ |
359 | - public function skip_reg_step( $reg_step_slug = '' ) { |
|
360 | - $step_to_skip = $this->find_reg_step( $reg_step_slug ); |
|
361 | - if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) { |
|
362 | - $step_to_skip->set_is_current_step( false ); |
|
359 | + public function skip_reg_step($reg_step_slug = '') { |
|
360 | + $step_to_skip = $this->find_reg_step($reg_step_slug); |
|
361 | + if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) { |
|
362 | + $step_to_skip->set_is_current_step(false); |
|
363 | 363 | $step_to_skip->set_completed(); |
364 | 364 | // advance to the next step |
365 | - $this->set_current_step( $this->next_step->slug() ); |
|
365 | + $this->set_current_step($this->next_step->slug()); |
|
366 | 366 | // also reset the step param in the request in case any other code references that directly |
367 | - EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() ); |
|
367 | + EE_Registry::instance()->REQ->set('step', $this->current_step->slug()); |
|
368 | 368 | // since we are skipping a step and setting the current step to be what was previously the next step, |
369 | 369 | // we need to check that the next step is now correct, and not still set to the current step. |
370 | - if ( $this->current_step->slug() === $this->next_step->slug() ) { |
|
370 | + if ($this->current_step->slug() === $this->next_step->slug()) { |
|
371 | 371 | // correctly setup the next step |
372 | 372 | $this->set_next_step(); |
373 | 373 | } |
374 | - $this->set_reg_step_initiated( $this->current_step ); |
|
374 | + $this->set_reg_step_initiated($this->current_step); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | * @param bool $reset whether to reset reg steps after removal |
386 | 386 | * @throws EE_Error |
387 | 387 | */ |
388 | - public function remove_reg_step( $reg_step_slug = '', $reset = true ) { |
|
389 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
390 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
388 | + public function remove_reg_step($reg_step_slug = '', $reset = true) { |
|
389 | + unset($this->reg_steps[$reg_step_slug]); |
|
390 | + if ($this->transaction instanceof EE_Transaction) { |
|
391 | 391 | /** @type EE_Transaction_Processor $transaction_processor */ |
392 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
392 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
393 | 393 | // now remove reg step from TXN and save |
394 | - $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
|
394 | + $transaction_processor->remove_reg_step($this->transaction, $reg_step_slug); |
|
395 | 395 | $this->transaction->save(); |
396 | 396 | } |
397 | - if ( $reset ) { |
|
397 | + if ($reset) { |
|
398 | 398 | $this->reset_reg_steps(); |
399 | 399 | } |
400 | 400 | } |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | * @param int $order |
410 | 410 | * @return void |
411 | 411 | */ |
412 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
413 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
414 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
412 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
413 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
414 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | |
@@ -424,25 +424,25 @@ discard block |
||
424 | 424 | * @param string $current_step |
425 | 425 | * @return void |
426 | 426 | */ |
427 | - public function set_current_step( $current_step ) { |
|
427 | + public function set_current_step($current_step) { |
|
428 | 428 | // grab what step we're on |
429 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
429 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
430 | 430 | // verify instance |
431 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
431 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
432 | 432 | // we don't want to repeat completed steps if this is the first time through SPCO |
433 | - if ( $this->continue_reg && ! $this->revisit && $this->current_step->completed() ) { |
|
433 | + if ($this->continue_reg && ! $this->revisit && $this->current_step->completed()) { |
|
434 | 434 | // so advance to the next step |
435 | 435 | $this->set_next_step(); |
436 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
436 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
437 | 437 | // and attempt to set it as the current step |
438 | - $this->set_current_step( $this->next_step->slug() ); |
|
438 | + $this->set_current_step($this->next_step->slug()); |
|
439 | 439 | } |
440 | 440 | return; |
441 | 441 | } |
442 | - $this->current_step->set_is_current_step( TRUE ); |
|
442 | + $this->current_step->set_is_current_step(TRUE); |
|
443 | 443 | } else { |
444 | 444 | EE_Error::add_error( |
445 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
445 | + __('The current step could not be set.', 'event_espresso'), |
|
446 | 446 | __FILE__, __FUNCTION__, __LINE__ |
447 | 447 | ); |
448 | 448 | } |
@@ -459,20 +459,20 @@ discard block |
||
459 | 459 | */ |
460 | 460 | public function set_next_step() { |
461 | 461 | // set pointer to start of array |
462 | - reset( $this->reg_steps ); |
|
462 | + reset($this->reg_steps); |
|
463 | 463 | // if there is more than one step |
464 | - if ( count( $this->reg_steps ) > 1 ) { |
|
464 | + if (count($this->reg_steps) > 1) { |
|
465 | 465 | // advance to the current step and set pointer |
466 | - while ( key( $this->reg_steps ) !== $this->current_step->slug() && key( $this->reg_steps ) !== '' ) { |
|
467 | - next( $this->reg_steps ); |
|
466 | + while (key($this->reg_steps) !== $this->current_step->slug() && key($this->reg_steps) !== '') { |
|
467 | + next($this->reg_steps); |
|
468 | 468 | } |
469 | 469 | } |
470 | 470 | // advance one more spot ( if it exists ) |
471 | - $this->next_step = next( $this->reg_steps ); |
|
471 | + $this->next_step = next($this->reg_steps); |
|
472 | 472 | // verify instance |
473 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
473 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
474 | 474 | // then back to current step to reset |
475 | - prev( $this->reg_steps ); |
|
475 | + prev($this->reg_steps); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -486,8 +486,8 @@ discard block |
||
486 | 486 | * @return EE_SPCO_Reg_Step | null |
487 | 487 | */ |
488 | 488 | public function get_next_reg_step() { |
489 | - $next = next( $this->reg_steps ); |
|
490 | - prev( $this->reg_steps ); |
|
489 | + $next = next($this->reg_steps); |
|
490 | + prev($this->reg_steps); |
|
491 | 491 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
492 | 492 | } |
493 | 493 | |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | * @return EE_SPCO_Reg_Step | null |
503 | 503 | */ |
504 | 504 | public function get_prev_reg_step() { |
505 | - $prev = prev( $this->reg_steps ); |
|
506 | - next( $this->reg_steps ); |
|
505 | + $prev = prev($this->reg_steps); |
|
506 | + next($this->reg_steps); |
|
507 | 507 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
508 | 508 | } |
509 | 509 | |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | * @return void |
517 | 517 | */ |
518 | 518 | public function sort_reg_steps() { |
519 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
520 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
519 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
520 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -530,19 +530,19 @@ discard block |
||
530 | 530 | * @param string $reg_step_slug |
531 | 531 | * @return EE_SPCO_Reg_Step|null |
532 | 532 | */ |
533 | - public function find_reg_step( $reg_step_slug = '' ) { |
|
534 | - if ( ! empty( $reg_step_slug ) ) { |
|
533 | + public function find_reg_step($reg_step_slug = '') { |
|
534 | + if ( ! empty($reg_step_slug)) { |
|
535 | 535 | // copy reg step array |
536 | 536 | $reg_steps = $this->reg_steps; |
537 | 537 | // set pointer to start of array |
538 | - reset( $reg_steps ); |
|
538 | + reset($reg_steps); |
|
539 | 539 | // if there is more than one step |
540 | - if ( count( $reg_steps ) > 1 ) { |
|
540 | + if (count($reg_steps) > 1) { |
|
541 | 541 | // advance to the current step and set pointer |
542 | - while ( key( $reg_steps ) !== $reg_step_slug && key( $reg_steps ) !== '' ) { |
|
543 | - next( $reg_steps ); |
|
542 | + while (key($reg_steps) !== $reg_step_slug && key($reg_steps) !== '') { |
|
543 | + next($reg_steps); |
|
544 | 544 | } |
545 | - return current( $reg_steps ); |
|
545 | + return current($reg_steps); |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 | return null; |
@@ -558,17 +558,17 @@ discard block |
||
558 | 558 | * @param EE_SPCO_Reg_Step $reg_step_B |
559 | 559 | * @return array() |
560 | 560 | */ |
561 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
561 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
562 | 562 | // send finalize_registration step to the end of the array |
563 | - if ( $reg_step_A->slug() === 'finalize_registration' ) { |
|
563 | + if ($reg_step_A->slug() === 'finalize_registration') { |
|
564 | 564 | return 1; |
565 | - } else if ( $reg_step_B->slug() === 'finalize_registration' ) { |
|
565 | + } else if ($reg_step_B->slug() === 'finalize_registration') { |
|
566 | 566 | return -1; |
567 | 567 | } |
568 | - if ( $reg_step_A->order() === $reg_step_B->order() ) { |
|
568 | + if ($reg_step_A->order() === $reg_step_B->order()) { |
|
569 | 569 | return 0; |
570 | 570 | } |
571 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
571 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * @param EE_SPCO_Reg_Step $reg_step |
581 | 581 | * @throws \EE_Error |
582 | 582 | */ |
583 | - public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) { |
|
583 | + public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) { |
|
584 | 584 | // call set_reg_step_initiated ??? |
585 | 585 | if ( |
586 | 586 | // first time visiting SPCO ? |
@@ -593,13 +593,13 @@ discard block |
||
593 | 593 | ) |
594 | 594 | ) { |
595 | 595 | /** @type EE_Transaction_Processor $transaction_processor */ |
596 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
596 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
597 | 597 | // set the start time for this reg step |
598 | - if ( ! $transaction_processor->set_reg_step_initiated( $this->transaction, $reg_step->slug() ) ) { |
|
599 | - if ( WP_DEBUG ) { |
|
598 | + if ( ! $transaction_processor->set_reg_step_initiated($this->transaction, $reg_step->slug())) { |
|
599 | + if (WP_DEBUG) { |
|
600 | 600 | EE_Error::add_error( |
601 | 601 | sprintf( |
602 | - __( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), |
|
602 | + __('The "%1$s" registration step was not initialized properly.', 'event_espresso'), |
|
603 | 603 | $reg_step->name() |
604 | 604 | ), |
605 | 605 | __FILE__, __FUNCTION__, __LINE__ |
@@ -618,10 +618,10 @@ discard block |
||
618 | 618 | * @return void |
619 | 619 | */ |
620 | 620 | public function set_reg_step_JSON_info() { |
621 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
621 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
622 | 622 | // pass basic reg step data to JS |
623 | - foreach ( $this->reg_steps as $reg_step ) { |
|
624 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
623 | + foreach ($this->reg_steps as $reg_step) { |
|
624 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
625 | 625 | } |
626 | 626 | // reset reg step html |
627 | 627 | // $this->json_response->set_reg_step_html( '' ); |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | */ |
638 | 638 | public function reset_reg_steps() { |
639 | 639 | $this->sort_reg_steps(); |
640 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
640 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
641 | 641 | $this->set_next_step(); |
642 | 642 | // the text that appears on the reg step form submit button |
643 | 643 | $this->current_step->set_submit_button_text(); |
@@ -654,9 +654,9 @@ discard block |
||
654 | 654 | */ |
655 | 655 | public function get_registration_time_limit() { |
656 | 656 | |
657 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
657 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
658 | 658 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
659 | - $registration_time_limit = gmdate( $time_limit_format, $registration_time_limit ); |
|
659 | + $registration_time_limit = gmdate($time_limit_format, $registration_time_limit); |
|
660 | 660 | return apply_filters( |
661 | 661 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
662 | 662 | $registration_time_limit |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | // overpaid TXN |
677 | 677 | // free TXN ( total = 0.00 ) |
678 | 678 | // then payment required is TRUE |
679 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
679 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | |
@@ -688,12 +688,12 @@ discard block |
||
688 | 688 | * @param EE_Transaction $transaction |
689 | 689 | * @return EE_Cart |
690 | 690 | */ |
691 | - public function get_cart_for_transaction( $transaction ) { |
|
692 | - $session = EE_Registry::instance()->load_core( 'Session' ); |
|
693 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction, $session ) : null; |
|
691 | + public function get_cart_for_transaction($transaction) { |
|
692 | + $session = EE_Registry::instance()->load_core('Session'); |
|
693 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction, $session) : null; |
|
694 | 694 | // verify cart |
695 | - if ( ! $cart instanceof EE_Cart ) { |
|
696 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
695 | + if ( ! $cart instanceof EE_Cart) { |
|
696 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | return $cart; |
@@ -709,8 +709,8 @@ discard block |
||
709 | 709 | */ |
710 | 710 | public function initialize_txn_reg_steps_array() { |
711 | 711 | $txn_reg_steps_array = array(); |
712 | - foreach ( $this->reg_steps as $reg_step ) { |
|
713 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
712 | + foreach ($this->reg_steps as $reg_step) { |
|
713 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
714 | 714 | } |
715 | 715 | return $txn_reg_steps_array; |
716 | 716 | } |
@@ -727,15 +727,15 @@ discard block |
||
727 | 727 | public function update_txn_reg_steps_array() { |
728 | 728 | $updated = false; |
729 | 729 | /** @type EE_Transaction_Processor $transaction_processor */ |
730 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
731 | - foreach ( $this->reg_steps as $reg_step ) { |
|
732 | - if ( $reg_step->completed() ) { |
|
733 | - $updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) |
|
730 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
731 | + foreach ($this->reg_steps as $reg_step) { |
|
732 | + if ($reg_step->completed()) { |
|
733 | + $updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) |
|
734 | 734 | ? true |
735 | 735 | : $updated; |
736 | 736 | } |
737 | 737 | } |
738 | - if ( $updated ) { |
|
738 | + if ($updated) { |
|
739 | 739 | $this->transaction->save(); |
740 | 740 | } |
741 | 741 | return $updated; |
@@ -751,14 +751,14 @@ discard block |
||
751 | 751 | * @throws \EE_Error |
752 | 752 | */ |
753 | 753 | public function stash_transaction_and_checkout() { |
754 | - if ( ! $this->revisit ) { |
|
754 | + if ( ! $this->revisit) { |
|
755 | 755 | $this->update_txn_reg_steps_array(); |
756 | 756 | } |
757 | 757 | $this->track_transaction_and_registration_status_updates(); |
758 | 758 | // save all data to the db, but suppress errors |
759 | 759 | //$this->save_all_data( FALSE ); |
760 | 760 | // cache the checkout in the session |
761 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
761 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | |
@@ -773,21 +773,21 @@ discard block |
||
773 | 773 | */ |
774 | 774 | public function track_transaction_and_registration_status_updates() { |
775 | 775 | // verify the transaction |
776 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
776 | + if ($this->transaction instanceof EE_Transaction) { |
|
777 | 777 | /** @type EE_Transaction_Payments $transaction_payments */ |
778 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
778 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
779 | 779 | /** @type EE_Transaction_Processor $transaction_processor */ |
780 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
780 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
781 | 781 | // has there been a TXN status change during this checkout? |
782 | - if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) { |
|
782 | + if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) { |
|
783 | 783 | $this->txn_status_updated = true; |
784 | 784 | } |
785 | 785 | /** @type EE_Registration_Processor $registration_processor */ |
786 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
786 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
787 | 787 | // grab the saved registrations from the transaction |
788 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
789 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
790 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
788 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
789 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
790 | + $this->set_reg_status_updated($registration->ID(), true); |
|
791 | 791 | } |
792 | 792 | } |
793 | 793 | } |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | * @return bool |
809 | 809 | * @throws \EE_Error |
810 | 810 | */ |
811 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
811 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
812 | 812 | return ! $this->revisit |
813 | 813 | || $this->primary_revisit |
814 | 814 | || ( |
@@ -841,18 +841,18 @@ discard block |
||
841 | 841 | * @return bool |
842 | 842 | * @throws \EE_Error |
843 | 843 | */ |
844 | - public function save_all_data( $show_errors = TRUE ) { |
|
844 | + public function save_all_data($show_errors = TRUE) { |
|
845 | 845 | // verify the transaction |
846 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
846 | + if ($this->transaction instanceof EE_Transaction) { |
|
847 | 847 | // save to ensure that TXN has ID |
848 | 848 | $this->transaction->save(); |
849 | 849 | // grab the saved registrations from the transaction |
850 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
851 | - $this->_save_registration( $registration, $show_errors ); |
|
850 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
851 | + $this->_save_registration($registration, $show_errors); |
|
852 | 852 | } |
853 | 853 | } else { |
854 | - if ( $show_errors ) { |
|
855 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
854 | + if ($show_errors) { |
|
855 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
856 | 856 | } |
857 | 857 | return FALSE; |
858 | 858 | } |
@@ -869,32 +869,32 @@ discard block |
||
869 | 869 | * @return void |
870 | 870 | * @throws \EE_Error |
871 | 871 | */ |
872 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
872 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
873 | 873 | // verify object |
874 | - if ( $registration instanceof EE_Registration ) { |
|
874 | + if ($registration instanceof EE_Registration) { |
|
875 | 875 | // should this registration be processed during this visit ? |
876 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
876 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
877 | 877 | //set TXN ID |
878 | - if ( ! $registration->transaction_ID() ) { |
|
879 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
878 | + if ( ! $registration->transaction_ID()) { |
|
879 | + $registration->set_transaction_id($this->transaction->ID()); |
|
880 | 880 | } |
881 | 881 | // verify and save the attendee |
882 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
882 | + $this->_save_registration_attendee($registration, $show_errors); |
|
883 | 883 | // save answers to reg form questions |
884 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
884 | + $this->_save_registration_answers($registration, $show_errors); |
|
885 | 885 | // save changes |
886 | 886 | $registration->save(); |
887 | 887 | // update txn cache |
888 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
889 | - if ( $show_errors ) { |
|
890 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
888 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
889 | + if ($show_errors) { |
|
890 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
891 | 891 | } |
892 | 892 | } |
893 | 893 | } |
894 | 894 | } else { |
895 | - if ( $show_errors ) { |
|
895 | + if ($show_errors) { |
|
896 | 896 | EE_Error::add_error( |
897 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
897 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
898 | 898 | __FILE__, __FUNCTION__, __LINE__ |
899 | 899 | ); |
900 | 900 | } |
@@ -911,25 +911,25 @@ discard block |
||
911 | 911 | * @return void |
912 | 912 | * @throws \EE_Error |
913 | 913 | */ |
914 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
915 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
914 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
915 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
916 | 916 | // save so that ATT has ID |
917 | 917 | $registration->attendee()->save(); |
918 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() ) ) { |
|
919 | - if ( $show_errors ) { |
|
918 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
919 | + if ($show_errors) { |
|
920 | 920 | EE_Error::add_error( |
921 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
921 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
922 | 922 | __FILE__, __FUNCTION__, __LINE__ |
923 | 923 | ); |
924 | 924 | } |
925 | 925 | } |
926 | 926 | } else { |
927 | - if ( $show_errors ) { |
|
927 | + if ($show_errors) { |
|
928 | 928 | EE_Error::add_error( |
929 | 929 | sprintf( |
930 | 930 | '%1$s||%1$s $attendee = %2$s', |
931 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
932 | - var_export( $registration->attendee(), true ) |
|
931 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
932 | + var_export($registration->attendee(), true) |
|
933 | 933 | ), |
934 | 934 | __FILE__, __FUNCTION__, __LINE__ |
935 | 935 | ); |
@@ -947,25 +947,25 @@ discard block |
||
947 | 947 | * @return void |
948 | 948 | * @throws \EE_Error |
949 | 949 | */ |
950 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
950 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
951 | 951 | // now save the answers |
952 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
952 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
953 | 953 | // verify object |
954 | - if ( $answer instanceof EE_Answer ) { |
|
955 | - $answer->set_registration( $registration->ID() ); |
|
954 | + if ($answer instanceof EE_Answer) { |
|
955 | + $answer->set_registration($registration->ID()); |
|
956 | 956 | $answer->save(); |
957 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
958 | - if ( $show_errors ) { |
|
957 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
958 | + if ($show_errors) { |
|
959 | 959 | EE_Error::add_error( |
960 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
960 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
961 | 961 | __FILE__, __FUNCTION__, __LINE__ |
962 | 962 | ); |
963 | 963 | } |
964 | 964 | } |
965 | 965 | } else { |
966 | - if ( $show_errors ) { |
|
966 | + if ($show_errors) { |
|
967 | 967 | EE_Error::add_error( |
968 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
968 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
969 | 969 | __FILE__, __FUNCTION__, __LINE__ |
970 | 970 | ); |
971 | 971 | } |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | * @return bool |
985 | 985 | * @throws \EE_Error |
986 | 986 | */ |
987 | - public function refresh_all_entities( $from_db = false ) { |
|
987 | + public function refresh_all_entities($from_db = false) { |
|
988 | 988 | $from_db = $this->current_step->is_final_step() || $this->action === 'process_gateway_response' |
989 | 989 | ? true |
990 | 990 | : $from_db; |
@@ -1008,11 +1008,11 @@ discard block |
||
1008 | 1008 | */ |
1009 | 1009 | protected function refresh_from_db() { |
1010 | 1010 | // verify the transaction |
1011 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1011 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1012 | 1012 | // pull fresh TXN data from the db |
1013 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
1013 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
1014 | 1014 | // update EE_Checkout's cached primary_attendee object |
1015 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
1015 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
1016 | 1016 | // update EE_Checkout's cached payment object |
1017 | 1017 | $payment = $this->transaction->last_payment(); |
1018 | 1018 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -1020,9 +1020,9 @@ discard block |
||
1020 | 1020 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
1021 | 1021 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
1022 | 1022 | //now refresh the cart, based on the TXN |
1023 | - $this->cart = $this->get_cart_for_transaction( $this->transaction ); |
|
1023 | + $this->cart = $this->get_cart_for_transaction($this->transaction); |
|
1024 | 1024 | } else { |
1025 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1025 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1026 | 1026 | return FALSE; |
1027 | 1027 | } |
1028 | 1028 | return TRUE; |
@@ -1037,21 +1037,21 @@ discard block |
||
1037 | 1037 | * @return EE_Attendee | null |
1038 | 1038 | * @throws \EE_Error |
1039 | 1039 | */ |
1040 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
1040 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
1041 | 1041 | |
1042 | 1042 | $primary_attendee_obj = null; |
1043 | 1043 | // grab the saved registrations from the transaction |
1044 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
1044 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
1045 | 1045 | // verify object |
1046 | - if ( $registration instanceof EE_Registration ) { |
|
1046 | + if ($registration instanceof EE_Registration) { |
|
1047 | 1047 | $attendee = $registration->attendee(); |
1048 | 1048 | // verify object && maybe cache primary_attendee_obj ? |
1049 | - if ( $attendee instanceof EE_Attendee&& $registration->is_primary_registrant() ) { |
|
1049 | + if ($attendee instanceof EE_Attendee && $registration->is_primary_registrant()) { |
|
1050 | 1050 | $primary_attendee_obj = $attendee; |
1051 | 1051 | } |
1052 | 1052 | } else { |
1053 | 1053 | EE_Error::add_error( |
1054 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1054 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1055 | 1055 | __FILE__, __FUNCTION__, __LINE__ |
1056 | 1056 | ); |
1057 | 1057 | } |
@@ -1072,45 +1072,45 @@ discard block |
||
1072 | 1072 | */ |
1073 | 1073 | protected function refresh_entity_map() { |
1074 | 1074 | // verify the transaction |
1075 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1075 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1076 | 1076 | // never cache payment info |
1077 | - $this->transaction->clear_cache( 'Payment' ); |
|
1077 | + $this->transaction->clear_cache('Payment'); |
|
1078 | 1078 | /** @type EE_Transaction_Processor $transaction_processor */ |
1079 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1079 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1080 | 1080 | // is the Payment Options Reg Step completed ? |
1081 | - if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) { |
|
1081 | + if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) { |
|
1082 | 1082 | // then check for payments and update TXN accordingly |
1083 | 1083 | /** @type EE_Transaction_Payments $transaction_payments */ |
1084 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1085 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
1084 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1085 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
1086 | 1086 | } |
1087 | 1087 | // grab the saved registrations from the transaction |
1088 | 1088 | foreach ( |
1089 | - $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration |
|
1089 | + $this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration |
|
1090 | 1090 | ) { |
1091 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
1091 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
1092 | 1092 | } |
1093 | 1093 | // make sure our cached TXN is added to the model entity mapper |
1094 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
1094 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
1095 | 1095 | |
1096 | 1096 | } else { |
1097 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1097 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1098 | 1098 | return FALSE; |
1099 | 1099 | } |
1100 | 1100 | // verify and update the cart because inaccurate totals are not so much fun |
1101 | - if ( $this->cart instanceof EE_Cart ) { |
|
1101 | + if ($this->cart instanceof EE_Cart) { |
|
1102 | 1102 | $grand_total = $this->cart->get_grand_total(); |
1103 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
1103 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
1104 | 1104 | $grand_total->recalculate_total_including_taxes(); |
1105 | 1105 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
1106 | 1106 | $this->cart->get_grand_total()->ID(), |
1107 | 1107 | $this->cart->get_grand_total() |
1108 | 1108 | ); |
1109 | 1109 | } |
1110 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
1111 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
1110 | + if ($grand_total instanceof EE_Line_Item) { |
|
1111 | + $this->cart = EE_Cart::instance($grand_total); |
|
1112 | 1112 | } else { |
1113 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1113 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1114 | 1114 | return false; |
1115 | 1115 | } |
1116 | 1116 | } |
@@ -1127,19 +1127,19 @@ discard block |
||
1127 | 1127 | * @return void |
1128 | 1128 | * @throws \EE_Error |
1129 | 1129 | */ |
1130 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
1130 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
1131 | 1131 | |
1132 | 1132 | // verify object |
1133 | - if ( $registration instanceof EE_Registration ) { |
|
1133 | + if ($registration instanceof EE_Registration) { |
|
1134 | 1134 | // update the entity mapper attendee |
1135 | - $this->_refresh_registration_attendee( $registration ); |
|
1135 | + $this->_refresh_registration_attendee($registration); |
|
1136 | 1136 | // update the entity mapper answers for reg form questions |
1137 | - $this->_refresh_registration_answers( $registration ); |
|
1137 | + $this->_refresh_registration_answers($registration); |
|
1138 | 1138 | // make sure the cached registration is added to the model entity mapper |
1139 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1139 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1140 | 1140 | } else { |
1141 | 1141 | EE_Error::add_error( |
1142 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1142 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1143 | 1143 | __FILE__, __FUNCTION__, __LINE__ |
1144 | 1144 | ); |
1145 | 1145 | } |
@@ -1154,15 +1154,15 @@ discard block |
||
1154 | 1154 | * @return void |
1155 | 1155 | * @throws \EE_Error |
1156 | 1156 | */ |
1157 | - protected function _refresh_registration_attendee( $registration ) { |
|
1157 | + protected function _refresh_registration_attendee($registration) { |
|
1158 | 1158 | |
1159 | 1159 | $attendee = $registration->attendee(); |
1160 | 1160 | // verify object |
1161 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1161 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1162 | 1162 | // make sure the cached attendee is added to the model entity mapper |
1163 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1163 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1164 | 1164 | // maybe cache primary_attendee_obj ? |
1165 | - if ( $registration->is_primary_registrant() ) { |
|
1165 | + if ($registration->is_primary_registrant()) { |
|
1166 | 1166 | $this->primary_attendee_obj = $attendee; |
1167 | 1167 | } |
1168 | 1168 | } |
@@ -1177,19 +1177,19 @@ discard block |
||
1177 | 1177 | * @return void |
1178 | 1178 | * @throws \EE_Error |
1179 | 1179 | */ |
1180 | - protected function _refresh_registration_answers( $registration ) { |
|
1180 | + protected function _refresh_registration_answers($registration) { |
|
1181 | 1181 | |
1182 | 1182 | // now update the answers |
1183 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1183 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1184 | 1184 | // verify object |
1185 | - if ( $answer instanceof EE_Answer ) { |
|
1186 | - if ( $answer->ID() ) { |
|
1185 | + if ($answer instanceof EE_Answer) { |
|
1186 | + if ($answer->ID()) { |
|
1187 | 1187 | // make sure the cached answer is added to the model entity mapper |
1188 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1188 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1189 | 1189 | } |
1190 | 1190 | } else { |
1191 | 1191 | EE_Error::add_error( |
1192 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1192 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1193 | 1193 | __FILE__, __FUNCTION__, __LINE__ |
1194 | 1194 | ); |
1195 | 1195 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1205 | 1205 | */ |
1206 | 1206 | public function __wakeup() { |
1207 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1207 | + foreach ($this->reg_steps as $reg_step) { |
|
1208 | 1208 | $reg_step->checkout = $this; |
1209 | 1209 | } |
1210 | 1210 | } |
@@ -1221,12 +1221,12 @@ discard block |
||
1221 | 1221 | * @param bool $display_request |
1222 | 1222 | * @throws \EE_Error |
1223 | 1223 | */ |
1224 | - public function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1224 | + public function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1225 | 1225 | $disabled = true; |
1226 | - if ( WP_DEBUG && ! $disabled ) { |
|
1227 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1226 | + if (WP_DEBUG && ! $disabled) { |
|
1227 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1228 | 1228 | $default_data = array( |
1229 | - $class => $func . '() : ' . $line, |
|
1229 | + $class => $func.'() : '.$line, |
|
1230 | 1230 | 'request->step' => $this->step, |
1231 | 1231 | 'request->action' => $this->action, |
1232 | 1232 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1238,24 +1238,24 @@ discard block |
||
1238 | 1238 | 'reg_url_link' => $this->reg_url_link, |
1239 | 1239 | 'REQ' => $display_request ? $_REQUEST : '', |
1240 | 1240 | ); |
1241 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1242 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1243 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1244 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1245 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1241 | + if ($this->transaction instanceof EE_Transaction) { |
|
1242 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1243 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1244 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1245 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1246 | 1246 | } |
1247 | - if ( $this->transaction->ID() ) { |
|
1248 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1247 | + if ($this->transaction->ID()) { |
|
1248 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1249 | 1249 | // don't serialize objects |
1250 | - $info = $this->_strip_objects( $info ); |
|
1251 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1252 | - $debug_data[ $TXN_ID ] = array(); |
|
1250 | + $info = $this->_strip_objects($info); |
|
1251 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1252 | + $debug_data[$TXN_ID] = array(); |
|
1253 | 1253 | } |
1254 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1254 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1255 | 1255 | $default_data, |
1256 | 1256 | $info |
1257 | 1257 | ); |
1258 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1258 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1259 | 1259 | } |
1260 | 1260 | } |
1261 | 1261 | } |
@@ -1268,23 +1268,23 @@ discard block |
||
1268 | 1268 | * @param array $info |
1269 | 1269 | * @return array |
1270 | 1270 | */ |
1271 | - public function _strip_objects( $info = array() ) { |
|
1272 | - foreach ( (array)$info as $key => $value ) { |
|
1273 | - if ( is_array( $value )) { |
|
1274 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1275 | - } else if ( is_object( $value ) ) { |
|
1276 | - $object_class = get_class( $value ); |
|
1277 | - $info[ $object_class ] = array(); |
|
1278 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1279 | - if ( method_exists( $value, 'status' ) ) { |
|
1280 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1281 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1282 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1271 | + public function _strip_objects($info = array()) { |
|
1272 | + foreach ((array) $info as $key => $value) { |
|
1273 | + if (is_array($value)) { |
|
1274 | + $info[$key] = $this->_strip_objects($value); |
|
1275 | + } else if (is_object($value)) { |
|
1276 | + $object_class = get_class($value); |
|
1277 | + $info[$object_class] = array(); |
|
1278 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1279 | + if (method_exists($value, 'status')) { |
|
1280 | + $info[$object_class]['status'] = $value->status(); |
|
1281 | + } else if (method_exists($value, 'status_ID')) { |
|
1282 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1283 | 1283 | } |
1284 | - unset( $info[ $key ] ); |
|
1284 | + unset($info[$key]); |
|
1285 | 1285 | } |
1286 | 1286 | } |
1287 | - return (array)$info; |
|
1287 | + return (array) $info; |
|
1288 | 1288 | } |
1289 | 1289 | |
1290 | 1290 |
@@ -817,12 +817,12 @@ |
||
817 | 817 | if ( $registration instanceof EE_Registration ) { |
818 | 818 | // we display all attendee info for the primary registrant |
819 | 819 | if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
820 | - && $registration->is_primary_registrant() |
|
820 | + && $registration->is_primary_registrant() |
|
821 | 821 | ) { |
822 | 822 | $this->checkout->primary_revisit = true; |
823 | 823 | break; |
824 | 824 | } else if ( $this->checkout->revisit |
825 | - && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
825 | + && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
826 | 826 | ) { |
827 | 827 | // but hide info if it doesn't belong to you |
828 | 828 | $transaction->clear_cache( 'Registration', $registration->ID() ); |
@@ -1,4 +1,4 @@ discard block |
||
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 | * Single Page Checkout (SPCO) |
4 | 4 | * |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @return EED_Single_Page_Checkout |
48 | 48 | */ |
49 | 49 | public static function instance() { |
50 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
51 | - return parent::get_instance( __CLASS__ ); |
|
50 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
51 | + return parent::get_instance(__CLASS__); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -93,22 +93,22 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public static function set_hooks_admin() { |
95 | 95 | EED_Single_Page_Checkout::set_definitions(); |
96 | - if ( defined( 'DOING_AJAX' )) { |
|
96 | + if (defined('DOING_AJAX')) { |
|
97 | 97 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
98 | 98 | ob_start(); |
99 | 99 | EED_Single_Page_Checkout::load_request_handler(); |
100 | 100 | EED_Single_Page_Checkout::load_reg_steps(); |
101 | 101 | } else { |
102 | 102 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
103 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
103 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
104 | 104 | } |
105 | 105 | // set ajax hooks |
106 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
107 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
108 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
109 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
110 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
111 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
106 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
107 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
108 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
109 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
110 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
111 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param string $ajax_action |
120 | 120 | * @throws \EE_Error |
121 | 121 | */ |
122 | - public static function process_ajax_request( $ajax_action ) { |
|
123 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
122 | + public static function process_ajax_request($ajax_action) { |
|
123 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
124 | 124 | EED_Single_Page_Checkout::instance()->_initialize(); |
125 | 125 | } |
126 | 126 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @throws \EE_Error |
133 | 133 | */ |
134 | 134 | public static function display_reg_step() { |
135 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
135 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @throws \EE_Error |
144 | 144 | */ |
145 | 145 | public static function process_reg_step() { |
146 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
146 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @throws \EE_Error |
155 | 155 | */ |
156 | 156 | public static function update_reg_step() { |
157 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
157 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @throws \EE_Error |
168 | 168 | */ |
169 | 169 | public static function update_checkout() { |
170 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
170 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public static function load_request_handler() { |
182 | 182 | // load core Request_Handler class |
183 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
184 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
183 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
184 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -195,21 +195,21 @@ discard block |
||
195 | 195 | * @throws \EE_Error |
196 | 196 | */ |
197 | 197 | public static function set_definitions() { |
198 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
199 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
200 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
201 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
202 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
203 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
204 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
205 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
206 | - EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ] = sprintf( |
|
207 | - __( '%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
198 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
199 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
200 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
201 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
202 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
203 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
204 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
205 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
206 | + EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
|
207 | + __('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
208 | 208 | '<h4 class="important-notice">', |
209 | 209 | '</h4>', |
210 | 210 | '<br />', |
211 | 211 | '<p>', |
212 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
212 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
213 | 213 | '">', |
214 | 214 | '</a>', |
215 | 215 | '</p>' |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public static function load_reg_steps() { |
230 | 230 | static $reg_steps_loaded = FALSE; |
231 | - if ( $reg_steps_loaded ) { |
|
231 | + if ($reg_steps_loaded) { |
|
232 | 232 | return; |
233 | 233 | } |
234 | 234 | // filter list of reg_steps |
@@ -237,24 +237,24 @@ discard block |
||
237 | 237 | EED_Single_Page_Checkout::get_reg_steps() |
238 | 238 | ); |
239 | 239 | // sort by key (order) |
240 | - ksort( $reg_steps_to_load ); |
|
240 | + ksort($reg_steps_to_load); |
|
241 | 241 | // loop through folders |
242 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
242 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
243 | 243 | // we need a |
244 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
244 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
245 | 245 | // copy over to the reg_steps_array |
246 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
246 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
247 | 247 | // register custom key route for each reg step |
248 | 248 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
249 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
249 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
250 | 250 | // add AJAX or other hooks |
251 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
251 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
252 | 252 | // setup autoloaders if necessary |
253 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
254 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
253 | + if ( ! class_exists($reg_step['class_name'])) { |
|
254 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
255 | 255 | } |
256 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
257 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
256 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
257 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
@@ -273,28 +273,28 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public static function get_reg_steps() { |
275 | 275 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
276 | - if ( empty( $reg_steps )) { |
|
276 | + if (empty($reg_steps)) { |
|
277 | 277 | $reg_steps = array( |
278 | 278 | 10 => array( |
279 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
279 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
280 | 280 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
281 | 281 | 'slug' => 'attendee_information', |
282 | 282 | 'has_hooks' => FALSE |
283 | 283 | ), |
284 | 284 | 20 => array( |
285 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
285 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
286 | 286 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
287 | 287 | 'slug' => 'registration_confirmation', |
288 | 288 | 'has_hooks' => FALSE |
289 | 289 | ), |
290 | 290 | 30 => array( |
291 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
291 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
292 | 292 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
293 | 293 | 'slug' => 'payment_options', |
294 | 294 | 'has_hooks' => TRUE |
295 | 295 | ), |
296 | 296 | 999 => array( |
297 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
297 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
298 | 298 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
299 | 299 | 'slug' => 'finalize_registration', |
300 | 300 | 'has_hooks' => FALSE |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public static function registration_checkout_for_admin() { |
317 | 317 | EED_Single_Page_Checkout::load_reg_steps(); |
318 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
319 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
320 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
318 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
319 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
320 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
321 | 321 | EED_Single_Page_Checkout::instance()->_initialize(); |
322 | 322 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
323 | 323 | return EE_Registry::instance()->REQ->get_output(); |
@@ -334,15 +334,15 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public static function process_registration_from_admin() { |
336 | 336 | EED_Single_Page_Checkout::load_reg_steps(); |
337 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
338 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
339 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
337 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
338 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
339 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
340 | 340 | EED_Single_Page_Checkout::instance()->_initialize(); |
341 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
342 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
343 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
344 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
345 | - if ( $final_reg_step->process_reg_step() ) { |
|
341 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
342 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
343 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
344 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
345 | + if ($final_reg_step->process_reg_step()) { |
|
346 | 346 | $final_reg_step->set_completed(); |
347 | 347 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
348 | 348 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -362,11 +362,11 @@ discard block |
||
362 | 362 | * @return void |
363 | 363 | * @throws \EE_Error |
364 | 364 | */ |
365 | - public function run( $WP_Query ) { |
|
365 | + public function run($WP_Query) { |
|
366 | 366 | if ( |
367 | 367 | $WP_Query instanceof WP_Query |
368 | 368 | && $WP_Query->is_main_query() |
369 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
369 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
370 | 370 | ) { |
371 | 371 | $this->_initialize(); |
372 | 372 | } |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | * @return void |
383 | 383 | * @throws \EE_Error |
384 | 384 | */ |
385 | - public static function init( $WP_Query ) { |
|
386 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
385 | + public static function init($WP_Query) { |
|
386 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | */ |
398 | 398 | private function _initialize() { |
399 | 399 | // ensure SPCO doesn't run twice |
400 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
400 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
401 | 401 | return; |
402 | 402 | } |
403 | 403 | try { |
@@ -405,22 +405,22 @@ discard block |
||
405 | 405 | // setup the EE_Checkout object |
406 | 406 | $this->checkout = $this->_initialize_checkout(); |
407 | 407 | // filter checkout |
408 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
408 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
409 | 409 | // get the $_GET |
410 | 410 | $this->_get_request_vars(); |
411 | 411 | // filter continue_reg |
412 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
412 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
413 | 413 | // load the reg steps array |
414 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
414 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
415 | 415 | EED_Single_Page_Checkout::$_initialized = true; |
416 | 416 | return; |
417 | 417 | } |
418 | 418 | // set the current step |
419 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
419 | + $this->checkout->set_current_step($this->checkout->step); |
|
420 | 420 | // and the next step |
421 | 421 | $this->checkout->set_next_step(); |
422 | 422 | // verify that everything has been setup correctly |
423 | - if ( ! ( $this->_verify_transaction_and_get_registrations() && $this->_final_verifications() ) ) { |
|
423 | + if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) { |
|
424 | 424 | EED_Single_Page_Checkout::$_initialized = true; |
425 | 425 | return; |
426 | 426 | } |
@@ -445,11 +445,11 @@ discard block |
||
445 | 445 | // set no cache headers and constants |
446 | 446 | EE_System::do_not_cache(); |
447 | 447 | // add anchor |
448 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
448 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
449 | 449 | // remove transaction lock |
450 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
451 | - } catch ( Exception $e ) { |
|
452 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
450 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
451 | + } catch (Exception $e) { |
|
452 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
453 | 453 | } |
454 | 454 | } |
455 | 455 | |
@@ -463,16 +463,16 @@ discard block |
||
463 | 463 | * @throws EE_Error |
464 | 464 | */ |
465 | 465 | private function _verify_session() { |
466 | - if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
467 | - throw new EE_Error( __( 'The EE_Session class could not be loaded.', 'event_espresso' ) ); |
|
466 | + if ( ! EE_Registry::instance()->SSN instanceof EE_Session) { |
|
467 | + throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso')); |
|
468 | 468 | } |
469 | 469 | // is session still valid ? |
470 | - if ( EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) === '' ) { |
|
470 | + if (EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '') { |
|
471 | 471 | $this->checkout = new EE_Checkout(); |
472 | 472 | EE_Registry::instance()->SSN->reset_cart(); |
473 | 473 | EE_Registry::instance()->SSN->reset_checkout(); |
474 | 474 | EE_Registry::instance()->SSN->reset_transaction(); |
475 | - EE_Error::add_attention( EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ], __FILE__, __FUNCTION__, __LINE__ ); |
|
475 | + EE_Error::add_attention(EE_Registry::$i18n_js_strings['registration_expiration_notice'], __FILE__, __FUNCTION__, __LINE__); |
|
476 | 476 | EE_Registry::instance()->SSN->reset_expired(); |
477 | 477 | } |
478 | 478 | } |
@@ -492,20 +492,20 @@ discard block |
||
492 | 492 | /** @type EE_Checkout $checkout */ |
493 | 493 | $checkout = EE_Registry::instance()->SSN->checkout(); |
494 | 494 | // verify |
495 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
495 | + if ( ! $checkout instanceof EE_Checkout) { |
|
496 | 496 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
497 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
497 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
498 | 498 | } else { |
499 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
499 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
500 | 500 | $this->unlock_transaction(); |
501 | - wp_safe_redirect( $checkout->redirect_url ); |
|
501 | + wp_safe_redirect($checkout->redirect_url); |
|
502 | 502 | exit(); |
503 | 503 | } |
504 | 504 | } |
505 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
505 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
506 | 506 | // verify again |
507 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
508 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
507 | + if ( ! $checkout instanceof EE_Checkout) { |
|
508 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
509 | 509 | } |
510 | 510 | // reset anything that needs a clean slate for each request |
511 | 511 | $checkout->reset_for_current_request(); |
@@ -525,24 +525,24 @@ discard block |
||
525 | 525 | // load classes |
526 | 526 | EED_Single_Page_Checkout::load_request_handler(); |
527 | 527 | //make sure this request is marked as belonging to EE |
528 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
528 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
529 | 529 | // which step is being requested ? |
530 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
530 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
531 | 531 | // which step is being edited ? |
532 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
532 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
533 | 533 | // and what we're doing on the current step |
534 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
534 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
535 | 535 | // returning to edit ? |
536 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
536 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
537 | 537 | // or some other kind of revisit ? |
538 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
538 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
539 | 539 | // and whether or not to generate a reg form for this request |
540 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
540 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
541 | 541 | // and whether or not to process a reg form submission for this request |
542 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
542 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
543 | 543 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
544 | 544 | ? $this->checkout->process_form_submission |
545 | - : FALSE; // TRUE FALSE |
|
545 | + : FALSE; // TRUE FALSE |
|
546 | 546 | // $this->_display_request_vars(); |
547 | 547 | } |
548 | 548 | |
@@ -555,17 +555,17 @@ discard block |
||
555 | 555 | * @return void |
556 | 556 | */ |
557 | 557 | protected function _display_request_vars() { |
558 | - if ( ! WP_DEBUG ) { |
|
558 | + if ( ! WP_DEBUG) { |
|
559 | 559 | return; |
560 | 560 | } |
561 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
562 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
563 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
564 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
565 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
566 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
567 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
568 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
561 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
562 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
563 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
564 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
565 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
566 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
567 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
568 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | |
@@ -579,8 +579,8 @@ discard block |
||
579 | 579 | * @return array |
580 | 580 | */ |
581 | 581 | private function _get_first_step() { |
582 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
583 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
582 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
583 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | |
@@ -596,27 +596,27 @@ discard block |
||
596 | 596 | private function _load_and_instantiate_reg_steps() { |
597 | 597 | // have reg_steps already been instantiated ? |
598 | 598 | if ( |
599 | - empty( $this->checkout->reg_steps ) || |
|
600 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
599 | + empty($this->checkout->reg_steps) || |
|
600 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
601 | 601 | ) { |
602 | 602 | // if not, then loop through raw reg steps array |
603 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
604 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
603 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
604 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
605 | 605 | return false; |
606 | 606 | } |
607 | 607 | } |
608 | 608 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
609 | 609 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
610 | 610 | // skip the registration_confirmation page ? |
611 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
611 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
612 | 612 | // just remove it from the reg steps array |
613 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
613 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
614 | 614 | } else if ( |
615 | - isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
615 | + isset($this->checkout->reg_steps['registration_confirmation']) |
|
616 | 616 | && EE_Registry::instance()->CFG->registration->reg_confirmation_last |
617 | 617 | ) { |
618 | 618 | // set the order to something big like 100 |
619 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
619 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
620 | 620 | } |
621 | 621 | // filter the array for good luck |
622 | 622 | $this->checkout->reg_steps = apply_filters( |
@@ -626,13 +626,13 @@ discard block |
||
626 | 626 | // finally re-sort based on the reg step class order properties |
627 | 627 | $this->checkout->sort_reg_steps(); |
628 | 628 | } else { |
629 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
629 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
630 | 630 | // set all current step stati to FALSE |
631 | - $reg_step->set_is_current_step( FALSE ); |
|
631 | + $reg_step->set_is_current_step(FALSE); |
|
632 | 632 | } |
633 | 633 | } |
634 | - if ( empty( $this->checkout->reg_steps )) { |
|
635 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
634 | + if (empty($this->checkout->reg_steps)) { |
|
635 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
636 | 636 | return false; |
637 | 637 | } |
638 | 638 | // make reg step details available to JS |
@@ -650,10 +650,10 @@ discard block |
||
650 | 650 | * @param int $order |
651 | 651 | * @return bool |
652 | 652 | */ |
653 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
653 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
654 | 654 | |
655 | 655 | // we need a file_path, class_name, and slug to add a reg step |
656 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
656 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
657 | 657 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
658 | 658 | if ( |
659 | 659 | $this->checkout->reg_url_link |
@@ -671,26 +671,26 @@ discard block |
||
671 | 671 | FALSE |
672 | 672 | ); |
673 | 673 | // did we gets the goods ? |
674 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
674 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
675 | 675 | // set reg step order based on config |
676 | - $reg_step_obj->set_order( $order ); |
|
676 | + $reg_step_obj->set_order($order); |
|
677 | 677 | // add instantiated reg step object to the master reg steps array |
678 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
678 | + $this->checkout->add_reg_step($reg_step_obj); |
|
679 | 679 | } else { |
680 | 680 | EE_Error::add_error( |
681 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
681 | + __('The current step could not be set.', 'event_espresso'), |
|
682 | 682 | __FILE__, __FUNCTION__, __LINE__ |
683 | 683 | ); |
684 | 684 | return false; |
685 | 685 | } |
686 | 686 | } else { |
687 | - if ( WP_DEBUG ) { |
|
687 | + if (WP_DEBUG) { |
|
688 | 688 | EE_Error::add_error( |
689 | 689 | sprintf( |
690 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
691 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
692 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
693 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
690 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
691 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
692 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
693 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
694 | 694 | '<ul>', |
695 | 695 | '<li>', |
696 | 696 | '</li>', |
@@ -714,15 +714,15 @@ discard block |
||
714 | 714 | */ |
715 | 715 | private function _verify_transaction_and_get_registrations() { |
716 | 716 | // was there already a valid transaction in the checkout from the session ? |
717 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
717 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
718 | 718 | // get transaction from db or session |
719 | 719 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
720 | 720 | ? $this->_get_transaction_and_cart_for_previous_visit() |
721 | 721 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
722 | 722 | |
723 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
723 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
724 | 724 | EE_Error::add_error( |
725 | - __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), |
|
725 | + __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), |
|
726 | 726 | __FILE__, __FUNCTION__, __LINE__ |
727 | 727 | ); |
728 | 728 | $this->checkout->transaction = EE_Transaction::new_instance(); |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | return false; |
733 | 733 | } |
734 | 734 | // and the registrations for the transaction |
735 | - $this->_get_registrations( $this->checkout->transaction ); |
|
735 | + $this->_get_registrations($this->checkout->transaction); |
|
736 | 736 | } |
737 | 737 | return true; |
738 | 738 | } |
@@ -747,16 +747,16 @@ discard block |
||
747 | 747 | */ |
748 | 748 | private function _get_transaction_and_cart_for_previous_visit() { |
749 | 749 | /** @var $TXN_model EEM_Transaction */ |
750 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
750 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
751 | 751 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
752 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
752 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
753 | 753 | // verify transaction |
754 | - if ( $transaction instanceof EE_Transaction ) { |
|
754 | + if ($transaction instanceof EE_Transaction) { |
|
755 | 755 | // and get the cart that was used for that transaction |
756 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
756 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
757 | 757 | return $transaction; |
758 | 758 | } else { |
759 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
759 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
760 | 760 | return NULL; |
761 | 761 | } |
762 | 762 | } |
@@ -770,8 +770,8 @@ discard block |
||
770 | 770 | * @param EE_Transaction $transaction |
771 | 771 | * @return EE_Cart |
772 | 772 | */ |
773 | - private function _get_cart_for_transaction( $transaction ) { |
|
774 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
773 | + private function _get_cart_for_transaction($transaction) { |
|
774 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | |
@@ -783,8 +783,8 @@ discard block |
||
783 | 783 | * @param EE_Transaction $transaction |
784 | 784 | * @return EE_Cart |
785 | 785 | */ |
786 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
787 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
786 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
787 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | |
@@ -800,15 +800,15 @@ discard block |
||
800 | 800 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
801 | 801 | // if there's no transaction, then this is the FIRST visit to SPCO |
802 | 802 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
803 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
803 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
804 | 804 | // and then create a new transaction |
805 | 805 | $transaction = $this->_initialize_transaction(); |
806 | 806 | // verify transaction |
807 | - if ( $transaction instanceof EE_Transaction ) { |
|
807 | + if ($transaction instanceof EE_Transaction) { |
|
808 | 808 | // and save TXN data to the cart |
809 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
809 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
810 | 810 | } else { |
811 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
811 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
812 | 812 | } |
813 | 813 | return $transaction; |
814 | 814 | } |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | // grab the cart grand total |
829 | 829 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
830 | 830 | // create new TXN |
831 | - $transaction = EE_Transaction::new_instance( array( |
|
831 | + $transaction = EE_Transaction::new_instance(array( |
|
832 | 832 | 'TXN_timestamp' => time(), |
833 | 833 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
834 | 834 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
@@ -843,8 +843,8 @@ discard block |
||
843 | 843 | $transaction->ID() |
844 | 844 | ); |
845 | 845 | return $transaction; |
846 | - } catch( Exception $e ) { |
|
847 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
846 | + } catch (Exception $e) { |
|
847 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
848 | 848 | } |
849 | 849 | return NULL; |
850 | 850 | } |
@@ -859,38 +859,38 @@ discard block |
||
859 | 859 | * @return EE_Cart |
860 | 860 | * @throws \EE_Error |
861 | 861 | */ |
862 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
862 | + private function _get_registrations(EE_Transaction $transaction) { |
|
863 | 863 | // first step: grab the registrants { : o |
864 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
864 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
865 | 865 | // verify registrations have been set |
866 | - if ( empty( $registrations )) { |
|
866 | + if (empty($registrations)) { |
|
867 | 867 | // if no cached registrations, then check the db |
868 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
868 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
869 | 869 | // still nothing ? well as long as this isn't a revisit |
870 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
870 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
871 | 871 | // generate new registrations from scratch |
872 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
872 | + $registrations = $this->_initialize_registrations($transaction); |
|
873 | 873 | } |
874 | 874 | } |
875 | 875 | // sort by their original registration order |
876 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
876 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
877 | 877 | // then loop thru the array |
878 | - foreach ( $registrations as $registration ) { |
|
878 | + foreach ($registrations as $registration) { |
|
879 | 879 | // verify each registration |
880 | - if ( $registration instanceof EE_Registration ) { |
|
880 | + if ($registration instanceof EE_Registration) { |
|
881 | 881 | // we display all attendee info for the primary registrant |
882 | - if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
|
882 | + if ($this->checkout->reg_url_link === $registration->reg_url_link() |
|
883 | 883 | && $registration->is_primary_registrant() |
884 | 884 | ) { |
885 | 885 | $this->checkout->primary_revisit = true; |
886 | 886 | break; |
887 | - } else if ( $this->checkout->revisit |
|
887 | + } else if ($this->checkout->revisit |
|
888 | 888 | && $this->checkout->reg_url_link !== $registration->reg_url_link() |
889 | 889 | ) { |
890 | 890 | // but hide info if it doesn't belong to you |
891 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
891 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
892 | 892 | } |
893 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
893 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
894 | 894 | } |
895 | 895 | } |
896 | 896 | } |
@@ -905,17 +905,17 @@ discard block |
||
905 | 905 | * @return array |
906 | 906 | * @throws \EE_Error |
907 | 907 | */ |
908 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
908 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
909 | 909 | $att_nmbr = 0; |
910 | 910 | $registrations = array(); |
911 | - if ( $transaction instanceof EE_Transaction ) { |
|
911 | + if ($transaction instanceof EE_Transaction) { |
|
912 | 912 | /** @type EE_Registration_Processor $registration_processor */ |
913 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
913 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
914 | 914 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
915 | 915 | // now let's add the cart items to the $transaction |
916 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
916 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
917 | 917 | //do the following for each ticket of this type they selected |
918 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
918 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
919 | 919 | $att_nmbr++; |
920 | 920 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
921 | 921 | $line_item, |
@@ -923,12 +923,12 @@ discard block |
||
923 | 923 | $att_nmbr, |
924 | 924 | $this->checkout->total_ticket_count |
925 | 925 | ); |
926 | - if ( $registration instanceof EE_Registration ) { |
|
927 | - $registrations[ $registration->ID() ] = $registration; |
|
926 | + if ($registration instanceof EE_Registration) { |
|
927 | + $registrations[$registration->ID()] = $registration; |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | } |
931 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
931 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
932 | 932 | } |
933 | 933 | return $registrations; |
934 | 934 | } |
@@ -943,12 +943,12 @@ discard block |
||
943 | 943 | * @param EE_Registration $reg_B |
944 | 944 | * @return array() |
945 | 945 | */ |
946 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
946 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
947 | 947 | // this shouldn't ever happen within the same TXN, but oh well |
948 | - if ( $reg_A->count() === $reg_B->count() ) { |
|
948 | + if ($reg_A->count() === $reg_B->count()) { |
|
949 | 949 | return 0; |
950 | 950 | } |
951 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
951 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
952 | 952 | } |
953 | 953 | |
954 | 954 | |
@@ -963,21 +963,21 @@ discard block |
||
963 | 963 | */ |
964 | 964 | private function _final_verifications() { |
965 | 965 | // filter checkout |
966 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
966 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
967 | 967 | //verify that current step is still set correctly |
968 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
969 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
968 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
969 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
970 | 970 | return false; |
971 | 971 | } |
972 | 972 | // if returning to SPCO, then verify that primary registrant is set |
973 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
973 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
974 | 974 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
975 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
976 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
975 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
976 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
977 | 977 | return false; |
978 | 978 | } |
979 | 979 | $valid_registrant = null; |
980 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
980 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
981 | 981 | if ( |
982 | 982 | $registration instanceof EE_Registration |
983 | 983 | && $registration->reg_url_link() === $this->checkout->reg_url_link |
@@ -985,9 +985,9 @@ discard block |
||
985 | 985 | $valid_registrant = $registration; |
986 | 986 | } |
987 | 987 | } |
988 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
988 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
989 | 989 | // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? |
990 | - if ( EED_Single_Page_Checkout::$_checkout_verified ) { |
|
990 | + if (EED_Single_Page_Checkout::$_checkout_verified) { |
|
991 | 991 | // clear the session, mark the checkout as unverified, and try again |
992 | 992 | EE_Registry::instance()->SSN->clear_session(); |
993 | 993 | EED_Single_Page_Checkout::$_initialized = false; |
@@ -996,13 +996,13 @@ discard block |
||
996 | 996 | EE_Error::reset_notices(); |
997 | 997 | return false; |
998 | 998 | } |
999 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
999 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1000 | 1000 | return false; |
1001 | 1001 | } |
1002 | 1002 | } |
1003 | 1003 | // now that things have been kinda sufficiently verified, |
1004 | 1004 | // let's add the checkout to the session so that's available other systems |
1005 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
1005 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
1006 | 1006 | return true; |
1007 | 1007 | } |
1008 | 1008 | |
@@ -1017,15 +1017,15 @@ discard block |
||
1017 | 1017 | * @param bool $reinitializing |
1018 | 1018 | * @throws \EE_Error |
1019 | 1019 | */ |
1020 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
1021 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
1020 | + private function _initialize_reg_steps($reinitializing = false) { |
|
1021 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
1022 | 1022 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
1023 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
1024 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
1023 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
1024 | + if ( ! $reg_step->initialize_reg_step()) { |
|
1025 | 1025 | // if not initialized then maybe this step is being removed... |
1026 | - if ( ! $reinitializing && $reg_step->is_current_step() ) { |
|
1026 | + if ( ! $reinitializing && $reg_step->is_current_step()) { |
|
1027 | 1027 | // if it was the current step, then we need to start over here |
1028 | - $this->_initialize_reg_steps( true ); |
|
1028 | + $this->_initialize_reg_steps(true); |
|
1029 | 1029 | return; |
1030 | 1030 | } |
1031 | 1031 | continue; |
@@ -1034,13 +1034,13 @@ discard block |
||
1034 | 1034 | $reg_step->enqueue_styles_and_scripts(); |
1035 | 1035 | // i18n |
1036 | 1036 | $reg_step->translate_js_strings(); |
1037 | - if ( $reg_step->is_current_step() ) { |
|
1037 | + if ($reg_step->is_current_step()) { |
|
1038 | 1038 | // the text that appears on the reg step form submit button |
1039 | 1039 | $reg_step->set_submit_button_text(); |
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
1043 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
1043 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | |
@@ -1053,43 +1053,43 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | private function _check_form_submission() { |
1055 | 1055 | //does this request require the reg form to be generated ? |
1056 | - if ( $this->checkout->generate_reg_form ) { |
|
1056 | + if ($this->checkout->generate_reg_form) { |
|
1057 | 1057 | // ever heard that song by Blue Rodeo ? |
1058 | 1058 | try { |
1059 | 1059 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
1060 | 1060 | // if not displaying a form, then check for form submission |
1061 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
1061 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
1062 | 1062 | // clear out any old data in case this step is being run again |
1063 | - $this->checkout->current_step->set_valid_data( array() ); |
|
1063 | + $this->checkout->current_step->set_valid_data(array()); |
|
1064 | 1064 | // capture submitted form data |
1065 | 1065 | $this->checkout->current_step->reg_form->receive_form_submission( |
1066 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
1066 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
1067 | 1067 | ); |
1068 | 1068 | // validate submitted form data |
1069 | - if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) { |
|
1069 | + if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) { |
|
1070 | 1070 | // thou shall not pass !!! |
1071 | 1071 | $this->checkout->continue_reg = FALSE; |
1072 | 1072 | // any form validation errors? |
1073 | - if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) { |
|
1073 | + if ($this->checkout->current_step->reg_form->submission_error_message() !== '') { |
|
1074 | 1074 | $submission_error_messages = array(); |
1075 | 1075 | // bad, bad, bad registrant |
1076 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1077 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1076 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1077 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1078 | 1078 | $submission_error_messages[] = sprintf( |
1079 | - __( '%s : %s', 'event_espresso' ), |
|
1079 | + __('%s : %s', 'event_espresso'), |
|
1080 | 1080 | $validation_error->get_form_section()->html_label_text(), |
1081 | 1081 | $validation_error->getMessage() |
1082 | 1082 | ); |
1083 | 1083 | } |
1084 | 1084 | } |
1085 | - EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1085 | + EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1086 | 1086 | } |
1087 | 1087 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1088 | 1088 | $this->go_to_next_step(); |
1089 | 1089 | return; |
1090 | 1090 | } |
1091 | 1091 | } |
1092 | - } catch( EE_Error $e ) { |
|
1092 | + } catch (EE_Error $e) { |
|
1093 | 1093 | $e->get_error(); |
1094 | 1094 | } |
1095 | 1095 | } |
@@ -1106,22 +1106,22 @@ discard block |
||
1106 | 1106 | */ |
1107 | 1107 | private function _process_form_action() { |
1108 | 1108 | // what cha wanna do? |
1109 | - switch( $this->checkout->action ) { |
|
1109 | + switch ($this->checkout->action) { |
|
1110 | 1110 | // AJAX next step reg form |
1111 | 1111 | case 'display_spco_reg_step' : |
1112 | 1112 | $this->checkout->redirect = FALSE; |
1113 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1114 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1113 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1114 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1115 | 1115 | } |
1116 | 1116 | break; |
1117 | 1117 | |
1118 | 1118 | default : |
1119 | 1119 | // meh... do one of those other steps first |
1120 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1120 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1121 | 1121 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1122 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1122 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1123 | 1123 | // call action on current step |
1124 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1124 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1125 | 1125 | // good registrant, you get to proceed |
1126 | 1126 | if ( |
1127 | 1127 | $this->checkout->current_step->success_message() !== '' |
@@ -1132,7 +1132,7 @@ discard block |
||
1132 | 1132 | ) { |
1133 | 1133 | EE_Error::add_success( |
1134 | 1134 | $this->checkout->current_step->success_message() |
1135 | - . '<br />' . $this->checkout->next_step->_instructions() |
|
1135 | + . '<br />'.$this->checkout->next_step->_instructions() |
|
1136 | 1136 | ); |
1137 | 1137 | |
1138 | 1138 | } |
@@ -1140,12 +1140,12 @@ discard block |
||
1140 | 1140 | $this->_setup_redirect(); |
1141 | 1141 | } |
1142 | 1142 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1143 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1143 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1144 | 1144 | |
1145 | 1145 | } else { |
1146 | 1146 | EE_Error::add_error( |
1147 | 1147 | sprintf( |
1148 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1148 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1149 | 1149 | $this->checkout->action, |
1150 | 1150 | $this->checkout->current_step->name() |
1151 | 1151 | ), |
@@ -1171,10 +1171,10 @@ discard block |
||
1171 | 1171 | public function add_styles_and_scripts() { |
1172 | 1172 | // i18n |
1173 | 1173 | $this->translate_js_strings(); |
1174 | - if ( $this->checkout->admin_request ) { |
|
1175 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1174 | + if ($this->checkout->admin_request) { |
|
1175 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1176 | 1176 | } else { |
1177 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1177 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1178 | 1178 | } |
1179 | 1179 | } |
1180 | 1180 | |
@@ -1190,50 +1190,50 @@ discard block |
||
1190 | 1190 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1191 | 1191 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1192 | 1192 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1193 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1194 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1195 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1193 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1194 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1195 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1196 | 1196 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1197 | 1197 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1198 | 1198 | EE_Registry::$i18n_js_strings['process_registration'] = sprintf( |
1199 | - __( 'Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso' ), |
|
1199 | + __('Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso'), |
|
1200 | 1200 | '<br/>' |
1201 | 1201 | ); |
1202 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1202 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1203 | 1203 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1204 | 1204 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1205 | 1205 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1206 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1207 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1208 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1209 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1210 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1211 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1212 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1213 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1214 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1215 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1216 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1217 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1218 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1219 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1206 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1207 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1208 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1209 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1210 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1211 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1212 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1213 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1214 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1215 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1216 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1217 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1218 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1219 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1220 | 1220 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1221 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1221 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1222 | 1222 | '<h4 class="important-notice">', |
1223 | 1223 | '</h4>', |
1224 | 1224 | '<br />', |
1225 | 1225 | '<p>', |
1226 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1226 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1227 | 1227 | '">', |
1228 | 1228 | '</a>', |
1229 | 1229 | '</p>' |
1230 | 1230 | ); |
1231 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1232 | - EE_Registry::$i18n_js_strings[ 'session_extension' ] = absint( |
|
1233 | - apply_filters( 'FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS ) |
|
1231 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1232 | + EE_Registry::$i18n_js_strings['session_extension'] = absint( |
|
1233 | + apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS) |
|
1234 | 1234 | ); |
1235 | - EE_Registry::$i18n_js_strings[ 'session_expiration' ] = gmdate( |
|
1236 | - 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) |
|
1235 | + EE_Registry::$i18n_js_strings['session_expiration'] = gmdate( |
|
1236 | + 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS) |
|
1237 | 1237 | ); |
1238 | 1238 | |
1239 | 1239 | |
@@ -1249,31 +1249,31 @@ discard block |
||
1249 | 1249 | */ |
1250 | 1250 | public function enqueue_styles_and_scripts() { |
1251 | 1251 | // load css |
1252 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1253 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1252 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1253 | + wp_enqueue_style('single_page_checkout'); |
|
1254 | 1254 | // load JS |
1255 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1256 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1255 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1256 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1257 | 1257 | wp_register_script( |
1258 | 1258 | 'single_page_checkout', |
1259 | - SPCO_JS_URL . 'single_page_checkout.js', |
|
1260 | - array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), |
|
1259 | + SPCO_JS_URL.'single_page_checkout.js', |
|
1260 | + array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), |
|
1261 | 1261 | EVENT_ESPRESSO_VERSION, |
1262 | 1262 | TRUE |
1263 | 1263 | ); |
1264 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1264 | + wp_enqueue_script('single_page_checkout'); |
|
1265 | 1265 | |
1266 | 1266 | /** |
1267 | 1267 | * global action hook for enqueueing styles and scripts with |
1268 | 1268 | * spco calls. |
1269 | 1269 | */ |
1270 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1270 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1271 | 1271 | |
1272 | 1272 | /** |
1273 | 1273 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1274 | 1274 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1275 | 1275 | */ |
1276 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1276 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1288,20 +1288,20 @@ discard block |
||
1288 | 1288 | */ |
1289 | 1289 | private function _display_spco_reg_form() { |
1290 | 1290 | // if registering via the admin, just display the reg form for the current step |
1291 | - if ( $this->checkout->admin_request ) { |
|
1292 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1291 | + if ($this->checkout->admin_request) { |
|
1292 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1293 | 1293 | } else { |
1294 | 1294 | // add powered by EE msg |
1295 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1295 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1296 | 1296 | |
1297 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1298 | - EE_Registry::$i18n_js_strings[ 'empty_cart' ] = $empty_cart; |
|
1297 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1298 | + EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart; |
|
1299 | 1299 | $cookies_not_set_msg = ''; |
1300 | - if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1300 | + if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) { |
|
1301 | 1301 | $cookies_not_set_msg = apply_filters( |
1302 | 1302 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1303 | 1303 | sprintf( |
1304 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1304 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1305 | 1305 | '<div class="ee-attention">', |
1306 | 1306 | '</div>', |
1307 | 1307 | '<h6 class="important-notice">', |
@@ -1321,7 +1321,7 @@ discard block |
||
1321 | 1321 | 'layout_strategy' => |
1322 | 1322 | new EE_Template_Layout( |
1323 | 1323 | array( |
1324 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1324 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1325 | 1325 | 'template_args' => array( |
1326 | 1326 | 'empty_cart' => $empty_cart, |
1327 | 1327 | 'revisit' => $this->checkout->revisit, |
@@ -1330,8 +1330,8 @@ discard block |
||
1330 | 1330 | 'empty_msg' => apply_filters( |
1331 | 1331 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1332 | 1332 | sprintf( |
1333 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1334 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1333 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1334 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1335 | 1335 | '">', |
1336 | 1336 | '</a>' |
1337 | 1337 | ) |
@@ -1349,7 +1349,7 @@ discard block |
||
1349 | 1349 | ) |
1350 | 1350 | ); |
1351 | 1351 | // load template and add to output sent that gets filtered into the_content() |
1352 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1352 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1353 | 1353 | } |
1354 | 1354 | } |
1355 | 1355 | |
@@ -1363,8 +1363,8 @@ discard block |
||
1363 | 1363 | * @internal param string $label |
1364 | 1364 | * @return string |
1365 | 1365 | */ |
1366 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1367 | - if ( $next_step === 'finalize_registration' ) { |
|
1366 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1367 | + if ($next_step === 'finalize_registration') { |
|
1368 | 1368 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1369 | 1369 | } |
1370 | 1370 | } |
@@ -1378,18 +1378,18 @@ discard block |
||
1378 | 1378 | * @return string |
1379 | 1379 | */ |
1380 | 1380 | public static function display_registration_footer() { |
1381 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1382 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1383 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1384 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1381 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1382 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1383 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1384 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1385 | 1385 | echo apply_filters( |
1386 | 1386 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1387 | 1387 | sprintf( |
1388 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1389 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1388 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1389 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1390 | 1390 | '" target="_blank">', |
1391 | 1391 | '</a>', |
1392 | - '<a href="' . $url . '" title="', |
|
1392 | + '<a href="'.$url.'" title="', |
|
1393 | 1393 | '" target="_blank">', |
1394 | 1394 | '</a></div>' |
1395 | 1395 | ) |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | * @throws \EE_Error |
1408 | 1408 | */ |
1409 | 1409 | public function unlock_transaction() { |
1410 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1410 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1411 | 1411 | $this->checkout->transaction->unlock(); |
1412 | 1412 | } |
1413 | 1413 | } |
@@ -1422,12 +1422,12 @@ discard block |
||
1422 | 1422 | * @return array |
1423 | 1423 | */ |
1424 | 1424 | private function _setup_redirect() { |
1425 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1425 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1426 | 1426 | $this->checkout->redirect = TRUE; |
1427 | - if ( empty( $this->checkout->redirect_url )) { |
|
1427 | + if (empty($this->checkout->redirect_url)) { |
|
1428 | 1428 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1429 | 1429 | } |
1430 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1430 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1431 | 1431 | } |
1432 | 1432 | } |
1433 | 1433 | |
@@ -1441,9 +1441,9 @@ discard block |
||
1441 | 1441 | * @throws \EE_Error |
1442 | 1442 | */ |
1443 | 1443 | public function go_to_next_step() { |
1444 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1444 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1445 | 1445 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1446 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1446 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1447 | 1447 | } |
1448 | 1448 | $this->unlock_transaction(); |
1449 | 1449 | // just return for these conditions |
@@ -1472,7 +1472,7 @@ discard block |
||
1472 | 1472 | */ |
1473 | 1473 | protected function _handle_json_response() { |
1474 | 1474 | // if this is an ajax request |
1475 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1475 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1476 | 1476 | // DEBUG LOG |
1477 | 1477 | //$this->checkout->log( |
1478 | 1478 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1485,7 +1485,7 @@ discard block |
||
1485 | 1485 | $this->checkout->json_response->set_registration_time_limit( |
1486 | 1486 | $this->checkout->get_registration_time_limit() |
1487 | 1487 | ); |
1488 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1488 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1489 | 1489 | // just send the ajax ( |
1490 | 1490 | $json_response = apply_filters( |
1491 | 1491 | 'FHEE__EE_Single_Page_Checkout__JSON_response', |
@@ -1506,9 +1506,9 @@ discard block |
||
1506 | 1506 | */ |
1507 | 1507 | protected function _handle_html_redirects() { |
1508 | 1508 | // going somewhere ? |
1509 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1509 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1510 | 1510 | // store notices in a transient |
1511 | - EE_Error::get_notices( false, true, true ); |
|
1511 | + EE_Error::get_notices(false, true, true); |
|
1512 | 1512 | // DEBUG LOG |
1513 | 1513 | //$this->checkout->log( |
1514 | 1514 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | // 'headers_list' => headers_list(), |
1519 | 1519 | // ) |
1520 | 1520 | //); |
1521 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1521 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1522 | 1522 | exit(); |
1523 | 1523 | } |
1524 | 1524 | } |
@@ -112,7 +112,7 @@ |
||
112 | 112 | if ( |
113 | 113 | ! ( |
114 | 114 | $this->checkout->payment_method instanceof EE_Payment_Method |
115 | - && $this->checkout->payment_method->is_off_site() |
|
115 | + && $this->checkout->payment_method->is_off_site() |
|
116 | 116 | ) |
117 | 117 | ) { |
118 | 118 | // mark this reg step as completed |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param EE_Checkout $checkout |
23 | 23 | * @return \EE_SPCO_Reg_Step_Finalize_Registration |
24 | 24 | */ |
25 | - public function __construct( EE_Checkout $checkout ) { |
|
25 | + public function __construct(EE_Checkout $checkout) { |
|
26 | 26 | $this->_slug = 'finalize_registration'; |
27 | - $this->_name = __( 'Finalize Registration', 'event_espresso' ); |
|
27 | + $this->_name = __('Finalize Registration', 'event_espresso'); |
|
28 | 28 | $this->_submit_button_text = $this->_name; |
29 | 29 | $this->_template = ''; |
30 | 30 | $this->checkout = $checkout; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function initialize_reg_step() { |
49 | 49 | // there's actually no reg form to process if this is the final step |
50 | - if ( $this->is_current_step() ) { |
|
50 | + if ($this->is_current_step()) { |
|
51 | 51 | $this->checkout->step = $_REQUEST['step'] = $this->slug(); |
52 | 52 | $this->checkout->action = $_REQUEST['action'] = 'process_reg_step'; |
53 | 53 | $this->checkout->generate_reg_form = false; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function process_reg_step() { |
75 | 75 | // ensure all data gets refreshed from the db |
76 | - $this->checkout->refresh_all_entities( true ); |
|
76 | + $this->checkout->refresh_all_entities(true); |
|
77 | 77 | // ensures that all details and statuses for transaction, registration, and payments are updated |
78 | 78 | $txn_update_params = $this->_finalize_transaction(); |
79 | 79 | // DEBUG LOG |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | $txn_update_params |
103 | 103 | ); |
104 | 104 | // check if transaction has a primary registrant and that it has a related Attendee object |
105 | - if ( ! $this->_validate_primary_registrant() ) { |
|
105 | + if ( ! $this->_validate_primary_registrant()) { |
|
106 | 106 | return false; |
107 | 107 | } |
108 | 108 | // you don't have to go home but you can't stay here ! |
109 | 109 | $this->checkout->redirect = true; |
110 | 110 | $this->checkout->continue_reg = true; |
111 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
111 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
112 | 112 | if ( |
113 | 113 | ! ( |
114 | 114 | $this->checkout->payment_method instanceof EE_Payment_Method |
@@ -133,26 +133,26 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function _finalize_transaction() { |
135 | 135 | /** @type EE_Transaction_Processor $transaction_processor */ |
136 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
136 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
137 | 137 | //set revisit flag in txn processor |
138 | - $transaction_processor->set_revisit( $this->checkout->revisit ); |
|
138 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
139 | 139 | // at this point we'll consider a TXN to not have been abandoned |
140 | - $transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction ); |
|
141 | - if ( $this->checkout->cart instanceof EE_Cart ) { |
|
140 | + $transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction); |
|
141 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
142 | 142 | // save TXN data to the cart |
143 | 143 | $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( |
144 | 144 | $this->checkout->transaction->ID() |
145 | 145 | ); |
146 | 146 | } |
147 | 147 | /** @type EE_Transaction_Payments $transaction_payments */ |
148 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
148 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
149 | 149 | // maybe update status, but don't save transaction just yet |
150 | - $transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false ); |
|
150 | + $transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false); |
|
151 | 151 | // maybe send messages |
152 | 152 | $this->_trigger_notifications(); |
153 | 153 | // this will result in the base session properties getting saved to the TXN_Session_data field |
154 | 154 | $this->checkout->transaction->set_txn_session_data( |
155 | - EE_Registry::instance()->SSN->get_session_data( null, true ) |
|
155 | + EE_Registry::instance()->SSN->get_session_data(null, true) |
|
156 | 156 | ); |
157 | 157 | // update the TXN if payment conditions have changed |
158 | 158 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | * @throws \EE_Error |
175 | 175 | */ |
176 | 176 | protected function _trigger_notifications() { |
177 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
178 | - $is_revisit = filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN ); |
|
179 | - if ( $this->checkout->payment_method->is_off_site() ) { |
|
180 | - $gateway= $this->checkout->payment_method->type_obj()->get_gateway(); |
|
177 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
178 | + $is_revisit = filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN); |
|
179 | + if ($this->checkout->payment_method->is_off_site()) { |
|
180 | + $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
181 | 181 | if ( |
182 | 182 | ! $is_revisit |
183 | 183 | && $gateway instanceof EE_Offsite_Gateway |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | ) |
188 | 188 | ) { |
189 | 189 | // first time through SPCO and we are processing the payment notification NOW |
190 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
190 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
191 | 191 | } else { |
192 | 192 | // do NOT trigger notifications because this is a revisit, OR it was already done during the IPN |
193 | - remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' ); |
|
193 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
194 | 194 | add_filter( |
195 | 195 | 'FHEE__EED_Messages___maybe_registration__deliver_notifications', |
196 | 196 | '__return_false', |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | } |
200 | 200 | } else if ( |
201 | 201 | // if SPCO revisit and TXN status has changed due to a payment |
202 | - $is_revisit && ( $this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated() ) |
|
202 | + $is_revisit && ($this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated()) |
|
203 | 203 | ) { |
204 | 204 | // send out notifications |
205 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
206 | - } else if ( ! $is_revisit ) { |
|
207 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
205 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
206 | + } else if ( ! $is_revisit) { |
|
207 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | } |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | * @throws \EE_Error |
219 | 219 | */ |
220 | 220 | protected function _validate_primary_registrant() { |
221 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
221 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
222 | 222 | EE_Error::add_error( |
223 | - __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), |
|
223 | + __('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), |
|
224 | 224 | __FILE__, |
225 | 225 | __FUNCTION__, |
226 | 226 | __LINE__ |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | // setup URL for redirect |
233 | 233 | $this->checkout->redirect_url = add_query_arg( |
234 | - array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ), |
|
234 | + array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()), |
|
235 | 235 | $this->checkout->thank_you_page_url |
236 | 236 | ); |
237 | 237 | return true; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function update_reg_step() { |
246 | 246 | EE_Error::doing_it_wrong( |
247 | - __CLASS__ . '::' . __FILE__, |
|
247 | + __CLASS__.'::'.__FILE__, |
|
248 | 248 | __( |
249 | 249 | 'Can not call update_reg_step() on the Finalize Registration reg step.', |
250 | 250 | 'event_espresso' |
@@ -310,23 +310,23 @@ discard block |
||
310 | 310 | * @param float $amount |
311 | 311 | * @param string $name |
312 | 312 | * @param string $description |
313 | - * @param string $code |
|
314 | - * @param boolean $add_to_existing_line_item if true and a duplicate line item with |
|
315 | - * the same code is found, $amount will be added onto it; otherwise will simply |
|
316 | - * set the taxes to match $amount |
|
313 | + * @param string $code |
|
314 | + * @param boolean $add_to_existing_line_item if true and a duplicate line item with |
|
315 | + * the same code is found, $amount will be added onto it; otherwise will simply |
|
316 | + * set the taxes to match $amount |
|
317 | 317 | * @return EE_Line_Item the new tax created |
318 | 318 | */ |
319 | 319 | public function set_total_tax_to( EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false ); |
320 | 320 | |
321 | - /** |
|
322 | - * Makes all the line items which are children of $line_item taxable (or not). |
|
323 | - * Does NOT save the line items |
|
324 | - * @param EE_Line_Item $line_item |
|
325 | - * @param boolean $taxable |
|
326 | - * @param string $code_substring_for_whitelist if this string is part of the line item's code |
|
327 | - * it will be whitelisted (ie, except from becoming taxable) |
|
328 | - */ |
|
329 | - public static function set_line_items_taxable( EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null ); |
|
321 | + /** |
|
322 | + * Makes all the line items which are children of $line_item taxable (or not). |
|
323 | + * Does NOT save the line items |
|
324 | + * @param EE_Line_Item $line_item |
|
325 | + * @param boolean $taxable |
|
326 | + * @param string $code_substring_for_whitelist if this string is part of the line item's code |
|
327 | + * it will be whitelisted (ie, except from becoming taxable) |
|
328 | + */ |
|
329 | + public static function set_line_items_taxable( EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null ); |
|
330 | 330 | |
331 | 331 | /** |
332 | 332 | * Adds a simple item ( unrelated to any other model object) to the total line item, |
@@ -356,15 +356,15 @@ discard block |
||
356 | 356 | */ |
357 | 357 | interface EEHI_Money{ |
358 | 358 | /** |
359 | - * For comparing floats. Default operator is '=', but see the $operator below for all options. |
|
360 | - * This should be used to compare floats instead of normal '==' because floats |
|
361 | - * are inherently imprecise, and so you can sometimes have two floats that appear to be identical |
|
362 | - * but actually differ by 0.00000001. |
|
363 | - * @param float $float1 |
|
364 | - * @param float $float2 |
|
365 | - * @param string $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne |
|
366 | - * @return boolean whether the equation is true or false |
|
367 | - */ |
|
359 | + * For comparing floats. Default operator is '=', but see the $operator below for all options. |
|
360 | + * This should be used to compare floats instead of normal '==' because floats |
|
361 | + * are inherently imprecise, and so you can sometimes have two floats that appear to be identical |
|
362 | + * but actually differ by 0.00000001. |
|
363 | + * @param float $float1 |
|
364 | + * @param float $float2 |
|
365 | + * @param string $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne |
|
366 | + * @return boolean whether the equation is true or false |
|
367 | + */ |
|
368 | 368 | public function compare_floats( $float1, $float2, $operator='=' ); |
369 | 369 | } |
370 | 370 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | /** |
6 | 6 | * Interface EEI_Base |
7 | 7 | */ |
8 | -interface EEI_Base{ |
|
8 | +interface EEI_Base { |
|
9 | 9 | /** |
10 | 10 | * gets the unique ID of the model object. If it hasn't been saved yet |
11 | 11 | * to the database, this should be 0 or NULL |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return int records updated (or BOOLEAN if we actually ended up inserting the extra meta row) |
33 | 33 | * NOTE: if the values haven't changed, returns 0 |
34 | 34 | */ |
35 | - public function update_extra_meta($meta_key,$meta_value,$previous_value = NULL); |
|
35 | + public function update_extra_meta($meta_key, $meta_value, $previous_value = NULL); |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Adds a new extra meta record. If $unique is set to TRUE, we'll first double-check |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param boolean $unique |
44 | 44 | * @return boolean |
45 | 45 | */ |
46 | - public function add_extra_meta($meta_key,$meta_value,$unique = false); |
|
46 | + public function add_extra_meta($meta_key, $meta_value, $unique = false); |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Deletes all the extra meta rows for this record as specified by key. If $meta_value |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $meta_value |
53 | 53 | * @return int number of extra meta rows deleted |
54 | 54 | */ |
55 | - public function delete_extra_meta($meta_key,$meta_value = NULL); |
|
55 | + public function delete_extra_meta($meta_key, $meta_value = NULL); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Gets the extra meta with the given meta key. If you specify "single" we just return 1, otherwise |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param mixed $default if we don't find anything, what should we return? |
64 | 64 | * @return mixed single value if $single; array if ! $single |
65 | 65 | */ |
66 | - public function get_extra_meta($meta_key,$single = FALSE,$default = NULL); |
|
66 | + public function get_extra_meta($meta_key, $single = FALSE, $default = NULL); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param EE_Response $response |
91 | 91 | * @return EE_Response |
92 | 92 | */ |
93 | - public function handle_request( EE_Request $request, EE_Response $response ); |
|
93 | + public function handle_request(EE_Request $request, EE_Response $response); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @param EE_Request $request |
107 | 107 | * @param EE_Response $response |
108 | 108 | */ |
109 | - public function handle_response( EE_Request $request, EE_Response $response ); |
|
109 | + public function handle_response(EE_Request $request, EE_Response $response); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * @param string $country |
287 | 287 | * @param string $CNT_ISO |
288 | 288 | */ |
289 | - public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ); |
|
289 | + public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | /** |
297 | 297 | * Interface EEHI_Line_Item |
298 | 298 | */ |
299 | -interface EEHI_Line_Item{ |
|
299 | +interface EEHI_Line_Item { |
|
300 | 300 | /** |
301 | 301 | * Adds an item to the purchase in the right spot |
302 | 302 | * @param EE_Line_Item $total_line_item |
303 | 303 | * @param EE_Line_Item $line_item |
304 | 304 | */ |
305 | - public function add_item( EE_Line_Item $total_line_item, EE_Line_Item $line_item ); |
|
305 | + public function add_item(EE_Line_Item $total_line_item, EE_Line_Item $line_item); |
|
306 | 306 | /** |
307 | 307 | * Overwrites the previous tax by clearing out the old taxes, and creates a new |
308 | 308 | * tax and updates the total line item accordingly |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * set the taxes to match $amount |
317 | 317 | * @return EE_Line_Item the new tax created |
318 | 318 | */ |
319 | - public function set_total_tax_to( EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false ); |
|
319 | + public function set_total_tax_to(EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false); |
|
320 | 320 | |
321 | 321 | /** |
322 | 322 | * Makes all the line items which are children of $line_item taxable (or not). |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @param string $code_substring_for_whitelist if this string is part of the line item's code |
327 | 327 | * it will be whitelisted (ie, except from becoming taxable) |
328 | 328 | */ |
329 | - public static function set_line_items_taxable( EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null ); |
|
329 | + public static function set_line_items_taxable(EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null); |
|
330 | 330 | |
331 | 331 | /** |
332 | 332 | * Adds a simple item ( unrelated to any other model object) to the total line item, |
@@ -340,21 +340,21 @@ discard block |
||
340 | 340 | * @param boolean $code if set to a value, ensures there is only one line item with that code |
341 | 341 | * @return boolean success |
342 | 342 | */ |
343 | - public function add_unrelated_item( EE_Line_Item $total_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = null ); |
|
343 | + public function add_unrelated_item(EE_Line_Item $total_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = null); |
|
344 | 344 | |
345 | 345 | /** |
346 | 346 | * Gets the line item for the taxes subtotal |
347 | 347 | * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total |
348 | 348 | * @return \EE_Line_Item |
349 | 349 | */ |
350 | - public static function get_taxes_subtotal( EE_Line_Item $total_line_item ); |
|
350 | + public static function get_taxes_subtotal(EE_Line_Item $total_line_item); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
354 | 354 | /** |
355 | 355 | * Money-related helper |
356 | 356 | */ |
357 | -interface EEHI_Money{ |
|
357 | +interface EEHI_Money { |
|
358 | 358 | /** |
359 | 359 | * For comparing floats. Default operator is '=', but see the $operator below for all options. |
360 | 360 | * This should be used to compare floats instead of normal '==' because floats |
@@ -365,13 +365,13 @@ discard block |
||
365 | 365 | * @param string $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne |
366 | 366 | * @return boolean whether the equation is true or false |
367 | 367 | */ |
368 | - public function compare_floats( $float1, $float2, $operator='=' ); |
|
368 | + public function compare_floats($float1, $float2, $operator = '='); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Interface EEHI_Template |
373 | 373 | */ |
374 | -interface EEHI_Template{ |
|
374 | +interface EEHI_Template { |
|
375 | 375 | |
376 | 376 | /** |
377 | 377 | * EEH_Template::format_currency |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * @param string $cur_code_span_class |
385 | 385 | * @return string the html output for the formatted money value |
386 | 386 | */ |
387 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ); |
|
387 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code'); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | * @param array $options |
400 | 400 | * @return mixed |
401 | 401 | */ |
402 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ); |
|
402 | + public function display_line_item(EE_Line_Item $line_item, $options = array()); |
|
403 | 403 | |
404 | 404 | } |
405 | 405 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * @throws EE_Error |
417 | 417 | * @return bool |
418 | 418 | */ |
419 | - public static function ensure_file_exists_and_is_writable( $full_file_path = '' ); |
|
419 | + public static function ensure_file_exists_and_is_writable($full_file_path = ''); |
|
420 | 420 | |
421 | 421 | /** |
422 | 422 | * ensure_folder_exists_and_is_writable |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * @throws EE_Error |
426 | 426 | * @return bool |
427 | 427 | */ |
428 | - public static function ensure_folder_exists_and_is_writable( $folder = '' ); |
|
428 | + public static function ensure_folder_exists_and_is_writable($folder = ''); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | // End of file EEI_Interfaces.php |