@@ -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__ ); |
|
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__); |
|
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. |
@@ -486,12 +486,12 @@ discard block |
||
486 | 486 | */ |
487 | 487 | EE_Registry::instance()->load_helper('Template'); |
488 | 488 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php'; |
489 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
489 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
490 | 490 | |
491 | - if ( $has_custom ) { |
|
492 | - return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) ); |
|
491 | + if ($has_custom) { |
|
492 | + return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch')); |
|
493 | 493 | } |
494 | - return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' ); |
|
494 | + return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt'); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
503 | 503 | * @return string |
504 | 504 | */ |
505 | - public function invoice_url( $messenger = 'html' ) { |
|
505 | + public function invoice_url($messenger = 'html') { |
|
506 | 506 | /** |
507 | 507 | * 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. |
508 | 508 | * |
@@ -510,21 +510,21 @@ discard block |
||
510 | 510 | */ |
511 | 511 | EE_Registry::instance()->load_helper('Template'); |
512 | 512 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php'; |
513 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
513 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
514 | 514 | |
515 | - if ( $has_custom ) { |
|
516 | - if ( $messenger == 'html' ) { |
|
517 | - return $this->invoice_url( 'launch' ); |
|
515 | + if ($has_custom) { |
|
516 | + if ($messenger == 'html') { |
|
517 | + return $this->invoice_url('launch'); |
|
518 | 518 | } |
519 | 519 | $route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice'; |
520 | 520 | |
521 | - $query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() ); |
|
522 | - if ( $messenger == 'html' ) { |
|
521 | + $query_args = array('ee' => $route, 'id' => $this->reg_url_link()); |
|
522 | + if ($messenger == 'html') { |
|
523 | 523 | $query_args['html'] = TRUE; |
524 | 524 | } |
525 | - return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) ); |
|
525 | + return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id)); |
|
526 | 526 | } |
527 | - return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' ); |
|
527 | + return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice'); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @access public |
535 | 535 | */ |
536 | 536 | public function reg_url_link() { |
537 | - return $this->get( 'REG_url_link' ); |
|
537 | + return $this->get('REG_url_link'); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * @param string $type 'download','launch', or 'html' (default is 'launch') |
545 | 545 | * @return void |
546 | 546 | */ |
547 | - public function e_invoice_url( $type = 'launch' ) { |
|
548 | - echo $this->invoice_url( $type ); |
|
547 | + public function e_invoice_url($type = 'launch') { |
|
548 | + echo $this->invoice_url($type); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * @return string |
566 | 566 | */ |
567 | 567 | public function payment_overview_url() { |
568 | - 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() ); |
|
568 | + 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 | 569 | } |
570 | 570 | |
571 | 571 | |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | * @return string |
577 | 577 | */ |
578 | 578 | public function edit_attendee_information_url() { |
579 | - 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() ); |
|
579 | + 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 | 580 | } |
581 | 581 | |
582 | 582 | |
@@ -586,8 +586,8 @@ discard block |
||
586 | 586 | * @return string |
587 | 587 | */ |
588 | 588 | public function get_admin_edit_url() { |
589 | - EE_Registry::instance()->load_helper( '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' ) ); |
|
589 | + EE_Registry::instance()->load_helper('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')); |
|
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 | |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | * @access public |
1247 | 1247 | */ |
1248 | 1248 | public function price_paid() { |
1249 | - 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' ); |
|
1249 | + 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'); |
|
1250 | 1250 | return $this->final_price(); |
1251 | 1251 | } |
1252 | 1252 | |
@@ -1258,9 +1258,9 @@ discard block |
||
1258 | 1258 | * @access public |
1259 | 1259 | * @param float $REG_final_price |
1260 | 1260 | */ |
1261 | - public function set_price_paid( $REG_final_price = 0.00 ) { |
|
1262 | - 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' ); |
|
1263 | - $this->set_final_price( $REG_final_price ); |
|
1261 | + public function set_price_paid($REG_final_price = 0.00) { |
|
1262 | + 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'); |
|
1263 | + $this->set_final_price($REG_final_price); |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | * @return string |
1272 | 1272 | */ |
1273 | 1273 | public function pretty_price_paid() { |
1274 | - 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' ); |
|
1274 | + 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'); |
|
1275 | 1275 | return $this->pretty_final_price(); |
1276 | 1276 | } |
1277 | 1277 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @return EED_Add_New_State |
17 | 17 | */ |
18 | 18 | public static function instance() { |
19 | - return parent::get_instance( __CLASS__ ); |
|
19 | + return parent::get_instance(__CLASS__); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | * @return void |
28 | 28 | */ |
29 | 29 | public static function set_hooks() { |
30 | - add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 ); |
|
31 | - add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'translate_js_strings' ), 0 ); |
|
32 | - add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'wp_enqueue_scripts' ), 10 ); |
|
33 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
34 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
35 | - add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 ); |
|
36 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 ); |
|
37 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 ); |
|
38 | - add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 ); |
|
39 | - add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 ); |
|
30 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
31 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0); |
|
32 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10); |
|
33 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
34 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
35 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
36 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
37 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
38 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1); |
|
39 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -46,19 +46,19 @@ discard block |
||
46 | 46 | * @return void |
47 | 47 | */ |
48 | 48 | public static function set_hooks_admin() { |
49 | - add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 ); |
|
50 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
51 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
52 | - add_action( 'wp_ajax_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' )); |
|
53 | - add_action( 'wp_ajax_nopriv_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' )); |
|
54 | - add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 ); |
|
55 | - add_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 ); |
|
56 | - add_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 ); |
|
57 | - add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 ); |
|
58 | - add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 ); |
|
59 | - add_filter( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', array( 'EED_Add_New_State', 'filter_checkout_request_params' ), 10, 1 ); |
|
60 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 ); |
|
61 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 ); |
|
49 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
50 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
51 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
52 | + add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
53 | + add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
54 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
55 | + add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
56 | + add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
57 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1); |
|
58 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1); |
|
59 | + add_filter('FHEE__Single_Page_Checkout___check_form_submission__request_params', array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1); |
|
60 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
61 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * @return void |
71 | 71 | */ |
72 | 72 | public static function set_definitions() { |
73 | - define( 'ANS_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
74 | - define( 'ANS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
73 | + define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
74 | + define('ANS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param \WP $WP |
84 | 84 | * @return void |
85 | 85 | */ |
86 | - public function run( $WP ) { |
|
86 | + public function run($WP) { |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | * @return void |
112 | 112 | */ |
113 | 113 | public static function wp_enqueue_scripts() { |
114 | - if ( apply_filters( 'EED_Single_Page_Checkout__SPCO_active', false ) ) { |
|
115 | - wp_register_script( 'add_new_state', ANS_ASSETS_URL . 'add_new_state.js', array( 'espresso_core', 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, true ); |
|
116 | - wp_enqueue_script( 'add_new_state' ); |
|
114 | + if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { |
|
115 | + wp_register_script('add_new_state', ANS_ASSETS_URL.'add_new_state.js', array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true); |
|
116 | + wp_enqueue_script('add_new_state'); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -127,30 +127,30 @@ discard block |
||
127 | 127 | * @return string |
128 | 128 | */ |
129 | 129 | // public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){ |
130 | - public static function display_add_new_state_micro_form( EE_Form_Section_Proper $question_group_reg_form ){ |
|
130 | + public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) { |
|
131 | 131 | // only add the 'new_state_micro_form' when displaying reg forms, |
132 | 132 | // not during processing since we process the 'new_state_micro_form' in it's own AJAX request |
133 | - $action = EE_Registry::instance()->REQ->get( 'action', '' ); |
|
134 | - if ( $action === 'process_reg_step' || $action === 'update_reg_step' ) { |
|
133 | + $action = EE_Registry::instance()->REQ->get('action', ''); |
|
134 | + if ($action === 'process_reg_step' || $action === 'update_reg_step') { |
|
135 | 135 | return $question_group_reg_form; |
136 | 136 | } |
137 | 137 | // is the "state" question in this form section? |
138 | - $input = $question_group_reg_form->get_subsection( 'state' ); |
|
138 | + $input = $question_group_reg_form->get_subsection('state'); |
|
139 | 139 | // we're only doing this for state select inputs |
140 | - if ( $input instanceof EE_State_Select_Input ) { |
|
140 | + if ($input instanceof EE_State_Select_Input) { |
|
141 | 141 | // load helpers |
142 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
142 | + EE_Registry::instance()->load_helper('HTML'); |
|
143 | 143 | // grab any set values from the request |
144 | - $country_name = str_replace( 'state', 'new_state_country', $input->html_name() ); |
|
145 | - $state_name = str_replace( 'state', 'new_state_name', $input->html_name() ); |
|
146 | - $abbrv_name = str_replace( 'state', 'new_state_abbrv', $input->html_name() ); |
|
147 | - $new_state_submit_id = str_replace( 'state', 'new_state', $input->html_id() ); |
|
144 | + $country_name = str_replace('state', 'new_state_country', $input->html_name()); |
|
145 | + $state_name = str_replace('state', 'new_state_name', $input->html_name()); |
|
146 | + $abbrv_name = str_replace('state', 'new_state_abbrv', $input->html_name()); |
|
147 | + $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); |
|
148 | 148 | $country_options = array(); |
149 | 149 | $countries = EEM_Country::instance()->get_all_countries(); |
150 | - if ( ! empty( $countries )) { |
|
151 | - foreach( $countries as $country ){ |
|
152 | - if ( $country instanceof EE_Country ) { |
|
153 | - $country_options[ $country->ID() ] = $country->name(); |
|
150 | + if ( ! empty($countries)) { |
|
151 | + foreach ($countries as $country) { |
|
152 | + if ($country instanceof EE_Country) { |
|
153 | + $country_options[$country->ID()] = $country->name(); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | } |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | // add hidden input to indicate that a new state is being added |
164 | 164 | 'add_new_state' => new EE_Hidden_Input( |
165 | 165 | array( |
166 | - 'html_name' => str_replace( 'state', 'add_new_state', $input->html_name() ), |
|
167 | - 'html_id' => str_replace( 'state', 'add_new_state', $input->html_id() ), |
|
166 | + 'html_name' => str_replace('state', 'add_new_state', $input->html_name()), |
|
167 | + 'html_id' => str_replace('state', 'add_new_state', $input->html_id()), |
|
168 | 168 | 'default' => 0 |
169 | 169 | ) |
170 | 170 | ), |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | '', |
177 | 177 | __('click here to add a new state/province', 'event_espresso'), |
178 | 178 | '', |
179 | - 'display-' . $input->html_id(), |
|
179 | + 'display-'.$input->html_id(), |
|
180 | 180 | 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', |
181 | 181 | '', |
182 | - 'rel="' . $input->html_id() . '"' |
|
182 | + 'rel="'.$input->html_id().'"' |
|
183 | 183 | ) |
184 | 184 | ) |
185 | 185 | ), |
@@ -187,13 +187,13 @@ discard block |
||
187 | 187 | 'add_new_state_micro_form' =>new EE_Form_Section_HTML( |
188 | 188 | apply_filters( |
189 | 189 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', |
190 | - EEH_HTML::div( '', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', 'display: none;' ) . |
|
191 | - EEH_HTML::h6( __('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')) . |
|
192 | - EEH_HTML::ul() . |
|
193 | - EEH_HTML::li( __('first select the Country that your State/Province belongs to', 'event_espresso') ) . |
|
194 | - EEH_HTML::li( __('enter the name of your State/Province', 'event_espresso') ) . |
|
195 | - EEH_HTML::li( __('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso') ) . |
|
196 | - EEH_HTML::li( __('click the ADD button', 'event_espresso') ) . |
|
190 | + EEH_HTML::div('', $input->html_id().'-dv', 'ee-form-add-new-state-dv', 'display: none;'). |
|
191 | + EEH_HTML::h6(__('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')). |
|
192 | + EEH_HTML::ul(). |
|
193 | + EEH_HTML::li(__('first select the Country that your State/Province belongs to', 'event_espresso')). |
|
194 | + EEH_HTML::li(__('enter the name of your State/Province', 'event_espresso')). |
|
195 | + EEH_HTML::li(__('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso')). |
|
196 | + EEH_HTML::li(__('click the ADD button', 'event_espresso')). |
|
197 | 197 | EEH_HTML::ulx() |
198 | 198 | ) |
199 | 199 | ), |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | $country_options, |
203 | 203 | array( |
204 | 204 | 'html_name' => $country_name, |
205 | - 'html_id' => str_replace( 'state', 'new_state_country', $input->html_id() ), |
|
206 | - 'html_class' => $input->html_class() . ' new-state-country', |
|
205 | + 'html_id' => str_replace('state', 'new_state_country', $input->html_id()), |
|
206 | + 'html_class' => $input->html_class().' new-state-country', |
|
207 | 207 | 'html_label_text' => __('New State/Province Country', 'event_espresso'), |
208 | - 'default' => EE_Registry::instance()->REQ->get( $country_name, '' ), |
|
208 | + 'default' => EE_Registry::instance()->REQ->get($country_name, ''), |
|
209 | 209 | 'required' => false |
210 | 210 | ) |
211 | 211 | ), |
@@ -213,23 +213,23 @@ discard block |
||
213 | 213 | 'new_state_name' => new EE_Text_Input( |
214 | 214 | array( |
215 | 215 | 'html_name' => $state_name, |
216 | - 'html_id' => str_replace( 'state', 'new_state_name', $input->html_id() ), |
|
217 | - 'html_class' => $input->html_class() . ' new-state-state', |
|
216 | + 'html_id' => str_replace('state', 'new_state_name', $input->html_id()), |
|
217 | + 'html_class' => $input->html_class().' new-state-state', |
|
218 | 218 | 'html_label_text' => __('New State/Province Name', 'event_espresso'), |
219 | - 'default' => EE_Registry::instance()->REQ->get( $state_name, '' ), |
|
219 | + 'default' => EE_Registry::instance()->REQ->get($state_name, ''), |
|
220 | 220 | 'required' => false |
221 | 221 | ) |
222 | 222 | ), |
223 | - 'spacer' => new EE_Form_Section_HTML( EEH_HTML::br() ), |
|
223 | + 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()), |
|
224 | 224 | // NEW STATE NAME |
225 | 225 | 'new_state_abbrv' => new EE_Text_Input( |
226 | 226 | array( |
227 | 227 | 'html_name' => $abbrv_name, |
228 | - 'html_id' => str_replace( 'state', 'new_state_abbrv', $input->html_id() ), |
|
229 | - 'html_class' => $input->html_class() . ' new-state-abbrv', |
|
228 | + 'html_id' => str_replace('state', 'new_state_abbrv', $input->html_id()), |
|
229 | + 'html_class' => $input->html_class().' new-state-abbrv', |
|
230 | 230 | 'html_label_text' => __('New State/Province Abbreviation', 'event_espresso'), |
231 | 231 | 'html_other_attributes' => 'size="24"', |
232 | - 'default' => EE_Registry::instance()->REQ->get( $abbrv_name, '' ), |
|
232 | + 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), |
|
233 | 233 | 'required' => false |
234 | 234 | ) |
235 | 235 | ), |
@@ -237,26 +237,26 @@ discard block |
||
237 | 237 | 'add_new_state_submit_button' => new EE_Form_Section_HTML( |
238 | 238 | apply_filters( |
239 | 239 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', |
240 | - EEH_HTML::nbsp(3) . |
|
241 | - EEH_HTML::link( '', __('ADD', 'event_espresso'), '', 'submit-' . $new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="' . $new_state_submit_id . '"' ) |
|
240 | + EEH_HTML::nbsp(3). |
|
241 | + EEH_HTML::link('', __('ADD', 'event_espresso'), '', 'submit-'.$new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="'.$new_state_submit_id.'"') |
|
242 | 242 | ) |
243 | 243 | ), |
244 | 244 | // extra info |
245 | 245 | 'add_new_state_extra' => new EE_Form_Section_HTML( |
246 | 246 | apply_filters( |
247 | 247 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra', |
248 | - EEH_HTML::br(2) . |
|
249 | - EEH_HTML::div( '', '', 'small-text' ) . |
|
250 | - EEH_HTML::strong( __('Don\'t know your State/Province Abbreviation?', 'event_espresso') ) . |
|
251 | - EEH_HTML::br() . |
|
248 | + EEH_HTML::br(2). |
|
249 | + EEH_HTML::div('', '', 'small-text'). |
|
250 | + EEH_HTML::strong(__('Don\'t know your State/Province Abbreviation?', 'event_espresso')). |
|
251 | + EEH_HTML::br(). |
|
252 | 252 | sprintf( |
253 | 253 | __('You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', 'event_espresso'), |
254 | - EEH_HTML::link( 'http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk' ) |
|
255 | - ) . |
|
256 | - EEH_HTML::divx() . |
|
257 | - EEH_HTML::br() . |
|
258 | - EEH_HTML::link( '', __('cancel new state/province', 'event_espresso'), '', 'hide-' . $input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="' . $input->html_id() . '"' ) . |
|
259 | - EEH_HTML::divx() . |
|
254 | + EEH_HTML::link('http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk') |
|
255 | + ). |
|
256 | + EEH_HTML::divx(). |
|
257 | + EEH_HTML::br(). |
|
258 | + EEH_HTML::link('', __('cancel new state/province', 'event_espresso'), '', 'hide-'.$input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="'.$input->html_id().'"'). |
|
259 | + EEH_HTML::divx(). |
|
260 | 260 | EEH_HTML::br() |
261 | 261 | ) |
262 | 262 | ) |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | ) |
265 | 265 | ) |
266 | 266 | ); |
267 | - $question_group_reg_form->add_subsections( array( 'new_state_micro_form' => $new_state_micro_form ), 'state', false ); |
|
267 | + $question_group_reg_form->add_subsections(array('new_state_micro_form' => $new_state_micro_form), 'state', false); |
|
268 | 268 | } |
269 | 269 | return $question_group_reg_form; |
270 | 270 | } |
@@ -281,41 +281,41 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public static function add_new_state() { |
283 | 283 | $REQ = EE_Registry::instance()->load_core('Request_Handler'); |
284 | - if ( $REQ->is_set( 'add_new_state' ) && $REQ->get( 'add_new_state' ) == 1 ) { |
|
284 | + if ($REQ->is_set('add_new_state') && $REQ->get('add_new_state') == 1) { |
|
285 | 285 | EE_Registry::instance()->load_model('State'); |
286 | 286 | // grab country ISO code, new state name, and new state abbreviation |
287 | - $state_country = $REQ->is_set( 'new_state_country' ) ? sanitize_text_field( $REQ->get( 'new_state_country' )) : FALSE; |
|
288 | - $state_name = $REQ->is_set( 'new_state_name' ) ? sanitize_text_field( $REQ->get( 'new_state_name' )) : FALSE; |
|
289 | - $state_abbr = $REQ->is_set( 'new_state_abbrv' ) ? sanitize_text_field( $REQ->get( 'new_state_abbrv' )) : FALSE; |
|
287 | + $state_country = $REQ->is_set('new_state_country') ? sanitize_text_field($REQ->get('new_state_country')) : FALSE; |
|
288 | + $state_name = $REQ->is_set('new_state_name') ? sanitize_text_field($REQ->get('new_state_name')) : FALSE; |
|
289 | + $state_abbr = $REQ->is_set('new_state_abbrv') ? sanitize_text_field($REQ->get('new_state_abbrv')) : FALSE; |
|
290 | 290 | |
291 | 291 | //echo '<h4>$state_country : ' . $state_country . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
292 | 292 | //echo '<h4>$state_name : ' . $state_name . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
293 | 293 | //echo '<h4>$state_abbr : ' . $state_abbr . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
294 | 294 | |
295 | - if ( $state_country && $state_name && $state_abbr ) { |
|
296 | - $new_state = EED_Add_New_State::save_new_state_to_db( array( |
|
297 | - 'CNT_ISO'=> strtoupper( $state_country ), |
|
298 | - 'STA_abbrev' => strtoupper( $state_abbr ), |
|
299 | - 'STA_name' => ucwords( $state_name ), |
|
295 | + if ($state_country && $state_name && $state_abbr) { |
|
296 | + $new_state = EED_Add_New_State::save_new_state_to_db(array( |
|
297 | + 'CNT_ISO'=> strtoupper($state_country), |
|
298 | + 'STA_abbrev' => strtoupper($state_abbr), |
|
299 | + 'STA_name' => ucwords($state_name), |
|
300 | 300 | 'STA_active' => FALSE |
301 | 301 | )); |
302 | 302 | |
303 | - if ( $new_state instanceof EE_State ) { |
|
303 | + if ($new_state instanceof EE_State) { |
|
304 | 304 | // clean house |
305 | - EE_Registry::instance()->REQ->un_set( 'add_new_state' ); |
|
306 | - EE_Registry::instance()->REQ->un_set( 'new_state_country' ); |
|
307 | - EE_Registry::instance()->REQ->un_set( 'new_state_name' ); |
|
308 | - EE_Registry::instance()->REQ->un_set( 'new_state_abbrv' ); |
|
305 | + EE_Registry::instance()->REQ->un_set('add_new_state'); |
|
306 | + EE_Registry::instance()->REQ->un_set('new_state_country'); |
|
307 | + EE_Registry::instance()->REQ->un_set('new_state_name'); |
|
308 | + EE_Registry::instance()->REQ->un_set('new_state_abbrv'); |
|
309 | 309 | |
310 | 310 | // get any existing new states |
311 | 311 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
312 | 312 | 'new_states' |
313 | 313 | ); |
314 | - $new_states[ $new_state->ID() ] = $new_state; |
|
315 | - EE_Registry::instance()->SSN->set_session_data( array( 'new_states' => $new_states )); |
|
314 | + $new_states[$new_state->ID()] = $new_state; |
|
315 | + EE_Registry::instance()->SSN->set_session_data(array('new_states' => $new_states)); |
|
316 | 316 | |
317 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
318 | - echo json_encode( array( |
|
317 | + if (EE_Registry::instance()->REQ->ajax) { |
|
318 | + echo json_encode(array( |
|
319 | 319 | 'success' => TRUE, |
320 | 320 | 'id' => $new_state->ID(), |
321 | 321 | 'name' => $new_state->name(), |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | } |
331 | 331 | |
332 | 332 | } else { |
333 | - $error = __( 'A new State/Province could not be added because invalid or missing data was received.', 'event_espresso' ); |
|
334 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
335 | - echo json_encode( array( 'error' => $error )); |
|
333 | + $error = __('A new State/Province could not be added because invalid or missing data was received.', 'event_espresso'); |
|
334 | + if (EE_Registry::instance()->REQ->ajax) { |
|
335 | + echo json_encode(array('error' => $error)); |
|
336 | 336 | exit(); |
337 | 337 | } else { |
338 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
338 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | } |
@@ -353,11 +353,11 @@ discard block |
||
353 | 353 | * @param array $request_params |
354 | 354 | * @return array |
355 | 355 | */ |
356 | - public static function filter_checkout_request_params ( $request_params ) { |
|
357 | - foreach ( $request_params as $form_section ) { |
|
358 | - if ( is_array( $form_section )) { |
|
359 | - EED_Add_New_State::unset_new_state_request_params( $form_section ); |
|
360 | - EED_Add_New_State::filter_checkout_request_params( $form_section ); |
|
356 | + public static function filter_checkout_request_params($request_params) { |
|
357 | + foreach ($request_params as $form_section) { |
|
358 | + if (is_array($form_section)) { |
|
359 | + EED_Add_New_State::unset_new_state_request_params($form_section); |
|
360 | + EED_Add_New_State::filter_checkout_request_params($form_section); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | return $request_params; |
@@ -372,12 +372,12 @@ discard block |
||
372 | 372 | * @param array $request_params |
373 | 373 | * @return boolean |
374 | 374 | */ |
375 | - public static function unset_new_state_request_params ( $request_params ) { |
|
376 | - unset( $request_params[ 'new_state_micro_form' ] ); |
|
377 | - unset( $request_params[ 'add_new_state' ] ); |
|
378 | - unset( $request_params[ 'new_state_country' ] ); |
|
379 | - unset( $request_params[ 'new_state_name' ] ); |
|
380 | - unset( $request_params[ 'new_state_abbrv' ] ); |
|
375 | + public static function unset_new_state_request_params($request_params) { |
|
376 | + unset($request_params['new_state_micro_form']); |
|
377 | + unset($request_params['add_new_state']); |
|
378 | + unset($request_params['new_state_country']); |
|
379 | + unset($request_params['new_state_name']); |
|
380 | + unset($request_params['new_state_abbrv']); |
|
381 | 381 | return $request_params; |
382 | 382 | } |
383 | 383 | |
@@ -390,25 +390,25 @@ discard block |
||
390 | 390 | * @param array $props_n_values |
391 | 391 | * @return boolean |
392 | 392 | */ |
393 | - public static function save_new_state_to_db ( $props_n_values = array() ) { |
|
393 | + public static function save_new_state_to_db($props_n_values = array()) { |
|
394 | 394 | // EEH_Debug_Tools::printr( $props_n_values, '$props_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
395 | - $existing_state = EEM_State::instance()->get_all( array( $props_n_values, 'limit' => 1 )); |
|
396 | - if ( ! empty( $existing_state )) { |
|
397 | - return array_pop( $existing_state ); |
|
395 | + $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1)); |
|
396 | + if ( ! empty($existing_state)) { |
|
397 | + return array_pop($existing_state); |
|
398 | 398 | } |
399 | - $new_state = EE_State::new_instance( $props_n_values ); |
|
400 | - if ( $new_state instanceof EE_State ) { |
|
399 | + $new_state = EE_State::new_instance($props_n_values); |
|
400 | + if ($new_state instanceof EE_State) { |
|
401 | 401 | // if not non-ajax admin |
402 | - $new_state_key = $new_state->country_iso() . '-' . $new_state->abbrev(); |
|
402 | + $new_state_key = $new_state->country_iso().'-'.$new_state->abbrev(); |
|
403 | 403 | $new_state_notice = sprintf( |
404 | - __( 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso' ), |
|
405 | - '<b>' . $new_state->name() . '</b>', |
|
406 | - '<b>' . $new_state->abbrev() . '</b>', |
|
407 | - '<b>' . $new_state->country()->name() . '</b>', |
|
408 | - '<a href="' . add_query_arg( array( 'page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso() ), admin_url( 'admin.php' )) . '">' . __( 'Event Espresso - General Settings > Countries Tab', 'event_espresso' ) . '</a>', |
|
404 | + __('A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso'), |
|
405 | + '<b>'.$new_state->name().'</b>', |
|
406 | + '<b>'.$new_state->abbrev().'</b>', |
|
407 | + '<b>'.$new_state->country()->name().'</b>', |
|
408 | + '<a href="'.add_query_arg(array('page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso()), admin_url('admin.php')).'">'.__('Event Espresso - General Settings > Countries Tab', 'event_espresso').'</a>', |
|
409 | 409 | '<br />' |
410 | 410 | ); |
411 | - EE_Error::add_persistent_admin_notice( $new_state_key, $new_state_notice ); |
|
411 | + EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice); |
|
412 | 412 | $new_state->save(); |
413 | 413 | EEM_State::instance()->reset_cached_states(); |
414 | 414 | return $new_state; |
@@ -427,22 +427,22 @@ discard block |
||
427 | 427 | * @param array $cols_n_values |
428 | 428 | * @return boolean |
429 | 429 | */ |
430 | - public static function update_country_settings( $CNT_ISO = '', $STA_ID = '', $cols_n_values = array() ) { |
|
431 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : FALSE; |
|
432 | - if ( ! $CNT_ISO ) { |
|
433 | - EE_Error::add_error( __( 'An invalid or missing Country ISO Code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
430 | + public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) { |
|
431 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : FALSE; |
|
432 | + if ( ! $CNT_ISO) { |
|
433 | + EE_Error::add_error(__('An invalid or missing Country ISO Code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
434 | 434 | } |
435 | - $STA_abbrev = is_array( $cols_n_values ) && isset( $cols_n_values['STA_abbrev'] ) ? $cols_n_values['STA_abbrev'] : FALSE; |
|
436 | - if ( ! $STA_abbrev && ! empty( $STA_ID )) { |
|
437 | - $state = EEM_State::instance()->get_one_by_ID( $STA_ID ); |
|
438 | - if ( $state instanceof EE_State ) { |
|
435 | + $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] : FALSE; |
|
436 | + if ( ! $STA_abbrev && ! empty($STA_ID)) { |
|
437 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
438 | + if ($state instanceof EE_State) { |
|
439 | 439 | $STA_abbrev = $state->abbrev(); |
440 | 440 | } |
441 | 441 | } |
442 | - if ( ! $STA_abbrev ) { |
|
443 | - EE_Error::add_error( __( 'An invalid or missing State Abbreviation was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
442 | + if ( ! $STA_abbrev) { |
|
443 | + EE_Error::add_error(__('An invalid or missing State Abbreviation was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
444 | 444 | } |
445 | - EE_Error::dismiss_persistent_admin_notice( $CNT_ISO . '-' . $STA_abbrev, TRUE, TRUE ); |
|
445 | + EE_Error::dismiss_persistent_admin_notice($CNT_ISO.'-'.$STA_abbrev, TRUE, TRUE); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | |
@@ -458,19 +458,19 @@ discard block |
||
458 | 458 | * @param $answer |
459 | 459 | * @return bool |
460 | 460 | */ |
461 | - public static function inject_new_reg_state_into_options( $state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) { |
|
462 | - if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state ) { |
|
461 | + public static function inject_new_reg_state_into_options($state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) { |
|
462 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state) { |
|
463 | 463 | $STA_ID = $answer->value(); |
464 | - if ( ! empty( $STA_ID ) ) { |
|
465 | - $state = EEM_State::instance()->get_one_by_ID( $STA_ID ); |
|
466 | - if ( $state instanceof EE_State ) { |
|
464 | + if ( ! empty($STA_ID)) { |
|
465 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
466 | + if ($state instanceof EE_State) { |
|
467 | 467 | $country = $state->country(); |
468 | - if ( $country instanceof EE_Country ) { |
|
469 | - if ( ! isset( $state_options[ $country->name() ] )) { |
|
470 | - $state_options[ $country->name() ] = array(); |
|
468 | + if ($country instanceof EE_Country) { |
|
469 | + if ( ! isset($state_options[$country->name()])) { |
|
470 | + $state_options[$country->name()] = array(); |
|
471 | 471 | } |
472 | - if ( ! isset( $state_options[ $country->name() ][ $STA_ID ] )) { |
|
473 | - $state_options[ $country->name() ][ $STA_ID ] = $state->name(); |
|
472 | + if ( ! isset($state_options[$country->name()][$STA_ID])) { |
|
473 | + $state_options[$country->name()][$STA_ID] = $state->name(); |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | } |
@@ -492,14 +492,14 @@ discard block |
||
492 | 492 | * @param $answer |
493 | 493 | * @return bool |
494 | 494 | */ |
495 | - public static function inject_new_reg_country_into_options( $country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) { |
|
496 | - if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country ) { |
|
495 | + public static function inject_new_reg_country_into_options($country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) { |
|
496 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country) { |
|
497 | 497 | $CNT_ISO = $answer->value(); |
498 | - if ( ! empty( $CNT_ISO ) ) { |
|
499 | - $country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO ); |
|
500 | - if ( $country instanceof EE_Country ) { |
|
501 | - if ( ! isset( $country_options[ $CNT_ISO ] ) ) { |
|
502 | - $country_options[ $CNT_ISO ] = $country->name(); |
|
498 | + if ( ! empty($CNT_ISO)) { |
|
499 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
500 | + if ($country instanceof EE_Country) { |
|
501 | + if ( ! isset($country_options[$CNT_ISO])) { |
|
502 | + $country_options[$CNT_ISO] = $country->name(); |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 | } |
@@ -516,17 +516,17 @@ discard block |
||
516 | 516 | * @param EE_State[] $state_options |
517 | 517 | * @return boolean |
518 | 518 | */ |
519 | - public static function state_options( $state_options = array() ) { |
|
519 | + public static function state_options($state_options = array()) { |
|
520 | 520 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
521 | 521 | 'new_states' |
522 | 522 | ); |
523 | - if ( is_array( $new_states ) && ! empty( $new_states )) { |
|
524 | - foreach ( $new_states as $new_state ) { |
|
523 | + if (is_array($new_states) && ! empty($new_states)) { |
|
524 | + foreach ($new_states as $new_state) { |
|
525 | 525 | if ( |
526 | 526 | $new_state instanceof EE_State |
527 | 527 | && $new_state->country() instanceof EE_Country |
528 | 528 | ) { |
529 | - $state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name(); |
|
529 | + $state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name(); |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | } |
@@ -542,17 +542,17 @@ discard block |
||
542 | 542 | * @param EE_Country[] $country_options |
543 | 543 | * @return boolean |
544 | 544 | */ |
545 | - public static function country_options( $country_options = array() ) { |
|
545 | + public static function country_options($country_options = array()) { |
|
546 | 546 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
547 | 547 | 'new_states' |
548 | 548 | ); |
549 | - if ( is_array( $new_states ) && ! empty( $new_states )) { |
|
550 | - foreach ( $new_states as $new_state ) { |
|
549 | + if (is_array($new_states) && ! empty($new_states)) { |
|
550 | + foreach ($new_states as $new_state) { |
|
551 | 551 | if ( |
552 | 552 | $new_state instanceof EE_State |
553 | 553 | && $new_state->country() instanceof EE_Country |
554 | 554 | ) { |
555 | - $country_options[ $new_state->country()->ID() ] = $new_state->country()->name(); |
|
555 | + $country_options[$new_state->country()->ID()] = $new_state->country()->name(); |
|
556 | 556 | } |
557 | 557 | } |
558 | 558 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param WP $WP |
20 | 20 | * @return void |
21 | 21 | */ |
22 | - public function run( WP $WP ) {} |
|
22 | + public function run(WP $WP) {} |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * @param array $attributes |
70 | 70 | * @return string |
71 | 71 | */ |
72 | - public function process_shortcode( $attributes = array() ) { |
|
72 | + public function process_shortcode($attributes = array()) { |
|
73 | 73 | |
74 | 74 | //load helpers |
75 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
76 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
75 | + EE_Registry::instance()->load_helper('Event_View'); |
|
76 | + EE_Registry::instance()->load_helper('Template'); |
|
77 | 77 | |
78 | 78 | // merge in any attributes passed via fallback shortcode processor |
79 | - $attributes = array_merge( (array) $attributes, (array) $this->_attributes ); |
|
79 | + $attributes = array_merge((array) $attributes, (array) $this->_attributes); |
|
80 | 80 | |
81 | 81 | //set default attributes |
82 | 82 | $default_shortcode_attributes = array( |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | ); |
89 | 89 | |
90 | 90 | // allow the defaults to be filtered |
91 | - $default_shortcode_attributes = apply_filters( 'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes ); |
|
91 | + $default_shortcode_attributes = apply_filters('EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes); |
|
92 | 92 | // grab attributes and merge with defaults, then extract |
93 | - $attributes = array_merge( $default_shortcode_attributes, $attributes ); |
|
93 | + $attributes = array_merge($default_shortcode_attributes, $attributes); |
|
94 | 94 | |
95 | 95 | $template_args = array( |
96 | 96 | 'contacts' => array(), |
@@ -106,31 +106,31 @@ discard block |
||
106 | 106 | $error = false; |
107 | 107 | |
108 | 108 | //what event? |
109 | - if ( empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) && empty( $attributes['ticket_id'] ) ) { |
|
109 | + if (empty($attributes['event_id']) && empty($attributes['datetime_id']) && empty($attributes['ticket_id'])) { |
|
110 | 110 | //seems like is_espresso_event_single() isn't working as expected. So using alternate method. |
111 | - if ( is_single() && is_espresso_event() ) { |
|
111 | + if (is_single() && is_espresso_event()) { |
|
112 | 112 | $event = EEH_Event_View::get_event(); |
113 | - if ( $event instanceof EE_Event ) { |
|
113 | + if ($event instanceof EE_Event) { |
|
114 | 114 | $template_args['event'] = $event; |
115 | 115 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
116 | 116 | } |
117 | 117 | } else { |
118 | 118 | //try getting the earliest active event if none then get the |
119 | - $events = EEM_Event::instance()->get_active_events( array( 'limit' => 1, |
|
120 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
121 | - ) ); |
|
122 | - $events = empty( $events ) ? EEM_Event::instance()->get_upcoming_events( array( 'limit' => 1, |
|
123 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
124 | - ) ) : $events; |
|
125 | - $event = reset( $events ); |
|
126 | - if ( $event instanceof EE_Event ) { |
|
119 | + $events = EEM_Event::instance()->get_active_events(array('limit' => 1, |
|
120 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
121 | + )); |
|
122 | + $events = empty($events) ? EEM_Event::instance()->get_upcoming_events(array('limit' => 1, |
|
123 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
124 | + )) : $events; |
|
125 | + $event = reset($events); |
|
126 | + if ($event instanceof EE_Event) { |
|
127 | 127 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
128 | 128 | $template_args['event'] = $event; |
129 | 129 | } |
130 | 130 | } |
131 | - } elseif ( ! empty( $attributes['event_id'] ) ) { |
|
132 | - $event = EEM_Event::instance()->get_one_by_ID( $attributes['event_id'] ); |
|
133 | - if ( $event instanceof EE_Event ) { |
|
131 | + } elseif ( ! empty($attributes['event_id'])) { |
|
132 | + $event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']); |
|
133 | + if ($event instanceof EE_Event) { |
|
134 | 134 | $query[0]['Registration.EVT_ID'] = $attributes['event_id']; |
135 | 135 | $template_args['event'] = $event; |
136 | 136 | } else { |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | //datetime? |
142 | - if ( ! empty( $attributes['datetime_id'] ) && empty( $attributes['event_id'] ) ) { |
|
143 | - $datetime = EEM_Datetime::instance()->get_one_by_ID( $attributes['datetime_id'] ); |
|
144 | - if ( $datetime instanceof EE_Datetime ) { |
|
142 | + if ( ! empty($attributes['datetime_id']) && empty($attributes['event_id'])) { |
|
143 | + $datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']); |
|
144 | + if ($datetime instanceof EE_Datetime) { |
|
145 | 145 | $query[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id']; |
146 | 146 | $query['default_where_conditions'] = 'this_model_only'; |
147 | 147 | $template_args['datetime'] = $datetime; |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | //ticket?just |
155 | - if ( ! empty( $attributes['ticket_id'] ) && empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) ) { |
|
156 | - $ticket = EEM_Ticket::instance()->get_one_by_ID( $attributes['ticket_id'] ); |
|
157 | - if ( $ticket instanceof EE_Ticket ) { |
|
155 | + if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) { |
|
156 | + $ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']); |
|
157 | + if ($ticket instanceof EE_Ticket) { |
|
158 | 158 | $query[0]['Registration.TKT_ID'] = $attributes['ticket_id']; |
159 | 159 | $template_args['ticket'] = $ticket; |
160 | 160 | $template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime ? $ticket->first_datetime()->event() : null; |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | |
166 | 166 | //status |
167 | 167 | $reg_status_array = EEM_Registration::reg_status_array(); |
168 | - if ( $attributes['status'] != 'all' && isset( $reg_status_array[$attributes['status']] ) ) { |
|
168 | + if ($attributes['status'] != 'all' && isset($reg_status_array[$attributes['status']])) { |
|
169 | 169 | $query[0]['Registration.STS_ID'] = $attributes['status']; |
170 | 170 | } |
171 | - $query['group_by'] = array( 'ATT_ID' ); |
|
172 | - $query['order_by'] = apply_filters( 'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array( 'ATT_lname' => 'ASC', 'ATT_fname' => 'ASC' ) ); |
|
171 | + $query['group_by'] = array('ATT_ID'); |
|
172 | + $query['order_by'] = apply_filters('FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')); |
|
173 | 173 | |
174 | 174 | //if we have NO query where conditions, then there was an invalid parameter or the shortcode was used incorrectly |
175 | 175 | //so when WP_DEBUG is set and true, we'll show a message, otherwise we'll just return an empty string. |
176 | - if ( ( ! isset( $query[0] ) || ! is_array( $query[0] ) ) || $error ) { |
|
177 | - if ( WP_DEBUG ) { |
|
178 | - return '<div class="important-notice ee-attention">' . __( 'The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso' ) . '</div>'; |
|
176 | + if (( ! isset($query[0]) || ! is_array($query[0])) || $error) { |
|
177 | + if (WP_DEBUG) { |
|
178 | + return '<div class="important-notice ee-attention">'.__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso').'</div>'; |
|
179 | 179 | } else { |
180 | 180 | return ''; |
181 | 181 | } |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | |
184 | 184 | |
185 | 185 | //get contacts! |
186 | - $template_args['contacts'] = EEM_Attendee::instance()->get_all( $query ); |
|
186 | + $template_args['contacts'] = EEM_Attendee::instance()->get_all($query); |
|
187 | 187 | |
188 | 188 | |
189 | 189 | //all set let's load up the template and return. |
190 | - return EEH_Template::locate_template( 'loop-espresso_event_attendees.php', $template_args, true, true ); |
|
190 | + return EEH_Template::locate_template('loop-espresso_event_attendees.php', $template_args, true, true); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.0 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EEH_Debug_Tools{ |
|
11 | +class EEH_Debug_Tools { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * instance of the EEH_Autoloader object |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public static function instance() { |
43 | 43 | // check if class object is instantiated, and instantiated properly |
44 | - if ( ! self::$_instance instanceof EEH_Debug_Tools ) { |
|
44 | + if ( ! self::$_instance instanceof EEH_Debug_Tools) { |
|
45 | 45 | self::$_instance = new self(); |
46 | 46 | } |
47 | 47 | return self::$_instance; |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | */ |
58 | 58 | private function __construct() { |
59 | 59 | // load Kint PHP debugging library |
60 | - if ( ! class_exists( 'Kint' ) && file_exists( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' )){ |
|
60 | + if ( ! class_exists('Kint') && file_exists(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php')) { |
|
61 | 61 | // despite EE4 having a check for an existing copy of the Kint debugging class, |
62 | 62 | // if another plugin was loaded AFTER EE4 and they did NOT perform a similar check, |
63 | 63 | // then hilarity would ensue as PHP throws a "Cannot redeclare class Kint" error |
64 | 64 | // so we've moved it to our test folder so that it is not included with production releases |
65 | 65 | // plz use https://wordpress.org/plugins/kint-debugger/ if testing production versions of EE |
66 | - require_once( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' ); |
|
66 | + require_once(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php'); |
|
67 | 67 | } |
68 | - if ( ! defined('DOING_AJAX') || ! isset( $_REQUEST['noheader'] ) || $_REQUEST['noheader'] != 'true' || ! isset( $_REQUEST['TB_iframe'] )) { |
|
68 | + if ( ! defined('DOING_AJAX') || ! isset($_REQUEST['noheader']) || $_REQUEST['noheader'] != 'true' || ! isset($_REQUEST['TB_iframe'])) { |
|
69 | 69 | //add_action( 'shutdown', array($this,'espresso_session_footer_dump') ); |
70 | 70 | } |
71 | - $plugin = basename( EE_PLUGIN_DIR_PATH ); |
|
72 | - add_action( "activate_{$plugin}", array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' )); |
|
73 | - add_action( 'activated_plugin', array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' )); |
|
74 | - add_action( 'shutdown', array( 'EEH_Debug_Tools', 'show_db_name' )); |
|
71 | + $plugin = basename(EE_PLUGIN_DIR_PATH); |
|
72 | + add_action("activate_{$plugin}", array('EEH_Debug_Tools', 'ee_plugin_activation_errors')); |
|
73 | + add_action('activated_plugin', array('EEH_Debug_Tools', 'ee_plugin_activation_errors')); |
|
74 | + add_action('shutdown', array('EEH_Debug_Tools', 'show_db_name')); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | public static function show_db_name() { |
85 | - if ( ! defined( 'DOING_AJAX' ) && ( defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS )) { |
|
86 | - echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '. DB_NAME .'</p>'; |
|
85 | + if ( ! defined('DOING_AJAX') && (defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS)) { |
|
86 | + echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '.DB_NAME.'</p>'; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | public function espresso_session_footer_dump() { |
98 | - if ( class_exists('Kint') && function_exists( 'wp_get_current_user' ) && current_user_can('update_core') && ( defined('WP_DEBUG') && WP_DEBUG ) && ! defined('DOING_AJAX') && class_exists( 'EE_Registry' )) { |
|
99 | - Kint::dump( EE_Registry::instance()->SSN->id() ); |
|
100 | - Kint::dump( EE_Registry::instance()->SSN ); |
|
98 | + if (class_exists('Kint') && function_exists('wp_get_current_user') && current_user_can('update_core') && (defined('WP_DEBUG') && WP_DEBUG) && ! defined('DOING_AJAX') && class_exists('EE_Registry')) { |
|
99 | + Kint::dump(EE_Registry::instance()->SSN->id()); |
|
100 | + Kint::dump(EE_Registry::instance()->SSN); |
|
101 | 101 | // Kint::dump( EE_Registry::instance()->SSN->get_session_data('cart')->get_tickets() ); |
102 | 102 | $this->espresso_list_hooked_functions(); |
103 | 103 | $this->show_times(); |
@@ -114,27 +114,27 @@ discard block |
||
114 | 114 | * @param bool $tag |
115 | 115 | * @return void |
116 | 116 | */ |
117 | - public function espresso_list_hooked_functions( $tag=FALSE ){ |
|
117 | + public function espresso_list_hooked_functions($tag = FALSE) { |
|
118 | 118 | global $wp_filter; |
119 | 119 | echo '<br/><br/><br/><h3>Hooked Functions</h3>'; |
120 | - if ( $tag ) { |
|
121 | - $hook[$tag]=$wp_filter[$tag]; |
|
122 | - if ( ! is_array( $hook[$tag] )) { |
|
123 | - trigger_error( "Nothing found for '$tag' hook", E_USER_WARNING ); |
|
120 | + if ($tag) { |
|
121 | + $hook[$tag] = $wp_filter[$tag]; |
|
122 | + if ( ! is_array($hook[$tag])) { |
|
123 | + trigger_error("Nothing found for '$tag' hook", E_USER_WARNING); |
|
124 | 124 | return; |
125 | 125 | } |
126 | - echo '<h5>For Tag: '. $tag .'</h5>'; |
|
126 | + echo '<h5>For Tag: '.$tag.'</h5>'; |
|
127 | 127 | } |
128 | 128 | else { |
129 | - $hook=$wp_filter; |
|
130 | - ksort( $hook ); |
|
129 | + $hook = $wp_filter; |
|
130 | + ksort($hook); |
|
131 | 131 | } |
132 | - foreach( $hook as $tag => $priorities ) { |
|
132 | + foreach ($hook as $tag => $priorities) { |
|
133 | 133 | echo "<br />>>>>>\t<strong>$tag</strong><br />"; |
134 | - ksort( $priorities ); |
|
135 | - foreach( $priorities as $priority => $function ){ |
|
134 | + ksort($priorities); |
|
135 | + foreach ($priorities as $priority => $function) { |
|
136 | 136 | echo $priority; |
137 | - foreach( $function as $name => $properties ) { |
|
137 | + foreach ($function as $name => $properties) { |
|
138 | 138 | echo "\t$name<br />"; |
139 | 139 | } |
140 | 140 | } |
@@ -150,15 +150,15 @@ discard block |
||
150 | 150 | * @param string $hook_name |
151 | 151 | * @return array |
152 | 152 | */ |
153 | - public static function registered_filter_callbacks( $hook_name = '' ) { |
|
153 | + public static function registered_filter_callbacks($hook_name = '') { |
|
154 | 154 | $filters = array(); |
155 | 155 | global $wp_filter; |
156 | - if ( isset( $wp_filter[ $hook_name ] ) ) { |
|
157 | - $filters[ $hook_name ] = array(); |
|
158 | - foreach ( $wp_filter[ $hook_name ] as $priority => $callbacks ) { |
|
159 | - $filters[ $hook_name ][ $priority ] = array(); |
|
160 | - foreach ( $callbacks as $callback ) { |
|
161 | - $filters[ $hook_name ][ $priority ][] = $callback['function']; |
|
156 | + if (isset($wp_filter[$hook_name])) { |
|
157 | + $filters[$hook_name] = array(); |
|
158 | + foreach ($wp_filter[$hook_name] as $priority => $callbacks) { |
|
159 | + $filters[$hook_name][$priority] = array(); |
|
160 | + foreach ($callbacks as $callback) { |
|
161 | + $filters[$hook_name][$priority][] = $callback['function']; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | * start_timer |
172 | 172 | * @param null $timer_name |
173 | 173 | */ |
174 | - public function start_timer( $timer_name = NULL ){ |
|
175 | - $this->_start_times[$timer_name] = microtime( TRUE ); |
|
174 | + public function start_timer($timer_name = NULL) { |
|
175 | + $this->_start_times[$timer_name] = microtime(TRUE); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -181,15 +181,15 @@ discard block |
||
181 | 181 | * stop_timer |
182 | 182 | * @param string $timer_name |
183 | 183 | */ |
184 | - public function stop_timer($timer_name = 'default'){ |
|
185 | - if( isset( $this->_start_times[ $timer_name ] ) ){ |
|
186 | - $start_time = $this->_start_times[ $timer_name ]; |
|
187 | - unset( $this->_start_times[ $timer_name ] ); |
|
188 | - }else{ |
|
189 | - $start_time = array_pop( $this->_start_times ); |
|
184 | + public function stop_timer($timer_name = 'default') { |
|
185 | + if (isset($this->_start_times[$timer_name])) { |
|
186 | + $start_time = $this->_start_times[$timer_name]; |
|
187 | + unset($this->_start_times[$timer_name]); |
|
188 | + } else { |
|
189 | + $start_time = array_pop($this->_start_times); |
|
190 | 190 | } |
191 | - $total_time = microtime( TRUE ) - $start_time; |
|
192 | - switch ( $total_time ) { |
|
191 | + $total_time = microtime(TRUE) - $start_time; |
|
192 | + switch ($total_time) { |
|
193 | 193 | case $total_time < 0.00001 : |
194 | 194 | $color = '#8A549A'; |
195 | 195 | $bold = 'normal'; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $bold = 'bold'; |
216 | 216 | break; |
217 | 217 | } |
218 | - $this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">' . number_format( $total_time, 8 ) . '</div> ' . $timer_name; |
|
218 | + $this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">'.number_format($total_time, 8).'</div> '.$timer_name; |
|
219 | 219 | } |
220 | 220 | /** |
221 | 221 | * Measure the memory usage by PHP so far. |
@@ -223,10 +223,10 @@ discard block |
||
223 | 223 | * @param boolean $output_now whether to echo now, or wait until EEH_Debug_Tools::show_times() is called |
224 | 224 | * @return void |
225 | 225 | */ |
226 | - public function measure_memory( $label, $output_now = false ) { |
|
227 | - $memory_used = $this->convert( memory_get_peak_usage( true ) ); |
|
228 | - $this->_memory_usage_points[ $label ] = $memory_used; |
|
229 | - if( $output_now ) { |
|
226 | + public function measure_memory($label, $output_now = false) { |
|
227 | + $memory_used = $this->convert(memory_get_peak_usage(true)); |
|
228 | + $this->_memory_usage_points[$label] = $memory_used; |
|
229 | + if ($output_now) { |
|
230 | 230 | echo "\r\n<br>$label : $memory_used"; |
231 | 231 | } |
232 | 232 | } |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | * @param int $size |
237 | 237 | * @return string |
238 | 238 | */ |
239 | - public function convert( $size ) { |
|
240 | - $unit=array('b','kb','mb','gb','tb','pb'); |
|
241 | - return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[ absint( $i ) ]; |
|
239 | + public function convert($size) { |
|
240 | + $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb'); |
|
241 | + return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$unit[absint($i)]; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | * @param bool $output_now |
249 | 249 | * @return string |
250 | 250 | */ |
251 | - public function show_times($output_now=true){ |
|
252 | - $output = '<h2>Times:</h2>' . implode("<br>",$this->_times) . '<h2>Memory</h2>' . implode('<br>', $this->_memory_usage_points ); |
|
253 | - if($output_now){ |
|
251 | + public function show_times($output_now = true) { |
|
252 | + $output = '<h2>Times:</h2>'.implode("<br>", $this->_times).'<h2>Memory</h2>'.implode('<br>', $this->_memory_usage_points); |
|
253 | + if ($output_now) { |
|
254 | 254 | echo $output; |
255 | 255 | return ''; |
256 | 256 | } |
@@ -265,25 +265,25 @@ discard block |
||
265 | 265 | * @return void |
266 | 266 | */ |
267 | 267 | public static function ee_plugin_activation_errors() { |
268 | - if ( WP_DEBUG ) { |
|
268 | + if (WP_DEBUG) { |
|
269 | 269 | $activation_errors = ob_get_contents(); |
270 | - if ( ! empty( $activation_errors ) ) { |
|
271 | - $activation_errors = date( 'Y-m-d H:i:s' ) . "\n" . $activation_errors; |
|
270 | + if ( ! empty($activation_errors)) { |
|
271 | + $activation_errors = date('Y-m-d H:i:s')."\n".$activation_errors; |
|
272 | 272 | } |
273 | - espresso_load_required( 'EEH_File', EE_HELPERS . 'EEH_File.helper.php' ); |
|
274 | - if ( class_exists( 'EEH_File' )) { |
|
273 | + espresso_load_required('EEH_File', EE_HELPERS.'EEH_File.helper.php'); |
|
274 | + if (class_exists('EEH_File')) { |
|
275 | 275 | try { |
276 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html' ); |
|
277 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors ); |
|
278 | - } catch( EE_Error $e ){ |
|
279 | - EE_Error::add_error( sprintf( __( 'The Event Espresso activation errors file could not be setup because: %s', 'event_espresso' ), $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
276 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html'); |
|
277 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors); |
|
278 | + } catch (EE_Error $e) { |
|
279 | + EE_Error::add_error(sprintf(__('The Event Espresso activation errors file could not be setup because: %s', 'event_espresso'), $e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
280 | 280 | } |
281 | 281 | } else { |
282 | 282 | // old school attempt |
283 | - file_put_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors ); |
|
283 | + file_put_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors); |
|
284 | 284 | } |
285 | - $activation_errors = get_option( 'ee_plugin_activation_errors', '' ) . $activation_errors; |
|
286 | - update_option( 'ee_plugin_activation_errors', $activation_errors ); |
|
285 | + $activation_errors = get_option('ee_plugin_activation_errors', '').$activation_errors; |
|
286 | + update_option('ee_plugin_activation_errors', $activation_errors); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | * @param int $error_type |
300 | 300 | * @uses trigger_error() |
301 | 301 | */ |
302 | - public function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) { |
|
303 | - do_action( 'AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version); |
|
304 | - $version = is_null( $version ) ? '' : sprintf( __('(This message was added in version %s of Event Espresso.', 'event_espresso' ), $version ); |
|
305 | - trigger_error( sprintf( __('%1$s was called <strong>incorrectly</strong>. %2$s %3$s','event_espresso' ), $function, $message, $version ), $error_type ); |
|
302 | + public function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) { |
|
303 | + do_action('AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version); |
|
304 | + $version = is_null($version) ? '' : sprintf(__('(This message was added in version %s of Event Espresso.', 'event_espresso'), $version); |
|
305 | + trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', 'event_espresso'), $function, $message, $version), $error_type); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
@@ -323,22 +323,22 @@ discard block |
||
323 | 323 | * @param string $debug_index |
324 | 324 | * @param string $debug_key |
325 | 325 | */ |
326 | - public static function log( $class='', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO' ) { |
|
327 | - if ( WP_DEBUG /*&& false*/ ) { |
|
328 | - $debug_key = $debug_key . '_' . EE_Session::instance()->id(); |
|
329 | - $debug_data = get_option( $debug_key, array() ); |
|
326 | + public static function log($class = '', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO') { |
|
327 | + if (WP_DEBUG /*&& false*/) { |
|
328 | + $debug_key = $debug_key.'_'.EE_Session::instance()->id(); |
|
329 | + $debug_data = get_option($debug_key, array()); |
|
330 | 330 | $default_data = array( |
331 | - $class => $func . '() : ' . $line, |
|
331 | + $class => $func.'() : '.$line, |
|
332 | 332 | 'REQ' => $display_request ? $_REQUEST : '', |
333 | 333 | ); |
334 | 334 | // don't serialize objects |
335 | - $info = self::strip_objects( $info ); |
|
336 | - $index = ! empty( $debug_index ) ? $debug_index : 0; |
|
337 | - if ( ! isset( $debug_data[$index] ) ) { |
|
335 | + $info = self::strip_objects($info); |
|
336 | + $index = ! empty($debug_index) ? $debug_index : 0; |
|
337 | + if ( ! isset($debug_data[$index])) { |
|
338 | 338 | $debug_data[$index] = array(); |
339 | 339 | } |
340 | - $debug_data[$index][microtime()] = array_merge( $default_data, $info ); |
|
341 | - update_option( $debug_key, $debug_data ); |
|
340 | + $debug_data[$index][microtime()] = array_merge($default_data, $info); |
|
341 | + update_option($debug_key, $debug_data); |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
@@ -350,26 +350,26 @@ discard block |
||
350 | 350 | * @param array $info |
351 | 351 | * @return array |
352 | 352 | */ |
353 | - public static function strip_objects( $info = array() ) { |
|
354 | - foreach ( $info as $key => $value ) { |
|
355 | - if ( is_array( $value ) ) { |
|
356 | - $info[ $key ] = self::strip_objects( $value ); |
|
357 | - } else if ( is_object( $value ) ) { |
|
358 | - $object_class = get_class( $value ); |
|
359 | - $info[ $object_class ] = array(); |
|
360 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : spl_object_hash( $value ); |
|
361 | - if ( method_exists( $value, 'ID' ) ) { |
|
362 | - $info[ $object_class ][ 'ID' ] = $value->ID(); |
|
353 | + public static function strip_objects($info = array()) { |
|
354 | + foreach ($info as $key => $value) { |
|
355 | + if (is_array($value)) { |
|
356 | + $info[$key] = self::strip_objects($value); |
|
357 | + } else if (is_object($value)) { |
|
358 | + $object_class = get_class($value); |
|
359 | + $info[$object_class] = array(); |
|
360 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : spl_object_hash($value); |
|
361 | + if (method_exists($value, 'ID')) { |
|
362 | + $info[$object_class]['ID'] = $value->ID(); |
|
363 | 363 | } |
364 | - if ( method_exists( $value, 'status' ) ) { |
|
365 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
366 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
367 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
364 | + if (method_exists($value, 'status')) { |
|
365 | + $info[$object_class]['status'] = $value->status(); |
|
366 | + } else if (method_exists($value, 'status_ID')) { |
|
367 | + $info[$object_class]['status'] = $value->status_ID(); |
|
368 | 368 | } |
369 | - unset( $info[ $key ] ); |
|
369 | + unset($info[$key]); |
|
370 | 370 | } |
371 | 371 | } |
372 | - return (array)$info; |
|
372 | + return (array) $info; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | |
@@ -386,31 +386,31 @@ discard block |
||
386 | 386 | * @param string $height |
387 | 387 | * @param bool $die |
388 | 388 | */ |
389 | - public static function printr( $var, $var_name = false, $file = __FILE__, $line = __LINE__, $height = 'auto', $die = false ) { |
|
389 | + public static function printr($var, $var_name = false, $file = __FILE__, $line = __LINE__, $height = 'auto', $die = false) { |
|
390 | 390 | //$print_r = false; |
391 | - if ( is_object( $var ) ) { |
|
391 | + if (is_object($var)) { |
|
392 | 392 | $var_name = ! $var_name ? 'object' : $var_name; |
393 | 393 | //$print_r = true; |
394 | - } else if ( is_array( $var ) ) { |
|
394 | + } else if (is_array($var)) { |
|
395 | 395 | $var_name = ! $var_name ? 'array' : $var_name; |
396 | 396 | //$print_r = true; |
397 | - } else if ( is_numeric( $var ) ) { |
|
397 | + } else if (is_numeric($var)) { |
|
398 | 398 | $var_name = ! $var_name ? 'numeric' : $var_name; |
399 | - } else if ( is_string( $var ) ) { |
|
399 | + } else if (is_string($var)) { |
|
400 | 400 | $var_name = ! $var_name ? 'string' : $var_name; |
401 | - } else if ( is_null( $var ) ) { |
|
401 | + } else if (is_null($var)) { |
|
402 | 402 | $var_name = ! $var_name ? 'null' : $var_name; |
403 | 403 | } |
404 | - $var_name = ucwords( str_replace( array( '$', '_' ), array( '', ' ' ), $var_name ) ); |
|
404 | + $var_name = ucwords(str_replace(array('$', '_'), array('', ' '), $var_name)); |
|
405 | 405 | ob_start(); |
406 | - echo '<pre style="display:block; width:100%; height:' . $height . '; border:2px solid light-blue;">'; |
|
407 | - echo '<h5 style="color:#2EA2CC;"><b>' . $var_name . '</b></h5><span style="color:#E76700">'; |
|
406 | + echo '<pre style="display:block; width:100%; height:'.$height.'; border:2px solid light-blue;">'; |
|
407 | + echo '<h5 style="color:#2EA2CC;"><b>'.$var_name.'</b></h5><span style="color:#E76700">'; |
|
408 | 408 | //$print_r ? print_r( $var ) : var_dump( $var ); |
409 | - var_dump( $var ); |
|
410 | - echo '</span><br /><span style="font-size:10px;font-weight:normal;">' . $file . '<br />line no: ' . $line . '</span></pre>'; |
|
409 | + var_dump($var); |
|
410 | + echo '</span><br /><span style="font-size:10px;font-weight:normal;">'.$file.'<br />line no: '.$line.'</span></pre>'; |
|
411 | 411 | $result = ob_get_clean(); |
412 | - if ( $die ) { |
|
413 | - die( $result ); |
|
412 | + if ($die) { |
|
413 | + die($result); |
|
414 | 414 | } else { |
415 | 415 | echo $result; |
416 | 416 | } |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | * borrowed from Kint Debugger |
428 | 428 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
429 | 429 | */ |
430 | -if ( class_exists('Kint') && ! function_exists( 'dump_wp_query' ) ) { |
|
431 | - function dump_wp_query(){ |
|
430 | +if (class_exists('Kint') && ! function_exists('dump_wp_query')) { |
|
431 | + function dump_wp_query() { |
|
432 | 432 | global $wp_query; |
433 | 433 | d($wp_query); |
434 | 434 | } |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | * borrowed from Kint Debugger |
439 | 439 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
440 | 440 | */ |
441 | -if ( class_exists('Kint') && ! function_exists( 'dump_wp' ) ) { |
|
442 | - function dump_wp(){ |
|
441 | +if (class_exists('Kint') && ! function_exists('dump_wp')) { |
|
442 | + function dump_wp() { |
|
443 | 443 | global $wp; |
444 | 444 | d($wp); |
445 | 445 | } |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | * borrowed from Kint Debugger |
450 | 450 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
451 | 451 | */ |
452 | -if ( class_exists('Kint') && ! function_exists( 'dump_post' ) ) { |
|
453 | - function dump_post(){ |
|
452 | +if (class_exists('Kint') && ! function_exists('dump_post')) { |
|
453 | + function dump_post() { |
|
454 | 454 | global $post; |
455 | 455 | d($post); |
456 | 456 | } |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
42 | - return parent::get_instance( __CLASS__ ); |
|
41 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
42 | + return parent::get_instance(__CLASS__); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks_admin() { |
86 | 86 | EED_Single_Page_Checkout::set_definitions(); |
87 | - if ( defined( 'DOING_AJAX' )) { |
|
87 | + if (defined('DOING_AJAX')) { |
|
88 | 88 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
89 | 89 | ob_start(); |
90 | 90 | EED_Single_Page_Checkout::load_request_handler(); |
91 | 91 | EED_Single_Page_Checkout::load_reg_steps(); |
92 | 92 | } else { |
93 | 93 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
94 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
94 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
95 | 95 | } |
96 | 96 | // set ajax hooks |
97 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
98 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
99 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
100 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
101 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
102 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
97 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
98 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
99 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
100 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
101 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
102 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * process ajax request |
109 | 109 | * @param string $ajax_action |
110 | 110 | */ |
111 | - public static function process_ajax_request( $ajax_action ) { |
|
112 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
111 | + public static function process_ajax_request($ajax_action) { |
|
112 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
113 | 113 | EED_Single_Page_Checkout::instance()->_initialize(); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * ajax display registration step |
120 | 120 | */ |
121 | 121 | public static function display_reg_step() { |
122 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
122 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * ajax process registration step |
129 | 129 | */ |
130 | 130 | public static function process_reg_step() { |
131 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
131 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * ajax process registration step |
138 | 138 | */ |
139 | 139 | public static function update_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public static function update_checkout() { |
152 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
152 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public static function load_request_handler() { |
164 | 164 | // load core Request_Handler class |
165 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
166 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
165 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
166 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -176,21 +176,21 @@ discard block |
||
176 | 176 | * @return void |
177 | 177 | */ |
178 | 178 | public static function set_definitions() { |
179 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
180 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
181 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
182 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
183 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
184 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
185 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
187 | - EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ] = sprintf( |
|
188 | - __( '%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' ), |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | + EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
|
188 | + __('%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'), |
|
189 | 189 | '<h4 class="important-notice">', |
190 | 190 | '</h4>', |
191 | 191 | '<br />', |
192 | 192 | '<p>', |
193 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
193 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
194 | 194 | '">', |
195 | 195 | '</a>', |
196 | 196 | '</p>' |
@@ -209,31 +209,31 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public static function load_reg_steps() { |
211 | 211 | static $reg_steps_loaded = FALSE; |
212 | - if ( $reg_steps_loaded ) { |
|
212 | + if ($reg_steps_loaded) { |
|
213 | 213 | return; |
214 | 214 | } |
215 | 215 | // load EE_SPCO_Reg_Step base class |
216 | 216 | // EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class' ); |
217 | 217 | // filter list of reg_steps |
218 | - $reg_steps_to_load = apply_filters( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps() ); |
|
218 | + $reg_steps_to_load = apply_filters('AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps()); |
|
219 | 219 | // sort by key (order) |
220 | - ksort( $reg_steps_to_load ); |
|
220 | + ksort($reg_steps_to_load); |
|
221 | 221 | // loop through folders |
222 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
222 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
223 | 223 | // we need a |
224 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
224 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
225 | 225 | // copy over to the reg_steps_array |
226 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
226 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
227 | 227 | // register custom key route for each reg step ( ie: step=>"slug" - this is the entire reason we load the reg steps array now ) |
228 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
228 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
229 | 229 | // add AJAX or other hooks |
230 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
230 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
231 | 231 | // setup autoloaders if necessary |
232 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
233 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
232 | + if ( ! class_exists($reg_step['class_name'])) { |
|
233 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
234 | 234 | } |
235 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
236 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
235 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
236 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | } |
@@ -252,28 +252,28 @@ discard block |
||
252 | 252 | */ |
253 | 253 | public static function get_reg_steps() { |
254 | 254 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
255 | - if ( empty( $reg_steps )) { |
|
255 | + if (empty($reg_steps)) { |
|
256 | 256 | $reg_steps = array( |
257 | 257 | 10 => array( |
258 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
258 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
259 | 259 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
260 | 260 | 'slug' => 'attendee_information', |
261 | 261 | 'has_hooks' => FALSE |
262 | 262 | ), |
263 | 263 | 20 => array( |
264 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
264 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
265 | 265 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
266 | 266 | 'slug' => 'registration_confirmation', |
267 | 267 | 'has_hooks' => FALSE |
268 | 268 | ), |
269 | 269 | 30 => array( |
270 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
270 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
271 | 271 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
272 | 272 | 'slug' => 'payment_options', |
273 | 273 | 'has_hooks' => TRUE |
274 | 274 | ), |
275 | 275 | 999 => array( |
276 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
276 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
277 | 277 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
278 | 278 | 'slug' => 'finalize_registration', |
279 | 279 | 'has_hooks' => FALSE |
@@ -293,9 +293,9 @@ discard block |
||
293 | 293 | */ |
294 | 294 | public static function registration_checkout_for_admin() { |
295 | 295 | EED_Single_Page_Checkout::load_reg_steps(); |
296 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
297 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
298 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
296 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
297 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
298 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
299 | 299 | EED_Single_Page_Checkout::instance()->_initialize(); |
300 | 300 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
301 | 301 | return EE_Registry::instance()->REQ->get_output(); |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public static function process_registration_from_admin() { |
313 | 313 | EED_Single_Page_Checkout::load_reg_steps(); |
314 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
315 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
316 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
314 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
315 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
316 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
317 | 317 | EED_Single_Page_Checkout::instance()->_initialize(); |
318 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
319 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
320 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
321 | - if ( $final_reg_step->process_reg_step() ) { |
|
318 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
319 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
320 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
321 | + if ($final_reg_step->process_reg_step()) { |
|
322 | 322 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
323 | 323 | } |
324 | 324 | } |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | * @param WP_Query $WP_Query |
336 | 336 | * @return void |
337 | 337 | */ |
338 | - public function run( $WP_Query ) { |
|
339 | - if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )) { |
|
338 | + public function run($WP_Query) { |
|
339 | + if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)) { |
|
340 | 340 | $this->_initialize(); |
341 | 341 | } |
342 | 342 | } |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | * @param WP_Query $WP_Query |
352 | 352 | * @return void |
353 | 353 | */ |
354 | - public static function init( $WP_Query ) { |
|
355 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
354 | + public static function init($WP_Query) { |
|
355 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | |
@@ -366,29 +366,29 @@ discard block |
||
366 | 366 | */ |
367 | 367 | private function _initialize() { |
368 | 368 | // ensure SPCO doesn't run twice |
369 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
369 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
370 | 370 | return; |
371 | 371 | } |
372 | 372 | $this->_verify_session(); |
373 | 373 | // setup the EE_Checkout object |
374 | 374 | $this->checkout = $this->_initialize_checkout(); |
375 | 375 | // filter checkout |
376 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
376 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
377 | 377 | // get the $_GET |
378 | 378 | $this->_get_request_vars(); |
379 | 379 | // filter continue_reg |
380 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
380 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
381 | 381 | // load the reg steps array |
382 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
382 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
383 | 383 | EED_Single_Page_Checkout::$_initialized = true; |
384 | 384 | return; |
385 | 385 | } |
386 | 386 | // set the current step |
387 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
387 | + $this->checkout->set_current_step($this->checkout->step); |
|
388 | 388 | // and the next step |
389 | 389 | $this->checkout->set_next_step(); |
390 | 390 | // verify that everything has been setup correctly |
391 | - if ( ! ( $this->_verify_transaction_and_get_registrations() && $this->_final_verifications() ) ) { |
|
391 | + if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) { |
|
392 | 392 | EED_Single_Page_Checkout::$_initialized = true; |
393 | 393 | return; |
394 | 394 | } |
@@ -413,9 +413,9 @@ discard block |
||
413 | 413 | // set no cache headers and constants |
414 | 414 | EE_System::do_not_cache(); |
415 | 415 | // add anchor |
416 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
416 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
417 | 417 | // remove transaction lock |
418 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
418 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | |
@@ -428,16 +428,16 @@ discard block |
||
428 | 428 | * @throws EE_Error |
429 | 429 | */ |
430 | 430 | private function _verify_session() { |
431 | - if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
432 | - throw new EE_Error( __( 'The EE_Session class could not be loaded.', 'event_espresso' ) ); |
|
431 | + if ( ! EE_Registry::instance()->SSN instanceof EE_Session) { |
|
432 | + throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso')); |
|
433 | 433 | } |
434 | 434 | // is session still valid ? |
435 | - if ( EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) === '' ) { |
|
435 | + if (EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '') { |
|
436 | 436 | $this->checkout = new EE_Checkout(); |
437 | 437 | EE_Registry::instance()->SSN->reset_cart(); |
438 | 438 | EE_Registry::instance()->SSN->reset_checkout(); |
439 | 439 | EE_Registry::instance()->SSN->reset_transaction(); |
440 | - EE_Error::add_attention( EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ], __FILE__, __FUNCTION__, __LINE__ ); |
|
440 | + EE_Error::add_attention(EE_Registry::$i18n_js_strings['registration_expiration_notice'], __FILE__, __FUNCTION__, __LINE__); |
|
441 | 441 | EE_Registry::instance()->SSN->reset_expired(); |
442 | 442 | } |
443 | 443 | } |
@@ -457,20 +457,20 @@ discard block |
||
457 | 457 | /** @type EE_Checkout $checkout */ |
458 | 458 | $checkout = EE_Registry::instance()->SSN->checkout(); |
459 | 459 | // verify |
460 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
460 | + if ( ! $checkout instanceof EE_Checkout) { |
|
461 | 461 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
462 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
462 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
463 | 463 | // verify again |
464 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
465 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
464 | + if ( ! $checkout instanceof EE_Checkout) { |
|
465 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
466 | 466 | } |
467 | 467 | } else { |
468 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
469 | - wp_safe_redirect( $checkout->redirect_url ); |
|
468 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
469 | + wp_safe_redirect($checkout->redirect_url); |
|
470 | 470 | exit(); |
471 | 471 | } |
472 | 472 | } |
473 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
473 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
474 | 474 | // reset anything that needs a clean slate for each request |
475 | 475 | $checkout->reset_for_current_request(); |
476 | 476 | return $checkout; |
@@ -488,22 +488,22 @@ discard block |
||
488 | 488 | // load classes |
489 | 489 | EED_Single_Page_Checkout::load_request_handler(); |
490 | 490 | //make sure this request is marked as belonging to EE |
491 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
491 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
492 | 492 | // which step is being requested ? |
493 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
493 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
494 | 494 | // which step is being edited ? |
495 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
495 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
496 | 496 | // and what we're doing on the current step |
497 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
497 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
498 | 498 | // returning to edit ? |
499 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
499 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
500 | 500 | // or some other kind of revisit ? |
501 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
501 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
502 | 502 | // and whether or not to generate a reg form for this request |
503 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
503 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
504 | 504 | // and whether or not to process a reg form submission for this request |
505 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
506 | - $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
505 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
506 | + $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
507 | 507 | //$this->_display_request_vars(); |
508 | 508 | } |
509 | 509 | |
@@ -516,17 +516,17 @@ discard block |
||
516 | 516 | * @return void |
517 | 517 | */ |
518 | 518 | protected function _display_request_vars() { |
519 | - if ( ! WP_DEBUG ) { |
|
519 | + if ( ! WP_DEBUG) { |
|
520 | 520 | return; |
521 | 521 | } |
522 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
523 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
524 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
525 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
526 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
527 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
528 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
529 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
522 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
523 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
524 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
525 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
526 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
527 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
528 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
529 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | * @return array |
541 | 541 | */ |
542 | 542 | private function _get_first_step() { |
543 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
544 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
543 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
544 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | |
@@ -557,37 +557,37 @@ discard block |
||
557 | 557 | private function _load_and_instantiate_reg_steps() { |
558 | 558 | // have reg_steps already been instantiated ? |
559 | 559 | if ( |
560 | - empty( $this->checkout->reg_steps ) || |
|
561 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
560 | + empty($this->checkout->reg_steps) || |
|
561 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
562 | 562 | ) { |
563 | 563 | // if not, then loop through raw reg steps array |
564 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
565 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
564 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
565 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
566 | 566 | return false; |
567 | 567 | } |
568 | 568 | } |
569 | 569 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
570 | 570 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
571 | 571 | // skip the registration_confirmation page ? |
572 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
572 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
573 | 573 | // just remove it from the reg steps array |
574 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
575 | - } else if ( EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset( $this->checkout->reg_steps['registration_confirmation'] )) { |
|
574 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
575 | + } else if (EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset($this->checkout->reg_steps['registration_confirmation'])) { |
|
576 | 576 | // set the order to something big like 100 |
577 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
577 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
578 | 578 | } |
579 | 579 | // filter the array for good luck |
580 | - $this->checkout->reg_steps = apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps ); |
|
580 | + $this->checkout->reg_steps = apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps); |
|
581 | 581 | // finally re-sort based on the reg step class order properties |
582 | 582 | $this->checkout->sort_reg_steps(); |
583 | 583 | } else { |
584 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
584 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
585 | 585 | // set all current step stati to FALSE |
586 | - $reg_step->set_is_current_step( FALSE ); |
|
586 | + $reg_step->set_is_current_step(FALSE); |
|
587 | 587 | } |
588 | 588 | } |
589 | - if ( empty( $this->checkout->reg_steps )) { |
|
590 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
589 | + if (empty($this->checkout->reg_steps)) { |
|
590 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
591 | 591 | return false; |
592 | 592 | } |
593 | 593 | // make reg step details available to JS |
@@ -605,34 +605,34 @@ discard block |
||
605 | 605 | * @param int $order |
606 | 606 | * @return bool |
607 | 607 | */ |
608 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
608 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
609 | 609 | |
610 | 610 | // we need a file_path, class_name, and slug to add a reg step |
611 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
611 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
612 | 612 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
613 | - if ( $this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration' ) { |
|
613 | + if ($this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration') { |
|
614 | 614 | return true; |
615 | 615 | } |
616 | 616 | // instantiate step class using file path and class name |
617 | - $reg_step_obj = EE_Registry::instance()->load_file( $reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE ); |
|
617 | + $reg_step_obj = EE_Registry::instance()->load_file($reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE); |
|
618 | 618 | // did we gets the goods ? |
619 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
619 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
620 | 620 | // set reg step order based on config |
621 | - $reg_step_obj->set_order( $order ); |
|
621 | + $reg_step_obj->set_order($order); |
|
622 | 622 | // add instantiated reg step object to the master reg steps array |
623 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
623 | + $this->checkout->add_reg_step($reg_step_obj); |
|
624 | 624 | } else { |
625 | - EE_Error::add_error( __( 'The current step could not be set.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
625 | + EE_Error::add_error(__('The current step could not be set.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
626 | 626 | return false; |
627 | 627 | } |
628 | 628 | } else { |
629 | - if ( WP_DEBUG ) { |
|
629 | + if (WP_DEBUG) { |
|
630 | 630 | EE_Error::add_error( |
631 | 631 | sprintf( |
632 | - __( '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' ), |
|
633 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
634 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
635 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
632 | + __('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'), |
|
633 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
634 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
635 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
636 | 636 | '<ul>', |
637 | 637 | '<li>', |
638 | 638 | '</li>', |
@@ -656,18 +656,18 @@ discard block |
||
656 | 656 | */ |
657 | 657 | private function _verify_transaction_and_get_registrations() { |
658 | 658 | // was there already a valid transaction in the checkout from the session ? |
659 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
659 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
660 | 660 | // get transaction from db or session |
661 | 661 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() ? $this->_get_transaction_and_cart_for_previous_visit() : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
662 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
663 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
662 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
663 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
664 | 664 | // add some style and make it dance |
665 | 665 | $this->checkout->transaction = EE_Transaction::new_instance(); |
666 | 666 | $this->add_styles_and_scripts(); |
667 | 667 | return false; |
668 | 668 | } |
669 | 669 | // and the registrations for the transaction |
670 | - $this->_get_registrations( $this->checkout->transaction ); |
|
670 | + $this->_get_registrations($this->checkout->transaction); |
|
671 | 671 | } |
672 | 672 | return true; |
673 | 673 | } |
@@ -682,16 +682,16 @@ discard block |
||
682 | 682 | */ |
683 | 683 | private function _get_transaction_and_cart_for_previous_visit() { |
684 | 684 | /** @var $TXN_model EEM_Transaction */ |
685 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
685 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
686 | 686 | // 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 |
687 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
687 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
688 | 688 | // verify transaction |
689 | - if ( $transaction instanceof EE_Transaction ) { |
|
689 | + if ($transaction instanceof EE_Transaction) { |
|
690 | 690 | // and get the cart that was used for that transaction |
691 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
691 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
692 | 692 | return $transaction; |
693 | 693 | } else { |
694 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
694 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
695 | 695 | return NULL; |
696 | 696 | } |
697 | 697 | } |
@@ -705,11 +705,11 @@ discard block |
||
705 | 705 | * @param EE_Transaction $transaction |
706 | 706 | * @return EE_Cart |
707 | 707 | */ |
708 | - private function _get_cart_for_transaction( $transaction ) { |
|
709 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
708 | + private function _get_cart_for_transaction($transaction) { |
|
709 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
710 | 710 | // verify cart |
711 | - if ( ! $cart instanceof EE_Cart ) { |
|
712 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
711 | + if ( ! $cart instanceof EE_Cart) { |
|
712 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
713 | 713 | } |
714 | 714 | return $cart; |
715 | 715 | } |
@@ -724,8 +724,8 @@ discard block |
||
724 | 724 | * @param EE_Transaction $transaction |
725 | 725 | * @return EE_Cart |
726 | 726 | */ |
727 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
728 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
727 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
728 | + return EE_Cart::get_cart_from_txn($transaction); |
|
729 | 729 | } |
730 | 730 | |
731 | 731 | |
@@ -740,15 +740,15 @@ discard block |
||
740 | 740 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
741 | 741 | // if there's no transaction, then this is the FIRST visit to SPCO |
742 | 742 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
743 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
743 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
744 | 744 | // and then create a new transaction |
745 | 745 | $transaction = $this->_initialize_transaction(); |
746 | 746 | // verify transaction |
747 | - if ( $transaction instanceof EE_Transaction ) { |
|
747 | + if ($transaction instanceof EE_Transaction) { |
|
748 | 748 | // and save TXN data to the cart |
749 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
749 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
750 | 750 | } else { |
751 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
751 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
752 | 752 | } |
753 | 753 | return $transaction; |
754 | 754 | } |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | // grab the cart grand total |
769 | 769 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
770 | 770 | // create new TXN |
771 | - $transaction = EE_Transaction::new_instance( array( |
|
771 | + $transaction = EE_Transaction::new_instance(array( |
|
772 | 772 | 'TXN_timestamp' => time(), |
773 | 773 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
774 | 774 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
@@ -783,8 +783,8 @@ discard block |
||
783 | 783 | $transaction->ID() |
784 | 784 | ); |
785 | 785 | return $transaction; |
786 | - } catch( Exception $e ) { |
|
787 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
786 | + } catch (Exception $e) { |
|
787 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
788 | 788 | } |
789 | 789 | return NULL; |
790 | 790 | } |
@@ -798,34 +798,34 @@ discard block |
||
798 | 798 | * @param EE_Transaction $transaction |
799 | 799 | * @return EE_Cart |
800 | 800 | */ |
801 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
801 | + private function _get_registrations(EE_Transaction $transaction) { |
|
802 | 802 | // first step: grab the registrants { : o |
803 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
803 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
804 | 804 | // verify registrations have been set |
805 | - if ( empty( $registrations )) { |
|
805 | + if (empty($registrations)) { |
|
806 | 806 | // if no cached registrations, then check the db |
807 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
807 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
808 | 808 | // still nothing ? well as long as this isn't a revisit |
809 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
809 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
810 | 810 | // generate new registrations from scratch |
811 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
811 | + $registrations = $this->_initialize_registrations($transaction); |
|
812 | 812 | } |
813 | 813 | } |
814 | 814 | // sort by their original registration order |
815 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
815 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
816 | 816 | // then loop thru the array |
817 | - foreach ( $registrations as $registration ) { |
|
817 | + foreach ($registrations as $registration) { |
|
818 | 818 | // verify each registration |
819 | - if ( $registration instanceof EE_Registration ) { |
|
819 | + if ($registration instanceof EE_Registration) { |
|
820 | 820 | // we display all attendee info for the primary registrant |
821 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
821 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
822 | 822 | $this->checkout->primary_revisit = TRUE; |
823 | 823 | break; |
824 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
824 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
825 | 825 | // but hide info if it doesn't belong to you |
826 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
826 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
827 | 827 | } |
828 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
828 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
829 | 829 | } |
830 | 830 | } |
831 | 831 | } |
@@ -839,17 +839,17 @@ discard block |
||
839 | 839 | * @param EE_Transaction $transaction |
840 | 840 | * @return array |
841 | 841 | */ |
842 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
842 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
843 | 843 | $att_nmbr = 0; |
844 | 844 | $registrations = array(); |
845 | - if ( $transaction instanceof EE_Transaction ) { |
|
845 | + if ($transaction instanceof EE_Transaction) { |
|
846 | 846 | /** @type EE_Registration_Processor $registration_processor */ |
847 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
847 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
848 | 848 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
849 | 849 | // now let's add the cart items to the $transaction |
850 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
850 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
851 | 851 | //do the following for each ticket of this type they selected |
852 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
852 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
853 | 853 | $att_nmbr++; |
854 | 854 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
855 | 855 | $line_item, |
@@ -857,12 +857,12 @@ discard block |
||
857 | 857 | $att_nmbr, |
858 | 858 | $this->checkout->total_ticket_count |
859 | 859 | ); |
860 | - if ( $registration instanceof EE_Registration ) { |
|
861 | - $registrations[ $registration->ID() ] = $registration; |
|
860 | + if ($registration instanceof EE_Registration) { |
|
861 | + $registrations[$registration->ID()] = $registration; |
|
862 | 862 | } |
863 | 863 | } |
864 | 864 | } |
865 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
865 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
866 | 866 | } |
867 | 867 | return $registrations; |
868 | 868 | } |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | * @param EE_Registration $reg_B |
878 | 878 | * @return array() |
879 | 879 | */ |
880 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
880 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
881 | 881 | // this shouldn't ever happen within the same TXN, but oh well |
882 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
882 | + if ($reg_A->count() == $reg_B->count()) { |
|
883 | 883 | return 0; |
884 | 884 | } |
885 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
885 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
886 | 886 | } |
887 | 887 | |
888 | 888 | |
@@ -897,35 +897,35 @@ discard block |
||
897 | 897 | */ |
898 | 898 | private function _final_verifications() { |
899 | 899 | // filter checkout |
900 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
900 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
901 | 901 | //verify that current step is still set correctly |
902 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
903 | - 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__ ); |
|
902 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
903 | + 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__); |
|
904 | 904 | return false; |
905 | 905 | } |
906 | 906 | // if returning to SPCO, then verify that primary registrant is set |
907 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
907 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
908 | 908 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
909 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
910 | - 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__ ); |
|
909 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
910 | + 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__); |
|
911 | 911 | return false; |
912 | 912 | } |
913 | 913 | $valid_registrant = null; |
914 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
915 | - if ( $registration instanceof EE_Registration ) { |
|
916 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
914 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
915 | + if ($registration instanceof EE_Registration) { |
|
916 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
917 | 917 | $valid_registrant = $registration; |
918 | 918 | } |
919 | 919 | } |
920 | 920 | } |
921 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
922 | - 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__ ); |
|
921 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
922 | + 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__); |
|
923 | 923 | return false; |
924 | 924 | } |
925 | 925 | } |
926 | 926 | // now that things have been kinda sufficiently verified, |
927 | 927 | // let's add the checkout to the session so that's available other systems |
928 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
928 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
929 | 929 | return true; |
930 | 930 | } |
931 | 931 | |
@@ -941,28 +941,28 @@ discard block |
||
941 | 941 | * @access private |
942 | 942 | * @param bool $reinitializing |
943 | 943 | */ |
944 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
945 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
944 | + private function _initialize_reg_steps($reinitializing = false) { |
|
945 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
946 | 946 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
947 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
948 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
947 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
948 | + if ( ! $reg_step->initialize_reg_step()) { |
|
949 | 949 | // if not initialized then maybe this step is being removed... |
950 | - if ( $reg_step->is_current_step() && ! $reinitializing ) { |
|
950 | + if ($reg_step->is_current_step() && ! $reinitializing) { |
|
951 | 951 | // if it was the current step, then we need to start over here |
952 | - $this->_initialize_reg_steps( true ); |
|
952 | + $this->_initialize_reg_steps(true); |
|
953 | 953 | return; |
954 | 954 | } |
955 | 955 | continue; |
956 | 956 | } |
957 | 957 | // i18n |
958 | 958 | $reg_step->translate_js_strings(); |
959 | - if ( $reg_step->is_current_step() ) { |
|
959 | + if ($reg_step->is_current_step()) { |
|
960 | 960 | // the text that appears on the reg step form submit button |
961 | 961 | $reg_step->set_submit_button_text(); |
962 | 962 | } |
963 | 963 | } |
964 | 964 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
965 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
965 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | |
@@ -975,39 +975,39 @@ discard block |
||
975 | 975 | */ |
976 | 976 | private function _check_form_submission() { |
977 | 977 | //does this request require the reg form to be generated ? |
978 | - if ( $this->checkout->generate_reg_form ) { |
|
978 | + if ($this->checkout->generate_reg_form) { |
|
979 | 979 | // ever heard that song by Blue Rodeo ? |
980 | 980 | try { |
981 | 981 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
982 | 982 | // if not displaying a form, then check for form submission |
983 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
983 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
984 | 984 | // clear out any old data in case this step is being run again |
985 | - $this->checkout->current_step->set_valid_data( array() ); |
|
985 | + $this->checkout->current_step->set_valid_data(array()); |
|
986 | 986 | // capture submitted form data |
987 | 987 | $this->checkout->current_step->reg_form->receive_form_submission( |
988 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
988 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
989 | 989 | ); |
990 | 990 | // validate submitted form data |
991 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
991 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
992 | 992 | // thou shall not pass !!! |
993 | 993 | $this->checkout->continue_reg = FALSE; |
994 | 994 | // any form validation errors? |
995 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
995 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
996 | 996 | $submission_error_messages = array(); |
997 | 997 | // bad, bad, bad registrant |
998 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
999 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1000 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
998 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
999 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1000 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
1001 | 1001 | } |
1002 | 1002 | } |
1003 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1003 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1004 | 1004 | } |
1005 | 1005 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1006 | 1006 | $this->go_to_next_step(); |
1007 | 1007 | return; |
1008 | 1008 | } |
1009 | 1009 | } |
1010 | - } catch( EE_Error $e ) { |
|
1010 | + } catch (EE_Error $e) { |
|
1011 | 1011 | $e->get_error(); |
1012 | 1012 | } |
1013 | 1013 | } |
@@ -1023,38 +1023,38 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | private function _process_form_action() { |
1025 | 1025 | // what cha wanna do? |
1026 | - switch( $this->checkout->action ) { |
|
1026 | + switch ($this->checkout->action) { |
|
1027 | 1027 | // AJAX next step reg form |
1028 | 1028 | case 'display_spco_reg_step' : |
1029 | 1029 | $this->checkout->redirect = FALSE; |
1030 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1031 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1030 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1031 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1032 | 1032 | } |
1033 | 1033 | break; |
1034 | 1034 | |
1035 | 1035 | default : |
1036 | 1036 | // meh... do one of those other steps first |
1037 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1037 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1038 | 1038 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1039 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1039 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1040 | 1040 | // call action on current step |
1041 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1041 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1042 | 1042 | // good registrant, you get to proceed |
1043 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
1044 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
1045 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
1043 | + if ($this->checkout->current_step->success_message() != '') { |
|
1044 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
1045 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
1046 | 1046 | } |
1047 | 1047 | } |
1048 | 1048 | // pack it up, pack it in... |
1049 | 1049 | $this->_setup_redirect(); |
1050 | 1050 | } |
1051 | 1051 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1052 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1052 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1053 | 1053 | |
1054 | 1054 | } else { |
1055 | 1055 | EE_Error::add_error( |
1056 | 1056 | sprintf( |
1057 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1057 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1058 | 1058 | $this->checkout->action, |
1059 | 1059 | $this->checkout->current_step->name() |
1060 | 1060 | ), |
@@ -1080,10 +1080,10 @@ discard block |
||
1080 | 1080 | public function add_styles_and_scripts() { |
1081 | 1081 | // i18n |
1082 | 1082 | $this->translate_js_strings(); |
1083 | - if ( $this->checkout->admin_request ) { |
|
1084 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1083 | + if ($this->checkout->admin_request) { |
|
1084 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1085 | 1085 | } else { |
1086 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1086 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1087 | 1087 | } |
1088 | 1088 | } |
1089 | 1089 | |
@@ -1099,50 +1099,50 @@ discard block |
||
1099 | 1099 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1100 | 1100 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1101 | 1101 | 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'); |
1102 | - 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' ); |
|
1103 | - 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' ); |
|
1104 | - 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' ); |
|
1102 | + 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'); |
|
1103 | + 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'); |
|
1104 | + 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'); |
|
1105 | 1105 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1106 | 1106 | 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'); |
1107 | 1107 | EE_Registry::$i18n_js_strings['process_registration'] = sprintf( |
1108 | - __( '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' ), |
|
1108 | + __('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'), |
|
1109 | 1109 | '<br/>' |
1110 | 1110 | ); |
1111 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1111 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1112 | 1112 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1113 | 1113 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1114 | 1114 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1115 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1116 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1117 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1118 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1119 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1120 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1121 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1122 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1123 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1124 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1125 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1126 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1127 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1128 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1115 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1116 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1117 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1118 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1119 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1120 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1121 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1122 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1123 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1124 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1125 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1126 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1127 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1128 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1129 | 1129 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1130 | - __( '%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' ), |
|
1130 | + __('%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'), |
|
1131 | 1131 | '<h4 class="important-notice">', |
1132 | 1132 | '</h4>', |
1133 | 1133 | '<br />', |
1134 | 1134 | '<p>', |
1135 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1135 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1136 | 1136 | '">', |
1137 | 1137 | '</a>', |
1138 | 1138 | '</p>' |
1139 | 1139 | ); |
1140 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1141 | - EE_Registry::$i18n_js_strings[ 'session_extension' ] = absint( |
|
1142 | - apply_filters( 'FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS ) |
|
1140 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1141 | + EE_Registry::$i18n_js_strings['session_extension'] = absint( |
|
1142 | + apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS) |
|
1143 | 1143 | ); |
1144 | - EE_Registry::$i18n_js_strings[ 'session_expiration' ] = gmdate( |
|
1145 | - 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) |
|
1144 | + EE_Registry::$i18n_js_strings['session_expiration'] = gmdate( |
|
1145 | + 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS) |
|
1146 | 1146 | ); |
1147 | 1147 | |
1148 | 1148 | |
@@ -1158,31 +1158,31 @@ discard block |
||
1158 | 1158 | */ |
1159 | 1159 | public function enqueue_styles_and_scripts() { |
1160 | 1160 | // load css |
1161 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1162 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1161 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1162 | + wp_enqueue_style('single_page_checkout'); |
|
1163 | 1163 | // load JS |
1164 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1165 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1164 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1165 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1166 | 1166 | wp_register_script( |
1167 | 1167 | 'single_page_checkout', |
1168 | - SPCO_JS_URL . 'single_page_checkout.js', |
|
1169 | - array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), |
|
1168 | + SPCO_JS_URL.'single_page_checkout.js', |
|
1169 | + array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), |
|
1170 | 1170 | EVENT_ESPRESSO_VERSION, |
1171 | 1171 | TRUE |
1172 | 1172 | ); |
1173 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1173 | + wp_enqueue_script('single_page_checkout'); |
|
1174 | 1174 | |
1175 | 1175 | /** |
1176 | 1176 | * global action hook for enqueueing styles and scripts with |
1177 | 1177 | * spco calls. |
1178 | 1178 | */ |
1179 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1179 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1180 | 1180 | |
1181 | 1181 | /** |
1182 | 1182 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1183 | 1183 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1184 | 1184 | */ |
1185 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1185 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1186 | 1186 | |
1187 | 1187 | // add css and JS for current step |
1188 | 1188 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1198,21 +1198,21 @@ discard block |
||
1198 | 1198 | */ |
1199 | 1199 | private function _display_spco_reg_form() { |
1200 | 1200 | // if registering via the admin, just display the reg form for the current step |
1201 | - if ( $this->checkout->admin_request ) { |
|
1202 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1201 | + if ($this->checkout->admin_request) { |
|
1202 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1203 | 1203 | } else { |
1204 | 1204 | // add powered by EE msg |
1205 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1205 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1206 | 1206 | |
1207 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1208 | - EE_Registry::$i18n_js_strings[ 'empty_cart' ] = $empty_cart; |
|
1207 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1208 | + EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart; |
|
1209 | 1209 | $cookies_not_set_msg = ''; |
1210 | - if ( $empty_cart ) { |
|
1211 | - if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1210 | + if ($empty_cart) { |
|
1211 | + if ( ! isset($_COOKIE['ee_cookie_test'])) { |
|
1212 | 1212 | $cookies_not_set_msg = apply_filters( |
1213 | 1213 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1214 | 1214 | sprintf( |
1215 | - __( '%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' ), |
|
1215 | + __('%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'), |
|
1216 | 1216 | '<div class="ee-attention">', |
1217 | 1217 | '</div>', |
1218 | 1218 | '<h6 class="important-notice">', |
@@ -1233,7 +1233,7 @@ discard block |
||
1233 | 1233 | 'layout_strategy' => |
1234 | 1234 | new EE_Template_Layout( |
1235 | 1235 | array( |
1236 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1236 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1237 | 1237 | 'template_args' => array( |
1238 | 1238 | 'empty_cart' => $empty_cart, |
1239 | 1239 | 'revisit' => $this->checkout->revisit, |
@@ -1242,8 +1242,8 @@ discard block |
||
1242 | 1242 | 'empty_msg' => apply_filters( |
1243 | 1243 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1244 | 1244 | sprintf( |
1245 | - __( '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' ), |
|
1246 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1245 | + __('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'), |
|
1246 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1247 | 1247 | '">', |
1248 | 1248 | '</a>' |
1249 | 1249 | ) |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | ) |
1262 | 1262 | ); |
1263 | 1263 | // load template and add to output sent that gets filtered into the_content() |
1264 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1264 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1265 | 1265 | } |
1266 | 1266 | } |
1267 | 1267 | |
@@ -1275,8 +1275,8 @@ discard block |
||
1275 | 1275 | * @internal param string $label |
1276 | 1276 | * @return string |
1277 | 1277 | */ |
1278 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1279 | - if ( $next_step == 'finalize_registration' ) { |
|
1278 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1279 | + if ($next_step == 'finalize_registration') { |
|
1280 | 1280 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1281 | 1281 | } |
1282 | 1282 | } |
@@ -1290,18 +1290,18 @@ discard block |
||
1290 | 1290 | * @return string |
1291 | 1291 | */ |
1292 | 1292 | public static function display_registration_footer() { |
1293 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1294 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1295 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'http://eventespresso.com/' ); |
|
1296 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1293 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1294 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1295 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'http://eventespresso.com/'); |
|
1296 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1297 | 1297 | echo apply_filters( |
1298 | 1298 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1299 | 1299 | sprintf( |
1300 | - __( '%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' ), |
|
1301 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1300 | + __('%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'), |
|
1301 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1302 | 1302 | '" target="_blank">', |
1303 | 1303 | '</a>', |
1304 | - '<a href="' . $url . '" title="', |
|
1304 | + '<a href="'.$url.'" title="', |
|
1305 | 1305 | '" target="_blank">', |
1306 | 1306 | '</a></div>' |
1307 | 1307 | ) |
@@ -1332,12 +1332,12 @@ discard block |
||
1332 | 1332 | * @return array |
1333 | 1333 | */ |
1334 | 1334 | private function _setup_redirect() { |
1335 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1335 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1336 | 1336 | $this->checkout->redirect = TRUE; |
1337 | - if ( empty( $this->checkout->redirect_url )) { |
|
1337 | + if (empty($this->checkout->redirect_url)) { |
|
1338 | 1338 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1339 | 1339 | } |
1340 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1340 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1341 | 1341 | } |
1342 | 1342 | } |
1343 | 1343 | |
@@ -1350,12 +1350,12 @@ discard block |
||
1350 | 1350 | * @return void |
1351 | 1351 | */ |
1352 | 1352 | public function go_to_next_step() { |
1353 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1353 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1354 | 1354 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1355 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1355 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1356 | 1356 | } |
1357 | 1357 | // just return for these conditions |
1358 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1358 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1359 | 1359 | return; |
1360 | 1360 | } |
1361 | 1361 | // AJAX response |
@@ -1376,7 +1376,7 @@ discard block |
||
1376 | 1376 | */ |
1377 | 1377 | protected function _handle_json_response() { |
1378 | 1378 | // if this is an ajax request |
1379 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1379 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1380 | 1380 | // DEBUG LOG |
1381 | 1381 | //$this->checkout->log( |
1382 | 1382 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1386,10 +1386,10 @@ discard block |
||
1386 | 1386 | // 'continue_reg' => $this->checkout->continue_reg, |
1387 | 1387 | // ) |
1388 | 1388 | //); |
1389 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1390 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1389 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1390 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1391 | 1391 | // just send the ajax ( |
1392 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1392 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1393 | 1393 | $this->unlock_transaction(); |
1394 | 1394 | echo $json_response; |
1395 | 1395 | exit(); |
@@ -1406,9 +1406,9 @@ discard block |
||
1406 | 1406 | */ |
1407 | 1407 | protected function _handle_html_redirects() { |
1408 | 1408 | // going somewhere ? |
1409 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1409 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1410 | 1410 | // store notices in a transient |
1411 | - EE_Error::get_notices( false, true, true ); |
|
1411 | + EE_Error::get_notices(false, true, true); |
|
1412 | 1412 | $this->unlock_transaction(); |
1413 | 1413 | // DEBUG LOG |
1414 | 1414 | //$this->checkout->log( |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | // 'headers_list' => headers_list(), |
1420 | 1420 | // ) |
1421 | 1421 | //); |
1422 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1422 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1423 | 1423 | exit(); |
1424 | 1424 | } |
1425 | 1425 | } |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @return void |
29 | 29 | */ |
30 | 30 | public static function set_hooks() { |
31 | - add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) ); |
|
32 | - add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
33 | - add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
34 | - add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
35 | - add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
36 | - add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) ); |
|
37 | - add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
31 | + add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')); |
|
32 | + add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
33 | + add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
34 | + add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
35 | + add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
36 | + add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')); |
|
37 | + add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
38 | 38 | ); |
39 | - add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 ); |
|
39 | + add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * ajax switch_spco_billing_form |
46 | 46 | */ |
47 | 47 | public static function switch_spco_billing_form() { |
48 | - EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' ); |
|
48 | + EED_Single_Page_Checkout::process_ajax_request('switch_payment_method'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * ajax save_payer_details |
55 | 55 | */ |
56 | 56 | public static function save_payer_details() { |
57 | - EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' ); |
|
57 | + EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * ajax get_transaction_details |
64 | 64 | */ |
65 | 65 | public static function get_transaction_details() { |
66 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
66 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | * @param EE_Checkout $checkout |
92 | 92 | * @return \EE_SPCO_Reg_Step_Payment_Options |
93 | 93 | */ |
94 | - public function __construct( EE_Checkout $checkout ) { |
|
94 | + public function __construct(EE_Checkout $checkout) { |
|
95 | 95 | $this->_slug = 'payment_options'; |
96 | 96 | $this->_name = __('Payment Options', 'event_espresso'); |
97 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php'; |
|
97 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php'; |
|
98 | 98 | $this->checkout = $checkout; |
99 | 99 | $this->_reset_success_message(); |
100 | - $this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
100 | + $this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @param null $line_item_display |
116 | 116 | */ |
117 | - public function set_line_item_display( $line_item_display ) { |
|
117 | + public function set_line_item_display($line_item_display) { |
|
118 | 118 | $this->line_item_display = $line_item_display; |
119 | 119 | } |
120 | 120 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @return void |
126 | 126 | */ |
127 | 127 | public function translate_js_strings() { |
128 | - EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' ); |
|
129 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' ); |
|
130 | - EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' ); |
|
128 | + EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso'); |
|
129 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso'); |
|
130 | + EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -156,20 +156,20 @@ discard block |
||
156 | 156 | // $ 0.00 transactions (no payment required) |
157 | 157 | ! $this->checkout->payment_required() |
158 | 158 | // but do NOT remove if current action being called belongs to this reg step |
159 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
159 | + && ! is_callable(array($this, $this->checkout->action)) |
|
160 | 160 | && ! $this->completed() |
161 | 161 | ) { |
162 | 162 | // and if so, then we no longer need the Payment Options step |
163 | - if ( $this->is_current_step() ) { |
|
163 | + if ($this->is_current_step()) { |
|
164 | 164 | $this->checkout->generate_reg_form = false; |
165 | 165 | } |
166 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
166 | + $this->checkout->remove_reg_step($this->_slug); |
|
167 | 167 | // DEBUG LOG |
168 | 168 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
169 | 169 | return false; |
170 | 170 | } |
171 | 171 | // load EEM_Payment_Method |
172 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
172 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
173 | 173 | // get all active payment methods |
174 | 174 | $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
175 | 175 | $this->checkout->transaction, EEM_Payment_Method::scope_cart |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return bool |
184 | 184 | */ |
185 | 185 | public function generate_reg_form() { |
186 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
186 | + EE_Registry::instance()->load_helper('HTML'); |
|
187 | 187 | // reset in case someone changes their mind |
188 | 188 | $this->_reset_selected_method_of_payment(); |
189 | 189 | // set some defaults |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | $reg_count = 0; |
196 | 196 | $no_payment_required = true; |
197 | 197 | // loop thru registrations to gather info |
198 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
199 | - foreach ( $registrations as $registration ) { |
|
198 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
199 | + foreach ($registrations as $registration) { |
|
200 | 200 | /** @var $registration EE_Registration */ |
201 | 201 | $reg_count++; |
202 | 202 | // registrant is NOT Approved |
203 | - if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) { |
|
203 | + if ($registration->status_ID() === EEM_Registration::status_id_not_approved) { |
|
204 | 204 | // add event to list of events with pre-approval reg status |
205 | - $registrations_requiring_pre_approval[ $registration->ID() ] = $registration; |
|
205 | + $registrations_requiring_pre_approval[$registration->ID()] = $registration; |
|
206 | 206 | do_action( |
207 | 207 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
208 | 208 | $registration->event(), |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | && $registration->event()->is_sold_out() |
220 | 220 | ) { |
221 | 221 | // add event to list of events that are sold out |
222 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
222 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
223 | 223 | do_action( |
224 | 224 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
225 | 225 | $registration->event(), |
@@ -228,29 +228,29 @@ discard block |
||
228 | 228 | continue; |
229 | 229 | } |
230 | 230 | // are they allowed to pay now and is there monies owing? |
231 | - if ( $registration->owes_monies_and_can_pay() ) { |
|
232 | - $registrations_requiring_payment[ $registration->ID() ] = $registration; |
|
231 | + if ($registration->owes_monies_and_can_pay()) { |
|
232 | + $registrations_requiring_payment[$registration->ID()] = $registration; |
|
233 | 233 | do_action( |
234 | 234 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
235 | 235 | $registration->event(), |
236 | 236 | $this |
237 | 237 | ); |
238 | - } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free() ) { |
|
239 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
238 | + } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) { |
|
239 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | $subsections = array(); |
243 | 243 | // now decide which template to load |
244 | - if ( ! empty( $sold_out_events )) { |
|
245 | - $subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events ); |
|
244 | + if ( ! empty($sold_out_events)) { |
|
245 | + $subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events); |
|
246 | 246 | } |
247 | - if ( ! empty( $registrations_requiring_pre_approval )) { |
|
248 | - $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval ); |
|
247 | + if ( ! empty($registrations_requiring_pre_approval)) { |
|
248 | + $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval); |
|
249 | 249 | } |
250 | - if ( ! empty( $registrations_for_free_events ) ) { |
|
251 | - $subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events ); |
|
250 | + if ( ! empty($registrations_for_free_events)) { |
|
251 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
252 | 252 | } |
253 | - if ( ! empty( $registrations_requiring_payment ) ) { |
|
253 | + if ( ! empty($registrations_requiring_payment)) { |
|
254 | 254 | //EEH_Debug_Tools::printr( $registrations_requiring_payment, '$registrations_requiring_payment', __FILE__, __LINE__ ); |
255 | 255 | // autoload Line_Item_Display classes |
256 | 256 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -264,11 +264,11 @@ discard block |
||
264 | 264 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
265 | 265 | $this->checkout->amount_owing = $filtered_line_item_tree->total(); |
266 | 266 | |
267 | - if ( $this->checkout->amount_owing > 0 ) { |
|
267 | + if ($this->checkout->amount_owing > 0) { |
|
268 | 268 | EEH_Autoloader::register_line_item_display_autoloaders(); |
269 | - $this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) ); |
|
270 | - $subsections[ 'payment_options' ] = $this->_display_payment_options( |
|
271 | - $this->line_item_display->display_line_item( $filtered_line_item_tree ) |
|
269 | + $this->set_line_item_display(new EE_Line_Item_Display('spco')); |
|
270 | + $subsections['payment_options'] = $this->_display_payment_options( |
|
271 | + $this->line_item_display->display_line_item($filtered_line_item_tree) |
|
272 | 272 | ); |
273 | 273 | $this->_apply_transaction_payments_to_amount_owing(); |
274 | 274 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $this->_save_selected_method_of_payment(); |
280 | 280 | |
281 | 281 | $subsections['default_hidden_inputs'] = $this->reg_step_hidden_inputs(); |
282 | - $subsections['extra_hidden_inputs' ] = $this->_extra_hidden_inputs( $no_payment_required ); |
|
282 | + $subsections['extra_hidden_inputs'] = $this->_extra_hidden_inputs($no_payment_required); |
|
283 | 283 | |
284 | 284 | return new EE_Form_Section_Proper( |
285 | 285 | array( |
@@ -307,21 +307,21 @@ discard block |
||
307 | 307 | * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection |
308 | 308 | * @return \EE_Line_Item_Filter_Collection |
309 | 309 | */ |
310 | - public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) { |
|
311 | - if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
310 | + public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) { |
|
311 | + if ( ! EE_Registry::instance()->SSN instanceof EE_Session) { |
|
312 | 312 | return $line_item_filter_collection; |
313 | 313 | } |
314 | - if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout ) { |
|
314 | + if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout) { |
|
315 | 315 | return $line_item_filter_collection; |
316 | 316 | } |
317 | - if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction ) { |
|
317 | + if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction) { |
|
318 | 318 | return $line_item_filter_collection; |
319 | 319 | } |
320 | 320 | $registrations = EE_Registry::instance()->SSN->checkout()->transaction->registrations( |
321 | 321 | EE_Registry::instance()->SSN->checkout()->reg_cache_where_params |
322 | 322 | ); |
323 | - $line_item_filter_collection->add( new EE_Billable_Line_Item_Filter( $registrations ) ); |
|
324 | - $line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
323 | + $line_item_filter_collection->add(new EE_Billable_Line_Item_Filter($registrations)); |
|
324 | + $line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter()); |
|
325 | 325 | return $line_item_filter_collection; |
326 | 326 | } |
327 | 327 | |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | * @return void |
336 | 336 | */ |
337 | 337 | protected function _hide_reg_step_submit_button_if_revisit() { |
338 | - if ( $this->checkout->revisit ) { |
|
339 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' ); |
|
338 | + if ($this->checkout->revisit) { |
|
339 | + add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string'); |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
@@ -347,25 +347,25 @@ discard block |
||
347 | 347 | * @param \EE_Event[] $sold_out_events_array |
348 | 348 | * @return \EE_Form_Section_Proper |
349 | 349 | */ |
350 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
350 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
351 | 351 | // set some defaults |
352 | 352 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
353 | 353 | $sold_out_events = ''; |
354 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
355 | - $sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )); |
|
354 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
355 | + $sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')); |
|
356 | 356 | } |
357 | 357 | return new EE_Form_Section_Proper( |
358 | 358 | array( |
359 | 359 | 'layout_strategy' => new EE_Template_Layout( |
360 | 360 | array( |
361 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template |
|
361 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template |
|
362 | 362 | 'template_args' => apply_filters( |
363 | 363 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
364 | 364 | array( |
365 | 365 | 'sold_out_events' => $sold_out_events, |
366 | 366 | 'sold_out_events_msg' => apply_filters( |
367 | 367 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg', |
368 | - __( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' ) |
|
368 | + __('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso') |
|
369 | 369 | ) |
370 | 370 | ) |
371 | 371 | ) |
@@ -382,14 +382,14 @@ discard block |
||
382 | 382 | * @param array $registrations_requiring_pre_approval |
383 | 383 | * @return \EE_Form_Section_Proper |
384 | 384 | */ |
385 | - private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) { |
|
385 | + private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) { |
|
386 | 386 | $events_requiring_pre_approval = ''; |
387 | - foreach ( $registrations_requiring_pre_approval as $registration ) { |
|
388 | - if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) { |
|
389 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li( |
|
390 | - EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
387 | + foreach ($registrations_requiring_pre_approval as $registration) { |
|
388 | + if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) { |
|
389 | + $events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li( |
|
390 | + EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
391 | 391 | ) |
392 | - . EEH_HTML::span( $registration->event()->name(), '', 'orange-text' ) |
|
392 | + . EEH_HTML::span($registration->event()->name(), '', 'orange-text') |
|
393 | 393 | ); |
394 | 394 | } |
395 | 395 | } |
@@ -397,14 +397,14 @@ discard block |
||
397 | 397 | array( |
398 | 398 | 'layout_strategy' => new EE_Template_Layout( |
399 | 399 | array( |
400 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template |
|
400 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template |
|
401 | 401 | 'template_args' => apply_filters( |
402 | 402 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
403 | 403 | array( |
404 | - 'events_requiring_pre_approval' => implode( '', $events_requiring_pre_approval ), |
|
404 | + 'events_requiring_pre_approval' => implode('', $events_requiring_pre_approval), |
|
405 | 405 | 'events_requiring_pre_approval_msg' => apply_filters( |
406 | 406 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
407 | - __( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' ) |
|
407 | + __('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso') |
|
408 | 408 | ) |
409 | 409 | ) |
410 | 410 | ), |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @param \EE_Event[] $registrations_for_free_events |
423 | 423 | * @return \EE_Form_Section_Proper |
424 | 424 | */ |
425 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
425 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
426 | 426 | // set some defaults |
427 | 427 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
428 | 428 | // generate no_payment_required form |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | array( |
431 | 431 | 'layout_strategy' => new EE_Template_Layout( |
432 | 432 | array( |
433 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template |
|
433 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template |
|
434 | 434 | 'template_args' => apply_filters( |
435 | 435 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args', |
436 | 436 | array( |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'registrations' => array(), |
439 | 439 | 'ticket_count' => array(), |
440 | 440 | 'registrations_for_free_events' => $registrations_for_free_events, |
441 | - 'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' )) |
|
441 | + 'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso')) |
|
442 | 442 | ) |
443 | 443 | ), |
444 | 444 | ) |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | * @param string $transaction_details |
456 | 456 | * @return \EE_Form_Section_Proper |
457 | 457 | */ |
458 | - private function _display_payment_options( $transaction_details = '' ) { |
|
458 | + private function _display_payment_options($transaction_details = '') { |
|
459 | 459 | // has method_of_payment been set by no-js user? |
460 | 460 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
461 | 461 | // build payment options form |
@@ -467,18 +467,18 @@ discard block |
||
467 | 467 | 'before_payment_options' => apply_filters( |
468 | 468 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options', |
469 | 469 | new EE_Form_Section_Proper( |
470 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
470 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
471 | 471 | ) |
472 | 472 | ), |
473 | 473 | 'payment_options' => $this->_setup_payment_options(), |
474 | 474 | 'after_payment_options' => apply_filters( |
475 | 475 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options', |
476 | 476 | new EE_Form_Section_Proper( |
477 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
477 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
478 | 478 | ) |
479 | 479 | ), |
480 | 480 | ), |
481 | - 'layout_strategy' => new EE_Template_Layout( array( |
|
481 | + 'layout_strategy' => new EE_Template_Layout(array( |
|
482 | 482 | 'layout_template_file' => $this->_template, |
483 | 483 | 'template_args' => apply_filters( |
484 | 484 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args', |
@@ -502,11 +502,11 @@ discard block |
||
502 | 502 | * @param bool $no_payment_required |
503 | 503 | * @return \EE_Form_Section_Proper |
504 | 504 | */ |
505 | - private function _extra_hidden_inputs( $no_payment_required = TRUE ) { |
|
505 | + private function _extra_hidden_inputs($no_payment_required = TRUE) { |
|
506 | 506 | |
507 | 507 | return new EE_Form_Section_Proper( |
508 | 508 | array( |
509 | - 'html_id' => 'ee-' . $this->slug() . '-extra-hidden-inputs', |
|
509 | + 'html_id' => 'ee-'.$this->slug().'-extra-hidden-inputs', |
|
510 | 510 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
511 | 511 | 'subsections' => array( |
512 | 512 | 'spco_no_payment_required' => new EE_Hidden_Input( |
@@ -541,9 +541,9 @@ discard block |
||
541 | 541 | */ |
542 | 542 | protected function _apply_transaction_payments_to_amount_owing() { |
543 | 543 | $payments = $this->checkout->transaction->approved_payments(); |
544 | - if ( ! empty( $payments ) ) { |
|
545 | - foreach ( $payments as $payment ) { |
|
546 | - if ( $payment instanceof EE_Payment ) { |
|
544 | + if ( ! empty($payments)) { |
|
545 | + foreach ($payments as $payment) { |
|
546 | + if ($payment instanceof EE_Payment) { |
|
547 | 547 | $this->checkout->amount_owing -= $payment->amount(); |
548 | 548 | } |
549 | 549 | } |
@@ -559,9 +559,9 @@ discard block |
||
559 | 559 | * @param bool $force_reset |
560 | 560 | * @return void |
561 | 561 | */ |
562 | - private function _reset_selected_method_of_payment( $force_reset = FALSE ) { |
|
563 | - $reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE )); |
|
564 | - if ( $reset_payment_method ) { |
|
562 | + private function _reset_selected_method_of_payment($force_reset = FALSE) { |
|
563 | + $reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE)); |
|
564 | + if ($reset_payment_method) { |
|
565 | 565 | $this->checkout->selected_method_of_payment = NULL; |
566 | 566 | $this->checkout->payment_method = NULL; |
567 | 567 | $this->checkout->billing_form = NULL; |
@@ -580,9 +580,9 @@ discard block |
||
580 | 580 | * @param string $selected_method_of_payment |
581 | 581 | * @return EE_Billing_Info_Form |
582 | 582 | */ |
583 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
584 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
585 | - EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment )); |
|
583 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
584 | + $selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
585 | + EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment)); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | |
@@ -595,40 +595,40 @@ discard block |
||
595 | 595 | // load payment method classes |
596 | 596 | $this->checkout->available_payment_methods = $this->_get_available_payment_methods(); |
597 | 597 | // switch up header depending on number of available payment methods |
598 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
599 | - ? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' )) |
|
600 | - : apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' )); |
|
598 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
599 | + ? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso')) |
|
600 | + : apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso')); |
|
601 | 601 | $available_payment_methods = array( |
602 | 602 | // display the "Payment Method" header |
603 | 603 | 'payment_method_header' => new EE_Form_Section_HTML( |
604 | - EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' ) |
|
604 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
605 | 605 | ) |
606 | 606 | ); |
607 | 607 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
608 | 608 | $available_payment_method_options = array(); |
609 | 609 | $default_payment_method_option = array(); |
610 | 610 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
611 | - $payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' ))); |
|
611 | + $payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;'))); |
|
612 | 612 | // loop through payment methods |
613 | - foreach( $this->checkout->available_payment_methods as $payment_method ) { |
|
614 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
615 | - $payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' ); |
|
613 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
614 | + if ($payment_method instanceof EE_Payment_Method) { |
|
615 | + $payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img'); |
|
616 | 616 | // check if any payment methods are set as default |
617 | 617 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
618 | - if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) { |
|
618 | + if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) { |
|
619 | 619 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
620 | 620 | $this->_save_selected_method_of_payment(); |
621 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
621 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
622 | 622 | } else { |
623 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
623 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
624 | 624 | } |
625 | - $payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method ); |
|
625 | + $payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method); |
|
626 | 626 | } |
627 | 627 | } |
628 | 628 | // prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs |
629 | 629 | $available_payment_method_options = $default_payment_method_option + $available_payment_method_options; |
630 | 630 | // now generate the actual form inputs |
631 | - $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options ); |
|
631 | + $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options); |
|
632 | 632 | $available_payment_methods = $available_payment_methods + $payment_methods_billing_info; |
633 | 633 | |
634 | 634 | // build the available payment methods form |
@@ -648,19 +648,19 @@ discard block |
||
648 | 648 | * @return EE_Payment_Method[] |
649 | 649 | */ |
650 | 650 | protected function _get_available_payment_methods() { |
651 | - if ( ! empty( $this->checkout->available_payment_methods )) { |
|
651 | + if ( ! empty($this->checkout->available_payment_methods)) { |
|
652 | 652 | return $this->checkout->available_payment_methods; |
653 | 653 | } |
654 | 654 | $available_payment_methods = array(); |
655 | 655 | // load EEM_Payment_Method |
656 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
656 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
657 | 657 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
658 | 658 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
659 | 659 | // get all active payment methods |
660 | - $payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart ); |
|
661 | - foreach ( $payment_methods as $payment_method ) { |
|
662 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
663 | - $available_payment_methods[ $payment_method->slug() ] = $payment_method; |
|
660 | + $payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart); |
|
661 | + foreach ($payment_methods as $payment_method) { |
|
662 | + if ($payment_method instanceof EE_Payment_Method) { |
|
663 | + $available_payment_methods[$payment_method->slug()] = $payment_method; |
|
664 | 664 | } |
665 | 665 | } |
666 | 666 | return $available_payment_methods; |
@@ -676,14 +676,14 @@ discard block |
||
676 | 676 | * @param array $available_payment_method_options |
677 | 677 | * @return \EE_Form_Section_Proper |
678 | 678 | */ |
679 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
679 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
680 | 680 | // generate inputs |
681 | 681 | return new EE_Form_Section_Proper( |
682 | 682 | array( |
683 | 683 | 'html_id' => 'ee-available-payment-method-inputs', |
684 | 684 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
685 | 685 | 'subsections' => array( |
686 | - '' => new EE_Radio_Button_Input ( |
|
686 | + '' => new EE_Radio_Button_Input( |
|
687 | 687 | $available_payment_method_options, |
688 | 688 | array( |
689 | 689 | 'html_name' => 'selected_method_of_payment', |
@@ -707,36 +707,36 @@ discard block |
||
707 | 707 | * @param EE_Payment_Method $payment_method |
708 | 708 | * @return \EE_Form_Section_Proper |
709 | 709 | */ |
710 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
710 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
711 | 711 | $currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE; |
712 | 712 | // generate the billing form for payment method |
713 | - $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML(); |
|
713 | + $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML(); |
|
714 | 714 | $this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form; |
715 | 715 | // it's all in the details |
716 | - $info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' ); |
|
716 | + $info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr'); |
|
717 | 717 | // add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not |
718 | - if ( $payment_method->description() ) { |
|
718 | + if ($payment_method->description()) { |
|
719 | 719 | $payment_method_info = $payment_method->description(); |
720 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
721 | - $payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
720 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
721 | + $payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
722 | 722 | } else { |
723 | - $payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
723 | + $payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
724 | 724 | } |
725 | - $info_html .= EEH_HTML::p ( |
|
726 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ), |
|
725 | + $info_html .= EEH_HTML::p( |
|
726 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info), |
|
727 | 727 | '', |
728 | 728 | 'spco-payment-method-desc ee-attention' |
729 | 729 | ); |
730 | 730 | |
731 | 731 | return new EE_Form_Section_Proper( |
732 | 732 | array( |
733 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
733 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
734 | 734 | 'html_class' => 'spco-payment-method-info-dv', |
735 | 735 | // only display the selected or default PM |
736 | 736 | 'html_style' => $currently_selected ? '' : 'display:none;', |
737 | 737 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
738 | 738 | 'subsections' => array( |
739 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
739 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
740 | 740 | 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML() |
741 | 741 | ) |
742 | 742 | ) |
@@ -754,12 +754,12 @@ discard block |
||
754 | 754 | */ |
755 | 755 | public function get_billing_form_html_for_payment_method() { |
756 | 756 | // how have they chosen to pay? |
757 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
757 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
758 | 758 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
759 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
759 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
760 | 760 | return FALSE; |
761 | 761 | } |
762 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
762 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
763 | 763 | EE_Error::add_success( |
764 | 764 | apply_filters( |
765 | 765 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -768,20 +768,20 @@ discard block |
||
768 | 768 | ); |
769 | 769 | } |
770 | 770 | // now generate billing form for selected method of payment |
771 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
771 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
772 | 772 | // fill form with attendee info if applicable |
773 | - if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
774 | - $payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
773 | + if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
774 | + $payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
775 | 775 | } |
776 | 776 | // and debug content |
777 | - if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
778 | - $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form ); |
|
777 | + if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
778 | + $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form); |
|
779 | 779 | } |
780 | 780 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : ''; |
781 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info )); |
|
781 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
782 | 782 | // localize validation rules for main form |
783 | 783 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
784 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
784 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
785 | 785 | return TRUE; |
786 | 786 | } |
787 | 787 | |
@@ -794,15 +794,15 @@ discard block |
||
794 | 794 | * @param EE_Payment_Method $payment_method |
795 | 795 | * @return \EE_Billing_Info_Form |
796 | 796 | */ |
797 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
798 | - $billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) ); |
|
799 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
800 | - if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) { |
|
801 | - if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
797 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
798 | + $billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing)); |
|
799 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
800 | + if (EE_Registry::instance()->REQ->is_set('payment_method')) { |
|
801 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
802 | 802 | EE_Error::add_success( |
803 | 803 | apply_filters( |
804 | 804 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
805 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
805 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name()) |
|
806 | 806 | ) |
807 | 807 | ); |
808 | 808 | } |
@@ -827,27 +827,27 @@ discard block |
||
827 | 827 | * @param string $request_param |
828 | 828 | * @return NULL|string |
829 | 829 | */ |
830 | - private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) { |
|
830 | + private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') { |
|
831 | 831 | // is selected_method_of_payment set in the request ? |
832 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE ); |
|
833 | - if ( $selected_method_of_payment ) { |
|
832 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE); |
|
833 | + if ($selected_method_of_payment) { |
|
834 | 834 | // sanitize it |
835 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment; |
|
836 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
835 | + $selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment; |
|
836 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
837 | 837 | // store it in the session so that it's available for all subsequent requests including AJAX |
838 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
838 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
839 | 839 | } else { |
840 | 840 | // or is is set in the session ? |
841 | - $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' ); |
|
841 | + $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment'); |
|
842 | 842 | } |
843 | 843 | // do ya really really gotta have it? |
844 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
844 | + if (empty($selected_method_of_payment) && $required) { |
|
845 | 845 | EE_Error::add_error( |
846 | 846 | sprintf( |
847 | - __( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ), |
|
847 | + __('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'), |
|
848 | 848 | '<br/>', |
849 | 849 | '<br/>', |
850 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
850 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
851 | 851 | ), |
852 | 852 | __FILE__, __FUNCTION__, __LINE__ |
853 | 853 | ); |
@@ -873,37 +873,37 @@ discard block |
||
873 | 873 | * @return string |
874 | 874 | */ |
875 | 875 | public function switch_payment_method() { |
876 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
876 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
877 | 877 | return false; |
878 | 878 | } |
879 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
879 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
880 | 880 | EE_Error::add_success( |
881 | 881 | apply_filters( |
882 | 882 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
883 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() ) |
|
883 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
884 | 884 | ) |
885 | 885 | ); |
886 | 886 | } |
887 | 887 | // generate billing form for selected method of payment if it hasn't been done already |
888 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
889 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
888 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
889 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
890 | 890 | } |
891 | 891 | // fill form with attendee info if applicable |
892 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
893 | - $this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
892 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
893 | + $this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
894 | 894 | } |
895 | 895 | // and debug content |
896 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
897 | - $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form ); |
|
896 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
897 | + $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form); |
|
898 | 898 | } |
899 | 899 | // get html and validation rules for form |
900 | - if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) { |
|
901 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() )); |
|
900 | + if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { |
|
901 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html())); |
|
902 | 902 | // localize validation rules for main form |
903 | - $this->checkout->billing_form->localize_validation_rules( TRUE ); |
|
904 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
903 | + $this->checkout->billing_form->localize_validation_rules(TRUE); |
|
904 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
905 | 905 | } else { |
906 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' )); |
|
906 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); |
|
907 | 907 | } |
908 | 908 | //prevents advancement to next step |
909 | 909 | $this->checkout->continue_reg = FALSE; |
@@ -918,18 +918,18 @@ discard block |
||
918 | 918 | */ |
919 | 919 | protected function _verify_payment_method_is_set() { |
920 | 920 | // generate billing form for selected method of payment if it hasn't been done already |
921 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
921 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
922 | 922 | // how have they chosen to pay? |
923 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
923 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
924 | 924 | } else { |
925 | 925 | // choose your own adventure based on method_of_payment |
926 | - switch ( $this->checkout->selected_method_of_payment ) { |
|
926 | + switch ($this->checkout->selected_method_of_payment) { |
|
927 | 927 | case 'events_sold_out' : |
928 | 928 | EE_Error::add_attention( |
929 | 929 | apply_filters( |
930 | 930 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__sold_out_events_msg', |
931 | - __( '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.', |
|
932 | - 'event_espresso' ) |
|
931 | + __('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.', |
|
932 | + 'event_espresso') |
|
933 | 933 | ), |
934 | 934 | __FILE__, __FUNCTION__, __LINE__ |
935 | 935 | ); |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | EE_Error::add_attention( |
940 | 940 | apply_filters( |
941 | 941 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__payments_closed_msg', |
942 | - __( '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' ) |
|
942 | + __('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') |
|
943 | 943 | ), |
944 | 944 | __FILE__, __FUNCTION__, __LINE__ |
945 | 945 | ); |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | EE_Error::add_attention( |
950 | 950 | apply_filters( |
951 | 951 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__no_payment_required_msg', |
952 | - __( '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' ) |
|
952 | + __('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') |
|
953 | 953 | ), |
954 | 954 | __FILE__, __FUNCTION__, __LINE__ |
955 | 955 | ); |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | } |
960 | 960 | } |
961 | 961 | // verify payment method |
962 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
962 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
963 | 963 | // get payment method for selected method of payment |
964 | 964 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
965 | 965 | } |
@@ -979,23 +979,23 @@ discard block |
||
979 | 979 | * @return void |
980 | 980 | */ |
981 | 981 | public function save_payer_details_via_ajax() { |
982 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
982 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
983 | 983 | return; |
984 | 984 | } |
985 | 985 | // generate billing form for selected method of payment if it hasn't been done already |
986 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
987 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
986 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
987 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
988 | 988 | } |
989 | 989 | // generate primary attendee from payer info if applicable |
990 | 990 | if ( ! $this->checkout->transaction_has_primary_registrant()) { |
991 | 991 | $attendee = $this->_create_attendee_from_request_data(); |
992 | - if ( $attendee instanceof EE_Attendee ) { |
|
993 | - foreach ( $this->checkout->transaction->registrations() as $registration ) { |
|
994 | - if ( $registration->is_primary_registrant() ) { |
|
992 | + if ($attendee instanceof EE_Attendee) { |
|
993 | + foreach ($this->checkout->transaction->registrations() as $registration) { |
|
994 | + if ($registration->is_primary_registrant()) { |
|
995 | 995 | $this->checkout->primary_attendee_obj = $attendee; |
996 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
997 | - $registration->set_attendee_id( $attendee->ID() ); |
|
998 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
996 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
997 | + $registration->set_attendee_id($attendee->ID()); |
|
998 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
999 | 999 | } |
1000 | 1000 | } |
1001 | 1001 | } |
@@ -1008,56 +1008,56 @@ discard block |
||
1008 | 1008 | * uses info from alternate GET or POST data (such as AJAX) to create a new attendee |
1009 | 1009 | * @return \EE_Attendee |
1010 | 1010 | */ |
1011 | - protected function _create_attendee_from_request_data(){ |
|
1011 | + protected function _create_attendee_from_request_data() { |
|
1012 | 1012 | // get State ID |
1013 | - $STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : ''; |
|
1014 | - if ( ! empty( $STA_ID )) { |
|
1013 | + $STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; |
|
1014 | + if ( ! empty($STA_ID)) { |
|
1015 | 1015 | // can we get state object from name ? |
1016 | - EE_Registry::instance()->load_model( 'State' ); |
|
1017 | - $state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' ); |
|
1018 | - $STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID; |
|
1016 | + EE_Registry::instance()->load_model('State'); |
|
1017 | + $state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID'); |
|
1018 | + $STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID; |
|
1019 | 1019 | } |
1020 | 1020 | // get Country ISO |
1021 | - $CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : ''; |
|
1022 | - if ( ! empty( $CNT_ISO )) { |
|
1021 | + $CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; |
|
1022 | + if ( ! empty($CNT_ISO)) { |
|
1023 | 1023 | // can we get country object from name ? |
1024 | - EE_Registry::instance()->load_model( 'Country' ); |
|
1025 | - $country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' ); |
|
1026 | - $CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO; |
|
1024 | + EE_Registry::instance()->load_model('Country'); |
|
1025 | + $country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO'); |
|
1026 | + $CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO; |
|
1027 | 1027 | } |
1028 | 1028 | // grab attendee data |
1029 | 1029 | $attendee_data = array( |
1030 | - 'ATT_fname' => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '', |
|
1031 | - 'ATT_lname' => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '', |
|
1032 | - 'ATT_email' => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '', |
|
1033 | - 'ATT_address' => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '', |
|
1034 | - 'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '', |
|
1035 | - 'ATT_city' => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '', |
|
1030 | + 'ATT_fname' => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '', |
|
1031 | + 'ATT_lname' => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '', |
|
1032 | + 'ATT_email' => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '', |
|
1033 | + 'ATT_address' => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '', |
|
1034 | + 'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '', |
|
1035 | + 'ATT_city' => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '', |
|
1036 | 1036 | 'STA_ID' => $STA_ID, |
1037 | 1037 | 'CNT_ISO' => $CNT_ISO, |
1038 | - 'ATT_zip' => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '', |
|
1039 | - 'ATT_phone' => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '', |
|
1038 | + 'ATT_zip' => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '', |
|
1039 | + 'ATT_phone' => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '', |
|
1040 | 1040 | ); |
1041 | 1041 | // validate the email address since it is the most important piece of info |
1042 | - if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) { |
|
1043 | - EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1042 | + if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) { |
|
1043 | + EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1044 | 1044 | } |
1045 | 1045 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1046 | - if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) { |
|
1047 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
1046 | + if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) { |
|
1047 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
1048 | 1048 | 'ATT_fname' => $attendee_data['ATT_fname'], |
1049 | 1049 | 'ATT_lname' => $attendee_data['ATT_lname'], |
1050 | 1050 | 'ATT_email' => $attendee_data['ATT_email'] |
1051 | 1051 | )); |
1052 | - if ( $existing_attendee instanceof EE_Attendee ) { |
|
1052 | + if ($existing_attendee instanceof EE_Attendee) { |
|
1053 | 1053 | return $existing_attendee; |
1054 | 1054 | } |
1055 | 1055 | } |
1056 | 1056 | // no existing attendee? kk let's create a new one |
1057 | 1057 | // kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist |
1058 | - $attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1059 | - $attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1060 | - return EE_Attendee::new_instance( $attendee_data ); |
|
1058 | + $attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1059 | + $attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1060 | + return EE_Attendee::new_instance($attendee_data); |
|
1061 | 1061 | } |
1062 | 1062 | |
1063 | 1063 | |
@@ -1077,22 +1077,22 @@ discard block |
||
1077 | 1077 | */ |
1078 | 1078 | public function process_reg_step() { |
1079 | 1079 | // how have they chosen to pay? |
1080 | - $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE ); |
|
1080 | + $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE); |
|
1081 | 1081 | // choose your own adventure based on method_of_payment |
1082 | - switch( $this->checkout->selected_method_of_payment ) { |
|
1082 | + switch ($this->checkout->selected_method_of_payment) { |
|
1083 | 1083 | |
1084 | 1084 | case 'events_sold_out' : |
1085 | 1085 | $this->checkout->redirect = TRUE; |
1086 | 1086 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
1087 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1087 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1088 | 1088 | // mark this reg step as completed |
1089 | 1089 | $this->set_completed(); |
1090 | 1090 | return FALSE; |
1091 | 1091 | break; |
1092 | 1092 | |
1093 | 1093 | case 'payments_closed' : |
1094 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) { |
|
1095 | - EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1094 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) { |
|
1095 | + EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1096 | 1096 | } |
1097 | 1097 | // mark this reg step as completed |
1098 | 1098 | $this->set_completed(); |
@@ -1100,8 +1100,8 @@ discard block |
||
1100 | 1100 | break; |
1101 | 1101 | |
1102 | 1102 | case 'no_payment_required' : |
1103 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) { |
|
1104 | - EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1103 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) { |
|
1104 | + EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1105 | 1105 | } |
1106 | 1106 | // mark this reg step as completed |
1107 | 1107 | $this->set_completed(); |
@@ -1110,9 +1110,9 @@ discard block |
||
1110 | 1110 | |
1111 | 1111 | default: |
1112 | 1112 | $payment_successful = $this->_process_payment(); |
1113 | - if ( $payment_successful ) { |
|
1113 | + if ($payment_successful) { |
|
1114 | 1114 | $this->checkout->continue_reg = true; |
1115 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
1115 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
1116 | 1116 | } else { |
1117 | 1117 | $this->checkout->continue_reg = false; |
1118 | 1118 | } |
@@ -1130,8 +1130,8 @@ discard block |
||
1130 | 1130 | * @param \EE_Payment_Method $payment_method |
1131 | 1131 | * @return void |
1132 | 1132 | */ |
1133 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
1134 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1133 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
1134 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1135 | 1135 | case EE_PMT_Base::offsite : |
1136 | 1136 | break; |
1137 | 1137 | case EE_PMT_Base::onsite : |
@@ -1154,15 +1154,15 @@ discard block |
||
1154 | 1154 | public function update_reg_step() { |
1155 | 1155 | $success = TRUE; |
1156 | 1156 | // if payment required |
1157 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
1158 | - do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction ); |
|
1157 | + if ($this->checkout->transaction->total() > 0) { |
|
1158 | + do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction); |
|
1159 | 1159 | // attempt payment via payment method |
1160 | 1160 | $success = $this->process_reg_step(); |
1161 | 1161 | } |
1162 | - if ( $success && ! $this->checkout->redirect ) { |
|
1163 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
1162 | + if ($success && ! $this->checkout->redirect) { |
|
1163 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
1164 | 1164 | // set return URL |
1165 | - $this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url ); |
|
1165 | + $this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url); |
|
1166 | 1166 | } |
1167 | 1167 | return $success; |
1168 | 1168 | } |
@@ -1180,32 +1180,32 @@ discard block |
||
1180 | 1180 | */ |
1181 | 1181 | private function _process_payment() { |
1182 | 1182 | // basically confirm that the event hasn't sold out since they hit the page |
1183 | - if ( ! $this->_last_second_ticket_verifications() ) { |
|
1183 | + if ( ! $this->_last_second_ticket_verifications()) { |
|
1184 | 1184 | return false; |
1185 | 1185 | } |
1186 | 1186 | // ya gotta make a choice man |
1187 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
1188 | - $this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' )); |
|
1187 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1188 | + $this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso')); |
|
1189 | 1189 | return FALSE; |
1190 | 1190 | } |
1191 | 1191 | // get EE_Payment_Method object |
1192 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1192 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1193 | 1193 | return FALSE; |
1194 | 1194 | } |
1195 | 1195 | // setup billing form |
1196 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1197 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
1196 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1197 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
1198 | 1198 | // bad billing form ? |
1199 | - if ( ! $this->_billing_form_is_valid() ) { |
|
1199 | + if ( ! $this->_billing_form_is_valid()) { |
|
1200 | 1200 | return FALSE; |
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | // ensure primary registrant has been fully processed |
1204 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
1204 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
1205 | 1205 | return FALSE; |
1206 | 1206 | } |
1207 | 1207 | // if session is close to expiring (under 10 minutes by default) |
1208 | - if ( ( time() - EE_Registry::instance()->SSN->expiration() ) < EE_Registry::instance()->SSN->extension() ) { |
|
1208 | + if ((time() - EE_Registry::instance()->SSN->expiration()) < EE_Registry::instance()->SSN->extension()) { |
|
1209 | 1209 | // add some time to session expiration so that payment can be completed |
1210 | 1210 | EE_Registry::instance()->SSN->extend_expiration(); |
1211 | 1211 | } |
@@ -1214,24 +1214,24 @@ discard block |
||
1214 | 1214 | // 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 |
1215 | 1215 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
1216 | 1216 | // attempt payment |
1217 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
1217 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
1218 | 1218 | // process results |
1219 | - $payment = $this->_validate_payment( $payment ); |
|
1220 | - $payment = $this->_post_payment_processing( $payment ); |
|
1219 | + $payment = $this->_validate_payment($payment); |
|
1220 | + $payment = $this->_post_payment_processing($payment); |
|
1221 | 1221 | // verify payment |
1222 | - if ( $payment instanceof EE_Payment ) { |
|
1222 | + if ($payment instanceof EE_Payment) { |
|
1223 | 1223 | // store that for later |
1224 | 1224 | $this->checkout->payment = $payment; |
1225 | 1225 | /** @type EE_Transaction_Processor $transaction_processor */ |
1226 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1226 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1227 | 1227 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1228 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1229 | - if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) { |
|
1228 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1229 | + if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) { |
|
1230 | 1230 | return true; |
1231 | 1231 | } else { |
1232 | 1232 | return false; |
1233 | 1233 | } |
1234 | - } else if ( $payment === true ) { |
|
1234 | + } else if ($payment === true) { |
|
1235 | 1235 | // please note that offline payment methods will NOT make a payment, |
1236 | 1236 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
1237 | 1237 | $this->checkout->payment = $payment; |
@@ -1251,22 +1251,22 @@ discard block |
||
1251 | 1251 | */ |
1252 | 1252 | protected function _last_second_ticket_verifications() { |
1253 | 1253 | // don't bother re-validating if not a return visit |
1254 | - if ( ! $this->checkout->revisit ) { |
|
1254 | + if ( ! $this->checkout->revisit) { |
|
1255 | 1255 | return true; |
1256 | 1256 | } |
1257 | 1257 | $registrations = $this->checkout->transaction->registrations(); |
1258 | - if ( empty( $registrations ) ) { |
|
1258 | + if (empty($registrations)) { |
|
1259 | 1259 | return false; |
1260 | 1260 | } |
1261 | - foreach ( $registrations as $registration ) { |
|
1262 | - if ( $registration instanceof EE_Registration ) { |
|
1261 | + foreach ($registrations as $registration) { |
|
1262 | + if ($registration instanceof EE_Registration) { |
|
1263 | 1263 | $event = $registration->event_obj(); |
1264 | - if ( ! ( $event instanceof EE_Event && $event->is_sold_out( true ) ) ) { |
|
1264 | + if ( ! ($event instanceof EE_Event && $event->is_sold_out(true))) { |
|
1265 | 1265 | EE_Error::add_error( |
1266 | 1266 | apply_filters( |
1267 | 1267 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___last_second_ticket_verifications__sold_out_events_msg', |
1268 | 1268 | sprintf( |
1269 | - __( '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' ), |
|
1269 | + __('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'), |
|
1270 | 1270 | $event->name() |
1271 | 1271 | ) |
1272 | 1272 | ), |
@@ -1290,10 +1290,10 @@ discard block |
||
1290 | 1290 | * @return bool |
1291 | 1291 | */ |
1292 | 1292 | public function redirect_form() { |
1293 | - $payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() ); |
|
1293 | + $payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment()); |
|
1294 | 1294 | $html = $payment_method_billing_info->get_html_and_js(); |
1295 | 1295 | $html .= $this->checkout->redirect_form; |
1296 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
1296 | + EE_Registry::instance()->REQ->add_output($html); |
|
1297 | 1297 | return TRUE; |
1298 | 1298 | } |
1299 | 1299 | |
@@ -1306,33 +1306,33 @@ discard block |
||
1306 | 1306 | * @return bool |
1307 | 1307 | */ |
1308 | 1308 | private function _billing_form_is_valid() { |
1309 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
1310 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
1309 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
1310 | + if ($this->checkout->billing_form->was_submitted()) { |
|
1311 | 1311 | $this->checkout->billing_form->receive_form_submission(); |
1312 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
1312 | + if ($this->checkout->billing_form->is_valid()) { |
|
1313 | 1313 | return TRUE; |
1314 | 1314 | } |
1315 | 1315 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
1316 | 1316 | $error_strings = array(); |
1317 | - foreach( $validation_errors as $validation_error ){ |
|
1318 | - if( $validation_error instanceof EE_Validation_Error ){ |
|
1317 | + foreach ($validation_errors as $validation_error) { |
|
1318 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1319 | 1319 | $form_section = $validation_error->get_form_section(); |
1320 | - if( $form_section instanceof EE_Form_Input_Base ){ |
|
1320 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
1321 | 1321 | $label = $form_section->html_label_text(); |
1322 | - }elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
1322 | + }elseif ($form_section instanceof EE_Form_Section_Base) { |
|
1323 | 1323 | $label = $form_section->name(); |
1324 | - }else{ |
|
1325 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
1324 | + } else { |
|
1325 | + $label = __('Validation Error', 'event_espresso'); |
|
1326 | 1326 | } |
1327 | - $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
1327 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
1328 | 1328 | } |
1329 | 1329 | } |
1330 | - EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings ) ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1330 | + EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__); |
|
1331 | 1331 | } else { |
1332 | - EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1332 | + EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1333 | 1333 | } |
1334 | 1334 | } else { |
1335 | - EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1335 | + EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1336 | 1336 | } |
1337 | 1337 | return FALSE; |
1338 | 1338 | } |
@@ -1350,9 +1350,9 @@ discard block |
||
1350 | 1350 | */ |
1351 | 1351 | private function _setup_primary_registrant_prior_to_payment() { |
1352 | 1352 | // check if transaction has a primary registrant and that it has a related Attendee object |
1353 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
1353 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
1354 | 1354 | // need to at least gather some primary registrant data before attempting payment |
1355 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) { |
|
1355 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) { |
|
1356 | 1356 | return FALSE; |
1357 | 1357 | } |
1358 | 1358 | } |
@@ -1360,13 +1360,13 @@ discard block |
||
1360 | 1360 | // grab the primary_registration object |
1361 | 1361 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1362 | 1362 | /** @type EE_Transaction_Processor $transaction_processor */ |
1363 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1363 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1364 | 1364 | // at this point we'll consider a TXN to not have been failed |
1365 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1365 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1366 | 1366 | // save the TXN ( which clears cached copy of primary_registration) |
1367 | 1367 | $this->checkout->transaction->save(); |
1368 | 1368 | // grab TXN ID and save it to the primary_registration |
1369 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
1369 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
1370 | 1370 | // save what we have so far |
1371 | 1371 | $primary_registration->save(); |
1372 | 1372 | return TRUE; |
@@ -1383,41 +1383,41 @@ discard block |
||
1383 | 1383 | private function _capture_primary_registration_data_from_billing_form() { |
1384 | 1384 | // convert billing form data into an attendee |
1385 | 1385 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
1386 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
1386 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
1387 | 1387 | EE_Error::add_error( |
1388 | 1388 | sprintf( |
1389 | - __( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1389 | + __('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1390 | 1390 | '<br/>', |
1391 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1391 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1392 | 1392 | ), __FILE__, __FUNCTION__, __LINE__ |
1393 | 1393 | ); |
1394 | 1394 | return FALSE; |
1395 | 1395 | } |
1396 | 1396 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1397 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
1397 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
1398 | 1398 | EE_Error::add_error( |
1399 | 1399 | sprintf( |
1400 | - __( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1400 | + __('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1401 | 1401 | '<br/>', |
1402 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1402 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1403 | 1403 | ), __FILE__, __FUNCTION__, __LINE__ |
1404 | 1404 | ); |
1405 | 1405 | return FALSE; |
1406 | 1406 | } |
1407 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) { |
|
1407 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) { |
|
1408 | 1408 | EE_Error::add_error( |
1409 | 1409 | sprintf( |
1410 | - __( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1410 | + __('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1411 | 1411 | '<br/>', |
1412 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1412 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1413 | 1413 | ), __FILE__, __FUNCTION__, __LINE__ |
1414 | 1414 | ); |
1415 | 1415 | return FALSE; |
1416 | 1416 | } |
1417 | 1417 | /** @type EE_Registration_Processor $registration_processor */ |
1418 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1418 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1419 | 1419 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1420 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
1420 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
1421 | 1421 | |
1422 | 1422 | return TRUE; |
1423 | 1423 | } |
@@ -1433,35 +1433,35 @@ discard block |
||
1433 | 1433 | */ |
1434 | 1434 | private function _get_payment_method_for_selected_method_of_payment() { |
1435 | 1435 | // get EE_Payment_Method object |
1436 | - if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) { |
|
1437 | - $payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ]; |
|
1436 | + if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) { |
|
1437 | + $payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment]; |
|
1438 | 1438 | } else { |
1439 | 1439 | // load EEM_Payment_Method |
1440 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
1440 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
1441 | 1441 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
1442 | 1442 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
1443 | - $payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
1443 | + $payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
1444 | 1444 | } |
1445 | 1445 | // verify $payment_method |
1446 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
1446 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
1447 | 1447 | // not a payment |
1448 | 1448 | EE_Error::add_error( |
1449 | 1449 | sprintf( |
1450 | - __( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1450 | + __('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1451 | 1451 | '<br/>', |
1452 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1452 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1453 | 1453 | ), __FILE__, __FUNCTION__, __LINE__ |
1454 | 1454 | ); |
1455 | 1455 | return NULL; |
1456 | 1456 | } |
1457 | 1457 | // and verify it has a valid Payment_Method Type object |
1458 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
1458 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
1459 | 1459 | // not a payment |
1460 | 1460 | EE_Error::add_error( |
1461 | 1461 | sprintf( |
1462 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1462 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1463 | 1463 | '<br/>', |
1464 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1464 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1465 | 1465 | ), __FILE__, __FUNCTION__, __LINE__ |
1466 | 1466 | ); |
1467 | 1467 | return NULL; |
@@ -1480,30 +1480,30 @@ discard block |
||
1480 | 1480 | * @type EE_Payment_Method $payment_method |
1481 | 1481 | * @return mixed EE_Payment | boolean |
1482 | 1482 | */ |
1483 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
1484 | - $payment =NULL; |
|
1483 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
1484 | + $payment = NULL; |
|
1485 | 1485 | $this->checkout->transaction->save(); |
1486 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1487 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
1486 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1487 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
1488 | 1488 | return FALSE; |
1489 | 1489 | } |
1490 | 1490 | try { |
1491 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
1491 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
1492 | 1492 | // generate payment object |
1493 | 1493 | $payment = $payment_processor->process_payment( |
1494 | 1494 | $payment_method, |
1495 | 1495 | $this->checkout->transaction, |
1496 | 1496 | $this->checkout->amount_owing, |
1497 | 1497 | $this->checkout->billing_form, |
1498 | - $this->_get_return_url( $payment_method ), |
|
1498 | + $this->_get_return_url($payment_method), |
|
1499 | 1499 | 'CART', |
1500 | 1500 | $this->checkout->admin_request, |
1501 | 1501 | TRUE, |
1502 | 1502 | $this->reg_step_url() |
1503 | 1503 | ); |
1504 | 1504 | |
1505 | - } catch( Exception $e ) { |
|
1506 | - $this->_handle_payment_processor_exception( $e ); |
|
1505 | + } catch (Exception $e) { |
|
1506 | + $this->_handle_payment_processor_exception($e); |
|
1507 | 1507 | } |
1508 | 1508 | return $payment; |
1509 | 1509 | } |
@@ -1517,12 +1517,12 @@ discard block |
||
1517 | 1517 | * @param \Exception $e |
1518 | 1518 | * @return void |
1519 | 1519 | */ |
1520 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
1520 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
1521 | 1521 | EE_Error::add_error( |
1522 | 1522 | sprintf( |
1523 | - __( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ), |
|
1523 | + __('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'), |
|
1524 | 1524 | '<br/>', |
1525 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
1525 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
1526 | 1526 | $e->getMessage(), |
1527 | 1527 | $e->getFile(), |
1528 | 1528 | $e->getLine() |
@@ -1539,9 +1539,9 @@ discard block |
||
1539 | 1539 | * @param \EE_Payment_Method $payment_method |
1540 | 1540 | * @return string |
1541 | 1541 | */ |
1542 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
1542 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
1543 | 1543 | $return_url = ''; |
1544 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1544 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1545 | 1545 | |
1546 | 1546 | case EE_PMT_Base::offsite : |
1547 | 1547 | $return_url = add_query_arg( |
@@ -1572,27 +1572,27 @@ discard block |
||
1572 | 1572 | * @param EE_Payment $payment |
1573 | 1573 | * @return EE_Payment | FALSE |
1574 | 1574 | */ |
1575 | - private function _validate_payment( $payment = NULL ) { |
|
1576 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
1575 | + private function _validate_payment($payment = NULL) { |
|
1576 | + if ($this->checkout->payment_method->is_off_line()) { |
|
1577 | 1577 | return TRUE; |
1578 | 1578 | } |
1579 | 1579 | // verify payment object |
1580 | - if ( $payment instanceof EE_Payment ) { |
|
1580 | + if ($payment instanceof EE_Payment) { |
|
1581 | 1581 | if ( |
1582 | 1582 | $payment->status() != EEM_Payment::status_id_approved |
1583 | 1583 | && $payment->status() != EEM_Payment::status_id_pending |
1584 | 1584 | && $payment->status() != EEM_Payment::status_id_cancelled |
1585 | 1585 | && $payment->gateway_response() != '' |
1586 | 1586 | ) { |
1587 | - EE_Error::add_error( $payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1587 | + EE_Error::add_error($payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__); |
|
1588 | 1588 | } |
1589 | 1589 | } else { |
1590 | 1590 | // not a payment |
1591 | 1591 | EE_Error::add_error( |
1592 | 1592 | sprintf( |
1593 | - __( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1593 | + __('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1594 | 1594 | '<br/>', |
1595 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1595 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1596 | 1596 | ), __FILE__, __FUNCTION__, __LINE__ |
1597 | 1597 | ); |
1598 | 1598 | return FALSE; |
@@ -1609,23 +1609,23 @@ discard block |
||
1609 | 1609 | * @param EE_Payment $payment |
1610 | 1610 | * @return bool |
1611 | 1611 | */ |
1612 | - private function _post_payment_processing( $payment = NULL ) { |
|
1612 | + private function _post_payment_processing($payment = NULL) { |
|
1613 | 1613 | // On-Site payment? |
1614 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1615 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) { |
|
1614 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1615 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
1616 | 1616 | //$this->_setup_redirect_for_next_step(); |
1617 | 1617 | $this->checkout->continue_reg = false; |
1618 | 1618 | } |
1619 | 1619 | // Off-Site payment? |
1620 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
1620 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
1621 | 1621 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
1622 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ){ |
|
1623 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' ); |
|
1622 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
1623 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()'); |
|
1624 | 1624 | $this->checkout->redirect = TRUE; |
1625 | 1625 | $this->checkout->redirect_form = $payment->redirect_form(); |
1626 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
1626 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
1627 | 1627 | // set JSON response |
1628 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
1628 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
1629 | 1629 | // set cron job for finalizing the TXN |
1630 | 1630 | // in case the user does not return from the off-site gateway |
1631 | 1631 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -1633,21 +1633,21 @@ discard block |
||
1633 | 1633 | $this->checkout->transaction->ID() |
1634 | 1634 | ); |
1635 | 1635 | // and lastly, let's bump the payment status to pending |
1636 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
1636 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
1637 | 1637 | $payment->save(); |
1638 | 1638 | } else { |
1639 | 1639 | // not a payment |
1640 | 1640 | $this->checkout->continue_reg = false; |
1641 | 1641 | EE_Error::add_error( |
1642 | 1642 | sprintf( |
1643 | - __( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1643 | + __('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1644 | 1644 | '<br/>', |
1645 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1645 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1646 | 1646 | ), __FILE__, __FUNCTION__, __LINE__ |
1647 | 1647 | ); |
1648 | 1648 | } |
1649 | 1649 | // Off-Line payment? |
1650 | - } else if ( $payment === TRUE ) { |
|
1650 | + } else if ($payment === TRUE) { |
|
1651 | 1651 | //$this->_setup_redirect_for_next_step(); |
1652 | 1652 | return TRUE; |
1653 | 1653 | } else { |
@@ -1683,65 +1683,65 @@ discard block |
||
1683 | 1683 | * @return bool |
1684 | 1684 | * @throws \EE_Error |
1685 | 1685 | */ |
1686 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
1686 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
1687 | 1687 | // off-line payment? carry on |
1688 | - if ( $payment_occurs == EE_PMT_Base::offline ) { |
|
1688 | + if ($payment_occurs == EE_PMT_Base::offline) { |
|
1689 | 1689 | return true; |
1690 | 1690 | } |
1691 | 1691 | // verify payment validity |
1692 | - if ( $payment instanceof EE_Payment ) { |
|
1693 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
1692 | + if ($payment instanceof EE_Payment) { |
|
1693 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
1694 | 1694 | $msg = $payment->gateway_response(); |
1695 | 1695 | // check results |
1696 | - switch ( $payment->status() ) { |
|
1696 | + switch ($payment->status()) { |
|
1697 | 1697 | |
1698 | 1698 | // good payment |
1699 | 1699 | case EEM_Payment::status_id_approved : |
1700 | - EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1700 | + EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1701 | 1701 | return TRUE; |
1702 | 1702 | break; |
1703 | 1703 | |
1704 | 1704 | // slow payment |
1705 | 1705 | case EEM_Payment::status_id_pending : |
1706 | - if ( empty( $msg )) { |
|
1707 | - $msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' ); |
|
1706 | + if (empty($msg)) { |
|
1707 | + $msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso'); |
|
1708 | 1708 | } |
1709 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1709 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1710 | 1710 | return TRUE; |
1711 | 1711 | break; |
1712 | 1712 | |
1713 | 1713 | // don't wanna payment |
1714 | 1714 | case EEM_Payment::status_id_cancelled : |
1715 | - if ( empty( $msg )) { |
|
1715 | + if (empty($msg)) { |
|
1716 | 1716 | $msg = _n( |
1717 | 1717 | 'Payment cancelled. Please try again.', |
1718 | 1718 | 'Payment cancelled. Please try again or select another method of payment.', |
1719 | - count( $this->checkout->available_payment_methods ), |
|
1719 | + count($this->checkout->available_payment_methods), |
|
1720 | 1720 | 'event_espresso' |
1721 | 1721 | ); |
1722 | 1722 | } |
1723 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1723 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1724 | 1724 | return FALSE; |
1725 | 1725 | break; |
1726 | 1726 | |
1727 | 1727 | // not enough payment |
1728 | 1728 | case EEM_Payment::status_id_declined : |
1729 | - if ( empty( $msg )) { |
|
1729 | + if (empty($msg)) { |
|
1730 | 1730 | $msg = _n( |
1731 | 1731 | 'We\'re sorry but your payment was declined. Please try again.', |
1732 | 1732 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
1733 | - count( $this->checkout->available_payment_methods ), |
|
1733 | + count($this->checkout->available_payment_methods), |
|
1734 | 1734 | 'event_espresso' |
1735 | 1735 | ); |
1736 | 1736 | } |
1737 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1737 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1738 | 1738 | return FALSE; |
1739 | 1739 | break; |
1740 | 1740 | |
1741 | 1741 | // bad payment |
1742 | 1742 | case EEM_Payment::status_id_failed : |
1743 | - if ( ! empty( $msg ) ) { |
|
1744 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1743 | + if ( ! empty($msg)) { |
|
1744 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1745 | 1745 | return false; |
1746 | 1746 | } |
1747 | 1747 | // default to error below |
@@ -1751,14 +1751,14 @@ discard block |
||
1751 | 1751 | } |
1752 | 1752 | // off-site payment gateway responses are too unreliable, so let's just assume that |
1753 | 1753 | // the payment processing is just running slower than the registrant's request |
1754 | - if ( $payment_occurs == EE_PMT_Base::offsite ) { |
|
1754 | + if ($payment_occurs == EE_PMT_Base::offsite) { |
|
1755 | 1755 | return true; |
1756 | 1756 | } |
1757 | 1757 | EE_Error::add_error( |
1758 | 1758 | sprintf( |
1759 | - __( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1759 | + __('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1760 | 1760 | '<br/>', |
1761 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1761 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1762 | 1762 | ), |
1763 | 1763 | __FILE__, __FUNCTION__, __LINE__ |
1764 | 1764 | ); |
@@ -1791,13 +1791,13 @@ discard block |
||
1791 | 1791 | public function process_gateway_response() { |
1792 | 1792 | $payment = null; |
1793 | 1793 | // how have they chosen to pay? |
1794 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1794 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1795 | 1795 | // get EE_Payment_Method object |
1796 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1796 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1797 | 1797 | $this->checkout->continue_reg = false; |
1798 | 1798 | return false; |
1799 | 1799 | } |
1800 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
1800 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
1801 | 1801 | return false; |
1802 | 1802 | } |
1803 | 1803 | $this->_validate_offsite_return(); |
@@ -1811,23 +1811,23 @@ discard block |
||
1811 | 1811 | // true |
1812 | 1812 | //); |
1813 | 1813 | // verify TXN |
1814 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1814 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1815 | 1815 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
1816 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
1816 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
1817 | 1817 | $this->checkout->continue_reg = false; |
1818 | 1818 | return false; |
1819 | 1819 | } |
1820 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
1821 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
1822 | - $payment = $this->_validate_payment( $payment ); |
|
1820 | + $payment = $this->_process_off_site_payment($gateway); |
|
1821 | + $payment = $this->_process_cancelled_payments($payment); |
|
1822 | + $payment = $this->_validate_payment($payment); |
|
1823 | 1823 | // if payment was not declined by the payment gateway or cancelled by the registrant |
1824 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
1824 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
1825 | 1825 | //$this->_setup_redirect_for_next_step(); |
1826 | 1826 | // store that for later |
1827 | 1827 | $this->checkout->payment = $payment; |
1828 | 1828 | // mark this reg step as completed, as long as gateway doesn't use a separate IPN request, |
1829 | 1829 | // because we will complete this step during the IPN processing then |
1830 | - if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) { |
|
1830 | + if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) { |
|
1831 | 1831 | $this->set_completed(); |
1832 | 1832 | } |
1833 | 1833 | return true; |
@@ -1850,19 +1850,19 @@ discard block |
||
1850 | 1850 | * @return bool |
1851 | 1851 | */ |
1852 | 1852 | private function _validate_offsite_return() { |
1853 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
1854 | - if ( $TXN_ID != $this->checkout->transaction->ID() ) { |
|
1853 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
1854 | + if ($TXN_ID != $this->checkout->transaction->ID()) { |
|
1855 | 1855 | // Houston... we might have a problem |
1856 | 1856 | $invalid_TXN = false; |
1857 | 1857 | // first gather some info |
1858 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1858 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1859 | 1859 | $primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null; |
1860 | 1860 | // let's start by retrieving the cart for this TXN |
1861 | - $cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction ); |
|
1862 | - if ( $cart instanceof EE_Cart ) { |
|
1861 | + $cart = EE_Cart::get_cart_from_txn($this->checkout->transaction); |
|
1862 | + if ($cart instanceof EE_Cart) { |
|
1863 | 1863 | // verify that the current cart has tickets |
1864 | 1864 | $tickets = $cart->get_tickets(); |
1865 | - if ( empty( $tickets ) ) { |
|
1865 | + if (empty($tickets)) { |
|
1866 | 1866 | $invalid_TXN = true; |
1867 | 1867 | } |
1868 | 1868 | } else { |
@@ -1870,39 +1870,39 @@ discard block |
||
1870 | 1870 | } |
1871 | 1871 | $valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null; |
1872 | 1872 | // validate current Session ID and compare against valid TXN session ID |
1873 | - if ( EE_Session::instance()->id() === null ) { |
|
1873 | + if (EE_Session::instance()->id() === null) { |
|
1874 | 1874 | $invalid_TXN = true; |
1875 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
1875 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
1876 | 1876 | // WARNING !!! |
1877 | 1877 | // this could be PayPal sending back duplicate requests (ya they do that) |
1878 | 1878 | // or it **could** mean someone is simply registering AGAIN after having just done so |
1879 | 1879 | // so now we need to determine if this current TXN looks valid or not |
1880 | 1880 | /** @type EE_Transaction_Processor $transaction_processor */ |
1881 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1881 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1882 | 1882 | // has this step even been started ? |
1883 | - if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false ) |
|
1883 | + if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false) |
|
1884 | 1884 | ) { |
1885 | 1885 | // really? you're half way through this reg step, but you never started it ? |
1886 | 1886 | $invalid_TXN = true; |
1887 | 1887 | } |
1888 | 1888 | } |
1889 | - if ( $invalid_TXN ) { |
|
1889 | + if ($invalid_TXN) { |
|
1890 | 1890 | // is the valid TXN completed ? |
1891 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
1891 | + if ($valid_TXN instanceof EE_Transaction) { |
|
1892 | 1892 | /** @type EE_Transaction_Processor $transaction_processor */ |
1893 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1893 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1894 | 1894 | // has this step even been started ? |
1895 | - $reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() ); |
|
1896 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
1895 | + $reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug()); |
|
1896 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
1897 | 1897 | // so it **looks** like this is a double request from PayPal |
1898 | 1898 | // so let's try to pick up where we left off |
1899 | 1899 | $this->checkout->transaction = $valid_TXN; |
1900 | - $this->checkout->refresh_all_entities( true ); |
|
1900 | + $this->checkout->refresh_all_entities(true); |
|
1901 | 1901 | return; |
1902 | 1902 | } |
1903 | 1903 | } |
1904 | 1904 | // you appear to be lost? |
1905 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
1905 | + $this->_redirect_wayward_request($primary_registrant); |
|
1906 | 1906 | } |
1907 | 1907 | } |
1908 | 1908 | } |
@@ -1916,16 +1916,16 @@ discard block |
||
1916 | 1916 | * @param \EE_Registration $primary_registrant |
1917 | 1917 | * @return bool |
1918 | 1918 | */ |
1919 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
1920 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1919 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
1920 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1921 | 1921 | // try redirecting based on the current TXN |
1922 | 1922 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null; |
1923 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1923 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1924 | 1924 | EE_Error::add_error( |
1925 | 1925 | sprintf( |
1926 | - __( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1926 | + __('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1927 | 1927 | '<br/>', |
1928 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1928 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1929 | 1929 | ), |
1930 | 1930 | __FILE__, __FUNCTION__, __LINE__ |
1931 | 1931 | ); |
@@ -1953,16 +1953,16 @@ discard block |
||
1953 | 1953 | * @param \EE_Offsite_Gateway $gateway |
1954 | 1954 | * @return \EE_Payment |
1955 | 1955 | */ |
1956 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
1956 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
1957 | 1957 | try { |
1958 | 1958 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
1959 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
1959 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
1960 | 1960 | $payment = $this->checkout->transaction->last_payment(); |
1961 | 1961 | //$payment_source = 'last_payment'; |
1962 | 1962 | } else { |
1963 | 1963 | // get payment details and process results |
1964 | 1964 | /** @type EE_Payment_Processor $payment_processor */ |
1965 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1965 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1966 | 1966 | $payment = $payment_processor->process_ipn( |
1967 | 1967 | $_REQUEST, |
1968 | 1968 | $this->checkout->transaction, |
@@ -1972,14 +1972,14 @@ discard block |
||
1972 | 1972 | ); |
1973 | 1973 | //$payment_source = 'process_ipn'; |
1974 | 1974 | } |
1975 | - } catch ( Exception $e ) { |
|
1975 | + } catch (Exception $e) { |
|
1976 | 1976 | // let's just eat the exception and try to move on using any previously set payment info |
1977 | 1977 | $payment = $this->checkout->transaction->last_payment(); |
1978 | 1978 | //$payment_source = 'last_payment after Exception'; |
1979 | 1979 | // but if we STILL don't have a payment object |
1980 | - if ( ! $payment instanceof EE_Payment ) { |
|
1980 | + if ( ! $payment instanceof EE_Payment) { |
|
1981 | 1981 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
1982 | - $this->_handle_payment_processor_exception( $e ); |
|
1982 | + $this->_handle_payment_processor_exception($e); |
|
1983 | 1983 | } |
1984 | 1984 | } |
1985 | 1985 | // DEBUG LOG |
@@ -2003,13 +2003,13 @@ discard block |
||
2003 | 2003 | * @param EE_Payment $payment |
2004 | 2004 | * @return EE_Payment | FALSE |
2005 | 2005 | */ |
2006 | - private function _process_cancelled_payments( $payment = NULL ) { |
|
2006 | + private function _process_cancelled_payments($payment = NULL) { |
|
2007 | 2007 | if ( |
2008 | - isset( $_REQUEST[ 'ee_cancel_payment' ] ) |
|
2008 | + isset($_REQUEST['ee_cancel_payment']) |
|
2009 | 2009 | && $payment instanceof EE_Payment |
2010 | 2010 | && $payment->status() == EEM_Payment::status_id_failed |
2011 | 2011 | ) { |
2012 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
2012 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
2013 | 2013 | } |
2014 | 2014 | return $payment; |
2015 | 2015 | } |
@@ -2026,23 +2026,23 @@ discard block |
||
2026 | 2026 | public function get_transaction_details_for_gateways() { |
2027 | 2027 | $txn_details = array(); |
2028 | 2028 | // ya gotta make a choice man |
2029 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
2029 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
2030 | 2030 | $txn_details = array( |
2031 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
2031 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
2032 | 2032 | ); |
2033 | 2033 | } |
2034 | 2034 | // get EE_Payment_Method object |
2035 | 2035 | if ( |
2036 | - empty( $txn_details ) && |
|
2036 | + empty($txn_details) && |
|
2037 | 2037 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
2038 | 2038 | ) { |
2039 | 2039 | $txn_details = array( |
2040 | 2040 | 'selected_method_of_payment' => $this->checkout->selected_method_of_payment, |
2041 | - 'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' ) |
|
2041 | + 'error' => __('A valid Payment Method could not be determined.', 'event_espresso') |
|
2042 | 2042 | ); |
2043 | 2043 | } |
2044 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
2045 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
2044 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
2045 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
2046 | 2046 | $txn_details = array( |
2047 | 2047 | 'TXN_ID' => $this->checkout->transaction->ID(), |
2048 | 2048 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -2053,7 +2053,7 @@ discard block |
||
2053 | 2053 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
2054 | 2054 | 'payment_amount' => $this->checkout->amount_owing, |
2055 | 2055 | 'return_url' => $return_url, |
2056 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
2056 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
2057 | 2057 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
2058 | 2058 | array( |
2059 | 2059 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -2062,7 +2062,7 @@ discard block |
||
2062 | 2062 | ) |
2063 | 2063 | ); |
2064 | 2064 | } |
2065 | - echo json_encode( $txn_details ); |
|
2065 | + echo json_encode($txn_details); |
|
2066 | 2066 | exit(); |
2067 | 2067 | } |
2068 | 2068 |