@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | /** |
278 | 278 | * @param $REG_ID |
279 | - * @param $reg_status |
|
279 | + * @param boolean $reg_status |
|
280 | 280 | */ |
281 | 281 | public function set_reg_status_updated( $REG_ID, $reg_status ) { |
282 | 282 | $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
@@ -1110,6 +1110,7 @@ discard block |
||
1110 | 1110 | * |
1111 | 1111 | * @param string | int $reg_cache_ID |
1112 | 1112 | * @param EE_Registration $registration |
1113 | + * @param integer $reg_cache_ID |
|
1113 | 1114 | * @return void |
1114 | 1115 | * @throws \EE_Error |
1115 | 1116 | */ |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Checkout |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Checkout |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_Checkout { |
15 | 15 | |
16 | 16 | /** |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE ); |
251 | 251 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax; |
252 | 252 | $this->reg_cache_where_params = array( |
253 | - 0 => array( 'REG_deleted' => false ), |
|
254 | - 'order_by' => array( 'REG_count' => 'ASC' ) |
|
255 | - ); |
|
253 | + 0 => array( 'REG_deleted' => false ), |
|
254 | + 'order_by' => array( 'REG_count' => 'ASC' ) |
|
255 | + ); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -807,10 +807,10 @@ discard block |
||
807 | 807 | */ |
808 | 808 | public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
809 | 809 | return ! $this->revisit |
810 | - || $this->primary_revisit |
|
811 | - || ( |
|
812 | - $this->revisit && $this->reg_url_link === $registration->reg_url_link() |
|
813 | - ) |
|
810 | + || $this->primary_revisit |
|
811 | + || ( |
|
812 | + $this->revisit && $this->reg_url_link === $registration->reg_url_link() |
|
813 | + ) |
|
814 | 814 | ? true |
815 | 815 | : false; |
816 | 816 | } |
@@ -1202,16 +1202,16 @@ discard block |
||
1202 | 1202 | * @return array |
1203 | 1203 | * @throws \EE_Error |
1204 | 1204 | */ |
1205 | - public function __sleep() |
|
1206 | - { |
|
1207 | - if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) { |
|
1208 | - $this->primary_attendee_obj = $this->primary_attendee_obj->ID(); |
|
1209 | - } // remove the reg form and the checkout |
|
1210 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1211 | - $this->transaction = $this->transaction->ID(); |
|
1212 | - } // remove the reg form and the checkout |
|
1213 | - return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) ); |
|
1214 | - } |
|
1205 | + public function __sleep() |
|
1206 | + { |
|
1207 | + if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) { |
|
1208 | + $this->primary_attendee_obj = $this->primary_attendee_obj->ID(); |
|
1209 | + } // remove the reg form and the checkout |
|
1210 | + if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1211 | + $this->transaction = $this->transaction->ID(); |
|
1212 | + } // remove the reg form and the checkout |
|
1213 | + return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) ); |
|
1214 | + } |
|
1215 | 1215 | |
1216 | 1216 | |
1217 | 1217 | /** |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | $this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url(); |
248 | 248 | $this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url(); |
249 | 249 | $this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url(); |
250 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE ); |
|
250 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE); |
|
251 | 251 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax; |
252 | 252 | $this->reg_cache_where_params = array( |
253 | - 0 => array( 'REG_deleted' => false ), |
|
254 | - 'order_by' => array( 'REG_count' => 'ASC' ) |
|
253 | + 0 => array('REG_deleted' => false), |
|
254 | + 'order_by' => array('REG_count' => 'ASC') |
|
255 | 255 | ); |
256 | 256 | } |
257 | 257 | |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | * @return boolean |
264 | 264 | */ |
265 | 265 | public function any_reg_status_updated() { |
266 | - foreach ( $this->reg_status_updated as $reg_status ) { |
|
267 | - if ( $reg_status ) { |
|
266 | + foreach ($this->reg_status_updated as $reg_status) { |
|
267 | + if ($reg_status) { |
|
268 | 268 | return true; |
269 | 269 | } |
270 | 270 | } |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | * @param $REG_ID |
278 | 278 | * @return boolean |
279 | 279 | */ |
280 | - public function reg_status_updated( $REG_ID ) { |
|
281 | - return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false; |
|
280 | + public function reg_status_updated($REG_ID) { |
|
281 | + return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | * @param $REG_ID |
288 | 288 | * @param $reg_status |
289 | 289 | */ |
290 | - public function set_reg_status_updated( $REG_ID, $reg_status ) { |
|
291 | - $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
|
290 | + public function set_reg_status_updated($REG_ID, $reg_status) { |
|
291 | + $this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * can ONLY be set by the Finalize_Registration reg step |
310 | 310 | */ |
311 | 311 | public function set_exit_spco() { |
312 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
312 | + if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
313 | 313 | $this->exit_spco = true; |
314 | 314 | } |
315 | 315 | } |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function reset_for_current_request() { |
328 | 328 | $this->process_form_submission = FALSE; |
329 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true ); |
|
329 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true); |
|
330 | 330 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
331 | 331 | $this->continue_reg = true; |
332 | 332 | $this->redirect = false; |
333 | 333 | // don't reset the cached redirect form if we're about to be asked to display it !!! |
334 | - if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) { |
|
334 | + if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') { |
|
335 | 335 | $this->redirect_form = ''; |
336 | 336 | } |
337 | 337 | $this->redirect_url = ''; |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | * @param EE_SPCO_Reg_Step $reg_step_obj |
349 | 349 | * @return void |
350 | 350 | */ |
351 | - public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
|
352 | - $this->reg_steps[ $reg_step_obj->slug() ] = $reg_step_obj; |
|
351 | + public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) { |
|
352 | + $this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
@@ -365,22 +365,22 @@ discard block |
||
365 | 365 | * @return void |
366 | 366 | * @throws \EE_Error |
367 | 367 | */ |
368 | - public function skip_reg_step( $reg_step_slug = '' ) { |
|
369 | - $step_to_skip = $this->find_reg_step( $reg_step_slug ); |
|
370 | - if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) { |
|
371 | - $step_to_skip->set_is_current_step( false ); |
|
368 | + public function skip_reg_step($reg_step_slug = '') { |
|
369 | + $step_to_skip = $this->find_reg_step($reg_step_slug); |
|
370 | + if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) { |
|
371 | + $step_to_skip->set_is_current_step(false); |
|
372 | 372 | $step_to_skip->set_completed(); |
373 | 373 | // advance to the next step |
374 | - $this->set_current_step( $this->next_step->slug() ); |
|
374 | + $this->set_current_step($this->next_step->slug()); |
|
375 | 375 | // also reset the step param in the request in case any other code references that directly |
376 | - EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() ); |
|
376 | + EE_Registry::instance()->REQ->set('step', $this->current_step->slug()); |
|
377 | 377 | // since we are skipping a step and setting the current step to be what was previously the next step, |
378 | 378 | // we need to check that the next step is now correct, and not still set to the current step. |
379 | - if ( $this->current_step->slug() === $this->next_step->slug() ) { |
|
379 | + if ($this->current_step->slug() === $this->next_step->slug()) { |
|
380 | 380 | // correctly setup the next step |
381 | 381 | $this->set_next_step(); |
382 | 382 | } |
383 | - $this->set_reg_step_initiated( $this->current_step ); |
|
383 | + $this->set_reg_step_initiated($this->current_step); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
@@ -394,14 +394,14 @@ discard block |
||
394 | 394 | * @param bool $reset whether to reset reg steps after removal |
395 | 395 | * @throws EE_Error |
396 | 396 | */ |
397 | - public function remove_reg_step( $reg_step_slug = '', $reset = true ) { |
|
398 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
399 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
397 | + public function remove_reg_step($reg_step_slug = '', $reset = true) { |
|
398 | + unset($this->reg_steps[$reg_step_slug]); |
|
399 | + if ($this->transaction instanceof EE_Transaction) { |
|
400 | 400 | // now remove reg step from TXN and save |
401 | - $this->transaction->remove_reg_step( $reg_step_slug ); |
|
401 | + $this->transaction->remove_reg_step($reg_step_slug); |
|
402 | 402 | $this->transaction->save(); |
403 | 403 | } |
404 | - if ( $reset ) { |
|
404 | + if ($reset) { |
|
405 | 405 | $this->reset_reg_steps(); |
406 | 406 | } |
407 | 407 | } |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | * @param int $order |
417 | 417 | * @return void |
418 | 418 | */ |
419 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
420 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
421 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
419 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
420 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
421 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
@@ -431,25 +431,25 @@ discard block |
||
431 | 431 | * @param string $current_step |
432 | 432 | * @return void |
433 | 433 | */ |
434 | - public function set_current_step( $current_step ) { |
|
434 | + public function set_current_step($current_step) { |
|
435 | 435 | // grab what step we're on |
436 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
436 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
437 | 437 | // verify instance |
438 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
438 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
439 | 439 | // we don't want to repeat completed steps if this is the first time through SPCO |
440 | - if ( $this->continue_reg && ! $this->revisit && $this->current_step->completed() ) { |
|
440 | + if ($this->continue_reg && ! $this->revisit && $this->current_step->completed()) { |
|
441 | 441 | // so advance to the next step |
442 | 442 | $this->set_next_step(); |
443 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
443 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
444 | 444 | // and attempt to set it as the current step |
445 | - $this->set_current_step( $this->next_step->slug() ); |
|
445 | + $this->set_current_step($this->next_step->slug()); |
|
446 | 446 | } |
447 | 447 | return; |
448 | 448 | } |
449 | - $this->current_step->set_is_current_step( TRUE ); |
|
449 | + $this->current_step->set_is_current_step(TRUE); |
|
450 | 450 | } else { |
451 | 451 | EE_Error::add_error( |
452 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
452 | + __('The current step could not be set.', 'event_espresso'), |
|
453 | 453 | __FILE__, __FUNCTION__, __LINE__ |
454 | 454 | ); |
455 | 455 | } |
@@ -466,20 +466,20 @@ discard block |
||
466 | 466 | */ |
467 | 467 | public function set_next_step() { |
468 | 468 | // set pointer to start of array |
469 | - reset( $this->reg_steps ); |
|
469 | + reset($this->reg_steps); |
|
470 | 470 | // if there is more than one step |
471 | - if ( count( $this->reg_steps ) > 1 ) { |
|
471 | + if (count($this->reg_steps) > 1) { |
|
472 | 472 | // advance to the current step and set pointer |
473 | - while ( key( $this->reg_steps ) !== $this->current_step->slug() && key( $this->reg_steps ) !== '' ) { |
|
474 | - next( $this->reg_steps ); |
|
473 | + while (key($this->reg_steps) !== $this->current_step->slug() && key($this->reg_steps) !== '') { |
|
474 | + next($this->reg_steps); |
|
475 | 475 | } |
476 | 476 | } |
477 | 477 | // advance one more spot ( if it exists ) |
478 | - $this->next_step = next( $this->reg_steps ); |
|
478 | + $this->next_step = next($this->reg_steps); |
|
479 | 479 | // verify instance |
480 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
480 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
481 | 481 | // then back to current step to reset |
482 | - prev( $this->reg_steps ); |
|
482 | + prev($this->reg_steps); |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | |
@@ -493,8 +493,8 @@ discard block |
||
493 | 493 | * @return EE_SPCO_Reg_Step | null |
494 | 494 | */ |
495 | 495 | public function get_next_reg_step() { |
496 | - $next = next( $this->reg_steps ); |
|
497 | - prev( $this->reg_steps ); |
|
496 | + $next = next($this->reg_steps); |
|
497 | + prev($this->reg_steps); |
|
498 | 498 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
499 | 499 | } |
500 | 500 | |
@@ -509,8 +509,8 @@ discard block |
||
509 | 509 | * @return EE_SPCO_Reg_Step | null |
510 | 510 | */ |
511 | 511 | public function get_prev_reg_step() { |
512 | - $prev = prev( $this->reg_steps ); |
|
513 | - next( $this->reg_steps ); |
|
512 | + $prev = prev($this->reg_steps); |
|
513 | + next($this->reg_steps); |
|
514 | 514 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
515 | 515 | } |
516 | 516 | |
@@ -523,8 +523,8 @@ discard block |
||
523 | 523 | * @return void |
524 | 524 | */ |
525 | 525 | public function sort_reg_steps() { |
526 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
527 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
526 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
527 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | |
@@ -537,19 +537,19 @@ discard block |
||
537 | 537 | * @param string $reg_step_slug |
538 | 538 | * @return EE_SPCO_Reg_Step|null |
539 | 539 | */ |
540 | - public function find_reg_step( $reg_step_slug = '' ) { |
|
541 | - if ( ! empty( $reg_step_slug ) ) { |
|
540 | + public function find_reg_step($reg_step_slug = '') { |
|
541 | + if ( ! empty($reg_step_slug)) { |
|
542 | 542 | // copy reg step array |
543 | 543 | $reg_steps = $this->reg_steps; |
544 | 544 | // set pointer to start of array |
545 | - reset( $reg_steps ); |
|
545 | + reset($reg_steps); |
|
546 | 546 | // if there is more than one step |
547 | - if ( count( $reg_steps ) > 1 ) { |
|
547 | + if (count($reg_steps) > 1) { |
|
548 | 548 | // advance to the current step and set pointer |
549 | - while ( key( $reg_steps ) !== $reg_step_slug && key( $reg_steps ) !== '' ) { |
|
550 | - next( $reg_steps ); |
|
549 | + while (key($reg_steps) !== $reg_step_slug && key($reg_steps) !== '') { |
|
550 | + next($reg_steps); |
|
551 | 551 | } |
552 | - return current( $reg_steps ); |
|
552 | + return current($reg_steps); |
|
553 | 553 | } |
554 | 554 | } |
555 | 555 | return null; |
@@ -565,17 +565,17 @@ discard block |
||
565 | 565 | * @param EE_SPCO_Reg_Step $reg_step_B |
566 | 566 | * @return int |
567 | 567 | */ |
568 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
568 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
569 | 569 | // send finalize_registration step to the end of the array |
570 | - if ( $reg_step_A->slug() === 'finalize_registration' ) { |
|
570 | + if ($reg_step_A->slug() === 'finalize_registration') { |
|
571 | 571 | return 1; |
572 | - } else if ( $reg_step_B->slug() === 'finalize_registration' ) { |
|
572 | + } else if ($reg_step_B->slug() === 'finalize_registration') { |
|
573 | 573 | return -1; |
574 | 574 | } |
575 | - if ( $reg_step_A->order() === $reg_step_B->order() ) { |
|
575 | + if ($reg_step_A->order() === $reg_step_B->order()) { |
|
576 | 576 | return 0; |
577 | 577 | } |
578 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
578 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | * @param EE_SPCO_Reg_Step $reg_step |
588 | 588 | * @throws \EE_Error |
589 | 589 | */ |
590 | - public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) { |
|
590 | + public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) { |
|
591 | 591 | // call set_reg_step_initiated ??? |
592 | 592 | if ( |
593 | 593 | // first time visiting SPCO ? |
@@ -600,11 +600,11 @@ discard block |
||
600 | 600 | ) |
601 | 601 | ) { |
602 | 602 | // set the start time for this reg step |
603 | - if ( ! $this->transaction->set_reg_step_initiated( $reg_step->slug() ) ) { |
|
604 | - if ( WP_DEBUG ) { |
|
603 | + if ( ! $this->transaction->set_reg_step_initiated($reg_step->slug())) { |
|
604 | + if (WP_DEBUG) { |
|
605 | 605 | EE_Error::add_error( |
606 | 606 | sprintf( |
607 | - __( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), |
|
607 | + __('The "%1$s" registration step was not initialized properly.', 'event_espresso'), |
|
608 | 608 | $reg_step->name() |
609 | 609 | ), |
610 | 610 | __FILE__, __FUNCTION__, __LINE__ |
@@ -623,10 +623,10 @@ discard block |
||
623 | 623 | * @return void |
624 | 624 | */ |
625 | 625 | public function set_reg_step_JSON_info() { |
626 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
626 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
627 | 627 | // pass basic reg step data to JS |
628 | - foreach ( $this->reg_steps as $reg_step ) { |
|
629 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
628 | + foreach ($this->reg_steps as $reg_step) { |
|
629 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
630 | 630 | } |
631 | 631 | // reset reg step html |
632 | 632 | // $this->json_response->set_reg_step_html( '' ); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | */ |
643 | 643 | public function reset_reg_steps() { |
644 | 644 | $this->sort_reg_steps(); |
645 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
645 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
646 | 646 | $this->set_next_step(); |
647 | 647 | // the text that appears on the reg step form submit button |
648 | 648 | $this->current_step->set_submit_button_text(); |
@@ -659,9 +659,9 @@ discard block |
||
659 | 659 | */ |
660 | 660 | public function get_registration_time_limit() { |
661 | 661 | |
662 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
662 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
663 | 663 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
664 | - $registration_time_limit = date( $time_limit_format, $registration_time_limit ); |
|
664 | + $registration_time_limit = date($time_limit_format, $registration_time_limit); |
|
665 | 665 | return apply_filters( |
666 | 666 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
667 | 667 | $registration_time_limit |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | // overpaid TXN |
682 | 682 | // free TXN ( total = 0.00 ) |
683 | 683 | // then payment required is TRUE |
684 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
684 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -693,12 +693,12 @@ discard block |
||
693 | 693 | * @param EE_Transaction $transaction |
694 | 694 | * @return EE_Cart |
695 | 695 | */ |
696 | - public function get_cart_for_transaction( $transaction ) { |
|
697 | - $session = EE_Registry::instance()->load_core( 'Session' ); |
|
698 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction, $session ) : null; |
|
696 | + public function get_cart_for_transaction($transaction) { |
|
697 | + $session = EE_Registry::instance()->load_core('Session'); |
|
698 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction, $session) : null; |
|
699 | 699 | // verify cart |
700 | - if ( ! $cart instanceof EE_Cart ) { |
|
701 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
700 | + if ( ! $cart instanceof EE_Cart) { |
|
701 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
702 | 702 | } |
703 | 703 | |
704 | 704 | return $cart; |
@@ -714,8 +714,8 @@ discard block |
||
714 | 714 | */ |
715 | 715 | public function initialize_txn_reg_steps_array() { |
716 | 716 | $txn_reg_steps_array = array(); |
717 | - foreach ( $this->reg_steps as $reg_step ) { |
|
718 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
717 | + foreach ($this->reg_steps as $reg_step) { |
|
718 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
719 | 719 | } |
720 | 720 | return $txn_reg_steps_array; |
721 | 721 | } |
@@ -731,14 +731,14 @@ discard block |
||
731 | 731 | */ |
732 | 732 | public function update_txn_reg_steps_array() { |
733 | 733 | $updated = false; |
734 | - foreach ( $this->reg_steps as $reg_step ) { |
|
735 | - if ( $reg_step->completed() ) { |
|
736 | - $updated = $this->transaction->set_reg_step_completed( $reg_step->slug() ) |
|
734 | + foreach ($this->reg_steps as $reg_step) { |
|
735 | + if ($reg_step->completed()) { |
|
736 | + $updated = $this->transaction->set_reg_step_completed($reg_step->slug()) |
|
737 | 737 | ? true |
738 | 738 | : $updated; |
739 | 739 | } |
740 | 740 | } |
741 | - if ( $updated ) { |
|
741 | + if ($updated) { |
|
742 | 742 | $this->transaction->save(); |
743 | 743 | } |
744 | 744 | return $updated; |
@@ -754,14 +754,14 @@ discard block |
||
754 | 754 | * @throws \EE_Error |
755 | 755 | */ |
756 | 756 | public function stash_transaction_and_checkout() { |
757 | - if ( ! $this->revisit ) { |
|
757 | + if ( ! $this->revisit) { |
|
758 | 758 | $this->update_txn_reg_steps_array(); |
759 | 759 | } |
760 | 760 | $this->track_transaction_and_registration_status_updates(); |
761 | 761 | // save all data to the db, but suppress errors |
762 | 762 | //$this->save_all_data( FALSE ); |
763 | 763 | // cache the checkout in the session |
764 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
764 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | |
@@ -776,15 +776,15 @@ discard block |
||
776 | 776 | */ |
777 | 777 | public function track_transaction_and_registration_status_updates() { |
778 | 778 | // verify the transaction |
779 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
779 | + if ($this->transaction instanceof EE_Transaction) { |
|
780 | 780 | // has there been a TXN status change during this checkout? |
781 | 781 | $this->txn_status_updated = $this->transaction->txn_status_updated(); |
782 | 782 | /** @type EE_Registration_Processor $registration_processor */ |
783 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
783 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
784 | 784 | // grab the saved registrations from the transaction |
785 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
786 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
787 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
785 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
786 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
787 | + $this->set_reg_status_updated($registration->ID(), true); |
|
788 | 788 | } |
789 | 789 | } |
790 | 790 | } |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | * @return bool |
806 | 806 | * @throws \EE_Error |
807 | 807 | */ |
808 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
808 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
809 | 809 | return ! $this->revisit |
810 | 810 | || $this->primary_revisit |
811 | 811 | || ( |
@@ -838,18 +838,18 @@ discard block |
||
838 | 838 | * @return bool |
839 | 839 | * @throws \EE_Error |
840 | 840 | */ |
841 | - public function save_all_data( $show_errors = TRUE ) { |
|
841 | + public function save_all_data($show_errors = TRUE) { |
|
842 | 842 | // verify the transaction |
843 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
843 | + if ($this->transaction instanceof EE_Transaction) { |
|
844 | 844 | // save to ensure that TXN has ID |
845 | 845 | $this->transaction->save(); |
846 | 846 | // grab the saved registrations from the transaction |
847 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
848 | - $this->_save_registration( $registration, $show_errors ); |
|
847 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
848 | + $this->_save_registration($registration, $show_errors); |
|
849 | 849 | } |
850 | 850 | } else { |
851 | - if ( $show_errors ) { |
|
852 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
851 | + if ($show_errors) { |
|
852 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
853 | 853 | } |
854 | 854 | return FALSE; |
855 | 855 | } |
@@ -866,32 +866,32 @@ discard block |
||
866 | 866 | * @return void |
867 | 867 | * @throws \EE_Error |
868 | 868 | */ |
869 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
869 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
870 | 870 | // verify object |
871 | - if ( $registration instanceof EE_Registration ) { |
|
871 | + if ($registration instanceof EE_Registration) { |
|
872 | 872 | // should this registration be processed during this visit ? |
873 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
873 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
874 | 874 | //set TXN ID |
875 | - if ( ! $registration->transaction_ID() ) { |
|
876 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
875 | + if ( ! $registration->transaction_ID()) { |
|
876 | + $registration->set_transaction_id($this->transaction->ID()); |
|
877 | 877 | } |
878 | 878 | // verify and save the attendee |
879 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
879 | + $this->_save_registration_attendee($registration, $show_errors); |
|
880 | 880 | // save answers to reg form questions |
881 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
881 | + $this->_save_registration_answers($registration, $show_errors); |
|
882 | 882 | // save changes |
883 | 883 | $registration->save(); |
884 | 884 | // update txn cache |
885 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
886 | - if ( $show_errors ) { |
|
887 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
885 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
886 | + if ($show_errors) { |
|
887 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
888 | 888 | } |
889 | 889 | } |
890 | 890 | } |
891 | 891 | } else { |
892 | - if ( $show_errors ) { |
|
892 | + if ($show_errors) { |
|
893 | 893 | EE_Error::add_error( |
894 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
894 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
895 | 895 | __FILE__, __FUNCTION__, __LINE__ |
896 | 896 | ); |
897 | 897 | } |
@@ -908,25 +908,25 @@ discard block |
||
908 | 908 | * @return void |
909 | 909 | * @throws \EE_Error |
910 | 910 | */ |
911 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
912 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
911 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
912 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
913 | 913 | // save so that ATT has ID |
914 | 914 | $registration->attendee()->save(); |
915 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() ) ) { |
|
916 | - if ( $show_errors ) { |
|
915 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
916 | + if ($show_errors) { |
|
917 | 917 | EE_Error::add_error( |
918 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
918 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
919 | 919 | __FILE__, __FUNCTION__, __LINE__ |
920 | 920 | ); |
921 | 921 | } |
922 | 922 | } |
923 | 923 | } else { |
924 | - if ( $show_errors ) { |
|
924 | + if ($show_errors) { |
|
925 | 925 | EE_Error::add_error( |
926 | 926 | sprintf( |
927 | 927 | '%1$s||%1$s $attendee = %2$s', |
928 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
929 | - var_export( $registration->attendee(), true ) |
|
928 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
929 | + var_export($registration->attendee(), true) |
|
930 | 930 | ), |
931 | 931 | __FILE__, __FUNCTION__, __LINE__ |
932 | 932 | ); |
@@ -944,25 +944,25 @@ discard block |
||
944 | 944 | * @return void |
945 | 945 | * @throws \EE_Error |
946 | 946 | */ |
947 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
947 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
948 | 948 | // now save the answers |
949 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
949 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
950 | 950 | // verify object |
951 | - if ( $answer instanceof EE_Answer ) { |
|
952 | - $answer->set_registration( $registration->ID() ); |
|
951 | + if ($answer instanceof EE_Answer) { |
|
952 | + $answer->set_registration($registration->ID()); |
|
953 | 953 | $answer->save(); |
954 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
955 | - if ( $show_errors ) { |
|
954 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
955 | + if ($show_errors) { |
|
956 | 956 | EE_Error::add_error( |
957 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
957 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
958 | 958 | __FILE__, __FUNCTION__, __LINE__ |
959 | 959 | ); |
960 | 960 | } |
961 | 961 | } |
962 | 962 | } else { |
963 | - if ( $show_errors ) { |
|
963 | + if ($show_errors) { |
|
964 | 964 | EE_Error::add_error( |
965 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
965 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
966 | 966 | __FILE__, __FUNCTION__, __LINE__ |
967 | 967 | ); |
968 | 968 | } |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | * @return bool |
982 | 982 | * @throws \EE_Error |
983 | 983 | */ |
984 | - public function refresh_all_entities( $from_db = false ) { |
|
984 | + public function refresh_all_entities($from_db = false) { |
|
985 | 985 | $from_db = $this->current_step->is_final_step() || $this->action === 'process_gateway_response' |
986 | 986 | ? true |
987 | 987 | : $from_db; |
@@ -1005,11 +1005,11 @@ discard block |
||
1005 | 1005 | */ |
1006 | 1006 | protected function refresh_from_db() { |
1007 | 1007 | // verify the transaction |
1008 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1008 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1009 | 1009 | // pull fresh TXN data from the db |
1010 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
1010 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
1011 | 1011 | // update EE_Checkout's cached primary_attendee object |
1012 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
1012 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
1013 | 1013 | // update EE_Checkout's cached payment object |
1014 | 1014 | $payment = $this->transaction->last_payment(); |
1015 | 1015 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -1017,9 +1017,9 @@ discard block |
||
1017 | 1017 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
1018 | 1018 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
1019 | 1019 | //now refresh the cart, based on the TXN |
1020 | - $this->cart = $this->get_cart_for_transaction( $this->transaction ); |
|
1020 | + $this->cart = $this->get_cart_for_transaction($this->transaction); |
|
1021 | 1021 | } else { |
1022 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1022 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1023 | 1023 | return FALSE; |
1024 | 1024 | } |
1025 | 1025 | return TRUE; |
@@ -1034,21 +1034,21 @@ discard block |
||
1034 | 1034 | * @return EE_Attendee | null |
1035 | 1035 | * @throws \EE_Error |
1036 | 1036 | */ |
1037 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
1037 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
1038 | 1038 | |
1039 | 1039 | $primary_attendee_obj = null; |
1040 | 1040 | // grab the saved registrations from the transaction |
1041 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
1041 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
1042 | 1042 | // verify object |
1043 | - if ( $registration instanceof EE_Registration ) { |
|
1043 | + if ($registration instanceof EE_Registration) { |
|
1044 | 1044 | $attendee = $registration->attendee(); |
1045 | 1045 | // verify object && maybe cache primary_attendee_obj ? |
1046 | - if ( $attendee instanceof EE_Attendee&& $registration->is_primary_registrant() ) { |
|
1046 | + if ($attendee instanceof EE_Attendee && $registration->is_primary_registrant()) { |
|
1047 | 1047 | $primary_attendee_obj = $attendee; |
1048 | 1048 | } |
1049 | 1049 | } else { |
1050 | 1050 | EE_Error::add_error( |
1051 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1051 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1052 | 1052 | __FILE__, __FUNCTION__, __LINE__ |
1053 | 1053 | ); |
1054 | 1054 | } |
@@ -1069,43 +1069,43 @@ discard block |
||
1069 | 1069 | */ |
1070 | 1070 | protected function refresh_entity_map() { |
1071 | 1071 | // verify the transaction |
1072 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1072 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1073 | 1073 | // never cache payment info |
1074 | - $this->transaction->clear_cache( 'Payment' ); |
|
1074 | + $this->transaction->clear_cache('Payment'); |
|
1075 | 1075 | // is the Payment Options Reg Step completed ? |
1076 | - if ( $this->transaction->reg_step_completed( 'payment_options' ) ) { |
|
1076 | + if ($this->transaction->reg_step_completed('payment_options')) { |
|
1077 | 1077 | // then check for payments and update TXN accordingly |
1078 | 1078 | /** @type EE_Transaction_Payments $transaction_payments */ |
1079 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1080 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
1079 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1080 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
1081 | 1081 | } |
1082 | 1082 | // grab the saved registrations from the transaction |
1083 | 1083 | foreach ( |
1084 | - $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration |
|
1084 | + $this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration |
|
1085 | 1085 | ) { |
1086 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
1086 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
1087 | 1087 | } |
1088 | 1088 | // make sure our cached TXN is added to the model entity mapper |
1089 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
1089 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
1090 | 1090 | |
1091 | 1091 | } else { |
1092 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1092 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1093 | 1093 | return FALSE; |
1094 | 1094 | } |
1095 | 1095 | // verify and update the cart because inaccurate totals are not so much fun |
1096 | - if ( $this->cart instanceof EE_Cart ) { |
|
1096 | + if ($this->cart instanceof EE_Cart) { |
|
1097 | 1097 | $grand_total = $this->cart->get_grand_total(); |
1098 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
1098 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
1099 | 1099 | $grand_total->recalculate_total_including_taxes(); |
1100 | 1100 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
1101 | 1101 | $this->cart->get_grand_total()->ID(), |
1102 | 1102 | $this->cart->get_grand_total() |
1103 | 1103 | ); |
1104 | 1104 | } |
1105 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
1106 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
1105 | + if ($grand_total instanceof EE_Line_Item) { |
|
1106 | + $this->cart = EE_Cart::instance($grand_total); |
|
1107 | 1107 | } else { |
1108 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1108 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1109 | 1109 | return false; |
1110 | 1110 | } |
1111 | 1111 | } |
@@ -1122,19 +1122,19 @@ discard block |
||
1122 | 1122 | * @return void |
1123 | 1123 | * @throws \EE_Error |
1124 | 1124 | */ |
1125 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
1125 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
1126 | 1126 | |
1127 | 1127 | // verify object |
1128 | - if ( $registration instanceof EE_Registration ) { |
|
1128 | + if ($registration instanceof EE_Registration) { |
|
1129 | 1129 | // update the entity mapper attendee |
1130 | - $this->_refresh_registration_attendee( $registration ); |
|
1130 | + $this->_refresh_registration_attendee($registration); |
|
1131 | 1131 | // update the entity mapper answers for reg form questions |
1132 | - $this->_refresh_registration_answers( $registration ); |
|
1132 | + $this->_refresh_registration_answers($registration); |
|
1133 | 1133 | // make sure the cached registration is added to the model entity mapper |
1134 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1134 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1135 | 1135 | } else { |
1136 | 1136 | EE_Error::add_error( |
1137 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1137 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1138 | 1138 | __FILE__, __FUNCTION__, __LINE__ |
1139 | 1139 | ); |
1140 | 1140 | } |
@@ -1149,15 +1149,15 @@ discard block |
||
1149 | 1149 | * @return void |
1150 | 1150 | * @throws \EE_Error |
1151 | 1151 | */ |
1152 | - protected function _refresh_registration_attendee( $registration ) { |
|
1152 | + protected function _refresh_registration_attendee($registration) { |
|
1153 | 1153 | |
1154 | 1154 | $attendee = $registration->attendee(); |
1155 | 1155 | // verify object |
1156 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1156 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1157 | 1157 | // make sure the cached attendee is added to the model entity mapper |
1158 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1158 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1159 | 1159 | // maybe cache primary_attendee_obj ? |
1160 | - if ( $registration->is_primary_registrant() ) { |
|
1160 | + if ($registration->is_primary_registrant()) { |
|
1161 | 1161 | $this->primary_attendee_obj = $attendee; |
1162 | 1162 | } |
1163 | 1163 | } |
@@ -1172,19 +1172,19 @@ discard block |
||
1172 | 1172 | * @return void |
1173 | 1173 | * @throws \EE_Error |
1174 | 1174 | */ |
1175 | - protected function _refresh_registration_answers( $registration ) { |
|
1175 | + protected function _refresh_registration_answers($registration) { |
|
1176 | 1176 | |
1177 | 1177 | // now update the answers |
1178 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1178 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1179 | 1179 | // verify object |
1180 | - if ( $answer instanceof EE_Answer ) { |
|
1181 | - if ( $answer->ID() ) { |
|
1180 | + if ($answer instanceof EE_Answer) { |
|
1181 | + if ($answer->ID()) { |
|
1182 | 1182 | // make sure the cached answer is added to the model entity mapper |
1183 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1183 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1184 | 1184 | } |
1185 | 1185 | } else { |
1186 | 1186 | EE_Error::add_error( |
1187 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1187 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1188 | 1188 | __FILE__, __FUNCTION__, __LINE__ |
1189 | 1189 | ); |
1190 | 1190 | } |
@@ -1204,13 +1204,13 @@ discard block |
||
1204 | 1204 | */ |
1205 | 1205 | public function __sleep() |
1206 | 1206 | { |
1207 | - if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) { |
|
1207 | + if ($this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID()) { |
|
1208 | 1208 | $this->primary_attendee_obj = $this->primary_attendee_obj->ID(); |
1209 | 1209 | } // remove the reg form and the checkout |
1210 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1210 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1211 | 1211 | $this->transaction = $this->transaction->ID(); |
1212 | 1212 | } // remove the reg form and the checkout |
1213 | - return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) ); |
|
1213 | + return array_diff(array_keys(get_object_vars($this)), array('billing_form', 'registration_form')); |
|
1214 | 1214 | } |
1215 | 1215 | |
1216 | 1216 | |
@@ -1220,15 +1220,15 @@ discard block |
||
1220 | 1220 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1221 | 1221 | */ |
1222 | 1222 | public function __wakeup() { |
1223 | - if ( ! $this->primary_attendee_obj instanceof EE_Attendee && absint( $this->primary_attendee_obj ) !== 0 ) { |
|
1223 | + if ( ! $this->primary_attendee_obj instanceof EE_Attendee && absint($this->primary_attendee_obj) !== 0) { |
|
1224 | 1224 | // $this->primary_attendee_obj is actually just an ID, so use it to get the object from the db |
1225 | - $this->primary_attendee_obj = EEM_Attendee::instance()->get_one_by_ID( $this->primary_attendee_obj ); |
|
1225 | + $this->primary_attendee_obj = EEM_Attendee::instance()->get_one_by_ID($this->primary_attendee_obj); |
|
1226 | 1226 | } |
1227 | - if ( ! $this->transaction instanceof EE_Transaction && absint( $this->transaction ) !== 0 ) { |
|
1227 | + if ( ! $this->transaction instanceof EE_Transaction && absint($this->transaction) !== 0) { |
|
1228 | 1228 | // $this->transaction is actually just an ID, so use it to get the object from the db |
1229 | - $this->transaction = EEM_Transaction::instance()->get_one_by_ID( $this->transaction ); |
|
1229 | + $this->transaction = EEM_Transaction::instance()->get_one_by_ID($this->transaction); |
|
1230 | 1230 | } |
1231 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1231 | + foreach ($this->reg_steps as $reg_step) { |
|
1232 | 1232 | $reg_step->checkout = $this; |
1233 | 1233 | } |
1234 | 1234 | } |
@@ -1245,12 +1245,12 @@ discard block |
||
1245 | 1245 | * @param bool $display_request |
1246 | 1246 | * @throws \EE_Error |
1247 | 1247 | */ |
1248 | - public function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1248 | + public function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1249 | 1249 | $disabled = true; |
1250 | - if ( WP_DEBUG && ! $disabled ) { |
|
1251 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1250 | + if (WP_DEBUG && ! $disabled) { |
|
1251 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1252 | 1252 | $default_data = array( |
1253 | - $class => $func . '() : ' . $line, |
|
1253 | + $class => $func.'() : '.$line, |
|
1254 | 1254 | 'request->step' => $this->step, |
1255 | 1255 | 'request->action' => $this->action, |
1256 | 1256 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1262,24 +1262,24 @@ discard block |
||
1262 | 1262 | 'reg_url_link' => $this->reg_url_link, |
1263 | 1263 | 'REQ' => $display_request ? $_REQUEST : '', |
1264 | 1264 | ); |
1265 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1266 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1267 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1268 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1269 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1265 | + if ($this->transaction instanceof EE_Transaction) { |
|
1266 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1267 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1268 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1269 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1270 | 1270 | } |
1271 | - if ( $this->transaction->ID() ) { |
|
1272 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1271 | + if ($this->transaction->ID()) { |
|
1272 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1273 | 1273 | // don't serialize objects |
1274 | - $info = $this->_strip_objects( $info ); |
|
1275 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1276 | - $debug_data[ $TXN_ID ] = array(); |
|
1274 | + $info = $this->_strip_objects($info); |
|
1275 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1276 | + $debug_data[$TXN_ID] = array(); |
|
1277 | 1277 | } |
1278 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1278 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1279 | 1279 | $default_data, |
1280 | 1280 | $info |
1281 | 1281 | ); |
1282 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1282 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1283 | 1283 | } |
1284 | 1284 | } |
1285 | 1285 | } |
@@ -1292,23 +1292,23 @@ discard block |
||
1292 | 1292 | * @param array $info |
1293 | 1293 | * @return array |
1294 | 1294 | */ |
1295 | - public function _strip_objects( $info = array() ) { |
|
1296 | - foreach ( (array)$info as $key => $value ) { |
|
1297 | - if ( is_array( $value )) { |
|
1298 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1299 | - } else if ( is_object( $value ) ) { |
|
1300 | - $object_class = get_class( $value ); |
|
1301 | - $info[ $object_class ] = array(); |
|
1302 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1303 | - if ( method_exists( $value, 'status' ) ) { |
|
1304 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1305 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1306 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1295 | + public function _strip_objects($info = array()) { |
|
1296 | + foreach ((array) $info as $key => $value) { |
|
1297 | + if (is_array($value)) { |
|
1298 | + $info[$key] = $this->_strip_objects($value); |
|
1299 | + } else if (is_object($value)) { |
|
1300 | + $object_class = get_class($value); |
|
1301 | + $info[$object_class] = array(); |
|
1302 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1303 | + if (method_exists($value, 'status')) { |
|
1304 | + $info[$object_class]['status'] = $value->status(); |
|
1305 | + } else if (method_exists($value, 'status_ID')) { |
|
1306 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1307 | 1307 | } |
1308 | - unset( $info[ $key ] ); |
|
1308 | + unset($info[$key]); |
|
1309 | 1309 | } |
1310 | 1310 | } |
1311 | - return (array)$info; |
|
1311 | + return (array) $info; |
|
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use EventEspresso\core\domain\services\ticket\CancelTicketLineItemService; |
5 | 5 | |
6 | 6 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
7 | - exit('No direct script access allowed'); |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -21,22 +21,22 @@ discard block |
||
21 | 21 | class CancelRegistrationService |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
26 | - */ |
|
27 | - private $cancel_ticket_line_item_service; |
|
24 | + /** |
|
25 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
26 | + */ |
|
27 | + private $cancel_ticket_line_item_service; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * Command constructor |
|
33 | - * |
|
34 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
35 | - */ |
|
36 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
37 | - { |
|
38 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
39 | - } |
|
31 | + /** |
|
32 | + * Command constructor |
|
33 | + * |
|
34 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
35 | + */ |
|
36 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
37 | + { |
|
38 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
@@ -44,27 +44,27 @@ discard block |
||
44 | 44 | * @param \EE_Registration $registration |
45 | 45 | * @param bool $cancel_ticket_line_item |
46 | 46 | */ |
47 | - public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true) |
|
48 | - { |
|
49 | - // first cancel the original line item for the registration's ticket |
|
50 | - if ( $cancel_ticket_line_item ) { |
|
51 | - $this->cancel_ticket_line_item_service->forRegistration( $registration ); |
|
52 | - } |
|
53 | - $this->cancelRegistrationOnly($registration); |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * @param \EE_Registration $registration |
|
60 | - * @throws \EE_Error |
|
61 | - */ |
|
62 | - public function cancelRegistrationOnly(\EE_Registration $registration) |
|
63 | - { |
|
64 | - // now cancel the registration itself |
|
65 | - $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
66 | - $registration->save(); |
|
67 | - } |
|
47 | + public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true) |
|
48 | + { |
|
49 | + // first cancel the original line item for the registration's ticket |
|
50 | + if ( $cancel_ticket_line_item ) { |
|
51 | + $this->cancel_ticket_line_item_service->forRegistration( $registration ); |
|
52 | + } |
|
53 | + $this->cancelRegistrationOnly($registration); |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * @param \EE_Registration $registration |
|
60 | + * @throws \EE_Error |
|
61 | + */ |
|
62 | + public function cancelRegistrationOnly(\EE_Registration $registration) |
|
63 | + { |
|
64 | + // now cancel the registration itself |
|
65 | + $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
66 | + $registration->save(); |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | 70 |
@@ -47,8 +47,8 @@ |
||
47 | 47 | public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true) |
48 | 48 | { |
49 | 49 | // first cancel the original line item for the registration's ticket |
50 | - if ( $cancel_ticket_line_item ) { |
|
51 | - $this->cancel_ticket_line_item_service->forRegistration( $registration ); |
|
50 | + if ($cancel_ticket_line_item) { |
|
51 | + $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
52 | 52 | } |
53 | 53 | $this->cancelRegistrationOnly($registration); |
54 | 54 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <div style="float:right"> |
2 | - <?php printf( __( 'View %1$sRegistrations%4$s / %2$sTransactions%4$s for this %3$sevent%4$s.', 'event_espresso' ), '<a href="' . $filtered_registrations_link . '">', '<a href="' . $filtered_transactions_link . '">', '<a href="' . $event_link . '">', '</a>' );?> |
|
2 | + <?php printf(__('View %1$sRegistrations%4$s / %2$sTransactions%4$s for this %3$sevent%4$s.', 'event_espresso'), '<a href="'.$filtered_registrations_link.'">', '<a href="'.$filtered_transactions_link.'">', '<a href="'.$event_link.'">', '</a>'); ?> |
|
3 | 3 | </div> |
4 | -<h3 id="reg-admin-reg-details-reg-nmbr-hdr"><?php echo $previous_registration . ' '; echo __( 'Registration # ', 'event_espresso' ) . $reg_nmbr['value']; echo ' ' . $next_registration; ?></h3> |
|
5 | -<h2 id="reg-admin-reg-details-reg-date-hdr"><?php echo $reg_datetime['value'];?></h2> |
|
4 | +<h3 id="reg-admin-reg-details-reg-nmbr-hdr"><?php echo $previous_registration.' '; echo __('Registration # ', 'event_espresso').$reg_nmbr['value']; echo ' '.$next_registration; ?></h3> |
|
5 | +<h2 id="reg-admin-reg-details-reg-date-hdr"><?php echo $reg_datetime['value']; ?></h2> |
|
6 | 6 | |
7 | -<?php if ( $registration->group_size() > 1 ) : ?> |
|
8 | - <a id="scroll-to-other-attendees" class="scroll-to" href="#other-attendees"><?php echo __( 'Scroll to Other Registrations in the Same Transaction', 'event_espresso' );?></a> |
|
7 | +<?php if ($registration->group_size() > 1) : ?> |
|
8 | + <a id="scroll-to-other-attendees" class="scroll-to" href="#other-attendees"><?php echo __('Scroll to Other Registrations in the Same Transaction', 'event_espresso'); ?></a> |
|
9 | 9 | <?php endif; ?> |
10 | 10 | |
11 | -<?php do_action( 'AHEE__reg_status_change_buttons__after_header', $REG_ID ); ?> |
|
11 | +<?php do_action('AHEE__reg_status_change_buttons__after_header', $REG_ID); ?> |
|
12 | 12 |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | </td> |
24 | 24 | <td> |
25 | 25 | <div id="invoice-info"> |
26 | - <h2 id="invoice-hdr"><?php _e( 'Order Confirmation', 'event_espresso' ) ?></h2> |
|
26 | + <h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso') ?></h2> |
|
27 | 27 | |
28 | - <h3 id="invoice-date"><?php _e( 'Date:', 'event_espresso' ) ?> |
|
28 | + <h3 id="invoice-date"><?php _e('Date:', 'event_espresso') ?> |
|
29 | 29 | <span class="plain-text">[PRIMARY_REGISTRANT_REGISTRATION_DATE]</span></h3> |
30 | 30 | |
31 | - <h3 id="invoice-txn-id"><?php _e( 'Transaction ID:', 'event_espresso' ) ?> |
|
31 | + <h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso') ?> |
|
32 | 32 | <span class="plain-text">[TXN_ID]</span></h3> |
33 | 33 | |
34 | - <h3 id="invoice-txn-status"><?php _e( 'Status:', 'event_espresso' ) ?> |
|
34 | + <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso') ?> |
|
35 | 35 | <span class="[TXN_STATUS_ID] plain-text">[TXN_STATUS]</span></h3> |
36 | 36 | </div> |
37 | 37 | </td> |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | [EVENT_LIST] |
42 | 42 | </div> |
43 | 43 | <div class="taxes"> |
44 | - <h3 class="section-title"><?php _e( "Additional Charges/Discounts", 'event_espresso' ) ?></h3> |
|
44 | + <h3 class="section-title"><?php _e("Additional Charges/Discounts", 'event_espresso') ?></h3> |
|
45 | 45 | <table class="invoice-amount"> |
46 | 46 | <thead> |
47 | 47 | <tr class="header_row"> |
48 | - <th class="left ticket_th"><?php _e( "Name", "event_espresso" ); ?></th> |
|
49 | - <th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th> |
|
50 | - <th class="event_th item_c"><?php _e( 'Quantity', 'event_espresso' ); ?></th> |
|
51 | - <th class="event_th item_c"><?php _e( 'Unit Price', 'event_espresso' ); ?></th> |
|
52 | - <th class="subtotal_th"><?php _e( 'Total', 'event_espresso' ); ?></th> |
|
48 | + <th class="left ticket_th"><?php _e("Name", "event_espresso"); ?></th> |
|
49 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
50 | + <th class="event_th item_c"><?php _e('Quantity', 'event_espresso'); ?></th> |
|
51 | + <th class="event_th item_c"><?php _e('Unit Price', 'event_espresso'); ?></th> |
|
52 | + <th class="subtotal_th"><?php _e('Total', 'event_espresso'); ?></th> |
|
53 | 53 | </tr> |
54 | 54 | </thead> |
55 | 55 | <tbody> |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | </table> |
61 | 61 | </div> |
62 | 62 | <div class="taxes"> |
63 | - <h3 class="section-title"><?php _e( "Taxes", 'event_espresso' ) ?></h3> |
|
64 | - <p><?php printf( __( '%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso' ), '<strong>', '</strong>' ); ?></p> |
|
63 | + <h3 class="section-title"><?php _e("Taxes", 'event_espresso') ?></h3> |
|
64 | + <p><?php printf(__('%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
65 | 65 | <table class="invoice-amount"> |
66 | 66 | <thead> |
67 | 67 | <tr class="header_row"> |
68 | - <th class="left ticket_th"><?php _e( "Tax Name", "event_espresso" ); ?></th> |
|
69 | - <th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th> |
|
70 | - <th class="event_th item_c"><?php _e( 'Rate', 'event_espresso' ); ?></th> |
|
71 | - <th class="subtotal_th"><?php _e( 'Tax Amount', 'event_espresso' ); ?></th> |
|
68 | + <th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th> |
|
69 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
70 | + <th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th> |
|
71 | + <th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th> |
|
72 | 72 | </tr> |
73 | 73 | </thead> |
74 | 74 | <tbody> |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | </table> |
80 | 80 | </div> |
81 | 81 | <div class="grand-total-dv"> |
82 | - <h2 class="grand-total"><?php printf( __( "Grand Total: %s", "event_espresso" ), '[TOTAL_COST]' ); ?></h2> |
|
82 | + <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), '[TOTAL_COST]'); ?></h2> |
|
83 | 83 | </div> |
84 | 84 | <div class="payment-dv"> |
85 | - <h3 class="section-title"><?php _e( "Payments", 'event_espresso' ) ?></h3> |
|
85 | + <h3 class="section-title"><?php _e("Payments", 'event_espresso') ?></h3> |
|
86 | 86 | <table class="invoice-amount"> |
87 | 87 | <thead> |
88 | 88 | <tr class="header_row"> |
89 | - <th><span class=""><?php _e( 'Payment Method', 'event_espresso' ); ?></span></th> |
|
90 | - <th class='left datetime_th'><?php _e( "Date", 'event_espresso' ) ?></th> |
|
91 | - <th><span class=""><?php _e( 'Transaction Id / Cheque #', 'event_espresso' ); ?></span></th> |
|
92 | - <th><span class=""><?php _e( 'P.O. / S.O.#', 'event_espresso' ); ?></span></th> |
|
93 | - <th><span class=""><?php _e( 'Status', 'event_espresso' ); ?></span></th> |
|
94 | - <th><?php _e( 'Amount', 'event_espresso' ); ?></th> |
|
89 | + <th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th> |
|
90 | + <th class='left datetime_th'><?php _e("Date", 'event_espresso') ?></th> |
|
91 | + <th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th> |
|
92 | + <th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th> |
|
93 | + <th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th> |
|
94 | + <th><?php _e('Amount', 'event_espresso'); ?></th> |
|
95 | 95 | </tr> |
96 | 96 | </thead> |
97 | 97 | <tbody> |
@@ -105,21 +105,21 @@ discard block |
||
105 | 105 | <tfoot> |
106 | 106 | <tr class='total_tr'> |
107 | 107 | <td colspan="4"> </td> |
108 | - <td class="item_r"><?php _e( 'Total Paid', 'event_espresso' ) ?></td> |
|
108 | + <td class="item_r"><?php _e('Total Paid', 'event_espresso') ?></td> |
|
109 | 109 | <td class="item_r">[TOTAL_AMOUNT_PAID]</td> |
110 | 110 | </tr> |
111 | 111 | <tr class="total_tr odd"> |
112 | 112 | <td colspan="4"> </td> |
113 | - <td class="total" id="total_currency"><?php _e( 'Amount Owed:', 'event_espresso' ); ?></td> |
|
113 | + <td class="total" id="total_currency"><?php _e('Amount Owed:', 'event_espresso'); ?></td> |
|
114 | 114 | <td class="total">[TOTAL_OWING]</td> |
115 | 115 | </tr> |
116 | 116 | </tfoot> |
117 | 117 | </table> |
118 | 118 | </div> |
119 | 119 | <div class="additional-info-dv"> |
120 | - <h3 class="section-title"><?php _e( "Additional Information:", "event_espresso" ); ?></h3> |
|
120 | + <h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3> |
|
121 | 121 | <div class="additional-info"> |
122 | - <h2><?php _e( "Venue Details:", "event_espresso" ); ?></h2> |
|
122 | + <h2><?php _e("Venue Details:", "event_espresso"); ?></h2> |
|
123 | 123 | <table class="venue-list"> |
124 | 124 | <tr class="venue-details"> |
125 | 125 | <td class="venue-details-part venue-address-dv"> |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | * @param $class_file |
9 | 9 | * @return array |
10 | 10 | */ |
11 | -function espresso_invoice_template_files( $class_file) { |
|
11 | +function espresso_invoice_template_files($class_file) { |
|
12 | 12 | // read our template dir and build an array of files |
13 | - $dhandle = opendir(dirname($class_file) . '/lib/templates/css/'); //If the template files have been moved to the uploads folder |
|
13 | + $dhandle = opendir(dirname($class_file).'/lib/templates/css/'); //If the template files have been moved to the uploads folder |
|
14 | 14 | //} else return FALSE; |
15 | 15 | |
16 | 16 | $files = array(); |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * @param string $selected |
51 | 51 | * @return string |
52 | 52 | */ |
53 | -function espresso_invoice_is_selected( $input_item, $selected='') { |
|
54 | - if ( $input_item === $selected ) { |
|
53 | +function espresso_invoice_is_selected($input_item, $selected = '') { |
|
54 | + if ($input_item === $selected) { |
|
55 | 55 | return 'selected="selected"'; |
56 | 56 | } else { |
57 | 57 | return ''; |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | use EventEspresso\core\services\database\TableAnalysis; |
3 | 3 | use EventEspresso\core\services\database\TableManager; |
4 | 4 | |
5 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { |
|
5 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
6 | 6 | exit('No direct script access allowed'); |
7 | 7 | } |
8 | 8 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | /** |
22 | 22 | */ |
23 | -class EE_DMS_Unknown_1_0_0 extends EE_Data_Migration_Script_Base{ |
|
23 | +class EE_DMS_Unknown_1_0_0 extends EE_Data_Migration_Script_Base { |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Returns whether or not this data migration script can operate on the given version of the database. |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * @param TableManager $table_manager |
48 | 48 | * @param TableAnalysis $table_analysis |
49 | 49 | */ |
50 | - public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) { |
|
50 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) { |
|
51 | 51 | $this->_migration_stages = array(); |
52 | 52 | $this->_pretty_name = __("Fatal Uncatchable Error Occurred", "event_espresso"); |
53 | 53 | // dd($this); |
54 | - parent::__construct( $table_manager, $table_analysis ); |
|
54 | + parent::__construct($table_manager, $table_analysis); |
|
55 | 55 | } |
56 | 56 | public function migration_page_hooks() { |
57 | 57 |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | use EventEspresso\core\services\database\TableAnalysis; |
3 | 3 | use EventEspresso\core\services\database\TableManager; |
4 | 4 | |
5 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { |
|
5 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
6 | 6 | exit('No direct script access allowed'); |
7 | 7 | } |
8 | 8 | |
@@ -124,14 +124,14 @@ discard block |
||
124 | 124 | * @param TableManager $table_manager |
125 | 125 | * @param TableAnalysis $table_analysis |
126 | 126 | */ |
127 | - public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) { |
|
128 | - $this->_migration_stages = (array) apply_filters('FHEE__'.get_class($this).'__construct__migration_stages',$this->_migration_stages); |
|
129 | - foreach($this->_migration_stages as $migration_stage){ |
|
130 | - if ( $migration_stage instanceof EE_Data_Migration_Script_Stage ) { |
|
127 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) { |
|
128 | + $this->_migration_stages = (array) apply_filters('FHEE__'.get_class($this).'__construct__migration_stages', $this->_migration_stages); |
|
129 | + foreach ($this->_migration_stages as $migration_stage) { |
|
130 | + if ($migration_stage instanceof EE_Data_Migration_Script_Stage) { |
|
131 | 131 | $migration_stage->_construct_finalize($this); |
132 | 132 | } |
133 | 133 | } |
134 | - parent::__construct( $table_manager, $table_analysis ); |
|
134 | + parent::__construct($table_manager, $table_analysis); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * Place to add hooks and filters for tweaking the migrations page, in order |
141 | 141 | * to customize it |
142 | 142 | */ |
143 | - public function migration_page_hooks(){ |
|
143 | + public function migration_page_hooks() { |
|
144 | 144 | //by default none are added because we normally like the default look of the migration page |
145 | 145 | } |
146 | 146 | |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | * @param int|string $new_pk eg posts.ID |
156 | 156 | * @return void |
157 | 157 | */ |
158 | - public function set_mapping($old_table,$old_pk,$new_table,$new_pk){ |
|
158 | + public function set_mapping($old_table, $old_pk, $new_table, $new_pk) { |
|
159 | 159 | //make sure it has the needed keys |
160 | - if( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])){ |
|
160 | + if ( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])) { |
|
161 | 161 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
162 | 162 | } |
163 | 163 | $this->_mappings[$old_table][$new_table][$old_pk] = $new_pk; |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | * @param string $new_table with wpdb prefix (wp_). Eg: wp_posts |
174 | 174 | * @return mixed the primary key on the new table |
175 | 175 | */ |
176 | - public function get_mapping_new_pk($old_table,$old_pk,$new_table){ |
|
177 | - if( ! isset($this->_mappings[$old_table]) || |
|
178 | - ! isset($this->_mappings[$old_table][$new_table])){ |
|
176 | + public function get_mapping_new_pk($old_table, $old_pk, $new_table) { |
|
177 | + if ( ! isset($this->_mappings[$old_table]) || |
|
178 | + ! isset($this->_mappings[$old_table][$new_table])) { |
|
179 | 179 | //try fetching the option |
180 | 180 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
181 | 181 | } |
@@ -192,15 +192,15 @@ discard block |
||
192 | 192 | * @param mixed $new_pk |
193 | 193 | * @return mixed |
194 | 194 | */ |
195 | - public function get_mapping_old_pk($old_table,$new_table,$new_pk){ |
|
196 | - if( ! isset($this->_mappings[$old_table]) || |
|
197 | - ! isset($this->_mappings[$old_table][$new_table])){ |
|
195 | + public function get_mapping_old_pk($old_table, $new_table, $new_pk) { |
|
196 | + if ( ! isset($this->_mappings[$old_table]) || |
|
197 | + ! isset($this->_mappings[$old_table][$new_table])) { |
|
198 | 198 | //try fetching the option |
199 | 199 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
200 | 200 | } |
201 | - if(isset($this->_mappings[$old_table][$new_table])){ |
|
201 | + if (isset($this->_mappings[$old_table][$new_table])) { |
|
202 | 202 | $new_pk_to_old_pk = array_flip($this->_mappings[$old_table][$new_table]); |
203 | - if(isset($new_pk_to_old_pk[$new_pk])){ |
|
203 | + if (isset($new_pk_to_old_pk[$new_pk])) { |
|
204 | 204 | return $new_pk_to_old_pk[$new_pk]; |
205 | 205 | } |
206 | 206 | } |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * @param string $new_table_name |
216 | 216 | * @return array |
217 | 217 | */ |
218 | - protected function _get_mapping_option($old_table_name,$new_table_name){ |
|
219 | - $option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name),array()); |
|
218 | + protected function _get_mapping_option($old_table_name, $new_table_name) { |
|
219 | + $option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name), array()); |
|
220 | 220 | return $option; |
221 | 221 | } |
222 | 222 | |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | * @param array $mapping_array |
230 | 230 | * @return boolean success of updating option |
231 | 231 | */ |
232 | - protected function _set_mapping_option($old_table_name,$new_table_name,$mapping_array){ |
|
232 | + protected function _set_mapping_option($old_table_name, $new_table_name, $mapping_array) { |
|
233 | 233 | // echo "set mapping for $old_table_name $new_table_name".count($mapping_array)."<br>"; |
234 | - $success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name),$mapping_array); |
|
234 | + $success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name), $mapping_array); |
|
235 | 235 | return $success; |
236 | 236 | } |
237 | 237 | |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | * @param string $new_table_name |
244 | 244 | * @return string |
245 | 245 | */ |
246 | - protected function _get_mapping_option_name($old_table_name,$new_table_name){ |
|
246 | + protected function _get_mapping_option_name($old_table_name, $new_table_name) { |
|
247 | 247 | global $wpdb; |
248 | - $old_table_name_sans_wp = str_replace($wpdb->prefix,"",$old_table_name); |
|
249 | - $new_table_name_sans_wp = str_replace($wpdb->prefix,"",$new_table_name); |
|
248 | + $old_table_name_sans_wp = str_replace($wpdb->prefix, "", $old_table_name); |
|
249 | + $new_table_name_sans_wp = str_replace($wpdb->prefix, "", $new_table_name); |
|
250 | 250 | $migrates_to = EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this)); |
251 | - return substr( EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix . $migrates_to [ 'slug' ] . '_' . $migrates_to[ 'version' ] . '_' . $old_table_name_sans_wp . '_' . $new_table_name_sans_wp, 0, 64 ); |
|
251 | + return substr(EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix.$migrates_to ['slug'].'_'.$migrates_to['version'].'_'.$old_table_name_sans_wp.'_'.$new_table_name_sans_wp, 0, 64); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | * 99% until the function "migration_step" returns EE_Data_Migration_Script_Base::status_complete. |
266 | 266 | * @return int |
267 | 267 | */ |
268 | - protected function _count_records_to_migrate(){ |
|
268 | + protected function _count_records_to_migrate() { |
|
269 | 269 | $count = 0; |
270 | - foreach($this->stages() as $stage){ |
|
271 | - $count+= $stage->count_records_to_migrate(); |
|
270 | + foreach ($this->stages() as $stage) { |
|
271 | + $count += $stage->count_records_to_migrate(); |
|
272 | 272 | } |
273 | 273 | return $count; |
274 | 274 | } |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | * by just setting a transient and updating it after each migration_step |
281 | 281 | * @return int |
282 | 282 | */ |
283 | - public function count_records_migrated(){ |
|
283 | + public function count_records_migrated() { |
|
284 | 284 | $count = 0; |
285 | - foreach($this->stages() as $stage){ |
|
286 | - $count+= $stage->count_records_migrated(); |
|
285 | + foreach ($this->stages() as $stage) { |
|
286 | + $count += $stage->count_records_migrated(); |
|
287 | 287 | } |
288 | 288 | $this->_records_migrated = $count; |
289 | 289 | return $count; |
@@ -297,24 +297,24 @@ discard block |
||
297 | 297 | * @throws EE_Error |
298 | 298 | * @throws Exception |
299 | 299 | */ |
300 | - public function migration_step($num_records_to_migrate_limit){ |
|
300 | + public function migration_step($num_records_to_migrate_limit) { |
|
301 | 301 | //reset the feedback message |
302 | 302 | $this->_feedback_message = ''; |
303 | 303 | //if we haven't yet done the 1st schema changes, do them now. buffer any output |
304 | 304 | $this->_maybe_do_schema_changes(true); |
305 | 305 | |
306 | - $num_records_actually_migrated =0; |
|
306 | + $num_records_actually_migrated = 0; |
|
307 | 307 | $records_migrated_per_stage = array(); |
308 | 308 | //setup the 'stage' variable, which should hold the last run stage of the migration (or none at all if nothing runs) |
309 | 309 | $stage = null; |
310 | 310 | //get the next stage that isn't complete |
311 | - foreach($this->stages() as $stage){ |
|
312 | - if( $stage->get_status() == EE_Data_Migration_Manager::status_continue){ |
|
313 | - try{ |
|
311 | + foreach ($this->stages() as $stage) { |
|
312 | + if ($stage->get_status() == EE_Data_Migration_Manager::status_continue) { |
|
313 | + try { |
|
314 | 314 | $records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated); |
315 | 315 | $num_records_actually_migrated += $records_migrated_during_stage; |
316 | 316 | $records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage; |
317 | - }catch(Exception $e){ |
|
317 | + } catch (Exception $e) { |
|
318 | 318 | //yes if we catch an exception here, we consider that migration stage borked. |
319 | 319 | $stage->set_status(EE_Data_Migration_Manager::status_fatal_error); |
320 | 320 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | throw $e; |
323 | 323 | } |
324 | 324 | //check that the migration stage didn't mark itself as having a fatal error |
325 | - if($stage->is_broken()){ |
|
325 | + if ($stage->is_broken()) { |
|
326 | 326 | $this->set_broken(); |
327 | 327 | throw new EE_Error($stage->get_last_error()); |
328 | 328 | } |
@@ -330,24 +330,24 @@ discard block |
||
330 | 330 | //once we've migrated all the number we intended to (possibly from different stages), stop migrating |
331 | 331 | //or if we had a fatal error |
332 | 332 | //or if the current script stopped early- its not done, but it's done all it thinks we should do on this step |
333 | - if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()){ |
|
333 | + if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()) { |
|
334 | 334 | break; |
335 | 335 | } |
336 | 336 | } |
337 | 337 | //check if we're all done this data migration... |
338 | 338 | //which is indicated by being done early AND the last stage claims to be done |
339 | - if($stage == NULL){ |
|
339 | + if ($stage == NULL) { |
|
340 | 340 | //this migration script apparently has NO stages... which is super weird, but whatever |
341 | 341 | $this->set_completed(); |
342 | 342 | $this->_maybe_do_schema_changes(false); |
343 | - }else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){ |
|
343 | + } else if ($num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()) { |
|
344 | 344 | //apparently we're done, because we couldn't migrate the number we intended to |
345 | 345 | $this->set_completed(); |
346 | 346 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
347 | 347 | //do schema changes for after the migration now |
348 | 348 | //first double-check we haven't already done this |
349 | 349 | $this->_maybe_do_schema_changes(false); |
350 | - }else{ |
|
350 | + } else { |
|
351 | 351 | //update feedback message, keeping in mind that we show them with the most recent at the top |
352 | 352 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
353 | 353 | } |
@@ -361,12 +361,12 @@ discard block |
||
361 | 361 | * @param array $records_migrated_per_stage KEYS are pretty names for each stage; values are the count of records migrated from that stage |
362 | 362 | * @return void |
363 | 363 | */ |
364 | - private function _update_feedback_message($records_migrated_per_stage){ |
|
364 | + private function _update_feedback_message($records_migrated_per_stage) { |
|
365 | 365 | $feedback_message_array = array(); |
366 | - foreach($records_migrated_per_stage as $migration_stage_name => $num_records_migrated){ |
|
367 | - $feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"),$num_records_migrated,$migration_stage_name) ; |
|
366 | + foreach ($records_migrated_per_stage as $migration_stage_name => $num_records_migrated) { |
|
367 | + $feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"), $num_records_migrated, $migration_stage_name); |
|
368 | 368 | } |
369 | - $this->_feedback_message .= implode("<br>",$feedback_message_array); |
|
369 | + $this->_feedback_message .= implode("<br>", $feedback_message_array); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -378,27 +378,27 @@ discard block |
||
378 | 378 | * @throws Exception |
379 | 379 | * @return void |
380 | 380 | */ |
381 | - private function _maybe_do_schema_changes($before = true){ |
|
381 | + private function _maybe_do_schema_changes($before = true) { |
|
382 | 382 | //so this property will be either _schema_changes_after_migration_ran or _schema_changes_before_migration_ran |
383 | - $property_name = '_schema_changes_'. ($before ? 'before' : 'after').'_migration_ran'; |
|
384 | - if ( ! $this->{$property_name} ){ |
|
385 | - try{ |
|
383 | + $property_name = '_schema_changes_'.($before ? 'before' : 'after').'_migration_ran'; |
|
384 | + if ( ! $this->{$property_name} ) { |
|
385 | + try { |
|
386 | 386 | ob_start(); |
387 | - if($before){ |
|
387 | + if ($before) { |
|
388 | 388 | $this->schema_changes_before_migration(); |
389 | - }else{ |
|
389 | + } else { |
|
390 | 390 | $this->schema_changes_after_migration(); |
391 | 391 | } |
392 | 392 | $output = ob_get_contents(); |
393 | 393 | ob_end_clean(); |
394 | - }catch(Exception $e){ |
|
394 | + } catch (Exception $e) { |
|
395 | 395 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
396 | 396 | throw $e; |
397 | 397 | } |
398 | 398 | //record that we've done these schema changes |
399 | 399 | $this->{$property_name} = true; |
400 | 400 | //if there were any warnings etc, record them as non-fatal errors |
401 | - if( $output ){ |
|
401 | + if ($output) { |
|
402 | 402 | //there were some warnings |
403 | 403 | $this->_errors[] = $output; |
404 | 404 | } |
@@ -425,9 +425,9 @@ discard block |
||
425 | 425 | * @param string $table_definition_sql |
426 | 426 | * @param string $engine_string |
427 | 427 | */ |
428 | - protected function _table_is_new_in_this_version($table_name,$table_definition_sql,$engine_string='ENGINE=InnoDB '){ |
|
428 | + protected function _table_is_new_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=InnoDB ') { |
|
429 | 429 | // EEH_Debug_Tools::instance()->start_timer( '_table_is_new_in_this_version_' . $table_name ); |
430 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( true ) ); |
|
430 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(true)); |
|
431 | 431 | // EEH_Debug_Tools::instance()->stop_timer( '_table_is_new_in_this_version_' . $table_name ); |
432 | 432 | } |
433 | 433 | |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | * @param string $table_definition_sql |
442 | 442 | * @param string $engine_string |
443 | 443 | */ |
444 | - protected function _table_is_changed_in_this_version($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
444 | + protected function _table_is_changed_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
445 | 445 | // EEH_Debug_Tools::instance()->start_timer( '_table_is_changed_in_this_version' . $table_name ); |
446 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
446 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
447 | 447 | // EEH_Debug_Tools::instance()->stop_timer( '_table_is_changed_in_this_version' . $table_name ); |
448 | 448 | } |
449 | 449 | |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | * @param string $table_name |
455 | 455 | * @return boolean |
456 | 456 | */ |
457 | - protected function _old_table_exists( $table_name ) { |
|
458 | - return $this->_get_table_analysis()->tableExists( $table_name ); |
|
457 | + protected function _old_table_exists($table_name) { |
|
458 | + return $this->_get_table_analysis()->tableExists($table_name); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | * @param string $table_name |
466 | 466 | * @return boolean |
467 | 467 | */ |
468 | - protected function _delete_table_if_empty( $table_name ) { |
|
469 | - return EEH_Activation::delete_db_table_if_empty( $table_name ); |
|
468 | + protected function _delete_table_if_empty($table_name) { |
|
469 | + return EEH_Activation::delete_db_table_if_empty($table_name); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | |
@@ -485,9 +485,9 @@ discard block |
||
485 | 485 | * @param string $table_definition_sql |
486 | 486 | * @param string $engine_string |
487 | 487 | */ |
488 | - protected function _table_should_exist_previously($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
488 | + protected function _table_should_exist_previously($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
489 | 489 | // EEH_Debug_Tools::instance()->start_timer( '_table_should_exist_previously' . $table_name ); |
490 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
490 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
491 | 491 | // EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name ); |
492 | 492 | } |
493 | 493 | |
@@ -502,13 +502,13 @@ discard block |
||
502 | 502 | * @param string $table_definition_sql |
503 | 503 | * @param string $engine_string |
504 | 504 | */ |
505 | - protected function _table_has_not_changed_since_previous( $table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
506 | - if( $this->_currently_migrating() ) { |
|
505 | + protected function _table_has_not_changed_since_previous($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
506 | + if ($this->_currently_migrating()) { |
|
507 | 507 | //if we're doing a migration, and this table apparently already exists, then we don't need do anything right? |
508 | 508 | // EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name ); |
509 | 509 | return; |
510 | 510 | } |
511 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
511 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | /** |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | protected function _currently_migrating() { |
519 | 519 | //we want to know if we are currently performing a migration. We could just believe what was set on the _migrating property, but let's double-check (ie the script should apply and we should be in MM) |
520 | 520 | return $this->_migrating && |
521 | - $this->can_migrate_from_version( EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set() ) && |
|
521 | + $this->can_migrate_from_version(EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set()) && |
|
522 | 522 | EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance; |
523 | 523 | } |
524 | 524 | |
@@ -529,17 +529,17 @@ discard block |
||
529 | 529 | * @param boolean $table_is_new |
530 | 530 | * @return boolean |
531 | 531 | */ |
532 | - protected function _pre_existing_table_should_be_dropped( $table_is_new ) { |
|
533 | - if( $table_is_new ) { |
|
534 | - if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating() ){ |
|
532 | + protected function _pre_existing_table_should_be_dropped($table_is_new) { |
|
533 | + if ($table_is_new) { |
|
534 | + if ($this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating()) { |
|
535 | 535 | return true; |
536 | - }else{ |
|
536 | + } else { |
|
537 | 537 | return false; |
538 | 538 | } |
539 | - }else{ |
|
540 | - if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){ |
|
539 | + } else { |
|
540 | + if (in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(), array(EE_System::req_type_new_activation))) { |
|
541 | 541 | return true; |
542 | - }else{ |
|
542 | + } else { |
|
543 | 543 | return false; |
544 | 544 | } |
545 | 545 | } |
@@ -552,12 +552,12 @@ discard block |
||
552 | 552 | * @param string $engine_string |
553 | 553 | * @param boolean $drop_pre_existing_tables |
554 | 554 | */ |
555 | - private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){ |
|
556 | - try{ |
|
557 | - EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
558 | - }catch( EE_Error $e ) { |
|
559 | - $message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString(); |
|
560 | - $this->add_error( $message ); |
|
555 | + private function _create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE) { |
|
556 | + try { |
|
557 | + EEH_Activation::create_table($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
558 | + } catch (EE_Error $e) { |
|
559 | + $message = $e->getMessage().'<br>Stack Trace:'.$e->getTraceAsString(); |
|
560 | + $this->add_error($message); |
|
561 | 561 | $this->_feedback_message .= $message; |
562 | 562 | } |
563 | 563 | } |
@@ -569,15 +569,15 @@ discard block |
||
569 | 569 | * @return int one of EE_System::_req_type_* constants |
570 | 570 | * @throws EE_Error |
571 | 571 | */ |
572 | - private function _get_req_type_for_plugin_corresponding_to_this_dms(){ |
|
573 | - if($this->slug() == 'Core'){ |
|
572 | + private function _get_req_type_for_plugin_corresponding_to_this_dms() { |
|
573 | + if ($this->slug() == 'Core') { |
|
574 | 574 | return EE_System::instance()->detect_req_type(); |
575 | - }else{//it must be for an addon |
|
575 | + } else {//it must be for an addon |
|
576 | 576 | $addon_name = $this->slug(); |
577 | - if( EE_Registry::instance()->get_addon_by_name($addon_name)){ |
|
577 | + if (EE_Registry::instance()->get_addon_by_name($addon_name)) { |
|
578 | 578 | return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type(); |
579 | - }else{ |
|
580 | - throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ; |
|
579 | + } else { |
|
580 | + throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"), $this->slug(), $addon_name, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name())))); |
|
581 | 581 | } |
582 | 582 | } |
583 | 583 | } |
@@ -588,13 +588,13 @@ discard block |
||
588 | 588 | * returns an array of strings describing errors by all the script's stages |
589 | 589 | * @return array |
590 | 590 | */ |
591 | - public function get_errors(){ |
|
591 | + public function get_errors() { |
|
592 | 592 | $all_errors = $this->_errors; |
593 | - if( ! is_array($all_errors)){ |
|
593 | + if ( ! is_array($all_errors)) { |
|
594 | 594 | $all_errors = array(); |
595 | 595 | } |
596 | - foreach($this->stages() as $stage){ |
|
597 | - $all_errors = array_merge($stage->get_errors(),$all_errors); |
|
596 | + foreach ($this->stages() as $stage) { |
|
597 | + $all_errors = array_merge($stage->get_errors(), $all_errors); |
|
598 | 598 | } |
599 | 599 | return $all_errors; |
600 | 600 | } |
@@ -605,8 +605,8 @@ discard block |
||
605 | 605 | * Indicates whether or not this migration script should continue |
606 | 606 | * @return boolean |
607 | 607 | */ |
608 | - public function can_continue(){ |
|
609 | - return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script); |
|
608 | + public function can_continue() { |
|
609 | + return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | * get ordered by the indexes |
619 | 619 | * @return EE_Data_Migration_Script_Stage[] |
620 | 620 | */ |
621 | - protected function stages(){ |
|
622 | - $stages = apply_filters( 'FHEE__'.get_class($this).'__stages',$this->_migration_stages ); |
|
621 | + protected function stages() { |
|
622 | + $stages = apply_filters('FHEE__'.get_class($this).'__stages', $this->_migration_stages); |
|
623 | 623 | ksort($stages); |
624 | 624 | return $stages; |
625 | 625 | } |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * can be displayed to the user |
632 | 632 | * @return string |
633 | 633 | */ |
634 | - public function get_feedback_message(){ |
|
634 | + public function get_feedback_message() { |
|
635 | 635 | return $this->_feedback_message; |
636 | 636 | } |
637 | 637 | |
@@ -643,16 +643,16 @@ discard block |
||
643 | 643 | * possible that this class is defined when it goes to sleep, but NOT available when it |
644 | 644 | * awakes (eg, this class is part of an addon that is deactivated at some point). |
645 | 645 | */ |
646 | - public function properties_as_array(){ |
|
646 | + public function properties_as_array() { |
|
647 | 647 | $properties = parent::properties_as_array(); |
648 | 648 | $properties['_migration_stages'] = array(); |
649 | - foreach($this->_migration_stages as $migration_stage_priority => $migration_stage_class){ |
|
649 | + foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) { |
|
650 | 650 | $properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array(); |
651 | 651 | } |
652 | 652 | unset($properties['_mappings']); |
653 | 653 | |
654 | - foreach($this->_mappings as $old_table_name => $mapping_to_new_table){ |
|
655 | - foreach($mapping_to_new_table as $new_table_name => $mapping){ |
|
654 | + foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) { |
|
655 | + foreach ($mapping_to_new_table as $new_table_name => $mapping) { |
|
656 | 656 | $this->_set_mapping_option($old_table_name, $new_table_name, $mapping); |
657 | 657 | } |
658 | 658 | } |
@@ -667,19 +667,19 @@ discard block |
||
667 | 667 | * @param array $array_of_properties like what's produced from properties_as_array() method |
668 | 668 | * @return void |
669 | 669 | */ |
670 | - public function instantiate_from_array_of_properties($array_of_properties){ |
|
670 | + public function instantiate_from_array_of_properties($array_of_properties) { |
|
671 | 671 | $stages_properties_arrays = $array_of_properties['_migration_stages']; |
672 | 672 | unset($array_of_properties['_migration_stages']); |
673 | 673 | unset($array_of_properties['class']); |
674 | - foreach($array_of_properties as $property_name => $property_value){ |
|
674 | + foreach ($array_of_properties as $property_name => $property_value) { |
|
675 | 675 | $this->{$property_name} = $property_value; |
676 | 676 | } |
677 | 677 | //_migration_stages are already instantiated, but have only default data |
678 | - foreach($this->_migration_stages as $stage){ |
|
679 | - $stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage),$stages_properties_arrays); |
|
678 | + foreach ($this->_migration_stages as $stage) { |
|
679 | + $stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage), $stages_properties_arrays); |
|
680 | 680 | //SO, if we found the stage data that was saved, use it. Otherwise, I guess the stage is new? (maybe added by |
681 | 681 | //an addon? Unlikely... not sure why it wouldn't exist, but if it doesn't just treat it like it was never started yet) |
682 | - if($stage_data){ |
|
682 | + if ($stage_data) { |
|
683 | 683 | $stage->instantiate_from_array_of_properties($stage_data); |
684 | 684 | } |
685 | 685 | } |
@@ -695,9 +695,9 @@ discard block |
||
695 | 695 | * @param array $migration_stage_data_arrays |
696 | 696 | * @return null |
697 | 697 | */ |
698 | - private function _find_migration_stage_data_with_classname($classname,$migration_stage_data_arrays){ |
|
699 | - foreach($migration_stage_data_arrays as $migration_stage_data_array){ |
|
700 | - if(isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname){ |
|
698 | + private function _find_migration_stage_data_with_classname($classname, $migration_stage_data_arrays) { |
|
699 | + foreach ($migration_stage_data_arrays as $migration_stage_data_array) { |
|
700 | + if (isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname) { |
|
701 | 701 | return $migration_stage_data_array; |
702 | 702 | } |
703 | 703 | } |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | * @return array where the first key is the plugin's slug, the 2nd is the version of that plugin |
714 | 714 | * that will be updated to. Eg array('Core','4.1.0') |
715 | 715 | */ |
716 | - public final function migrates_to_version(){ |
|
717 | - return EE_Data_Migration_Manager::instance()->script_migrates_to_version( get_class( $this ) ); |
|
716 | + public final function migrates_to_version() { |
|
717 | + return EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this)); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | |
@@ -726,10 +726,10 @@ discard block |
||
726 | 726 | * Or 'Core' for core (non-addon). |
727 | 727 | * @return string |
728 | 728 | */ |
729 | - public function slug(){ |
|
729 | + public function slug() { |
|
730 | 730 | $migrates_to_version_info = $this->migrates_to_version(); |
731 | 731 | //the slug is the first part of the array |
732 | - return $migrates_to_version_info[ 'slug' ]; |
|
732 | + return $migrates_to_version_info['slug']; |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | * the database up so it can run), then you can set "A" to priority 3 or something. |
744 | 744 | * @return int |
745 | 745 | */ |
746 | - public function priority(){ |
|
746 | + public function priority() { |
|
747 | 747 | return $this->_priority; |
748 | 748 | } |
749 | 749 | |
@@ -756,18 +756,18 @@ discard block |
||
756 | 756 | * @param boolean $migrating |
757 | 757 | * @return void |
758 | 758 | */ |
759 | - public function set_migrating( $migrating = TRUE ){ |
|
759 | + public function set_migrating($migrating = TRUE) { |
|
760 | 760 | $this->_migrating = $migrating; |
761 | 761 | } |
762 | 762 | |
763 | 763 | /** |
764 | 764 | * Marks that we think this migration class can continue to migrate |
765 | 765 | */ |
766 | - public function reattempt(){ |
|
766 | + public function reattempt() { |
|
767 | 767 | parent::reattempt(); |
768 | 768 | //also, we want to reattempt any stages that were marked as borked |
769 | - foreach( $this->stages() as $stage ) { |
|
770 | - if( $stage->is_broken() ) { |
|
769 | + foreach ($this->stages() as $stage) { |
|
770 | + if ($stage->is_broken()) { |
|
771 | 771 | $stage->reattempt(); |
772 | 772 | } |
773 | 773 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated); |
315 | 315 | $num_records_actually_migrated += $records_migrated_during_stage; |
316 | 316 | $records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage; |
317 | - }catch(Exception $e){ |
|
317 | + } catch(Exception $e){ |
|
318 | 318 | //yes if we catch an exception here, we consider that migration stage borked. |
319 | 319 | $stage->set_status(EE_Data_Migration_Manager::status_fatal_error); |
320 | 320 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
@@ -340,14 +340,14 @@ discard block |
||
340 | 340 | //this migration script apparently has NO stages... which is super weird, but whatever |
341 | 341 | $this->set_completed(); |
342 | 342 | $this->_maybe_do_schema_changes(false); |
343 | - }else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){ |
|
343 | + } else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){ |
|
344 | 344 | //apparently we're done, because we couldn't migrate the number we intended to |
345 | 345 | $this->set_completed(); |
346 | 346 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
347 | 347 | //do schema changes for after the migration now |
348 | 348 | //first double-check we haven't already done this |
349 | 349 | $this->_maybe_do_schema_changes(false); |
350 | - }else{ |
|
350 | + } else{ |
|
351 | 351 | //update feedback message, keeping in mind that we show them with the most recent at the top |
352 | 352 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
353 | 353 | } |
@@ -386,12 +386,12 @@ discard block |
||
386 | 386 | ob_start(); |
387 | 387 | if($before){ |
388 | 388 | $this->schema_changes_before_migration(); |
389 | - }else{ |
|
389 | + } else{ |
|
390 | 390 | $this->schema_changes_after_migration(); |
391 | 391 | } |
392 | 392 | $output = ob_get_contents(); |
393 | 393 | ob_end_clean(); |
394 | - }catch(Exception $e){ |
|
394 | + } catch(Exception $e){ |
|
395 | 395 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
396 | 396 | throw $e; |
397 | 397 | } |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | if( $table_is_new ) { |
534 | 534 | if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating() ){ |
535 | 535 | return true; |
536 | - }else{ |
|
536 | + } else{ |
|
537 | 537 | return false; |
538 | 538 | } |
539 | - }else{ |
|
539 | + } else{ |
|
540 | 540 | if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){ |
541 | 541 | return true; |
542 | - }else{ |
|
542 | + } else{ |
|
543 | 543 | return false; |
544 | 544 | } |
545 | 545 | } |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){ |
556 | 556 | try{ |
557 | 557 | EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables); |
558 | - }catch( EE_Error $e ) { |
|
558 | + } catch( EE_Error $e ) { |
|
559 | 559 | $message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString(); |
560 | 560 | $this->add_error( $message ); |
561 | 561 | $this->_feedback_message .= $message; |
@@ -572,11 +572,11 @@ discard block |
||
572 | 572 | private function _get_req_type_for_plugin_corresponding_to_this_dms(){ |
573 | 573 | if($this->slug() == 'Core'){ |
574 | 574 | return EE_System::instance()->detect_req_type(); |
575 | - }else{//it must be for an addon |
|
575 | + } else{//it must be for an addon |
|
576 | 576 | $addon_name = $this->slug(); |
577 | 577 | if( EE_Registry::instance()->get_addon_by_name($addon_name)){ |
578 | 578 | return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type(); |
579 | - }else{ |
|
579 | + } else{ |
|
580 | 580 | throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ; |
581 | 581 | } |
582 | 582 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | * @return float total taxes to apply to ticket. |
39 | 39 | * @throws \EE_Error |
40 | 40 | */ |
41 | - public static function get_total_taxes_for_admin( EE_Ticket $ticket ) { |
|
41 | + public static function get_total_taxes_for_admin(EE_Ticket $ticket) { |
|
42 | 42 | $tax = 0; |
43 | 43 | $total_tax = 0; |
44 | 44 | //This first checks to see if the given ticket is taxable. |
45 | - if ( ! $ticket->get( 'TKT_taxable' ) ) { |
|
45 | + if ( ! $ticket->get('TKT_taxable')) { |
|
46 | 46 | return $tax; |
47 | 47 | } |
48 | 48 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
49 | - $subtotal = self::get_subtotal_for_admin( $ticket ); |
|
49 | + $subtotal = self::get_subtotal_for_admin($ticket); |
|
50 | 50 | //get taxes |
51 | 51 | $taxes = self::get_taxes_for_admin(); |
52 | 52 | //apply taxes to subtotal |
53 | - foreach ( $taxes as $tax ) { |
|
53 | + foreach ($taxes as $tax) { |
|
54 | 54 | //assuming taxes are not cumulative |
55 | - $total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100; |
|
55 | + $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
56 | 56 | } |
57 | 57 | return $total_tax; |
58 | 58 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public static function get_total_taxes_percentage() { |
70 | 70 | $total_tax_percent = 0; |
71 | - foreach ( self::get_taxes_for_admin() as $tax_price ) { |
|
72 | - $total_tax_percent += $tax_price->get( 'PRC_amount' ); |
|
71 | + foreach (self::get_taxes_for_admin() as $tax_price) { |
|
72 | + $total_tax_percent += $tax_price->get('PRC_amount'); |
|
73 | 73 | } |
74 | 74 | return $total_tax_percent; |
75 | 75 | } |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @return float |
82 | 82 | * @throws \EE_Error |
83 | 83 | */ |
84 | - public static function get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
84 | + public static function get_subtotal_for_admin(EE_Ticket $ticket) { |
|
85 | 85 | $TKT_ID = $ticket->ID(); |
86 | - return isset( self::$_subtotal[ $TKT_ID ] ) |
|
87 | - ? self::$_subtotal[ $TKT_ID ] |
|
88 | - : self::_get_subtotal_for_admin( $ticket ); |
|
86 | + return isset(self::$_subtotal[$TKT_ID]) |
|
87 | + ? self::$_subtotal[$TKT_ID] |
|
88 | + : self::_get_subtotal_for_admin($ticket); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -97,37 +97,37 @@ discard block |
||
97 | 97 | * @return float subtotal calculated from all EE_Price[] on Ticket. |
98 | 98 | * @throws \EE_Error |
99 | 99 | */ |
100 | - private static function _get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
100 | + private static function _get_subtotal_for_admin(EE_Ticket $ticket) { |
|
101 | 101 | $subtotal = 0; |
102 | 102 | //get all prices |
103 | 103 | $prices = $ticket->get_many_related( |
104 | 104 | 'Price', |
105 | 105 | array( |
106 | 106 | 'default_where_conditions' => 'none', |
107 | - 'order_by' => array( 'PRC_order' => 'ASC' ), |
|
107 | + 'order_by' => array('PRC_order' => 'ASC'), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | //let's loop through them (base price is always the first item) |
111 | - foreach ( $prices as $price ) { |
|
112 | - if ( $price instanceof EE_Price ) { |
|
111 | + foreach ($prices as $price) { |
|
112 | + if ($price instanceof EE_Price) { |
|
113 | 113 | $price_type = $price->type_obj(); |
114 | - if ( $price_type instanceof EE_Price_Type ) { |
|
115 | - switch ( $price->type_obj()->base_type() ) { |
|
114 | + if ($price_type instanceof EE_Price_Type) { |
|
115 | + switch ($price->type_obj()->base_type()) { |
|
116 | 116 | case 1: // base price |
117 | 117 | case 3: // surcharges |
118 | - $subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 |
|
119 | - : $price->get( 'PRC_amount' ); |
|
118 | + $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
119 | + : $price->get('PRC_amount'); |
|
120 | 120 | break; |
121 | 121 | case 2: // discounts |
122 | - $subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 |
|
123 | - : $price->get( 'PRC_amount' ); |
|
122 | + $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
123 | + : $price->get('PRC_amount'); |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
129 | 129 | $TKT_ID = $ticket->ID(); |
130 | - self::$_subtotal = array( $TKT_ID => $subtotal ); |
|
130 | + self::$_subtotal = array($TKT_ID => $subtotal); |
|
131 | 131 | return $subtotal; |
132 | 132 | } |
133 | 133 | |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | * @throws \EE_Error |
141 | 141 | */ |
142 | 142 | public static function get_taxes_for_admin() { |
143 | - if ( empty( self::$_default_taxes ) ) { |
|
144 | - self::$_default_taxes = EE_Registry::instance()->load_model( 'Price' )->get_all( |
|
145 | - array( array( 'Price_Type.PBT_ID' => 4 ) ) |
|
143 | + if (empty(self::$_default_taxes)) { |
|
144 | + self::$_default_taxes = EE_Registry::instance()->load_model('Price')->get_all( |
|
145 | + array(array('Price_Type.PBT_ID' => 4)) |
|
146 | 146 | ); |
147 | 147 | } |
148 | 148 | return self::$_default_taxes; |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <p><strong><?php _e('PayPal Standard', 'event_espresso'); ?></strong></p> |
2 | -<p><span class="required"><?php _e('Please Note! This gateway has been deprecated and replaced with the PayPal Express payment method. ', 'event_espresso'); ?> <?php printf( __('If you still want to use this gateway, please follow the directions to %1$sactivate it here%2$s.', 'event_espresso'), "<a href='https://eventespresso.com/wiki/paypal-standard-payment-gateway/#deprecated' target='_blank'>", '</a>'); ?></span></p> |
|
2 | +<p><span class="required"><?php _e('Please Note! This gateway has been deprecated and replaced with the PayPal Express payment method. ', 'event_espresso'); ?> <?php printf(__('If you still want to use this gateway, please follow the directions to %1$sactivate it here%2$s.', 'event_espresso'), "<a href='https://eventespresso.com/wiki/paypal-standard-payment-gateway/#deprecated' target='_blank'>", '</a>'); ?></span></p> |
|
3 | 3 | <p> |
4 | 4 | <?php _e('Adjust the settings for the PayPal Standard payment gateway.', 'event_espresso'); ?> |
5 | 5 | </p> |
6 | 6 | <p> |
7 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso' ), "<a href='https://www.paypal.com/multicurrency' target='_blank'>","</a>" ); ?> |
|
7 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso'), "<a href='https://www.paypal.com/multicurrency' target='_blank'>", "</a>"); ?> |
|
8 | 8 | </p> |
9 | 9 | <p><strong><?php _e('PayPal Standard Settings', 'event_espresso'); ?></strong></p> |
10 | 10 | <ul> |
@@ -22,18 +22,18 @@ discard block |
||
22 | 22 | </li> |
23 | 23 | <li> |
24 | 24 | <strong><?php _e('PayPal Calculates Taxes', 'event_espresso'); ?></strong><br /> |
25 | -<?php printf( __('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>' ); ?><br/> |
|
26 | -<?php _e( 'Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso' );?> |
|
25 | +<?php printf(__('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>'); ?><br/> |
|
26 | +<?php _e('Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso'); ?> |
|
27 | 27 | </li> |
28 | 28 | <li> |
29 | 29 | <strong><?php _e('PayPal Calculates Shipping', 'event_espresso'); ?></strong><br /> |
30 | 30 | <?php _e('Similar to the "PayPal Calculates Taxes" setting, if this is set to "Yes", we will indicate to PayPal that it should calculate the shipping on each payment (if there are multiple payments for a single transaction, PayPal is permitted to add shipping charges to each payment.)', 'event_espresso'); ?><br/> |
31 | -<?php _e( 'Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso' );?> |
|
31 | +<?php _e('Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso'); ?> |
|
32 | 32 | <li> |
33 | -<strong><?php _e( 'Notes Regarding Paypal Taxes and Shipping', 'event_espresso' );?></strong><br/> |
|
34 | -<?php _e( 'If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso' );?><br/> |
|
35 | -<?php _e( 'However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso' );?><br/> |
|
36 | -<?php _e( 'Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso' );?> |
|
33 | +<strong><?php _e('Notes Regarding Paypal Taxes and Shipping', 'event_espresso'); ?></strong><br/> |
|
34 | +<?php _e('If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso'); ?><br/> |
|
35 | +<?php _e('However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso'); ?><br/> |
|
36 | +<?php _e('Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso'); ?> |
|
37 | 37 | </li> |
38 | 38 | <li> |
39 | 39 | <strong><?php _e('Shipping Address Options', 'event_espresso'); ?></strong><br /> |