@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\exceptions; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -15,5 +15,5 @@ discard block |
||
15 | 15 | * @author Darren Ethier |
16 | 16 | * @since 4.9.11.rc.001 |
17 | 17 | */ |
18 | -class SendMessageException extends \RuntimeException {} |
|
18 | +class SendMessageException extends \RuntimeException {} |
|
19 | 19 | // End of file SendMessageException.php |
20 | 20 | \ No newline at end of file |
@@ -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 | /** |
@@ -804,10 +804,10 @@ discard block |
||
804 | 804 | */ |
805 | 805 | public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
806 | 806 | return ! $this->revisit |
807 | - || $this->primary_revisit |
|
808 | - || ( |
|
809 | - $this->revisit && $this->reg_url_link === $registration->reg_url_link() |
|
810 | - ) |
|
807 | + || $this->primary_revisit |
|
808 | + || ( |
|
809 | + $this->revisit && $this->reg_url_link === $registration->reg_url_link() |
|
810 | + ) |
|
811 | 811 | ? true |
812 | 812 | : false; |
813 | 813 | } |
@@ -1199,16 +1199,16 @@ discard block |
||
1199 | 1199 | * @return array |
1200 | 1200 | * @throws \EE_Error |
1201 | 1201 | */ |
1202 | - public function __sleep() |
|
1203 | - { |
|
1204 | - if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) { |
|
1205 | - $this->primary_attendee_obj = $this->primary_attendee_obj->ID(); |
|
1206 | - } // remove the reg form and the checkout |
|
1207 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1208 | - $this->transaction = $this->transaction->ID(); |
|
1209 | - } // remove the reg form and the checkout |
|
1210 | - return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) ); |
|
1211 | - } |
|
1202 | + public function __sleep() |
|
1203 | + { |
|
1204 | + if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) { |
|
1205 | + $this->primary_attendee_obj = $this->primary_attendee_obj->ID(); |
|
1206 | + } // remove the reg form and the checkout |
|
1207 | + if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1208 | + $this->transaction = $this->transaction->ID(); |
|
1209 | + } // remove the reg form and the checkout |
|
1210 | + return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) ); |
|
1211 | + } |
|
1212 | 1212 | |
1213 | 1213 | |
1214 | 1214 | /** |
@@ -247,9 +247,9 @@ 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 | - $this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
252 | + $this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC')); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | * @return boolean |
261 | 261 | */ |
262 | 262 | public function any_reg_status_updated() { |
263 | - foreach ( $this->reg_status_updated as $reg_status ) { |
|
264 | - if ( $reg_status ) { |
|
263 | + foreach ($this->reg_status_updated as $reg_status) { |
|
264 | + if ($reg_status) { |
|
265 | 265 | return true; |
266 | 266 | } |
267 | 267 | } |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | * @param $REG_ID |
275 | 275 | * @return boolean |
276 | 276 | */ |
277 | - public function reg_status_updated( $REG_ID ) { |
|
278 | - return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false; |
|
277 | + public function reg_status_updated($REG_ID) { |
|
278 | + return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | * @param $REG_ID |
285 | 285 | * @param $reg_status |
286 | 286 | */ |
287 | - public function set_reg_status_updated( $REG_ID, $reg_status ) { |
|
288 | - $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
|
287 | + public function set_reg_status_updated($REG_ID, $reg_status) { |
|
288 | + $this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * can ONLY be set by the Finalize_Registration reg step |
307 | 307 | */ |
308 | 308 | public function set_exit_spco() { |
309 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
309 | + if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
310 | 310 | $this->exit_spco = true; |
311 | 311 | } |
312 | 312 | } |
@@ -323,12 +323,12 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public function reset_for_current_request() { |
325 | 325 | $this->process_form_submission = FALSE; |
326 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true ); |
|
326 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true); |
|
327 | 327 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
328 | 328 | $this->continue_reg = true; |
329 | 329 | $this->redirect = false; |
330 | 330 | // don't reset the cached redirect form if we're about to be asked to display it !!! |
331 | - if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) { |
|
331 | + if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') { |
|
332 | 332 | $this->redirect_form = ''; |
333 | 333 | } |
334 | 334 | $this->redirect_url = ''; |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | * @param EE_SPCO_Reg_Step $reg_step_obj |
346 | 346 | * @return void |
347 | 347 | */ |
348 | - public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
|
349 | - $this->reg_steps[ $reg_step_obj->slug() ] = $reg_step_obj; |
|
348 | + public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) { |
|
349 | + $this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj; |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | |
@@ -362,22 +362,22 @@ discard block |
||
362 | 362 | * @return void |
363 | 363 | * @throws \EE_Error |
364 | 364 | */ |
365 | - public function skip_reg_step( $reg_step_slug = '' ) { |
|
366 | - $step_to_skip = $this->find_reg_step( $reg_step_slug ); |
|
367 | - if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) { |
|
368 | - $step_to_skip->set_is_current_step( false ); |
|
365 | + public function skip_reg_step($reg_step_slug = '') { |
|
366 | + $step_to_skip = $this->find_reg_step($reg_step_slug); |
|
367 | + if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) { |
|
368 | + $step_to_skip->set_is_current_step(false); |
|
369 | 369 | $step_to_skip->set_completed(); |
370 | 370 | // advance to the next step |
371 | - $this->set_current_step( $this->next_step->slug() ); |
|
371 | + $this->set_current_step($this->next_step->slug()); |
|
372 | 372 | // also reset the step param in the request in case any other code references that directly |
373 | - EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() ); |
|
373 | + EE_Registry::instance()->REQ->set('step', $this->current_step->slug()); |
|
374 | 374 | // since we are skipping a step and setting the current step to be what was previously the next step, |
375 | 375 | // we need to check that the next step is now correct, and not still set to the current step. |
376 | - if ( $this->current_step->slug() === $this->next_step->slug() ) { |
|
376 | + if ($this->current_step->slug() === $this->next_step->slug()) { |
|
377 | 377 | // correctly setup the next step |
378 | 378 | $this->set_next_step(); |
379 | 379 | } |
380 | - $this->set_reg_step_initiated( $this->current_step ); |
|
380 | + $this->set_reg_step_initiated($this->current_step); |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
@@ -391,14 +391,14 @@ discard block |
||
391 | 391 | * @param bool $reset whether to reset reg steps after removal |
392 | 392 | * @throws EE_Error |
393 | 393 | */ |
394 | - public function remove_reg_step( $reg_step_slug = '', $reset = true ) { |
|
395 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
396 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
394 | + public function remove_reg_step($reg_step_slug = '', $reset = true) { |
|
395 | + unset($this->reg_steps[$reg_step_slug]); |
|
396 | + if ($this->transaction instanceof EE_Transaction) { |
|
397 | 397 | // now remove reg step from TXN and save |
398 | - $this->transaction->remove_reg_step( $reg_step_slug ); |
|
398 | + $this->transaction->remove_reg_step($reg_step_slug); |
|
399 | 399 | $this->transaction->save(); |
400 | 400 | } |
401 | - if ( $reset ) { |
|
401 | + if ($reset) { |
|
402 | 402 | $this->reset_reg_steps(); |
403 | 403 | } |
404 | 404 | } |
@@ -413,9 +413,9 @@ discard block |
||
413 | 413 | * @param int $order |
414 | 414 | * @return void |
415 | 415 | */ |
416 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
417 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
418 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
416 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
417 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
418 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
419 | 419 | } |
420 | 420 | } |
421 | 421 | |
@@ -428,25 +428,25 @@ discard block |
||
428 | 428 | * @param string $current_step |
429 | 429 | * @return void |
430 | 430 | */ |
431 | - public function set_current_step( $current_step ) { |
|
431 | + public function set_current_step($current_step) { |
|
432 | 432 | // grab what step we're on |
433 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
433 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
434 | 434 | // verify instance |
435 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
435 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
436 | 436 | // we don't want to repeat completed steps if this is the first time through SPCO |
437 | - if ( $this->continue_reg && ! $this->revisit && $this->current_step->completed() ) { |
|
437 | + if ($this->continue_reg && ! $this->revisit && $this->current_step->completed()) { |
|
438 | 438 | // so advance to the next step |
439 | 439 | $this->set_next_step(); |
440 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
440 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
441 | 441 | // and attempt to set it as the current step |
442 | - $this->set_current_step( $this->next_step->slug() ); |
|
442 | + $this->set_current_step($this->next_step->slug()); |
|
443 | 443 | } |
444 | 444 | return; |
445 | 445 | } |
446 | - $this->current_step->set_is_current_step( TRUE ); |
|
446 | + $this->current_step->set_is_current_step(TRUE); |
|
447 | 447 | } else { |
448 | 448 | EE_Error::add_error( |
449 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
449 | + __('The current step could not be set.', 'event_espresso'), |
|
450 | 450 | __FILE__, __FUNCTION__, __LINE__ |
451 | 451 | ); |
452 | 452 | } |
@@ -463,20 +463,20 @@ discard block |
||
463 | 463 | */ |
464 | 464 | public function set_next_step() { |
465 | 465 | // set pointer to start of array |
466 | - reset( $this->reg_steps ); |
|
466 | + reset($this->reg_steps); |
|
467 | 467 | // if there is more than one step |
468 | - if ( count( $this->reg_steps ) > 1 ) { |
|
468 | + if (count($this->reg_steps) > 1) { |
|
469 | 469 | // advance to the current step and set pointer |
470 | - while ( key( $this->reg_steps ) !== $this->current_step->slug() && key( $this->reg_steps ) !== '' ) { |
|
471 | - next( $this->reg_steps ); |
|
470 | + while (key($this->reg_steps) !== $this->current_step->slug() && key($this->reg_steps) !== '') { |
|
471 | + next($this->reg_steps); |
|
472 | 472 | } |
473 | 473 | } |
474 | 474 | // advance one more spot ( if it exists ) |
475 | - $this->next_step = next( $this->reg_steps ); |
|
475 | + $this->next_step = next($this->reg_steps); |
|
476 | 476 | // verify instance |
477 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
477 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
478 | 478 | // then back to current step to reset |
479 | - prev( $this->reg_steps ); |
|
479 | + prev($this->reg_steps); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | |
@@ -490,8 +490,8 @@ discard block |
||
490 | 490 | * @return EE_SPCO_Reg_Step | null |
491 | 491 | */ |
492 | 492 | public function get_next_reg_step() { |
493 | - $next = next( $this->reg_steps ); |
|
494 | - prev( $this->reg_steps ); |
|
493 | + $next = next($this->reg_steps); |
|
494 | + prev($this->reg_steps); |
|
495 | 495 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
496 | 496 | } |
497 | 497 | |
@@ -506,8 +506,8 @@ discard block |
||
506 | 506 | * @return EE_SPCO_Reg_Step | null |
507 | 507 | */ |
508 | 508 | public function get_prev_reg_step() { |
509 | - $prev = prev( $this->reg_steps ); |
|
510 | - next( $this->reg_steps ); |
|
509 | + $prev = prev($this->reg_steps); |
|
510 | + next($this->reg_steps); |
|
511 | 511 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
512 | 512 | } |
513 | 513 | |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | * @return void |
521 | 521 | */ |
522 | 522 | public function sort_reg_steps() { |
523 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
524 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
523 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
524 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -534,19 +534,19 @@ discard block |
||
534 | 534 | * @param string $reg_step_slug |
535 | 535 | * @return EE_SPCO_Reg_Step|null |
536 | 536 | */ |
537 | - public function find_reg_step( $reg_step_slug = '' ) { |
|
538 | - if ( ! empty( $reg_step_slug ) ) { |
|
537 | + public function find_reg_step($reg_step_slug = '') { |
|
538 | + if ( ! empty($reg_step_slug)) { |
|
539 | 539 | // copy reg step array |
540 | 540 | $reg_steps = $this->reg_steps; |
541 | 541 | // set pointer to start of array |
542 | - reset( $reg_steps ); |
|
542 | + reset($reg_steps); |
|
543 | 543 | // if there is more than one step |
544 | - if ( count( $reg_steps ) > 1 ) { |
|
544 | + if (count($reg_steps) > 1) { |
|
545 | 545 | // advance to the current step and set pointer |
546 | - while ( key( $reg_steps ) !== $reg_step_slug && key( $reg_steps ) !== '' ) { |
|
547 | - next( $reg_steps ); |
|
546 | + while (key($reg_steps) !== $reg_step_slug && key($reg_steps) !== '') { |
|
547 | + next($reg_steps); |
|
548 | 548 | } |
549 | - return current( $reg_steps ); |
|
549 | + return current($reg_steps); |
|
550 | 550 | } |
551 | 551 | } |
552 | 552 | return null; |
@@ -562,17 +562,17 @@ discard block |
||
562 | 562 | * @param EE_SPCO_Reg_Step $reg_step_B |
563 | 563 | * @return int |
564 | 564 | */ |
565 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
565 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
566 | 566 | // send finalize_registration step to the end of the array |
567 | - if ( $reg_step_A->slug() === 'finalize_registration' ) { |
|
567 | + if ($reg_step_A->slug() === 'finalize_registration') { |
|
568 | 568 | return 1; |
569 | - } else if ( $reg_step_B->slug() === 'finalize_registration' ) { |
|
569 | + } else if ($reg_step_B->slug() === 'finalize_registration') { |
|
570 | 570 | return -1; |
571 | 571 | } |
572 | - if ( $reg_step_A->order() === $reg_step_B->order() ) { |
|
572 | + if ($reg_step_A->order() === $reg_step_B->order()) { |
|
573 | 573 | return 0; |
574 | 574 | } |
575 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
575 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | * @param EE_SPCO_Reg_Step $reg_step |
585 | 585 | * @throws \EE_Error |
586 | 586 | */ |
587 | - public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) { |
|
587 | + public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) { |
|
588 | 588 | // call set_reg_step_initiated ??? |
589 | 589 | if ( |
590 | 590 | // first time visiting SPCO ? |
@@ -597,11 +597,11 @@ discard block |
||
597 | 597 | ) |
598 | 598 | ) { |
599 | 599 | // set the start time for this reg step |
600 | - if ( ! $this->transaction->set_reg_step_initiated( $reg_step->slug() ) ) { |
|
601 | - if ( WP_DEBUG ) { |
|
600 | + if ( ! $this->transaction->set_reg_step_initiated($reg_step->slug())) { |
|
601 | + if (WP_DEBUG) { |
|
602 | 602 | EE_Error::add_error( |
603 | 603 | sprintf( |
604 | - __( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), |
|
604 | + __('The "%1$s" registration step was not initialized properly.', 'event_espresso'), |
|
605 | 605 | $reg_step->name() |
606 | 606 | ), |
607 | 607 | __FILE__, __FUNCTION__, __LINE__ |
@@ -620,10 +620,10 @@ discard block |
||
620 | 620 | * @return void |
621 | 621 | */ |
622 | 622 | public function set_reg_step_JSON_info() { |
623 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
623 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
624 | 624 | // pass basic reg step data to JS |
625 | - foreach ( $this->reg_steps as $reg_step ) { |
|
626 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
625 | + foreach ($this->reg_steps as $reg_step) { |
|
626 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
627 | 627 | } |
628 | 628 | // reset reg step html |
629 | 629 | // $this->json_response->set_reg_step_html( '' ); |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | */ |
640 | 640 | public function reset_reg_steps() { |
641 | 641 | $this->sort_reg_steps(); |
642 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
642 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
643 | 643 | $this->set_next_step(); |
644 | 644 | // the text that appears on the reg step form submit button |
645 | 645 | $this->current_step->set_submit_button_text(); |
@@ -656,9 +656,9 @@ discard block |
||
656 | 656 | */ |
657 | 657 | public function get_registration_time_limit() { |
658 | 658 | |
659 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
659 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
660 | 660 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
661 | - $registration_time_limit = date( $time_limit_format, $registration_time_limit ); |
|
661 | + $registration_time_limit = date($time_limit_format, $registration_time_limit); |
|
662 | 662 | return apply_filters( |
663 | 663 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
664 | 664 | $registration_time_limit |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | // overpaid TXN |
679 | 679 | // free TXN ( total = 0.00 ) |
680 | 680 | // then payment required is TRUE |
681 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
681 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -690,12 +690,12 @@ discard block |
||
690 | 690 | * @param EE_Transaction $transaction |
691 | 691 | * @return EE_Cart |
692 | 692 | */ |
693 | - public function get_cart_for_transaction( $transaction ) { |
|
694 | - $session = EE_Registry::instance()->load_core( 'Session' ); |
|
695 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction, $session ) : null; |
|
693 | + public function get_cart_for_transaction($transaction) { |
|
694 | + $session = EE_Registry::instance()->load_core('Session'); |
|
695 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction, $session) : null; |
|
696 | 696 | // verify cart |
697 | - if ( ! $cart instanceof EE_Cart ) { |
|
698 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
697 | + if ( ! $cart instanceof EE_Cart) { |
|
698 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | return $cart; |
@@ -711,8 +711,8 @@ discard block |
||
711 | 711 | */ |
712 | 712 | public function initialize_txn_reg_steps_array() { |
713 | 713 | $txn_reg_steps_array = array(); |
714 | - foreach ( $this->reg_steps as $reg_step ) { |
|
715 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
714 | + foreach ($this->reg_steps as $reg_step) { |
|
715 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
716 | 716 | } |
717 | 717 | return $txn_reg_steps_array; |
718 | 718 | } |
@@ -728,14 +728,14 @@ discard block |
||
728 | 728 | */ |
729 | 729 | public function update_txn_reg_steps_array() { |
730 | 730 | $updated = false; |
731 | - foreach ( $this->reg_steps as $reg_step ) { |
|
732 | - if ( $reg_step->completed() ) { |
|
733 | - $updated = $this->transaction->set_reg_step_completed( $reg_step->slug() ) |
|
731 | + foreach ($this->reg_steps as $reg_step) { |
|
732 | + if ($reg_step->completed()) { |
|
733 | + $updated = $this->transaction->set_reg_step_completed($reg_step->slug()) |
|
734 | 734 | ? true |
735 | 735 | : $updated; |
736 | 736 | } |
737 | 737 | } |
738 | - if ( $updated ) { |
|
738 | + if ($updated) { |
|
739 | 739 | $this->transaction->save(); |
740 | 740 | } |
741 | 741 | return $updated; |
@@ -751,14 +751,14 @@ discard block |
||
751 | 751 | * @throws \EE_Error |
752 | 752 | */ |
753 | 753 | public function stash_transaction_and_checkout() { |
754 | - if ( ! $this->revisit ) { |
|
754 | + if ( ! $this->revisit) { |
|
755 | 755 | $this->update_txn_reg_steps_array(); |
756 | 756 | } |
757 | 757 | $this->track_transaction_and_registration_status_updates(); |
758 | 758 | // save all data to the db, but suppress errors |
759 | 759 | //$this->save_all_data( FALSE ); |
760 | 760 | // cache the checkout in the session |
761 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
761 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | |
@@ -773,15 +773,15 @@ discard block |
||
773 | 773 | */ |
774 | 774 | public function track_transaction_and_registration_status_updates() { |
775 | 775 | // verify the transaction |
776 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
776 | + if ($this->transaction instanceof EE_Transaction) { |
|
777 | 777 | // has there been a TXN status change during this checkout? |
778 | 778 | $this->txn_status_updated = $this->transaction->txn_status_updated(); |
779 | 779 | /** @type EE_Registration_Processor $registration_processor */ |
780 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
780 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
781 | 781 | // grab the saved registrations from the transaction |
782 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
783 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
784 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
782 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
783 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
784 | + $this->set_reg_status_updated($registration->ID(), true); |
|
785 | 785 | } |
786 | 786 | } |
787 | 787 | } |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | * @return bool |
803 | 803 | * @throws \EE_Error |
804 | 804 | */ |
805 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
805 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
806 | 806 | return ! $this->revisit |
807 | 807 | || $this->primary_revisit |
808 | 808 | || ( |
@@ -835,18 +835,18 @@ discard block |
||
835 | 835 | * @return bool |
836 | 836 | * @throws \EE_Error |
837 | 837 | */ |
838 | - public function save_all_data( $show_errors = TRUE ) { |
|
838 | + public function save_all_data($show_errors = TRUE) { |
|
839 | 839 | // verify the transaction |
840 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
840 | + if ($this->transaction instanceof EE_Transaction) { |
|
841 | 841 | // save to ensure that TXN has ID |
842 | 842 | $this->transaction->save(); |
843 | 843 | // grab the saved registrations from the transaction |
844 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
845 | - $this->_save_registration( $registration, $show_errors ); |
|
844 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
845 | + $this->_save_registration($registration, $show_errors); |
|
846 | 846 | } |
847 | 847 | } else { |
848 | - if ( $show_errors ) { |
|
849 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
848 | + if ($show_errors) { |
|
849 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
850 | 850 | } |
851 | 851 | return FALSE; |
852 | 852 | } |
@@ -863,32 +863,32 @@ discard block |
||
863 | 863 | * @return void |
864 | 864 | * @throws \EE_Error |
865 | 865 | */ |
866 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
866 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
867 | 867 | // verify object |
868 | - if ( $registration instanceof EE_Registration ) { |
|
868 | + if ($registration instanceof EE_Registration) { |
|
869 | 869 | // should this registration be processed during this visit ? |
870 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
870 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
871 | 871 | //set TXN ID |
872 | - if ( ! $registration->transaction_ID() ) { |
|
873 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
872 | + if ( ! $registration->transaction_ID()) { |
|
873 | + $registration->set_transaction_id($this->transaction->ID()); |
|
874 | 874 | } |
875 | 875 | // verify and save the attendee |
876 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
876 | + $this->_save_registration_attendee($registration, $show_errors); |
|
877 | 877 | // save answers to reg form questions |
878 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
878 | + $this->_save_registration_answers($registration, $show_errors); |
|
879 | 879 | // save changes |
880 | 880 | $registration->save(); |
881 | 881 | // update txn cache |
882 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
883 | - if ( $show_errors ) { |
|
884 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
882 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
883 | + if ($show_errors) { |
|
884 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
885 | 885 | } |
886 | 886 | } |
887 | 887 | } |
888 | 888 | } else { |
889 | - if ( $show_errors ) { |
|
889 | + if ($show_errors) { |
|
890 | 890 | EE_Error::add_error( |
891 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
891 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
892 | 892 | __FILE__, __FUNCTION__, __LINE__ |
893 | 893 | ); |
894 | 894 | } |
@@ -905,25 +905,25 @@ discard block |
||
905 | 905 | * @return void |
906 | 906 | * @throws \EE_Error |
907 | 907 | */ |
908 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
909 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
908 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
909 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
910 | 910 | // save so that ATT has ID |
911 | 911 | $registration->attendee()->save(); |
912 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() ) ) { |
|
913 | - if ( $show_errors ) { |
|
912 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
913 | + if ($show_errors) { |
|
914 | 914 | EE_Error::add_error( |
915 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
915 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
916 | 916 | __FILE__, __FUNCTION__, __LINE__ |
917 | 917 | ); |
918 | 918 | } |
919 | 919 | } |
920 | 920 | } else { |
921 | - if ( $show_errors ) { |
|
921 | + if ($show_errors) { |
|
922 | 922 | EE_Error::add_error( |
923 | 923 | sprintf( |
924 | 924 | '%1$s||%1$s $attendee = %2$s', |
925 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
926 | - var_export( $registration->attendee(), true ) |
|
925 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
926 | + var_export($registration->attendee(), true) |
|
927 | 927 | ), |
928 | 928 | __FILE__, __FUNCTION__, __LINE__ |
929 | 929 | ); |
@@ -941,25 +941,25 @@ discard block |
||
941 | 941 | * @return void |
942 | 942 | * @throws \EE_Error |
943 | 943 | */ |
944 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
944 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
945 | 945 | // now save the answers |
946 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
946 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
947 | 947 | // verify object |
948 | - if ( $answer instanceof EE_Answer ) { |
|
949 | - $answer->set_registration( $registration->ID() ); |
|
948 | + if ($answer instanceof EE_Answer) { |
|
949 | + $answer->set_registration($registration->ID()); |
|
950 | 950 | $answer->save(); |
951 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
952 | - if ( $show_errors ) { |
|
951 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
952 | + if ($show_errors) { |
|
953 | 953 | EE_Error::add_error( |
954 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
954 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
955 | 955 | __FILE__, __FUNCTION__, __LINE__ |
956 | 956 | ); |
957 | 957 | } |
958 | 958 | } |
959 | 959 | } else { |
960 | - if ( $show_errors ) { |
|
960 | + if ($show_errors) { |
|
961 | 961 | EE_Error::add_error( |
962 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
962 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
963 | 963 | __FILE__, __FUNCTION__, __LINE__ |
964 | 964 | ); |
965 | 965 | } |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | * @return bool |
979 | 979 | * @throws \EE_Error |
980 | 980 | */ |
981 | - public function refresh_all_entities( $from_db = false ) { |
|
981 | + public function refresh_all_entities($from_db = false) { |
|
982 | 982 | $from_db = $this->current_step->is_final_step() || $this->action === 'process_gateway_response' |
983 | 983 | ? true |
984 | 984 | : $from_db; |
@@ -1002,11 +1002,11 @@ discard block |
||
1002 | 1002 | */ |
1003 | 1003 | protected function refresh_from_db() { |
1004 | 1004 | // verify the transaction |
1005 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1005 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1006 | 1006 | // pull fresh TXN data from the db |
1007 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
1007 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
1008 | 1008 | // update EE_Checkout's cached primary_attendee object |
1009 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
1009 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
1010 | 1010 | // update EE_Checkout's cached payment object |
1011 | 1011 | $payment = $this->transaction->last_payment(); |
1012 | 1012 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -1014,9 +1014,9 @@ discard block |
||
1014 | 1014 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
1015 | 1015 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
1016 | 1016 | //now refresh the cart, based on the TXN |
1017 | - $this->cart = $this->get_cart_for_transaction( $this->transaction ); |
|
1017 | + $this->cart = $this->get_cart_for_transaction($this->transaction); |
|
1018 | 1018 | } else { |
1019 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1019 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1020 | 1020 | return FALSE; |
1021 | 1021 | } |
1022 | 1022 | return TRUE; |
@@ -1031,21 +1031,21 @@ discard block |
||
1031 | 1031 | * @return EE_Attendee | null |
1032 | 1032 | * @throws \EE_Error |
1033 | 1033 | */ |
1034 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
1034 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
1035 | 1035 | |
1036 | 1036 | $primary_attendee_obj = null; |
1037 | 1037 | // grab the saved registrations from the transaction |
1038 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
1038 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
1039 | 1039 | // verify object |
1040 | - if ( $registration instanceof EE_Registration ) { |
|
1040 | + if ($registration instanceof EE_Registration) { |
|
1041 | 1041 | $attendee = $registration->attendee(); |
1042 | 1042 | // verify object && maybe cache primary_attendee_obj ? |
1043 | - if ( $attendee instanceof EE_Attendee&& $registration->is_primary_registrant() ) { |
|
1043 | + if ($attendee instanceof EE_Attendee && $registration->is_primary_registrant()) { |
|
1044 | 1044 | $primary_attendee_obj = $attendee; |
1045 | 1045 | } |
1046 | 1046 | } else { |
1047 | 1047 | EE_Error::add_error( |
1048 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1048 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1049 | 1049 | __FILE__, __FUNCTION__, __LINE__ |
1050 | 1050 | ); |
1051 | 1051 | } |
@@ -1066,43 +1066,43 @@ discard block |
||
1066 | 1066 | */ |
1067 | 1067 | protected function refresh_entity_map() { |
1068 | 1068 | // verify the transaction |
1069 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1069 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1070 | 1070 | // never cache payment info |
1071 | - $this->transaction->clear_cache( 'Payment' ); |
|
1071 | + $this->transaction->clear_cache('Payment'); |
|
1072 | 1072 | // is the Payment Options Reg Step completed ? |
1073 | - if ( $this->transaction->reg_step_completed( 'payment_options' ) ) { |
|
1073 | + if ($this->transaction->reg_step_completed('payment_options')) { |
|
1074 | 1074 | // then check for payments and update TXN accordingly |
1075 | 1075 | /** @type EE_Transaction_Payments $transaction_payments */ |
1076 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1077 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
1076 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1077 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
1078 | 1078 | } |
1079 | 1079 | // grab the saved registrations from the transaction |
1080 | 1080 | foreach ( |
1081 | - $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration |
|
1081 | + $this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration |
|
1082 | 1082 | ) { |
1083 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
1083 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
1084 | 1084 | } |
1085 | 1085 | // make sure our cached TXN is added to the model entity mapper |
1086 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
1086 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
1087 | 1087 | |
1088 | 1088 | } else { |
1089 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1089 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1090 | 1090 | return FALSE; |
1091 | 1091 | } |
1092 | 1092 | // verify and update the cart because inaccurate totals are not so much fun |
1093 | - if ( $this->cart instanceof EE_Cart ) { |
|
1093 | + if ($this->cart instanceof EE_Cart) { |
|
1094 | 1094 | $grand_total = $this->cart->get_grand_total(); |
1095 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
1095 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
1096 | 1096 | $grand_total->recalculate_total_including_taxes(); |
1097 | 1097 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
1098 | 1098 | $this->cart->get_grand_total()->ID(), |
1099 | 1099 | $this->cart->get_grand_total() |
1100 | 1100 | ); |
1101 | 1101 | } |
1102 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
1103 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
1102 | + if ($grand_total instanceof EE_Line_Item) { |
|
1103 | + $this->cart = EE_Cart::instance($grand_total); |
|
1104 | 1104 | } else { |
1105 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1105 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1106 | 1106 | return false; |
1107 | 1107 | } |
1108 | 1108 | } |
@@ -1119,19 +1119,19 @@ discard block |
||
1119 | 1119 | * @return void |
1120 | 1120 | * @throws \EE_Error |
1121 | 1121 | */ |
1122 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
1122 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
1123 | 1123 | |
1124 | 1124 | // verify object |
1125 | - if ( $registration instanceof EE_Registration ) { |
|
1125 | + if ($registration instanceof EE_Registration) { |
|
1126 | 1126 | // update the entity mapper attendee |
1127 | - $this->_refresh_registration_attendee( $registration ); |
|
1127 | + $this->_refresh_registration_attendee($registration); |
|
1128 | 1128 | // update the entity mapper answers for reg form questions |
1129 | - $this->_refresh_registration_answers( $registration ); |
|
1129 | + $this->_refresh_registration_answers($registration); |
|
1130 | 1130 | // make sure the cached registration is added to the model entity mapper |
1131 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1131 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1132 | 1132 | } else { |
1133 | 1133 | EE_Error::add_error( |
1134 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1134 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1135 | 1135 | __FILE__, __FUNCTION__, __LINE__ |
1136 | 1136 | ); |
1137 | 1137 | } |
@@ -1146,15 +1146,15 @@ discard block |
||
1146 | 1146 | * @return void |
1147 | 1147 | * @throws \EE_Error |
1148 | 1148 | */ |
1149 | - protected function _refresh_registration_attendee( $registration ) { |
|
1149 | + protected function _refresh_registration_attendee($registration) { |
|
1150 | 1150 | |
1151 | 1151 | $attendee = $registration->attendee(); |
1152 | 1152 | // verify object |
1153 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1153 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1154 | 1154 | // make sure the cached attendee is added to the model entity mapper |
1155 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1155 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1156 | 1156 | // maybe cache primary_attendee_obj ? |
1157 | - if ( $registration->is_primary_registrant() ) { |
|
1157 | + if ($registration->is_primary_registrant()) { |
|
1158 | 1158 | $this->primary_attendee_obj = $attendee; |
1159 | 1159 | } |
1160 | 1160 | } |
@@ -1169,19 +1169,19 @@ discard block |
||
1169 | 1169 | * @return void |
1170 | 1170 | * @throws \EE_Error |
1171 | 1171 | */ |
1172 | - protected function _refresh_registration_answers( $registration ) { |
|
1172 | + protected function _refresh_registration_answers($registration) { |
|
1173 | 1173 | |
1174 | 1174 | // now update the answers |
1175 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1175 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1176 | 1176 | // verify object |
1177 | - if ( $answer instanceof EE_Answer ) { |
|
1178 | - if ( $answer->ID() ) { |
|
1177 | + if ($answer instanceof EE_Answer) { |
|
1178 | + if ($answer->ID()) { |
|
1179 | 1179 | // make sure the cached answer is added to the model entity mapper |
1180 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1180 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1181 | 1181 | } |
1182 | 1182 | } else { |
1183 | 1183 | EE_Error::add_error( |
1184 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1184 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1185 | 1185 | __FILE__, __FUNCTION__, __LINE__ |
1186 | 1186 | ); |
1187 | 1187 | } |
@@ -1201,13 +1201,13 @@ discard block |
||
1201 | 1201 | */ |
1202 | 1202 | public function __sleep() |
1203 | 1203 | { |
1204 | - if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) { |
|
1204 | + if ($this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID()) { |
|
1205 | 1205 | $this->primary_attendee_obj = $this->primary_attendee_obj->ID(); |
1206 | 1206 | } // remove the reg form and the checkout |
1207 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1207 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1208 | 1208 | $this->transaction = $this->transaction->ID(); |
1209 | 1209 | } // remove the reg form and the checkout |
1210 | - return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) ); |
|
1210 | + return array_diff(array_keys(get_object_vars($this)), array('billing_form', 'registration_form')); |
|
1211 | 1211 | } |
1212 | 1212 | |
1213 | 1213 | |
@@ -1217,15 +1217,15 @@ discard block |
||
1217 | 1217 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1218 | 1218 | */ |
1219 | 1219 | public function __wakeup() { |
1220 | - if ( ! $this->primary_attendee_obj instanceof EE_Attendee && absint( $this->primary_attendee_obj ) !== 0 ) { |
|
1220 | + if ( ! $this->primary_attendee_obj instanceof EE_Attendee && absint($this->primary_attendee_obj) !== 0) { |
|
1221 | 1221 | // $this->primary_attendee_obj is actually just an ID, so use it to get the object from the db |
1222 | - $this->primary_attendee_obj = EEM_Attendee::instance()->get_one_by_ID( $this->primary_attendee_obj ); |
|
1222 | + $this->primary_attendee_obj = EEM_Attendee::instance()->get_one_by_ID($this->primary_attendee_obj); |
|
1223 | 1223 | } |
1224 | - if ( ! $this->transaction instanceof EE_Transaction && absint( $this->transaction ) !== 0 ) { |
|
1224 | + if ( ! $this->transaction instanceof EE_Transaction && absint($this->transaction) !== 0) { |
|
1225 | 1225 | // $this->transaction is actually just an ID, so use it to get the object from the db |
1226 | - $this->transaction = EEM_Transaction::instance()->get_one_by_ID( $this->transaction ); |
|
1226 | + $this->transaction = EEM_Transaction::instance()->get_one_by_ID($this->transaction); |
|
1227 | 1227 | } |
1228 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1228 | + foreach ($this->reg_steps as $reg_step) { |
|
1229 | 1229 | $reg_step->checkout = $this; |
1230 | 1230 | } |
1231 | 1231 | } |
@@ -1242,12 +1242,12 @@ discard block |
||
1242 | 1242 | * @param bool $display_request |
1243 | 1243 | * @throws \EE_Error |
1244 | 1244 | */ |
1245 | - public function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1245 | + public function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1246 | 1246 | $disabled = true; |
1247 | - if ( WP_DEBUG && ! $disabled ) { |
|
1248 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1247 | + if (WP_DEBUG && ! $disabled) { |
|
1248 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1249 | 1249 | $default_data = array( |
1250 | - $class => $func . '() : ' . $line, |
|
1250 | + $class => $func.'() : '.$line, |
|
1251 | 1251 | 'request->step' => $this->step, |
1252 | 1252 | 'request->action' => $this->action, |
1253 | 1253 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1259,24 +1259,24 @@ discard block |
||
1259 | 1259 | 'reg_url_link' => $this->reg_url_link, |
1260 | 1260 | 'REQ' => $display_request ? $_REQUEST : '', |
1261 | 1261 | ); |
1262 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1263 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1264 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1265 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1266 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1262 | + if ($this->transaction instanceof EE_Transaction) { |
|
1263 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1264 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1265 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1266 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1267 | 1267 | } |
1268 | - if ( $this->transaction->ID() ) { |
|
1269 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1268 | + if ($this->transaction->ID()) { |
|
1269 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1270 | 1270 | // don't serialize objects |
1271 | - $info = $this->_strip_objects( $info ); |
|
1272 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1273 | - $debug_data[ $TXN_ID ] = array(); |
|
1271 | + $info = $this->_strip_objects($info); |
|
1272 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1273 | + $debug_data[$TXN_ID] = array(); |
|
1274 | 1274 | } |
1275 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1275 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1276 | 1276 | $default_data, |
1277 | 1277 | $info |
1278 | 1278 | ); |
1279 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1279 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1280 | 1280 | } |
1281 | 1281 | } |
1282 | 1282 | } |
@@ -1289,23 +1289,23 @@ discard block |
||
1289 | 1289 | * @param array $info |
1290 | 1290 | * @return array |
1291 | 1291 | */ |
1292 | - public function _strip_objects( $info = array() ) { |
|
1293 | - foreach ( (array)$info as $key => $value ) { |
|
1294 | - if ( is_array( $value )) { |
|
1295 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1296 | - } else if ( is_object( $value ) ) { |
|
1297 | - $object_class = get_class( $value ); |
|
1298 | - $info[ $object_class ] = array(); |
|
1299 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1300 | - if ( method_exists( $value, 'status' ) ) { |
|
1301 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1302 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1303 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1292 | + public function _strip_objects($info = array()) { |
|
1293 | + foreach ((array) $info as $key => $value) { |
|
1294 | + if (is_array($value)) { |
|
1295 | + $info[$key] = $this->_strip_objects($value); |
|
1296 | + } else if (is_object($value)) { |
|
1297 | + $object_class = get_class($value); |
|
1298 | + $info[$object_class] = array(); |
|
1299 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1300 | + if (method_exists($value, 'status')) { |
|
1301 | + $info[$object_class]['status'] = $value->status(); |
|
1302 | + } else if (method_exists($value, 'status_ID')) { |
|
1303 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1304 | 1304 | } |
1305 | - unset( $info[ $key ] ); |
|
1305 | + unset($info[$key]); |
|
1306 | 1306 | } |
1307 | 1307 | } |
1308 | - return (array)$info; |
|
1308 | + return (array) $info; |
|
1309 | 1309 | } |
1310 | 1310 | |
1311 | 1311 |
@@ -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; |