@@ -2,12 +2,12 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * Taxes class |
|
6 | - * |
|
7 | - * @package Event Espresso |
|
8 | - * @subpackage includes/classes/EE_Taxes.class.php |
|
9 | - * @author Brent Christensen |
|
10 | - */ |
|
5 | + * Taxes class |
|
6 | + * |
|
7 | + * @package Event Espresso |
|
8 | + * @subpackage includes/classes/EE_Taxes.class.php |
|
9 | + * @author Brent Christensen |
|
10 | + */ |
|
11 | 11 | class EE_Taxes extends EE_BASE { |
12 | 12 | |
13 | 13 | /** |
@@ -36,8 +36,9 @@ |
||
36 | 36 | $tax = 0; |
37 | 37 | $total_tax = 0; |
38 | 38 | //This first checks to see if the given ticket is taxable. |
39 | - if ( ! $ticket->get( 'TKT_taxable' ) ) |
|
40 | - return $tax; |
|
39 | + if ( ! $ticket->get( 'TKT_taxable' ) ) { |
|
40 | + return $tax; |
|
41 | + } |
|
41 | 42 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
42 | 43 | $subtotal = self::get_subtotal_for_admin( $ticket ); |
43 | 44 | //get taxes |
@@ -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 | * Taxes class |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | * @param EE_Ticket $ticket incoming EE_Ticket |
33 | 33 | * @return float total taxes to apply to ticket. |
34 | 34 | */ |
35 | - public static function get_total_taxes_for_admin( EE_Ticket $ticket ) { |
|
35 | + public static function get_total_taxes_for_admin(EE_Ticket $ticket) { |
|
36 | 36 | $tax = 0; |
37 | 37 | $total_tax = 0; |
38 | 38 | //This first checks to see if the given ticket is taxable. |
39 | - if ( ! $ticket->get( 'TKT_taxable' ) ) |
|
39 | + if ( ! $ticket->get('TKT_taxable')) |
|
40 | 40 | return $tax; |
41 | 41 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
42 | - $subtotal = self::get_subtotal_for_admin( $ticket ); |
|
42 | + $subtotal = self::get_subtotal_for_admin($ticket); |
|
43 | 43 | //get taxes |
44 | 44 | $taxes = self::get_taxes_for_admin(); |
45 | 45 | //apply taxes to subtotal |
46 | - foreach ( $taxes as $tax ) { |
|
46 | + foreach ($taxes as $tax) { |
|
47 | 47 | //assuming taxes are not cumulative |
48 | - $total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100; |
|
48 | + $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
49 | 49 | } |
50 | 50 | return $total_tax; |
51 | 51 | } |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * @param EE_Ticket $ticket |
57 | 57 | * @return float |
58 | 58 | */ |
59 | - public static function get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
59 | + public static function get_subtotal_for_admin(EE_Ticket $ticket) { |
|
60 | 60 | $TKT_ID = $ticket->ID(); |
61 | - return isset( self::$_subtotal[ $TKT_ID ] ) ? self::$_subtotal[ $TKT_ID ] : self::_get_subtotal_for_admin( $ticket ); |
|
61 | + return isset(self::$_subtotal[$TKT_ID]) ? self::$_subtotal[$TKT_ID] : self::_get_subtotal_for_admin($ticket); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -68,26 +68,26 @@ discard block |
||
68 | 68 | * @param EE_Ticket $ticket |
69 | 69 | * @return float subtotal calculated from all EE_Price[] on Ticket. |
70 | 70 | */ |
71 | - private static function _get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
71 | + private static function _get_subtotal_for_admin(EE_Ticket $ticket) { |
|
72 | 72 | $subtotal = 0; |
73 | 73 | //get all prices |
74 | - $prices = $ticket->get_many_related( 'Price', array( 'default_where_conditions' => 'none', 'order_by' => array( 'PRC_order' => 'ASC' ) ) ); |
|
74 | + $prices = $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))); |
|
75 | 75 | //let's loop through them (base price is always the first item) |
76 | - foreach ( $prices as $price ) { |
|
77 | - if ( $price instanceof EE_Price ) { |
|
78 | - switch ( $price->type_obj()->base_type() ) { |
|
76 | + foreach ($prices as $price) { |
|
77 | + if ($price instanceof EE_Price) { |
|
78 | + switch ($price->type_obj()->base_type()) { |
|
79 | 79 | case 1: // base price |
80 | 80 | case 3: // surcharges |
81 | - $subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' ); |
|
81 | + $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount'); |
|
82 | 82 | break; |
83 | 83 | case 2: // discounts |
84 | - $subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' ); |
|
84 | + $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount'); |
|
85 | 85 | break; |
86 | 86 | } |
87 | 87 | } |
88 | 88 | } |
89 | 89 | $TKT_ID = $ticket->ID(); |
90 | - self::$_subtotal = array( $TKT_ID => $subtotal ); |
|
90 | + self::$_subtotal = array($TKT_ID => $subtotal); |
|
91 | 91 | return $subtotal; |
92 | 92 | } |
93 | 93 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @return EE_Price[] EE_Price objects that have PRT_ID == 4 |
99 | 99 | */ |
100 | 100 | public static function get_taxes_for_admin() { |
101 | - self::$_default_taxes = ! empty( self::$_default_taxes ) ? self::$_default_taxes : EE_Registry::instance()->load_model( 'Price' )->get_all( array( array( 'Price_Type.PBT_ID' => 4 ) ) ); |
|
101 | + self::$_default_taxes = ! empty(self::$_default_taxes) ? self::$_default_taxes : EE_Registry::instance()->load_model('Price')->get_all(array(array('Price_Type.PBT_ID' => 4))); |
|
102 | 102 | return self::$_default_taxes; |
103 | 103 | } |
104 | 104 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @param array $props_n_values |
31 | 31 | * @return EE_Term_Relationship |
32 | 32 | */ |
33 | - public static function new_instance( $props_n_values = array() ) { |
|
34 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
35 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
33 | + public static function new_instance($props_n_values = array()) { |
|
34 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
35 | + return $has_object ? $has_object : new self($props_n_values); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * @param array $props_n_values |
42 | 42 | * @return EE_Term_Relationship |
43 | 43 | */ |
44 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
45 | - return new self( $props_n_values, TRUE ); |
|
44 | + public static function new_instance_from_db($props_n_values = array()) { |
|
45 | + return new self($props_n_values, TRUE); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 |
@@ -2,18 +2,18 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * Event Espresso |
|
6 | - * |
|
7 | - * Event Registration and Management Plugin for WordPress |
|
8 | - * |
|
9 | - * @ package Event Espresso |
|
10 | - * @ author Event Espresso |
|
11 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | - * @ link {@link http://www.eventespresso.com} |
|
14 | - * @ since 4.0 |
|
15 | - * |
|
16 | - */ |
|
5 | + * Event Espresso |
|
6 | + * |
|
7 | + * Event Registration and Management Plugin for WordPress |
|
8 | + * |
|
9 | + * @ package Event Espresso |
|
10 | + * @ author Event Espresso |
|
11 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | + * @ link {@link http://www.eventespresso.com} |
|
14 | + * @ since 4.0 |
|
15 | + * |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | |
19 | 19 |
@@ -2,18 +2,18 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * Event Espresso |
|
6 | - * |
|
7 | - * Event Registration and Management Plugin for WordPress |
|
8 | - * |
|
9 | - * @ package Event Espresso |
|
10 | - * @ author Event Espresso |
|
11 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | - * @ link {@link http://www.eventespresso.com} |
|
14 | - * @ since 4.0 |
|
15 | - * |
|
16 | - */ |
|
5 | + * Event Espresso |
|
6 | + * |
|
7 | + * Event Registration and Management Plugin for WordPress |
|
8 | + * |
|
9 | + * @ package Event Espresso |
|
10 | + * @ author Event Espresso |
|
11 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | + * @ link {@link http://www.eventespresso.com} |
|
14 | + * @ since 4.0 |
|
15 | + * |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | |
19 | 19 |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | /** |
196 | 196 | * Gets min |
197 | - * @return int |
|
197 | + * @return boolean |
|
198 | 198 | */ |
199 | 199 | function min() { |
200 | 200 | return $this->get( 'TKT_min' ); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * This returns the chronologically last datetime that this ticket is associated with |
237 | 237 | * @param string $dt_frmt |
238 | 238 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
239 | - * @return array |
|
239 | + * @return string |
|
240 | 240 | */ |
241 | 241 | public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
242 | 242 | return $this->first_datetime()->start_date( $dt_frmt ) . $conjunction . $this->last_datetime()->end_date( $dt_frmt ); |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | /** |
375 | 375 | * Gets all the ticket applicabilities (ie, relations between datetimes and tickets) |
376 | 376 | * @param array $query_params see EEM_Base::get_all() |
377 | - * @return EE_Datetime_Ticket |
|
377 | + * @return EE_Base_Class[] |
|
378 | 378 | */ |
379 | 379 | public function datetime_tickets( $query_params = array() ) { |
380 | 380 | return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | /** |
398 | 398 | * Gets ID |
399 | - * @return string |
|
399 | + * @return boolean |
|
400 | 400 | */ |
401 | 401 | function ID() { |
402 | 402 | return $this->get( 'TKT_ID' ); |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * |
411 | 411 | * @since 4.5.0 |
412 | 412 | * |
413 | - * @return int |
|
413 | + * @return boolean |
|
414 | 414 | */ |
415 | 415 | public function wp_user() { |
416 | 416 | return $this->get('TKT_wp_user'); |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | /** |
509 | 509 | * Sets name |
510 | 510 | * @param string $name |
511 | - * @return boolean |
|
511 | + * @return boolean|null |
|
512 | 512 | */ |
513 | 513 | function set_name( $name ) { |
514 | 514 | $this->set( 'TKT_name', $name ); |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | /** |
520 | 520 | * Gets description |
521 | - * @return string |
|
521 | + * @return boolean |
|
522 | 522 | */ |
523 | 523 | function description() { |
524 | 524 | return $this->get( 'TKT_description' ); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | /** |
530 | 530 | * Sets description |
531 | 531 | * @param string $description |
532 | - * @return boolean |
|
532 | + * @return boolean|null |
|
533 | 533 | */ |
534 | 534 | function set_description( $description ) { |
535 | 535 | $this->set( 'TKT_description', $description ); |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | /** |
600 | 600 | * Sets min |
601 | 601 | * @param int $min |
602 | - * @return boolean |
|
602 | + * @return boolean|null |
|
603 | 603 | */ |
604 | 604 | function set_min( $min ) { |
605 | 605 | $this->set( 'TKT_min', $min ); |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | |
610 | 610 | /** |
611 | 611 | * Gets max |
612 | - * @return int |
|
612 | + * @return boolean |
|
613 | 613 | */ |
614 | 614 | function max() { |
615 | 615 | return $this->get( 'TKT_max' ); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | /** |
621 | 621 | * Sets max |
622 | 622 | * @param int $max |
623 | - * @return boolean |
|
623 | + * @return boolean|null |
|
624 | 624 | */ |
625 | 625 | function set_max( $max ) { |
626 | 626 | $this->set( 'TKT_max', $max ); |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | /** |
632 | 632 | * Sets price |
633 | 633 | * @param float $price |
634 | - * @return boolean |
|
634 | + * @return boolean|null |
|
635 | 635 | */ |
636 | 636 | function set_price( $price ) { |
637 | 637 | $this->set( 'TKT_price', $price ); |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | |
642 | 642 | /** |
643 | 643 | * Gets sold |
644 | - * @return int |
|
644 | + * @return boolean |
|
645 | 645 | */ |
646 | 646 | function sold() { |
647 | 647 | return $this->get( 'TKT_sold' ); |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | /** |
653 | 653 | * increments sold by amount passed by $qty |
654 | 654 | * @param int $qty |
655 | - * @return boolean |
|
655 | + * @return boolean|null |
|
656 | 656 | */ |
657 | 657 | function increase_sold( $qty = 1 ) { |
658 | 658 | $sold = $this->get_raw( 'TKT_sold' ) + $qty; |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | /** |
665 | 665 | * Sets sold |
666 | 666 | * @param int $sold |
667 | - * @return boolean |
|
667 | + * @return boolean|null |
|
668 | 668 | */ |
669 | 669 | function set_sold( $sold ) { |
670 | 670 | $this->set( 'TKT_sold', $sold ); |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | /** |
676 | 676 | * decrements (subtracts) sold by amount passed by $qty |
677 | 677 | * @param int $qty |
678 | - * @return boolean |
|
678 | + * @return boolean|null |
|
679 | 679 | */ |
680 | 680 | function decrease_sold( $qty = 1 ) { |
681 | 681 | $sold = $this->get_raw( 'TKT_sold' ) - $qty; |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | |
689 | 689 | /** |
690 | 690 | * Gets qty |
691 | - * @return int |
|
691 | + * @return boolean |
|
692 | 692 | */ |
693 | 693 | function qty() { |
694 | 694 | return $this->get( 'TKT_qty' ); |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | /** |
700 | 700 | * Sets qty |
701 | 701 | * @param int $qty |
702 | - * @return boolean |
|
702 | + * @return boolean|null |
|
703 | 703 | */ |
704 | 704 | function set_qty( $qty ) { |
705 | 705 | $this->set( 'TKT_qty', $qty ); |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | /** |
711 | 711 | * Gets uses |
712 | - * @return int |
|
712 | + * @return boolean |
|
713 | 713 | */ |
714 | 714 | function uses() { |
715 | 715 | return $this->get( 'TKT_uses' ); |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | /** |
721 | 721 | * Sets uses |
722 | 722 | * @param int $uses |
723 | - * @return boolean |
|
723 | + * @return boolean|null |
|
724 | 724 | */ |
725 | 725 | function set_uses( $uses ) { |
726 | 726 | $this->set( 'TKT_uses', $uses ); |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | /** |
742 | 742 | * sets the TKT_required property |
743 | 743 | * @param boolean $required |
744 | - * @return boolean |
|
744 | + * @return boolean|null |
|
745 | 745 | */ |
746 | 746 | public function set_required( $required ) { |
747 | 747 | $this->set( 'TKT_required', $required ); |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | /** |
763 | 763 | * Sets taxable |
764 | 764 | * @param boolean $taxable |
765 | - * @return boolean |
|
765 | + * @return boolean|null |
|
766 | 766 | */ |
767 | 767 | function set_taxable( $taxable ) { |
768 | 768 | $this->set( 'TKT_taxable', $taxable ); |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | /** |
784 | 784 | * Sets is_default |
785 | 785 | * @param boolean $is_default |
786 | - * @return boolean |
|
786 | + * @return boolean|null |
|
787 | 787 | */ |
788 | 788 | function set_is_default( $is_default ) { |
789 | 789 | $this->set( 'TKT_is_default', $is_default ); |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | |
794 | 794 | /** |
795 | 795 | * Gets order |
796 | - * @return int |
|
796 | + * @return boolean |
|
797 | 797 | */ |
798 | 798 | function order() { |
799 | 799 | return $this->get( 'TKT_order' ); |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | /** |
805 | 805 | * Sets order |
806 | 806 | * @param int $order |
807 | - * @return boolean |
|
807 | + * @return boolean|null |
|
808 | 808 | */ |
809 | 809 | function set_order( $order ) { |
810 | 810 | $this->set( 'TKT_order', $order ); |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | |
815 | 815 | /** |
816 | 816 | * Gets row |
817 | - * @return int |
|
817 | + * @return boolean |
|
818 | 818 | */ |
819 | 819 | function row() { |
820 | 820 | return $this->get( 'TKT_row' ); |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | /** |
826 | 826 | * Sets row |
827 | 827 | * @param int $row |
828 | - * @return boolean |
|
828 | + * @return boolean|null |
|
829 | 829 | */ |
830 | 830 | function set_row( $row ) { |
831 | 831 | $this->set( 'TKT_row', $row ); |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | /** |
847 | 847 | * Sets deleted |
848 | 848 | * @param boolean $deleted |
849 | - * @return boolean |
|
849 | + * @return boolean|null |
|
850 | 850 | */ |
851 | 851 | function set_deleted( $deleted ) { |
852 | 852 | $this->set( 'TKT_deleted', $deleted ); |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | |
857 | 857 | /** |
858 | 858 | * Gets parent |
859 | - * @return int |
|
859 | + * @return boolean |
|
860 | 860 | */ |
861 | 861 | function parent_ID() { |
862 | 862 | return $this->get( 'TKT_parent' ); |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | /** |
868 | 868 | * Sets parent |
869 | 869 | * @param int $parent |
870 | - * @return boolean |
|
870 | + * @return boolean|null |
|
871 | 871 | */ |
872 | 872 | function set_parent_ID( $parent ) { |
873 | 873 | $this->set( 'TKT_parent', $parent ); |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | |
892 | 892 | /** |
893 | 893 | * Gets name |
894 | - * @return string |
|
894 | + * @return boolean |
|
895 | 895 | */ |
896 | 896 | function name() { |
897 | 897 | return $this->get( 'TKT_name' ); |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | |
902 | 902 | /** |
903 | 903 | * Gets price |
904 | - * @return float |
|
904 | + * @return boolean |
|
905 | 905 | */ |
906 | 906 | function price() { |
907 | 907 | return $this->get( 'TKT_price' ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param string $timezone |
64 | 64 | * @return EE_Ticket |
65 | 65 | */ |
66 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
67 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
68 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
66 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
67 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
68 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param string $timezone |
77 | 77 | * @return EE_Ticket |
78 | 78 | */ |
79 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
80 | - return new self( $props_n_values, TRUE, $timezone ); |
|
79 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
80 | + return new self($props_n_values, TRUE, $timezone); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return bool |
87 | 87 | */ |
88 | 88 | public function parent() { |
89 | - return $this->get( 'TKT_parent' ); |
|
89 | + return $this->get('TKT_parent'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -96,18 +96,18 @@ discard block |
||
96 | 96 | * @param int $DTT_ID the primary key for a particular datetime |
97 | 97 | * @return boolean |
98 | 98 | */ |
99 | - public function available( $DTT_ID = 0 ) { |
|
99 | + public function available($DTT_ID = 0) { |
|
100 | 100 | // are we checking availability for a particular datetime ? |
101 | - if ( $DTT_ID ) { |
|
101 | + if ($DTT_ID) { |
|
102 | 102 | // get that datetime object |
103 | - $datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
103 | + $datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
104 | 104 | // if ticket sales for this datetime have exceeded the reg limit... |
105 | - if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) { |
|
105 | + if ($datetime instanceof EE_Datetime && $datetime->sold_out()) { |
|
106 | 106 | return FALSE; |
107 | 107 | } |
108 | 108 | } |
109 | 109 | // datetime is still open for registration, but is this ticket sold out ? |
110 | - return $this->get_raw( 'TKT_qty' ) < 1 || $this->get_raw( 'TKT_qty' ) > $this->get_raw( 'TKT_sold' ) ? TRUE : FALSE; |
|
110 | + return $this->get_raw('TKT_qty') < 1 || $this->get_raw('TKT_qty') > $this->get_raw('TKT_sold') ? TRUE : FALSE; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -117,21 +117,21 @@ discard block |
||
117 | 117 | * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
118 | 118 | * @return mixed(int|string) status int if the display string isn't requested |
119 | 119 | */ |
120 | - public function ticket_status( $display = FALSE ) { |
|
121 | - if ( ! $this->is_remaining() ) { |
|
122 | - return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out; |
|
120 | + public function ticket_status($display = FALSE) { |
|
121 | + if ( ! $this->is_remaining()) { |
|
122 | + return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out; |
|
123 | 123 | } |
124 | - if ( $this->get( 'TKT_deleted' ) ) { |
|
125 | - return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived; |
|
124 | + if ($this->get('TKT_deleted')) { |
|
125 | + return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived; |
|
126 | 126 | } |
127 | - if ( $this->is_expired() ) { |
|
128 | - return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired; |
|
127 | + if ($this->is_expired()) { |
|
128 | + return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired; |
|
129 | 129 | } |
130 | - if ( $this->is_pending() ) { |
|
131 | - return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending; |
|
130 | + if ($this->is_pending()) { |
|
131 | + return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending; |
|
132 | 132 | } |
133 | - if ( $this->is_on_sale() ) { |
|
134 | - return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale; |
|
133 | + if ($this->is_on_sale()) { |
|
134 | + return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale; |
|
135 | 135 | } |
136 | 136 | return ''; |
137 | 137 | } |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
146 | 146 | * @return boolean true = tickets remaining, false not. |
147 | 147 | */ |
148 | - public function is_remaining( $DTT_ID = 0 ) { |
|
149 | - $num_remaining = $this->remaining( $DTT_ID ); |
|
150 | - if ( $num_remaining === 0 ) { |
|
148 | + public function is_remaining($DTT_ID = 0) { |
|
149 | + $num_remaining = $this->remaining($DTT_ID); |
|
150 | + if ($num_remaining === 0) { |
|
151 | 151 | return FALSE; |
152 | 152 | } |
153 | - if ( $num_remaining > 0 && $num_remaining < $this->min() ) { |
|
153 | + if ($num_remaining > 0 && $num_remaining < $this->min()) { |
|
154 | 154 | return FALSE; |
155 | 155 | } |
156 | 156 | return TRUE; |
@@ -164,25 +164,25 @@ discard block |
||
164 | 164 | * all related datetimes |
165 | 165 | * @return int |
166 | 166 | */ |
167 | - public function remaining( $DTT_ID = 0 ) { |
|
167 | + public function remaining($DTT_ID = 0) { |
|
168 | 168 | // are we checking availability for a particular datetime ? |
169 | - if ( $DTT_ID ) { |
|
169 | + if ($DTT_ID) { |
|
170 | 170 | // get array with the one requested datetime |
171 | - $datetimes = $this->get_many_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
171 | + $datetimes = $this->get_many_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
172 | 172 | } else { |
173 | 173 | // we need to check availability of ALL datetimes |
174 | - $datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
174 | + $datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
175 | 175 | } |
176 | 176 | // d( $datetimes ); |
177 | 177 | // if datetime reg limit is not unlimited |
178 | - if ( ! empty( $datetimes ) ) { |
|
178 | + if ( ! empty($datetimes)) { |
|
179 | 179 | // although TKT_qty and $datetime->spaces_remaining() could both be INF |
180 | 180 | //we only need to check for INF explicitly if we want to optimize. |
181 | 181 | //because INF - x = INF; and min(x,INF) = x( |
182 | - $tickets_remaining = $this->get( 'TKT_qty' ) - $this->get( 'TKT_sold' ); |
|
183 | - foreach ( $datetimes as $datetime ) { |
|
184 | - if ( $datetime instanceof EE_Datetime ) { |
|
185 | - $tickets_remaining = min( $tickets_remaining, $datetime->spaces_remaining() ); |
|
182 | + $tickets_remaining = $this->get('TKT_qty') - $this->get('TKT_sold'); |
|
183 | + foreach ($datetimes as $datetime) { |
|
184 | + if ($datetime instanceof EE_Datetime) { |
|
185 | + $tickets_remaining = min($tickets_remaining, $datetime->spaces_remaining()); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | return $tickets_remaining; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @return int |
198 | 198 | */ |
199 | 199 | function min() { |
200 | - return $this->get( 'TKT_min' ); |
|
200 | + return $this->get('TKT_min'); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @return boolean |
208 | 208 | */ |
209 | 209 | public function is_expired() { |
210 | - return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
|
210 | + return ($this->get_raw('TKT_end_date') < time()); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @return boolean |
218 | 218 | */ |
219 | 219 | public function is_pending() { |
220 | - return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
|
220 | + return ($this->get_raw('TKT_start_date') > time()); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @return boolean |
228 | 228 | */ |
229 | 229 | public function is_on_sale() { |
230 | - return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
|
230 | + return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time()); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
239 | 239 | * @return array |
240 | 240 | */ |
241 | - public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
|
242 | - return $this->first_datetime()->start_date( $dt_frmt ) . $conjunction . $this->last_datetime()->end_date( $dt_frmt ); |
|
241 | + public function date_range($dt_frmt = '', $conjunction = ' - ') { |
|
242 | + return $this->first_datetime()->start_date($dt_frmt).$conjunction.$this->last_datetime()->end_date($dt_frmt); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | * @return EE_Datetime |
250 | 250 | */ |
251 | 251 | public function first_datetime() { |
252 | - $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
|
253 | - return reset( $datetimes ); |
|
252 | + $datetimes = $this->datetimes(array('limit' => 1)); |
|
253 | + return reset($datetimes); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | * @param array $query_params see EEM_Base::get_all() |
262 | 262 | * @return EE_Datetime[] |
263 | 263 | */ |
264 | - public function datetimes( $query_params = array() ) { |
|
265 | - if ( ! isset( $query_params[ 'order_by' ] ) ) { |
|
266 | - $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
|
264 | + public function datetimes($query_params = array()) { |
|
265 | + if ( ! isset($query_params['order_by'])) { |
|
266 | + $query_params['order_by']['DTT_order'] = 'ASC'; |
|
267 | 267 | } |
268 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
268 | + return $this->get_many_related('Datetime', $query_params); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | * @return EE_Datetime |
276 | 276 | */ |
277 | 277 | public function last_datetime() { |
278 | - $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
|
279 | - return end( $datetimes ); |
|
278 | + $datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC'))); |
|
279 | + return end($datetimes); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -290,22 +290,22 @@ discard block |
||
290 | 290 | * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
291 | 291 | * @return mixed (array|int) how many tickets have sold |
292 | 292 | */ |
293 | - public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
|
293 | + public function tickets_sold($what = 'ticket', $dtt_id = NULL) { |
|
294 | 294 | $total = 0; |
295 | 295 | $tickets_sold = $this->_all_tickets_sold(); |
296 | - switch ( $what ) { |
|
296 | + switch ($what) { |
|
297 | 297 | case 'ticket' : |
298 | - return $tickets_sold[ 'ticket' ]; |
|
298 | + return $tickets_sold['ticket']; |
|
299 | 299 | break; |
300 | 300 | case 'datetime' : |
301 | - if ( empty( $tickets_sold[ 'datetime' ] ) ) { |
|
301 | + if (empty($tickets_sold['datetime'])) { |
|
302 | 302 | return $total; |
303 | 303 | } |
304 | - if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) { |
|
305 | - EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
304 | + if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) { |
|
305 | + EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
306 | 306 | return $total; |
307 | 307 | } |
308 | - return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ]; |
|
308 | + return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id]; |
|
309 | 309 | break; |
310 | 310 | default: |
311 | 311 | return $total; |
@@ -319,15 +319,15 @@ discard block |
||
319 | 319 | * @return EE_Ticket[] |
320 | 320 | */ |
321 | 321 | protected function _all_tickets_sold() { |
322 | - $datetimes = $this->get_many_related( 'Datetime' ); |
|
322 | + $datetimes = $this->get_many_related('Datetime'); |
|
323 | 323 | $tickets_sold = array(); |
324 | - if ( ! empty( $datetimes ) ) { |
|
325 | - foreach ( $datetimes as $datetime ) { |
|
326 | - $tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' ); |
|
324 | + if ( ! empty($datetimes)) { |
|
325 | + foreach ($datetimes as $datetime) { |
|
326 | + $tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold'); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | //Tickets sold |
330 | - $tickets_sold[ 'ticket' ] = $this->get_raw( 'TKT_sold' ); |
|
330 | + $tickets_sold['ticket'] = $this->get_raw('TKT_sold'); |
|
331 | 331 | return $tickets_sold; |
332 | 332 | } |
333 | 333 | |
@@ -340,9 +340,9 @@ discard block |
||
340 | 340 | * @param bool $return_array whether to return as an array indexed by price id or just the object. |
341 | 341 | * @return EE_Price |
342 | 342 | */ |
343 | - public function base_price( $return_array = FALSE ) { |
|
344 | - $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
|
345 | - return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) ); |
|
343 | + public function base_price($return_array = FALSE) { |
|
344 | + $_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price); |
|
345 | + return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where)); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | * @return EE_Price[] |
355 | 355 | */ |
356 | 356 | public function price_modifiers() { |
357 | - $query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) ); |
|
358 | - return $this->prices( $query_params ); |
|
357 | + $query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax)))); |
|
358 | + return $this->prices($query_params); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @param array $query_params like EEM_Base::get_all |
366 | 366 | * @return EE_Price[] |
367 | 367 | */ |
368 | - public function prices( $query_params = array() ) { |
|
369 | - return $this->get_many_related( 'Price', $query_params ); |
|
368 | + public function prices($query_params = array()) { |
|
369 | + return $this->get_many_related('Price', $query_params); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | * @param array $query_params see EEM_Base::get_all() |
377 | 377 | * @return EE_Datetime_Ticket |
378 | 378 | */ |
379 | - public function datetime_tickets( $query_params = array() ) { |
|
380 | - return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
|
379 | + public function datetime_tickets($query_params = array()) { |
|
380 | + return $this->get_many_related('Datetime_Ticket', $query_params); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | * @param boolean $show_deleted |
389 | 389 | * @return EE_Datetime[] |
390 | 390 | */ |
391 | - public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
|
392 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
|
391 | + public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) { |
|
392 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | * @return string |
400 | 400 | */ |
401 | 401 | function ID() { |
402 | - return $this->get( 'TKT_ID' ); |
|
402 | + return $this->get('TKT_ID'); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | * @return EE_Ticket_Template |
424 | 424 | */ |
425 | 425 | public function template() { |
426 | - return $this->get_first_related( 'Ticket_Template' ); |
|
426 | + return $this->get_first_related('Ticket_Template'); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @return EE_Price[] |
434 | 434 | */ |
435 | 435 | public function get_ticket_taxes_for_admin() { |
436 | - return EE_Taxes::get_taxes_for_admin( $this ); |
|
436 | + return EE_Taxes::get_taxes_for_admin($this); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * @return bool |
443 | 443 | */ |
444 | 444 | public function ticket_price() { |
445 | - return $this->get( 'TKT_price' ); |
|
445 | + return $this->get('TKT_price'); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * @return mixed |
452 | 452 | */ |
453 | 453 | public function pretty_price() { |
454 | - return $this->get_pretty( 'TKT_price' ); |
|
454 | + return $this->get_pretty('TKT_price'); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | |
@@ -470,17 +470,17 @@ discard block |
||
470 | 470 | * @param bool $no_cache |
471 | 471 | * @return float |
472 | 472 | */ |
473 | - public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
|
474 | - if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) { |
|
473 | + public function get_ticket_total_with_taxes($no_cache = FALSE) { |
|
474 | + if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) { |
|
475 | 475 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
476 | 476 | } |
477 | - return (float)$this->_ticket_total_with_taxes; |
|
477 | + return (float) $this->_ticket_total_with_taxes; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | |
481 | 481 | |
482 | 482 | public function ensure_TKT_Price_correct() { |
483 | - $this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) ); |
|
483 | + $this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this)); |
|
484 | 484 | $this->save(); |
485 | 485 | } |
486 | 486 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * @return float |
491 | 491 | */ |
492 | 492 | public function get_ticket_subtotal() { |
493 | - return EE_Taxes::get_subtotal_for_admin( $this ); |
|
493 | + return EE_Taxes::get_subtotal_for_admin($this); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | * @return float |
501 | 501 | */ |
502 | 502 | public function get_ticket_taxes_total_for_admin() { |
503 | - return EE_Taxes::get_total_taxes_for_admin( $this ); |
|
503 | + return EE_Taxes::get_total_taxes_for_admin($this); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | |
@@ -510,8 +510,8 @@ discard block |
||
510 | 510 | * @param string $name |
511 | 511 | * @return boolean |
512 | 512 | */ |
513 | - function set_name( $name ) { |
|
514 | - $this->set( 'TKT_name', $name ); |
|
513 | + function set_name($name) { |
|
514 | + $this->set('TKT_name', $name); |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | * @return string |
522 | 522 | */ |
523 | 523 | function description() { |
524 | - return $this->get( 'TKT_description' ); |
|
524 | + return $this->get('TKT_description'); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | * @param string $description |
532 | 532 | * @return boolean |
533 | 533 | */ |
534 | - function set_description( $description ) { |
|
535 | - $this->set( 'TKT_description', $description ); |
|
534 | + function set_description($description) { |
|
535 | + $this->set('TKT_description', $description); |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | * @param string $tm_frmt |
544 | 544 | * @return string |
545 | 545 | */ |
546 | - function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
547 | - return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
|
546 | + function start_date($dt_frmt = '', $tm_frmt = '') { |
|
547 | + return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | * @param string $start_date |
555 | 555 | * @return void |
556 | 556 | */ |
557 | - function set_start_date( $start_date ) { |
|
558 | - $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
|
557 | + function set_start_date($start_date) { |
|
558 | + $this->_set_date_time('B', $start_date, 'TKT_start_date'); |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | * @param string $tm_frmt |
567 | 567 | * @return string |
568 | 568 | */ |
569 | - function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
570 | - return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
|
569 | + function end_date($dt_frmt = '', $tm_frmt = '') { |
|
570 | + return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | |
@@ -577,8 +577,8 @@ discard block |
||
577 | 577 | * @param string $end_date |
578 | 578 | * @return void |
579 | 579 | */ |
580 | - function set_end_date( $end_date ) { |
|
581 | - $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
|
580 | + function set_end_date($end_date) { |
|
581 | + $this->_set_date_time('B', $end_date, 'TKT_end_date'); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | |
@@ -590,8 +590,8 @@ discard block |
||
590 | 590 | * |
591 | 591 | * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
592 | 592 | */ |
593 | - function set_end_time( $time ) { |
|
594 | - $this->_set_time_for( $time, 'TKT_end_date' ); |
|
593 | + function set_end_time($time) { |
|
594 | + $this->_set_time_for($time, 'TKT_end_date'); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | |
@@ -601,8 +601,8 @@ discard block |
||
601 | 601 | * @param int $min |
602 | 602 | * @return boolean |
603 | 603 | */ |
604 | - function set_min( $min ) { |
|
605 | - $this->set( 'TKT_min', $min ); |
|
604 | + function set_min($min) { |
|
605 | + $this->set('TKT_min', $min); |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | * @return int |
613 | 613 | */ |
614 | 614 | function max() { |
615 | - return $this->get( 'TKT_max' ); |
|
615 | + return $this->get('TKT_max'); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | |
@@ -622,8 +622,8 @@ discard block |
||
622 | 622 | * @param int $max |
623 | 623 | * @return boolean |
624 | 624 | */ |
625 | - function set_max( $max ) { |
|
626 | - $this->set( 'TKT_max', $max ); |
|
625 | + function set_max($max) { |
|
626 | + $this->set('TKT_max', $max); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | |
@@ -633,8 +633,8 @@ discard block |
||
633 | 633 | * @param float $price |
634 | 634 | * @return boolean |
635 | 635 | */ |
636 | - function set_price( $price ) { |
|
637 | - $this->set( 'TKT_price', $price ); |
|
636 | + function set_price($price) { |
|
637 | + $this->set('TKT_price', $price); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | * @return int |
645 | 645 | */ |
646 | 646 | function sold() { |
647 | - return $this->get( 'TKT_sold' ); |
|
647 | + return $this->get('TKT_sold'); |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | |
@@ -654,9 +654,9 @@ discard block |
||
654 | 654 | * @param int $qty |
655 | 655 | * @return boolean |
656 | 656 | */ |
657 | - function increase_sold( $qty = 1 ) { |
|
658 | - $sold = $this->get_raw( 'TKT_sold' ) + $qty; |
|
659 | - return $this->set_sold( $sold ); |
|
657 | + function increase_sold($qty = 1) { |
|
658 | + $sold = $this->get_raw('TKT_sold') + $qty; |
|
659 | + return $this->set_sold($sold); |
|
660 | 660 | } |
661 | 661 | |
662 | 662 | |
@@ -666,8 +666,8 @@ discard block |
||
666 | 666 | * @param int $sold |
667 | 667 | * @return boolean |
668 | 668 | */ |
669 | - function set_sold( $sold ) { |
|
670 | - $this->set( 'TKT_sold', $sold ); |
|
669 | + function set_sold($sold) { |
|
670 | + $this->set('TKT_sold', $sold); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | |
@@ -677,11 +677,11 @@ discard block |
||
677 | 677 | * @param int $qty |
678 | 678 | * @return boolean |
679 | 679 | */ |
680 | - function decrease_sold( $qty = 1 ) { |
|
681 | - $sold = $this->get_raw( 'TKT_sold' ) - $qty; |
|
680 | + function decrease_sold($qty = 1) { |
|
681 | + $sold = $this->get_raw('TKT_sold') - $qty; |
|
682 | 682 | // sold can not go below zero |
683 | - $sold = max( 0, $sold ); |
|
684 | - return $this->set_sold( $sold ); |
|
683 | + $sold = max(0, $sold); |
|
684 | + return $this->set_sold($sold); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | * @return int |
692 | 692 | */ |
693 | 693 | function qty() { |
694 | - return $this->get( 'TKT_qty' ); |
|
694 | + return $this->get('TKT_qty'); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | |
@@ -701,8 +701,8 @@ discard block |
||
701 | 701 | * @param int $qty |
702 | 702 | * @return boolean |
703 | 703 | */ |
704 | - function set_qty( $qty ) { |
|
705 | - $this->set( 'TKT_qty', $qty ); |
|
704 | + function set_qty($qty) { |
|
705 | + $this->set('TKT_qty', $qty); |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | * @return int |
713 | 713 | */ |
714 | 714 | function uses() { |
715 | - return $this->get( 'TKT_uses' ); |
|
715 | + return $this->get('TKT_uses'); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | * @param int $uses |
723 | 723 | * @return boolean |
724 | 724 | */ |
725 | - function set_uses( $uses ) { |
|
726 | - $this->set( 'TKT_uses', $uses ); |
|
725 | + function set_uses($uses) { |
|
726 | + $this->set('TKT_uses', $uses); |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | * @return boolean |
734 | 734 | */ |
735 | 735 | public function required() { |
736 | - return $this->get( 'TKT_required' ); |
|
736 | + return $this->get('TKT_required'); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | |
@@ -743,8 +743,8 @@ discard block |
||
743 | 743 | * @param boolean $required |
744 | 744 | * @return boolean |
745 | 745 | */ |
746 | - public function set_required( $required ) { |
|
747 | - $this->set( 'TKT_required', $required ); |
|
746 | + public function set_required($required) { |
|
747 | + $this->set('TKT_required', $required); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | * @return boolean |
755 | 755 | */ |
756 | 756 | function taxable() { |
757 | - return $this->get( 'TKT_taxable' ); |
|
757 | + return $this->get('TKT_taxable'); |
|
758 | 758 | } |
759 | 759 | |
760 | 760 | |
@@ -764,8 +764,8 @@ discard block |
||
764 | 764 | * @param boolean $taxable |
765 | 765 | * @return boolean |
766 | 766 | */ |
767 | - function set_taxable( $taxable ) { |
|
768 | - $this->set( 'TKT_taxable', $taxable ); |
|
767 | + function set_taxable($taxable) { |
|
768 | + $this->set('TKT_taxable', $taxable); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | * @return boolean |
776 | 776 | */ |
777 | 777 | function is_default() { |
778 | - return $this->get( 'TKT_is_default' ); |
|
778 | + return $this->get('TKT_is_default'); |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | * @param boolean $is_default |
786 | 786 | * @return boolean |
787 | 787 | */ |
788 | - function set_is_default( $is_default ) { |
|
789 | - $this->set( 'TKT_is_default', $is_default ); |
|
788 | + function set_is_default($is_default) { |
|
789 | + $this->set('TKT_is_default', $is_default); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @return int |
797 | 797 | */ |
798 | 798 | function order() { |
799 | - return $this->get( 'TKT_order' ); |
|
799 | + return $this->get('TKT_order'); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -806,8 +806,8 @@ discard block |
||
806 | 806 | * @param int $order |
807 | 807 | * @return boolean |
808 | 808 | */ |
809 | - function set_order( $order ) { |
|
810 | - $this->set( 'TKT_order', $order ); |
|
809 | + function set_order($order) { |
|
810 | + $this->set('TKT_order', $order); |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | * @return int |
818 | 818 | */ |
819 | 819 | function row() { |
820 | - return $this->get( 'TKT_row' ); |
|
820 | + return $this->get('TKT_row'); |
|
821 | 821 | } |
822 | 822 | |
823 | 823 | |
@@ -827,8 +827,8 @@ discard block |
||
827 | 827 | * @param int $row |
828 | 828 | * @return boolean |
829 | 829 | */ |
830 | - function set_row( $row ) { |
|
831 | - $this->set( 'TKT_row', $row ); |
|
830 | + function set_row($row) { |
|
831 | + $this->set('TKT_row', $row); |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | * @return boolean |
839 | 839 | */ |
840 | 840 | function deleted() { |
841 | - return $this->get( 'TKT_deleted' ); |
|
841 | + return $this->get('TKT_deleted'); |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | * @param boolean $deleted |
849 | 849 | * @return boolean |
850 | 850 | */ |
851 | - function set_deleted( $deleted ) { |
|
852 | - $this->set( 'TKT_deleted', $deleted ); |
|
851 | + function set_deleted($deleted) { |
|
852 | + $this->set('TKT_deleted', $deleted); |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | * @return int |
860 | 860 | */ |
861 | 861 | function parent_ID() { |
862 | - return $this->get( 'TKT_parent' ); |
|
862 | + return $this->get('TKT_parent'); |
|
863 | 863 | } |
864 | 864 | |
865 | 865 | |
@@ -869,8 +869,8 @@ discard block |
||
869 | 869 | * @param int $parent |
870 | 870 | * @return boolean |
871 | 871 | */ |
872 | - function set_parent_ID( $parent ) { |
|
873 | - $this->set( 'TKT_parent', $parent ); |
|
872 | + function set_parent_ID($parent) { |
|
873 | + $this->set('TKT_parent', $parent); |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | |
@@ -881,10 +881,10 @@ discard block |
||
881 | 881 | */ |
882 | 882 | function name_and_info() { |
883 | 883 | $times = array(); |
884 | - foreach ( $this->datetimes() as $datetime ) { |
|
884 | + foreach ($this->datetimes() as $datetime) { |
|
885 | 885 | $times[] = $datetime->start_date_and_time(); |
886 | 886 | } |
887 | - return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price(); |
|
887 | + return $this->name()." @ ".implode(", ", $times)." for ".$this->price(); |
|
888 | 888 | } |
889 | 889 | |
890 | 890 | |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | * @return string |
895 | 895 | */ |
896 | 896 | function name() { |
897 | - return $this->get( 'TKT_name' ); |
|
897 | + return $this->get('TKT_name'); |
|
898 | 898 | } |
899 | 899 | |
900 | 900 | |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | * @return float |
905 | 905 | */ |
906 | 906 | function price() { |
907 | - return $this->get( 'TKT_price' ); |
|
907 | + return $this->get('TKT_price'); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | |
@@ -914,8 +914,8 @@ discard block |
||
914 | 914 | * @param array $query_params like EEM_Base::get_all's |
915 | 915 | * @return EE_Registration[] |
916 | 916 | */ |
917 | - public function registrations( $query_params = array() ) { |
|
918 | - return $this->get_many_related( 'Registration', $query_params ); |
|
917 | + public function registrations($query_params = array()) { |
|
918 | + return $this->get_many_related('Registration', $query_params); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | |
@@ -926,8 +926,8 @@ discard block |
||
926 | 926 | * @return int |
927 | 927 | */ |
928 | 928 | public function update_tickets_sold() { |
929 | - $count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) ); |
|
930 | - $this->set_sold( $count_regs_for_this_ticket ); |
|
929 | + $count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0))); |
|
930 | + $this->set_sold($count_regs_for_this_ticket); |
|
931 | 931 | $this->save(); |
932 | 932 | return $count_regs_for_this_ticket; |
933 | 933 | } |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | * @param array $query_params like EEM_Base::get_all's |
940 | 940 | * @return int |
941 | 941 | */ |
942 | - public function count_registrations( $query_params = array() ) { |
|
942 | + public function count_registrations($query_params = array()) { |
|
943 | 943 | return $this->count_related('Registration', $query_params); |
944 | 944 | } |
945 | 945 | } //end EE_Ticket class |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param string $timezone |
36 | 36 | * @return EE_Ticket_Template|mixed |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param string $timezone |
48 | 48 | * @return EE_Ticket_Template |
49 | 49 | */ |
50 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
51 | - return new self( $props_n_values, TRUE, $timezone ); |
|
50 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
51 | + return new self($props_n_values, TRUE, $timezone); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 |
@@ -2,18 +2,18 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * Event Espresso |
|
6 | - * |
|
7 | - * Event Registration and Management Plugin for WordPress |
|
8 | - * |
|
9 | - * @ package Event Espresso |
|
10 | - * @ author Event Espresso |
|
11 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | - * @ link {@link http://www.eventespresso.com} |
|
14 | - * @ since 4.0 |
|
15 | - * |
|
16 | - */ |
|
5 | + * Event Espresso |
|
6 | + * |
|
7 | + * Event Registration and Management Plugin for WordPress |
|
8 | + * |
|
9 | + * @ package Event Espresso |
|
10 | + * @ author Event Espresso |
|
11 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | + * @ link {@link http://www.eventespresso.com} |
|
14 | + * @ since 4.0 |
|
15 | + * |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | |
19 | 19 |
@@ -742,11 +742,11 @@ |
||
742 | 742 | $pm = $this->get_first_related('Payment_Method'); |
743 | 743 | if( $pm instanceof EE_Payment_Method ){ |
744 | 744 | return $pm; |
745 | - }else{ |
|
745 | + } else{ |
|
746 | 746 | $last_payment = $this->last_payment(); |
747 | 747 | if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
748 | 748 | return $last_payment->payment_method(); |
749 | - }else{ |
|
749 | + } else{ |
|
750 | 750 | return NULL; |
751 | 751 | } |
752 | 752 | } |
@@ -2,18 +2,18 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * Event Espresso |
|
6 | - * |
|
7 | - * Event Registration and Management Plugin for WordPress |
|
8 | - * |
|
9 | - * @ package Event Espresso |
|
10 | - * @ author Event Espresso |
|
11 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | - * @ link {@link http://www.eventespresso.com} |
|
14 | - * @ since 4.0 |
|
15 | - * |
|
16 | - */ |
|
5 | + * Event Espresso |
|
6 | + * |
|
7 | + * Event Registration and Management Plugin for WordPress |
|
8 | + * |
|
9 | + * @ package Event Espresso |
|
10 | + * @ author Event Espresso |
|
11 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | + * @ link {@link http://www.eventespresso.com} |
|
14 | + * @ since 4.0 |
|
15 | + * |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | |
19 | 19 |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | /** |
210 | 210 | * get Transaction Total |
211 | 211 | * @access public |
212 | - * @return float |
|
212 | + * @return boolean |
|
213 | 213 | */ |
214 | 214 | public function total() { |
215 | 215 | return $this->get( 'TXN_total' ); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * get Total Amount Paid to Date |
222 | 222 | * @access public |
223 | - * @return float |
|
223 | + * @return boolean |
|
224 | 224 | */ |
225 | 225 | public function paid() { |
226 | 226 | return $this->get( 'TXN_paid' ); |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * Gets all the attendees for this transaction (handy for use with EE_Attendee's get_registrations_for_event function |
324 | 324 | * for getting attendees and how many registrations they each have for an event) |
325 | - * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT' |
|
325 | + * @return EE_Base_Class[] EE_Attendee[] by default, int if $output is set to 'COUNT' |
|
326 | 326 | */ |
327 | 327 | public function attendees() { |
328 | 328 | return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) ); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | /** |
568 | 568 | * Gets all the extra meta info on this payment |
569 | 569 | * @param array $query_params like EEM_Base::get_all |
570 | - * @return EE_Extra_Meta |
|
570 | + * @return EE_Base_Class[] |
|
571 | 571 | */ |
572 | 572 | public function extra_meta( $query_params = array() ) { |
573 | 573 | return $this->get_many_related( 'Extra_Meta', $query_params ); |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | |
715 | 715 | /** |
716 | 716 | * Gets PMD_ID |
717 | - * @return int |
|
717 | + * @return boolean |
|
718 | 718 | */ |
719 | 719 | function payment_method_ID() { |
720 | 720 | return $this->get('PMD_ID'); |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | /** |
726 | 726 | * Sets PMD_ID |
727 | 727 | * @param int $PMD_ID |
728 | - * @return boolean |
|
728 | + * @return boolean|null |
|
729 | 729 | */ |
730 | 730 | function set_payment_method_ID($PMD_ID) { |
731 | 731 | $this->set('PMD_ID', $PMD_ID); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @subpackage includes/classes/EE_Transaction.class.php |
27 | 27 | * @author Brent Christensen |
28 | 28 | */ |
29 | -class EE_Transaction extends EE_Base_Class implements EEI_Transaction{ |
|
29 | +class EE_Transaction extends EE_Base_Class implements EEI_Transaction { |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param string $timezone |
36 | 36 | * @return EE_Transaction |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @param string $timezone |
49 | 49 | * @return EE_Transaction |
50 | 50 | */ |
51 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
52 | - return new self( $props_n_values, TRUE, $timezone ); |
|
51 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
52 | + return new self($props_n_values, TRUE, $timezone); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * @return void |
65 | 65 | */ |
66 | 66 | public function lock() { |
67 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
68 | - $locked_transactions[ $this->ID() ] = true; |
|
69 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
67 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
68 | + $locked_transactions[$this->ID()] = true; |
|
69 | + update_option('ee_locked_transactions', $locked_transactions); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | public function unlock() { |
83 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
84 | - unset( $locked_transactions[ $this->ID() ] ); |
|
85 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
83 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
84 | + unset($locked_transactions[$this->ID()]); |
|
85 | + update_option('ee_locked_transactions', $locked_transactions); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @return boolean |
100 | 100 | */ |
101 | 101 | public function is_locked() { |
102 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
103 | - return isset( $locked_transactions[ $this->ID() ] ) ? true : false; |
|
102 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
103 | + return isset($locked_transactions[$this->ID()]) ? true : false; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * @access public |
112 | 112 | * @param float $total total value of transaction |
113 | 113 | */ |
114 | - public function set_total( $total = 0.00 ) { |
|
115 | - $this->set( 'TXN_total', $total ); |
|
114 | + public function set_total($total = 0.00) { |
|
115 | + $this->set('TXN_total', $total); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @access public |
124 | 124 | * @param float $total_paid total amount paid to date (sum of all payments) |
125 | 125 | */ |
126 | - public function set_paid( $total_paid = 0.00 ) { |
|
127 | - $this->set( 'TXN_paid', $total_paid ); |
|
126 | + public function set_paid($total_paid = 0.00) { |
|
127 | + $this->set('TXN_paid', $total_paid); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | * @access public |
136 | 136 | * @param string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set |
137 | 137 | */ |
138 | - public function set_status( $status = '' ) { |
|
139 | - $this->set( 'STS_ID', $status ); |
|
138 | + public function set_status($status = '') { |
|
139 | + $this->set('STS_ID', $status); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @access public |
148 | 148 | * @param string $hash_salt required for some payment gateways |
149 | 149 | */ |
150 | - public function set_hash_salt( $hash_salt = '' ) { |
|
151 | - $this->set( 'TXN_hash_salt', $hash_salt ); |
|
150 | + public function set_hash_salt($hash_salt = '') { |
|
151 | + $this->set('TXN_hash_salt', $hash_salt); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | * Sets TXN_reg_steps array |
158 | 158 | * @param array $txn_reg_steps |
159 | 159 | */ |
160 | - function set_reg_steps( $txn_reg_steps ) { |
|
161 | - $this->set( 'TXN_reg_steps', $txn_reg_steps ); |
|
160 | + function set_reg_steps($txn_reg_steps) { |
|
161 | + $this->set('TXN_reg_steps', $txn_reg_steps); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * @return array |
169 | 169 | */ |
170 | 170 | function reg_steps() { |
171 | - $TXN_reg_steps = $this->get( 'TXN_reg_steps' ); |
|
172 | - return is_array( $TXN_reg_steps ) ? $TXN_reg_steps : array(); |
|
171 | + $TXN_reg_steps = $this->get('TXN_reg_steps'); |
|
172 | + return is_array($TXN_reg_steps) ? $TXN_reg_steps : array(); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @return string of transaction's total cost, with currency symbol and decimal |
180 | 180 | */ |
181 | 181 | public function pretty_total() { |
182 | - return $this->get_pretty( 'TXN_total' ); |
|
182 | + return $this->get_pretty('TXN_total'); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @return string |
190 | 190 | */ |
191 | 191 | public function pretty_paid() { |
192 | - return $this->get_pretty( 'TXN_paid' ); |
|
192 | + return $this->get_pretty('TXN_paid'); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @return float amount remaining |
202 | 202 | */ |
203 | 203 | public function remaining() { |
204 | - return (float)( $this->total() - $this->paid() ); |
|
204 | + return (float) ($this->total() - $this->paid()); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @return float |
213 | 213 | */ |
214 | 214 | public function total() { |
215 | - return $this->get( 'TXN_total' ); |
|
215 | + return $this->get('TXN_total'); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @return float |
224 | 224 | */ |
225 | 225 | public function paid() { |
226 | - return $this->get( 'TXN_paid' ); |
|
226 | + return $this->get('TXN_paid'); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * @access public |
234 | 234 | */ |
235 | 235 | public function get_cart_session() { |
236 | - $session_data = $this->get( 'TXN_session_data' ); |
|
237 | - return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart ? $session_data[ 'cart' ] : NULL; |
|
236 | + $session_data = $this->get('TXN_session_data'); |
|
237 | + return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart ? $session_data['cart'] : NULL; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | * @access public |
245 | 245 | */ |
246 | 246 | public function session_data() { |
247 | - $session_data = $this->get( 'TXN_session_data' ); |
|
248 | - if ( empty( $session_data ) ) { |
|
249 | - $session_data = array( 'id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array() ); |
|
247 | + $session_data = $this->get('TXN_session_data'); |
|
248 | + if (empty($session_data)) { |
|
249 | + $session_data = array('id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array()); |
|
250 | 250 | } |
251 | 251 | return $session_data; |
252 | 252 | } |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | * @access public |
260 | 260 | * @param EE_Session|array $session_data |
261 | 261 | */ |
262 | - public function set_txn_session_data( $session_data ) { |
|
263 | - if ( $session_data instanceof EE_Session ) { |
|
264 | - $this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE )); |
|
262 | + public function set_txn_session_data($session_data) { |
|
263 | + if ($session_data instanceof EE_Session) { |
|
264 | + $this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE)); |
|
265 | 265 | } else { |
266 | - $this->set( 'TXN_session_data', $session_data ); |
|
266 | + $this->set('TXN_session_data', $session_data); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * @access public |
275 | 275 | */ |
276 | 276 | public function hash_salt_() { |
277 | - return $this->get( 'TXN_hash_salt' ); |
|
277 | + return $this->get('TXN_hash_salt'); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | |
@@ -293,13 +293,13 @@ discard block |
||
293 | 293 | * @param boolean $gmt - whether to return a unix timestamp with UTC offset applied (default) or no UTC offset applied |
294 | 294 | * @return string | int |
295 | 295 | */ |
296 | - public function datetime( $format = FALSE, $gmt = FALSE ) { |
|
297 | - if ( $format ) { |
|
298 | - return $this->get_pretty( 'TXN_timestamp' ); |
|
299 | - } else if ( $gmt ) { |
|
300 | - return $this->get_raw( 'TXN_timestamp' ); |
|
296 | + public function datetime($format = FALSE, $gmt = FALSE) { |
|
297 | + if ($format) { |
|
298 | + return $this->get_pretty('TXN_timestamp'); |
|
299 | + } else if ($gmt) { |
|
300 | + return $this->get_raw('TXN_timestamp'); |
|
301 | 301 | } else { |
302 | - return $this->get( 'TXN_timestamp' ); |
|
302 | + return $this->get('TXN_timestamp'); |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
@@ -311,10 +311,10 @@ discard block |
||
311 | 311 | * @param boolean $get_cached TRUE to retrieve cached registrations or FALSE to pull from the db |
312 | 312 | * @return EE_Registration[] |
313 | 313 | */ |
314 | - public function registrations( $query_params = array(), $get_cached = FALSE ) { |
|
315 | - $query_params = ( empty( $query_params ) || ! is_array( $query_params ) ) ? array( 'order_by' => array( 'Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC' ) ) : $query_params; |
|
314 | + public function registrations($query_params = array(), $get_cached = FALSE) { |
|
315 | + $query_params = (empty($query_params) || ! is_array($query_params)) ? array('order_by' => array('Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC')) : $query_params; |
|
316 | 316 | $query_params = $get_cached ? array() : $query_params; |
317 | - return $this->get_many_related( 'Registration', $query_params ); |
|
317 | + return $this->get_many_related('Registration', $query_params); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT' |
326 | 326 | */ |
327 | 327 | public function attendees() { |
328 | - return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) ); |
|
328 | + return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID()))); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | * @param array $query_params like EEM_Base::get_all |
336 | 336 | * @return EE_Payment[] |
337 | 337 | */ |
338 | - public function payments( $query_params = array() ) { |
|
339 | - return $this->get_many_related( 'Payment', $query_params ); |
|
338 | + public function payments($query_params = array()) { |
|
339 | + return $this->get_many_related('Payment', $query_params); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | * @return EE_Payment[] |
347 | 347 | */ |
348 | 348 | public function approved_payments() { |
349 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
350 | - return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) ); |
|
349 | + EE_Registry::instance()->load_model('Payment'); |
|
350 | + return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC'))); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -357,8 +357,8 @@ discard block |
||
357 | 357 | * @param bool $show_icons |
358 | 358 | * @return string |
359 | 359 | */ |
360 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
361 | - echo $this->pretty_status( $show_icons ); |
|
360 | + public function e_pretty_status($show_icons = FALSE) { |
|
361 | + echo $this->pretty_status($show_icons); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | * @param bool $show_icons |
369 | 369 | * @return string |
370 | 370 | */ |
371 | - public function pretty_status( $show_icons = FALSE ) { |
|
372 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
371 | + public function pretty_status($show_icons = FALSE) { |
|
372 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
373 | 373 | $icon = ''; |
374 | - switch ( $this->status_ID() ) { |
|
374 | + switch ($this->status_ID()) { |
|
375 | 375 | case EEM_Transaction::complete_status_code: |
376 | 376 | $icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : ''; |
377 | 377 | break; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | $icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : ''; |
389 | 389 | break; |
390 | 390 | } |
391 | - return $icon . $status[ $this->status_ID() ]; |
|
391 | + return $icon.$status[$this->status_ID()]; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * @access public |
399 | 399 | */ |
400 | 400 | public function status_ID() { |
401 | - return $this->get( 'STS_ID' ); |
|
401 | + return $this->get('STS_ID'); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @return boolean |
409 | 409 | */ |
410 | 410 | public function is_free() { |
411 | - return (float)$this->get( 'TXN_total' ) == 0 ? TRUE : FALSE; |
|
411 | + return (float) $this->get('TXN_total') == 0 ? TRUE : FALSE; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | |
@@ -476,12 +476,12 @@ discard block |
||
476 | 476 | * @access public |
477 | 477 | * @return string |
478 | 478 | */ |
479 | - public function invoice_url( $type = 'html' ) { |
|
479 | + public function invoice_url($type = 'html') { |
|
480 | 480 | $REG = $this->primary_registration(); |
481 | - if ( ! $REG instanceof EE_Registration ) { |
|
481 | + if ( ! $REG instanceof EE_Registration) { |
|
482 | 482 | return ''; |
483 | 483 | } |
484 | - return $REG->invoice_url( $type ); |
|
484 | + return $REG->invoice_url($type); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @return EE_Registration |
492 | 492 | */ |
493 | 493 | public function primary_registration() { |
494 | - return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) ); |
|
494 | + return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | |
@@ -501,12 +501,12 @@ discard block |
||
501 | 501 | * @param string $type 'pdf' or 'html' (default is 'html') |
502 | 502 | * @return string |
503 | 503 | */ |
504 | - public function receipt_url( $type = 'html' ) { |
|
504 | + public function receipt_url($type = 'html') { |
|
505 | 505 | $REG = $this->primary_registration(); |
506 | - if ( ! $REG instanceof EE_Registration ) { |
|
506 | + if ( ! $REG instanceof EE_Registration) { |
|
507 | 507 | return ''; |
508 | 508 | } |
509 | - return $REG->receipt_url( $type ); |
|
509 | + return $REG->receipt_url($type); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -531,15 +531,15 @@ discard block |
||
531 | 531 | * @deprecated |
532 | 532 | * @return boolean |
533 | 533 | */ |
534 | - public function update_based_on_payments(){ |
|
534 | + public function update_based_on_payments() { |
|
535 | 535 | EE_Error::doing_it_wrong( |
536 | - __CLASS__ . '::' . __FUNCTION__, |
|
537 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
536 | + __CLASS__.'::'.__FUNCTION__, |
|
537 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
538 | 538 | '4.6.0' |
539 | 539 | ); |
540 | 540 | /** @type EE_Transaction_Processor $transaction_processor */ |
541 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
542 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this ); |
|
541 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
542 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @return string |
549 | 549 | */ |
550 | 550 | public function gateway_response_on_transaction() { |
551 | - $payment = $this->get_first_related( 'Payment' ); |
|
551 | + $payment = $this->get_first_related('Payment'); |
|
552 | 552 | return $payment instanceof EE_Payment ? $payment->gateway_response() : ''; |
553 | 553 | } |
554 | 554 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | * @return EE_Status |
560 | 560 | */ |
561 | 561 | public function status_obj() { |
562 | - return $this->get_first_related( 'Status' ); |
|
562 | + return $this->get_first_related('Status'); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | |
@@ -569,8 +569,8 @@ discard block |
||
569 | 569 | * @param array $query_params like EEM_Base::get_all |
570 | 570 | * @return EE_Extra_Meta |
571 | 571 | */ |
572 | - public function extra_meta( $query_params = array() ) { |
|
573 | - return $this->get_many_related( 'Extra_Meta', $query_params ); |
|
572 | + public function extra_meta($query_params = array()) { |
|
573 | + return $this->get_many_related('Extra_Meta', $query_params); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | |
@@ -580,8 +580,8 @@ discard block |
||
580 | 580 | * @param EE_Registration $registration |
581 | 581 | * @return EE_Base_Class the relation was added to |
582 | 582 | */ |
583 | - public function add_registration( EE_Registration $registration ) { |
|
584 | - return $this->_add_relation_to( $registration, 'Registration' ); |
|
583 | + public function add_registration(EE_Registration $registration) { |
|
584 | + return $this->_add_relation_to($registration, 'Registration'); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | |
@@ -592,8 +592,8 @@ discard block |
||
592 | 592 | * @param int $registration_or_id |
593 | 593 | * @return EE_Base_Class that was removed from being related |
594 | 594 | */ |
595 | - public function remove_registration_with_id( $registration_or_id ) { |
|
596 | - return $this->_remove_relation_to( $registration_or_id, 'Registration' ); |
|
595 | + public function remove_registration_with_id($registration_or_id) { |
|
596 | + return $this->_remove_relation_to($registration_or_id, 'Registration'); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | * @return EE_Line_Item[] |
604 | 604 | */ |
605 | 605 | public function items_purchased() { |
606 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) ); |
|
606 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item))); |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | |
@@ -613,8 +613,8 @@ discard block |
||
613 | 613 | * @param EE_Line_Item $line_item |
614 | 614 | * @return EE_Base_Class the relation was added to |
615 | 615 | */ |
616 | - public function add_line_item( EE_Line_Item $line_item ) { |
|
617 | - return $this->_add_relation_to( $line_item, 'Line_Item' ); |
|
616 | + public function add_line_item(EE_Line_Item $line_item) { |
|
617 | + return $this->_add_relation_to($line_item, 'Line_Item'); |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | |
@@ -624,8 +624,8 @@ discard block |
||
624 | 624 | * @param array $query_params |
625 | 625 | * @return EE_Line_Item[] |
626 | 626 | */ |
627 | - public function line_items( $query_params = array() ) { |
|
628 | - return $this->get_many_related( 'Line_Item', $query_params ); |
|
627 | + public function line_items($query_params = array()) { |
|
628 | + return $this->get_many_related('Line_Item', $query_params); |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | * @return EE_Line_Item[] |
636 | 636 | */ |
637 | 637 | public function tax_items() { |
638 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) ); |
|
638 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | |
@@ -646,9 +646,9 @@ discard block |
||
646 | 646 | * @return EE_Line_Item |
647 | 647 | */ |
648 | 648 | public function total_line_item() { |
649 | - $item = $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) ); |
|
650 | - if( ! $item ){ |
|
651 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
649 | + $item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total))); |
|
650 | + if ( ! $item) { |
|
651 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
652 | 652 | $item = EEH_Line_Item::create_default_total_line_item(); |
653 | 653 | } |
654 | 654 | return $item; |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | */ |
664 | 664 | public function tax_total() { |
665 | 665 | $tax_line_item = $this->tax_total_line_item(); |
666 | - if ( $tax_line_item ) { |
|
666 | + if ($tax_line_item) { |
|
667 | 667 | return $tax_line_item->total(); |
668 | 668 | } else { |
669 | 669 | return 0; |
@@ -677,9 +677,9 @@ discard block |
||
677 | 677 | * @return EE_Line_Item |
678 | 678 | */ |
679 | 679 | public function tax_total_line_item() { |
680 | - $item = $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax_sub_total ) ) ); |
|
681 | - if( ! $item ){ |
|
682 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
680 | + $item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax_sub_total))); |
|
681 | + if ( ! $item) { |
|
682 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
683 | 683 | $item = EEH_Line_Item::create_default_total_line_item(); |
684 | 684 | } |
685 | 685 | return $item; |
@@ -691,20 +691,20 @@ discard block |
||
691 | 691 | * Gets the array of billing info for the gateway and for this transaction's primary registration's attendee. |
692 | 692 | * @return EE_Form_Section_Proper |
693 | 693 | */ |
694 | - public function billing_info(){ |
|
694 | + public function billing_info() { |
|
695 | 695 | $payment_method = $this->payment_method(); |
696 | - if ( !$payment_method){ |
|
696 | + if ( ! $payment_method) { |
|
697 | 697 | EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
698 | 698 | return false; |
699 | 699 | } |
700 | 700 | $primary_reg = $this->primary_registration(); |
701 | - if ( ! $primary_reg ) { |
|
702 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
701 | + if ( ! $primary_reg) { |
|
702 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
703 | 703 | return FALSE; |
704 | 704 | } |
705 | 705 | $attendee = $primary_reg->attendee(); |
706 | - if ( ! $attendee ) { |
|
707 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
706 | + if ( ! $attendee) { |
|
707 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
708 | 708 | return FALSE; |
709 | 709 | } |
710 | 710 | return $attendee->billing_info_for_payment_method($payment_method); |
@@ -739,15 +739,15 @@ discard block |
||
739 | 739 | * offline ones, dont' create payments) |
740 | 740 | * @return EE_Payment_Method |
741 | 741 | */ |
742 | - function payment_method(){ |
|
742 | + function payment_method() { |
|
743 | 743 | $pm = $this->get_first_related('Payment_Method'); |
744 | - if( $pm instanceof EE_Payment_Method ){ |
|
744 | + if ($pm instanceof EE_Payment_Method) { |
|
745 | 745 | return $pm; |
746 | - }else{ |
|
746 | + } else { |
|
747 | 747 | $last_payment = $this->last_payment(); |
748 | - if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
|
748 | + if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) { |
|
749 | 749 | return $last_payment->payment_method(); |
750 | - }else{ |
|
750 | + } else { |
|
751 | 751 | return NULL; |
752 | 752 | } |
753 | 753 | } |
@@ -758,15 +758,15 @@ discard block |
||
758 | 758 | * @return EE_Payment |
759 | 759 | */ |
760 | 760 | public function last_payment() { |
761 | - return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) ); |
|
761 | + return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc'))); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | /** |
765 | 765 | * Gets all the line items which are unrelated to tickets on this transaction |
766 | 766 | * @return EE_Line_Item[] |
767 | 767 | */ |
768 | - public function non_ticket_line_items(){ |
|
769 | - return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() ); |
|
768 | + public function non_ticket_line_items() { |
|
769 | + return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID()); |
|
770 | 770 | } |
771 | 771 | |
772 | 772 |
@@ -2,18 +2,18 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * Event Espresso |
|
6 | - * |
|
7 | - * Event Registration and Management Plugin for WordPress |
|
8 | - * |
|
9 | - * @ package Event Espresso |
|
10 | - * @ author Event Espresso |
|
11 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | - * @ link {@link http://www.eventespresso.com} |
|
14 | - * @ since 4.0 |
|
15 | - * |
|
16 | - */ |
|
5 | + * Event Espresso |
|
6 | + * |
|
7 | + * Event Registration and Management Plugin for WordPress |
|
8 | + * |
|
9 | + * @ package Event Espresso |
|
10 | + * @ author Event Espresso |
|
11 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | + * @ link {@link http://www.eventespresso.com} |
|
14 | + * @ since 4.0 |
|
15 | + * |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | |
19 | 19 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Gets name |
56 | - * @return string |
|
56 | + * @return boolean |
|
57 | 57 | */ |
58 | 58 | function name() { |
59 | 59 | return $this->get( 'VNU_name' ); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Gets phone |
65 | - * @return string |
|
65 | + * @return boolean |
|
66 | 66 | */ |
67 | 67 | function phone() { |
68 | 68 | return $this->get( 'VNU_phone' ); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | /** |
74 | 74 | * venue_url |
75 | - * @return string |
|
75 | + * @return boolean |
|
76 | 76 | */ |
77 | 77 | function venue_url() { |
78 | 78 | return $this->get( 'VNU_url' ); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Gets desc |
84 | - * @return string |
|
84 | + * @return boolean |
|
85 | 85 | */ |
86 | 86 | function description() { |
87 | 87 | return $this->get( 'VNU_desc' ); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Gets short description (AKA: the excerpt) |
94 | - * @return string |
|
94 | + * @return boolean |
|
95 | 95 | */ |
96 | 96 | function excerpt() { |
97 | 97 | return $this->get( 'VNU_short_desc' ); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Gets identifier |
104 | - * @return string |
|
104 | + * @return boolean |
|
105 | 105 | */ |
106 | 106 | function identifier() { |
107 | 107 | return $this->get( 'VNU_identifier' ); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Gets address |
114 | - * @return string |
|
114 | + * @return boolean |
|
115 | 115 | */ |
116 | 116 | function address() { |
117 | 117 | return $this->get( 'VNU_address' ); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Gets address2 |
124 | - * @return string |
|
124 | + * @return boolean |
|
125 | 125 | */ |
126 | 126 | function address2() { |
127 | 127 | return $this->get( 'VNU_address2' ); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Gets city |
135 | - * @return string |
|
135 | + * @return boolean |
|
136 | 136 | */ |
137 | 137 | function city() { |
138 | 138 | return $this->get( 'VNU_city' ); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | /** |
142 | 142 | * Gets state |
143 | - * @return int |
|
143 | + * @return boolean |
|
144 | 144 | */ |
145 | 145 | function state_ID() { |
146 | 146 | return $this->get( 'STA_ID' ); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | /** |
196 | 196 | * country_ID |
197 | - * @return string |
|
197 | + * @return boolean |
|
198 | 198 | */ |
199 | 199 | function country_ID() { |
200 | 200 | return $this->get( 'CNT_ISO' ); |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | /** |
241 | 241 | * Gets zip |
242 | - * @return string |
|
242 | + * @return boolean |
|
243 | 243 | */ |
244 | 244 | function zip() { |
245 | 245 | return $this->get( 'VNU_zip' ); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | |
260 | 260 | /** |
261 | 261 | * Gets created |
262 | - * @return string |
|
262 | + * @return boolean |
|
263 | 263 | */ |
264 | 264 | function created() { |
265 | 265 | return $this->get( 'VNU_created' ); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Gets modified |
272 | - * @return string |
|
272 | + * @return boolean |
|
273 | 273 | */ |
274 | 274 | function modified() { |
275 | 275 | return $this->get( 'VNU_modified' ); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | /** |
281 | 281 | * Gets order |
282 | - * @return int |
|
282 | + * @return boolean |
|
283 | 283 | */ |
284 | 284 | function order() { |
285 | 285 | return $this->get( 'VNU_order' ); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Gets wp_user |
292 | - * @return int |
|
292 | + * @return boolean |
|
293 | 293 | */ |
294 | 294 | function wp_user() { |
295 | 295 | return $this->get( 'VNU_wp_user' ); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | |
299 | 299 | |
300 | 300 | /** |
301 | - * @return string |
|
301 | + * @return boolean |
|
302 | 302 | */ |
303 | 303 | function virtual_phone() { |
304 | 304 | return $this->get( 'VNU_virtual_phone' ); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | |
308 | 308 | |
309 | 309 | /** |
310 | - * @return string |
|
310 | + * @return boolean |
|
311 | 311 | */ |
312 | 312 | function virtual_url() { |
313 | 313 | return $this->get( 'VNU_virtual_url' ); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | |
327 | 327 | /** |
328 | - * @return string |
|
328 | + * @return boolean |
|
329 | 329 | */ |
330 | 330 | function google_map_link() { |
331 | 331 | return $this->get( 'VNU_google_map_link' ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | * @param array $props_n_values |
34 | 34 | * @return EE_Venue |
35 | 35 | */ |
36 | - public static function new_instance( $props_n_values = array() ) { |
|
37 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
38 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
36 | + public static function new_instance($props_n_values = array()) { |
|
37 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
38 | + return $has_object ? $has_object : new self($props_n_values); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @param array $props_n_values |
46 | 46 | * @return EE_Venue |
47 | 47 | */ |
48 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
49 | - return new self( $props_n_values, TRUE ); |
|
48 | + public static function new_instance_from_db($props_n_values = array()) { |
|
49 | + return new self($props_n_values, TRUE); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @return string |
57 | 57 | */ |
58 | 58 | function name() { |
59 | - return $this->get( 'VNU_name' ); |
|
59 | + return $this->get('VNU_name'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @return string |
66 | 66 | */ |
67 | 67 | function phone() { |
68 | - return $this->get( 'VNU_phone' ); |
|
68 | + return $this->get('VNU_phone'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @return string |
76 | 76 | */ |
77 | 77 | function venue_url() { |
78 | - return $this->get( 'VNU_url' ); |
|
78 | + return $this->get('VNU_url'); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @return string |
85 | 85 | */ |
86 | 86 | function description() { |
87 | - return $this->get( 'VNU_desc' ); |
|
87 | + return $this->get('VNU_desc'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @return string |
95 | 95 | */ |
96 | 96 | function excerpt() { |
97 | - return $this->get( 'VNU_short_desc' ); |
|
97 | + return $this->get('VNU_short_desc'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @return string |
105 | 105 | */ |
106 | 106 | function identifier() { |
107 | - return $this->get( 'VNU_identifier' ); |
|
107 | + return $this->get('VNU_identifier'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @return string |
115 | 115 | */ |
116 | 116 | function address() { |
117 | - return $this->get( 'VNU_address' ); |
|
117 | + return $this->get('VNU_address'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @return string |
125 | 125 | */ |
126 | 126 | function address2() { |
127 | - return $this->get( 'VNU_address2' ); |
|
127 | + return $this->get('VNU_address2'); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @return string |
136 | 136 | */ |
137 | 137 | function city() { |
138 | - return $this->get( 'VNU_city' ); |
|
138 | + return $this->get('VNU_city'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return int |
144 | 144 | */ |
145 | 145 | function state_ID() { |
146 | - return $this->get( 'STA_ID' ); |
|
146 | + return $this->get('STA_ID'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @return string |
153 | 153 | */ |
154 | 154 | public function state_abbrev() { |
155 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' ); |
|
155 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @return string |
162 | 162 | */ |
163 | 163 | public function state_name() { |
164 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __( 'Unknown', 'event_espresso' ); |
|
164 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __('Unknown', 'event_espresso'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @return EE_State |
172 | 172 | */ |
173 | 173 | function state_obj() { |
174 | - return $this->get_first_related( 'State' ); |
|
174 | + return $this->get_first_related('State'); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return string |
184 | 184 | */ |
185 | 185 | public function state() { |
186 | - if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) { |
|
186 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
187 | 187 | return $this->state_abbrev(); |
188 | 188 | } else { |
189 | 189 | return $this->state_name(); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @return string |
198 | 198 | */ |
199 | 199 | function country_ID() { |
200 | - return $this->get( 'CNT_ISO' ); |
|
200 | + return $this->get('CNT_ISO'); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @return string |
207 | 207 | */ |
208 | 208 | public function country_name() { |
209 | - return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __( 'Unknown', 'event_espresso' ); |
|
209 | + return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __('Unknown', 'event_espresso'); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @return EE_Country |
217 | 217 | */ |
218 | 218 | function country_obj() { |
219 | - return $this->get_first_related( 'Country' ); |
|
219 | + return $this->get_first_related('Country'); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @return string |
229 | 229 | */ |
230 | 230 | public function country() { |
231 | - if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) { |
|
231 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
232 | 232 | return $this->country_ID(); |
233 | 233 | } else { |
234 | 234 | return $this->country_name(); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @return string |
243 | 243 | */ |
244 | 244 | function zip() { |
245 | - return $this->get( 'VNU_zip' ); |
|
245 | + return $this->get('VNU_zip'); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @return int |
253 | 253 | */ |
254 | 254 | function capacity() { |
255 | - return $this->get_pretty( 'VNU_capacity', 'symbol' ); |
|
255 | + return $this->get_pretty('VNU_capacity', 'symbol'); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @return string |
263 | 263 | */ |
264 | 264 | function created() { |
265 | - return $this->get( 'VNU_created' ); |
|
265 | + return $this->get('VNU_created'); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @return string |
273 | 273 | */ |
274 | 274 | function modified() { |
275 | - return $this->get( 'VNU_modified' ); |
|
275 | + return $this->get('VNU_modified'); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @return int |
283 | 283 | */ |
284 | 284 | function order() { |
285 | - return $this->get( 'VNU_order' ); |
|
285 | + return $this->get('VNU_order'); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @return int |
293 | 293 | */ |
294 | 294 | function wp_user() { |
295 | - return $this->get( 'VNU_wp_user' ); |
|
295 | + return $this->get('VNU_wp_user'); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @return string |
302 | 302 | */ |
303 | 303 | function virtual_phone() { |
304 | - return $this->get( 'VNU_virtual_phone' ); |
|
304 | + return $this->get('VNU_virtual_phone'); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * @return string |
311 | 311 | */ |
312 | 312 | function virtual_url() { |
313 | - return $this->get( 'VNU_virtual_url' ); |
|
313 | + return $this->get('VNU_virtual_url'); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return bool |
320 | 320 | */ |
321 | 321 | function enable_for_gmap() { |
322 | - return $this->get( 'VNU_enable_for_gmap' ); |
|
322 | + return $this->get('VNU_enable_for_gmap'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | * @return string |
329 | 329 | */ |
330 | 330 | function google_map_link() { |
331 | - return $this->get( 'VNU_google_map_link' ); |
|
331 | + return $this->get('VNU_google_map_link'); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -340,16 +340,16 @@ discard block |
||
340 | 340 | * @param bool $upcoming |
341 | 341 | * @return EE_Event[] |
342 | 342 | */ |
343 | - function events( $query_params = array(), $upcoming = FALSE ) { |
|
344 | - if ( $upcoming ) { |
|
343 | + function events($query_params = array(), $upcoming = FALSE) { |
|
344 | + if ($upcoming) { |
|
345 | 345 | $query_params = array( |
346 | 346 | array( |
347 | 347 | 'status' => 'publish', |
348 | - 'Datetime.DTT_EVT_start' => array( '>', current_time( 'mysql' )) |
|
348 | + 'Datetime.DTT_EVT_start' => array('>', current_time('mysql')) |
|
349 | 349 | ) |
350 | 350 | ); |
351 | 351 | } |
352 | - return $this->get_many_related( 'Event', $query_params ); |
|
352 | + return $this->get_many_related('Event', $query_params); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | /** |
368 | 368 | * Sets address |
369 | 369 | */ |
370 | - function set_address( $address = '' ) { |
|
371 | - $this->set( 'VNU_address', $address ); |
|
370 | + function set_address($address = '') { |
|
371 | + $this->set('VNU_address', $address); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | /** |
377 | 377 | * @param string $address2 |
378 | 378 | */ |
379 | - function set_address2( $address2 = '' ) { |
|
380 | - $this->set( 'VNU_address2', $address2 ); |
|
379 | + function set_address2($address2 = '') { |
|
380 | + $this->set('VNU_address2', $address2); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | |
@@ -385,8 +385,8 @@ discard block |
||
385 | 385 | /** |
386 | 386 | * @param string $city |
387 | 387 | */ |
388 | - function set_city( $city = '' ) { |
|
389 | - $this->set( 'VNU_city', $city ); |
|
388 | + function set_city($city = '') { |
|
389 | + $this->set('VNU_city', $city); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | /** |
395 | 395 | * @param int $state |
396 | 396 | */ |
397 | - function set_state_ID( $state = 0 ) { |
|
398 | - $this->set( 'STA_ID', $state ); |
|
397 | + function set_state_ID($state = 0) { |
|
398 | + $this->set('STA_ID', $state); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -406,8 +406,8 @@ discard block |
||
406 | 406 | * @param EE_State /int $state_id_or_obj |
407 | 407 | * @return EE_State |
408 | 408 | */ |
409 | - function set_state_obj( $state_id_or_obj ) { |
|
410 | - return $this->_add_relation_to( $state_id_or_obj, 'State' ); |
|
409 | + function set_state_obj($state_id_or_obj) { |
|
410 | + return $this->_add_relation_to($state_id_or_obj, 'State'); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | |
@@ -415,8 +415,8 @@ discard block |
||
415 | 415 | /** |
416 | 416 | * @param int $country_ID |
417 | 417 | */ |
418 | - function set_country_ID( $country_ID = 0 ) { |
|
419 | - $this->set( 'CNT_ISO', $country_ID ); |
|
418 | + function set_country_ID($country_ID = 0) { |
|
419 | + $this->set('CNT_ISO', $country_ID); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * @param EE_Country /string $country_id_or_obj |
426 | 426 | * @return EE_Country |
427 | 427 | */ |
428 | - function set_country_obj( $country_id_or_obj ) { |
|
428 | + function set_country_obj($country_id_or_obj) { |
|
429 | 429 | return $this->_add_relation_to($country_id_or_obj, 'Country'); |
430 | 430 | } |
431 | 431 | |
@@ -434,8 +434,8 @@ discard block |
||
434 | 434 | /** |
435 | 435 | * @param string $zip |
436 | 436 | */ |
437 | - function set_zip( $zip = '' ) { |
|
438 | - $this->set( 'VNU_zip', $zip ); |
|
437 | + function set_zip($zip = '') { |
|
438 | + $this->set('VNU_zip', $zip); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | /** |
444 | 444 | * @param int $capacity |
445 | 445 | */ |
446 | - function set_capacity( $capacity = 0 ) { |
|
447 | - $this->set( 'VNU_capacity', $capacity ); |
|
446 | + function set_capacity($capacity = 0) { |
|
447 | + $this->set('VNU_capacity', $capacity); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | |
@@ -452,8 +452,8 @@ discard block |
||
452 | 452 | /** |
453 | 453 | * @param string $created |
454 | 454 | */ |
455 | - function set_created( $created = '' ) { |
|
456 | - $this->set( 'VNU_created', $created ); |
|
455 | + function set_created($created = '') { |
|
456 | + $this->set('VNU_created', $created); |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | |
@@ -461,8 +461,8 @@ discard block |
||
461 | 461 | /** |
462 | 462 | * @param string $desc |
463 | 463 | */ |
464 | - function set_description( $desc = '' ) { |
|
465 | - $this->set( 'VNU_desc', $desc ); |
|
464 | + function set_description($desc = '') { |
|
465 | + $this->set('VNU_desc', $desc); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
@@ -470,8 +470,8 @@ discard block |
||
470 | 470 | /** |
471 | 471 | * @param string $identifier |
472 | 472 | */ |
473 | - function set_identifier( $identifier = '' ) { |
|
474 | - $this->set( 'VNU_identifier', $identifier ); |
|
473 | + function set_identifier($identifier = '') { |
|
474 | + $this->set('VNU_identifier', $identifier); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | /** |
480 | 480 | * @param string $modified |
481 | 481 | */ |
482 | - function set_modified( $modified = '' ) { |
|
483 | - $this->set( 'VNU_modified', $modified ); |
|
482 | + function set_modified($modified = '') { |
|
483 | + $this->set('VNU_modified', $modified); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
@@ -488,8 +488,8 @@ discard block |
||
488 | 488 | /** |
489 | 489 | * @param string $name |
490 | 490 | */ |
491 | - function set_name( $name = '' ) { |
|
492 | - $this->set( 'VNU_name', $name ); |
|
491 | + function set_name($name = '') { |
|
492 | + $this->set('VNU_name', $name); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | |
@@ -497,8 +497,8 @@ discard block |
||
497 | 497 | /** |
498 | 498 | * @param int $order |
499 | 499 | */ |
500 | - function set_order( $order = 0 ) { |
|
501 | - $this->set( 'VNU_order', $order ); |
|
500 | + function set_order($order = 0) { |
|
501 | + $this->set('VNU_order', $order); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | |
@@ -506,8 +506,8 @@ discard block |
||
506 | 506 | /** |
507 | 507 | * @param string $phone |
508 | 508 | */ |
509 | - function set_phone( $phone = '' ) { |
|
510 | - $this->set( 'VNU_phone', $phone ); |
|
509 | + function set_phone($phone = '') { |
|
510 | + $this->set('VNU_phone', $phone); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | |
@@ -515,8 +515,8 @@ discard block |
||
515 | 515 | /** |
516 | 516 | * @param int $wp_user |
517 | 517 | */ |
518 | - function set_wp_user( $wp_user = 1 ) { |
|
519 | - $this->set( 'VNU_wp_user', $wp_user ); |
|
518 | + function set_wp_user($wp_user = 1) { |
|
519 | + $this->set('VNU_wp_user', $wp_user); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | /** |
525 | 525 | * @param string $url |
526 | 526 | */ |
527 | - function set_venue_url( $url = '' ) { |
|
528 | - $this->set( 'VNU_url', $url ); |
|
527 | + function set_venue_url($url = '') { |
|
528 | + $this->set('VNU_url', $url); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | |
@@ -533,8 +533,8 @@ discard block |
||
533 | 533 | /** |
534 | 534 | * @param string $phone |
535 | 535 | */ |
536 | - function set_virtual_phone( $phone = '' ) { |
|
537 | - $this->set( 'VNU_virtual_phone', $phone ); |
|
536 | + function set_virtual_phone($phone = '') { |
|
537 | + $this->set('VNU_virtual_phone', $phone); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | /** |
543 | 543 | * @param string $url |
544 | 544 | */ |
545 | - function set_virtual_url( $url = '' ) { |
|
546 | - $this->set( 'VNU_virtual_url', $url ); |
|
545 | + function set_virtual_url($url = '') { |
|
546 | + $this->set('VNU_virtual_url', $url); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | |
@@ -551,8 +551,8 @@ discard block |
||
551 | 551 | /** |
552 | 552 | * @param string $enable |
553 | 553 | */ |
554 | - function set_enable_for_gmap( $enable = '' ) { |
|
555 | - $this->set( 'VNU_enable_for_gmap', $enable ); |
|
554 | + function set_enable_for_gmap($enable = '') { |
|
555 | + $this->set('VNU_enable_for_gmap', $enable); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | /** |
561 | 561 | * @param string $google_map_link |
562 | 562 | */ |
563 | - function set_google_map_link( $google_map_link = '' ) { |
|
564 | - $this->set( 'VNU_google_map_link', $google_map_link ); |
|
563 | + function set_google_map_link($google_map_link = '') { |
|
564 | + $this->set('VNU_google_map_link', $google_map_link); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 |
@@ -2,14 +2,14 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * EE_WP_User class |
|
6 | - * |
|
7 | - * @package Event Espresso |
|
8 | - * @subpackage includes/classes/EE_WP_User.class.php |
|
9 | - * @author Mike Nelson |
|
10 | - * |
|
11 | - * ------------------------------------------------------------------------ |
|
12 | - */ |
|
5 | + * EE_WP_User class |
|
6 | + * |
|
7 | + * @package Event Espresso |
|
8 | + * @subpackage includes/classes/EE_WP_User.class.php |
|
9 | + * @author Mike Nelson |
|
10 | + * |
|
11 | + * ------------------------------------------------------------------------ |
|
12 | + */ |
|
13 | 13 | class EE_WP_User extends EE_Base_Class { |
14 | 14 | |
15 | 15 | /** |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_WP_User class |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param array $props_n_values |
23 | 23 | * @return EE_WP_User|mixed |
24 | 24 | */ |
25 | - public static function new_instance( $props_n_values = array() ) { |
|
26 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
27 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
25 | + public static function new_instance($props_n_values = array()) { |
|
26 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
27 | + return $has_object ? $has_object : new self($props_n_values); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param array $props_n_values |
34 | 34 | * @return EE_WP_User |
35 | 35 | */ |
36 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
37 | - return new self( $props_n_values, TRUE ); |
|
36 | + public static function new_instance_from_db($props_n_values = array()) { |
|
37 | + return new self($props_n_values, TRUE); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @return WP_User |
43 | 43 | */ |
44 | 44 | public function wp_user_obj() { |
45 | - if( ! $this->_wp_user_obj ) { |
|
46 | - $this->_wp_user_obj = get_user_by('ID', $this->ID() ); |
|
45 | + if ( ! $this->_wp_user_obj) { |
|
46 | + $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
47 | 47 | } |
48 | 48 | return $this->_wp_user_obj; |
49 | 49 | } |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * constructor |
52 | 52 | */ |
53 | - protected function __construct( $timezone = NULL ){ |
|
54 | - $this->singular_item = __('Answer','event_espresso'); |
|
55 | - $this->plural_item = __('Answers','event_espresso'); |
|
53 | + protected function __construct($timezone = NULL) { |
|
54 | + $this->singular_item = __('Answer', 'event_espresso'); |
|
55 | + $this->plural_item = __('Answers', 'event_espresso'); |
|
56 | 56 | $this->_tables = array( |
57 | 57 | 'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID') |
58 | 58 | ); |
59 | 59 | $this->_fields = array( |
60 | 60 | 'Answer'=>array( |
61 | - 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')), |
|
62 | - 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'), |
|
63 | - 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'), |
|
64 | - 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value','event_espresso'), false, '') |
|
61 | + 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')), |
|
62 | + 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'), |
|
63 | + 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), |
|
64 | + 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '') |
|
65 | 65 | )); |
66 | 66 | $this->_model_relations = array( |
67 | 67 | 'Registration'=>new EE_Belongs_To_Relation(), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | ); |
70 | 70 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
71 | 71 | $this->_caps_slug = 'registrations'; |
72 | - parent::__construct( $timezone ); |
|
72 | + parent::__construct($timezone); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -82,19 +82,19 @@ discard block |
||
82 | 82 | * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value' |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){ |
|
86 | - $value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer ); |
|
87 | - if ( $value === NULL ){ |
|
88 | - $answer_obj = $this->get_registration_question_answer_object( $registration, $question_id, $pretty_answer ); |
|
89 | - if( $answer_obj instanceof EE_Answer ){ |
|
90 | - if($pretty_answer){ |
|
85 | + public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) { |
|
86 | + $value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer); |
|
87 | + if ($value === NULL) { |
|
88 | + $answer_obj = $this->get_registration_question_answer_object($registration, $question_id, $pretty_answer); |
|
89 | + if ($answer_obj instanceof EE_Answer) { |
|
90 | + if ($pretty_answer) { |
|
91 | 91 | $value = $answer_obj->pretty_value(); |
92 | - }else{ |
|
92 | + } else { |
|
93 | 93 | $value = $answer_obj->value(); |
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | - return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id ); |
|
97 | + return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | * @param int $question_id |
106 | 106 | * @return EE_Answer |
107 | 107 | */ |
108 | - public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){ |
|
109 | - $answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() ))); |
|
110 | - return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id ); |
|
108 | + public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) { |
|
109 | + $answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID()))); |
|
110 | + return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -119,27 +119,27 @@ discard block |
||
119 | 119 | * @param boolean $pretty_answer |
120 | 120 | * @return string |
121 | 121 | */ |
122 | - public function get_attendee_property_answer_value( EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE ){ |
|
122 | + public function get_attendee_property_answer_value(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) { |
|
123 | 123 | $field_name = NULL; |
124 | 124 | $value = NULL; |
125 | 125 | //only bother checking if the registration has an attendee |
126 | - if( $registration->attendee() instanceof EE_Attendee && isset($this->_question_id_to_att_field_map[$question_id])){ |
|
126 | + if ($registration->attendee() instanceof EE_Attendee && isset($this->_question_id_to_att_field_map[$question_id])) { |
|
127 | 127 | $field_name = $this->_question_id_to_att_field_map[$question_id]; |
128 | - if($pretty_answer){ |
|
129 | - if($field_name == 'STA_ID'){ |
|
128 | + if ($pretty_answer) { |
|
129 | + if ($field_name == 'STA_ID') { |
|
130 | 130 | $state = $registration->attendee()->state_obj(); |
131 | - $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'),$registration->attendee()->state_ID()); |
|
132 | - }else if($field_name == 'CNT_ISO'){ |
|
131 | + $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID()); |
|
132 | + } else if ($field_name == 'CNT_ISO') { |
|
133 | 133 | $country = $registration->attendee()->country_obj(); |
134 | - $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID()); |
|
135 | - }else{ |
|
134 | + $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID()); |
|
135 | + } else { |
|
136 | 136 | $value = $registration->attendee()->get_pretty($field_name); |
137 | 137 | } |
138 | - }else{ |
|
138 | + } else { |
|
139 | 139 | $value = $registration->attendee()->get($field_name); |
140 | 140 | } |
141 | 141 | } |
142 | - return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id ); |
|
142 | + return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -89,7 +91,7 @@ discard block |
||
89 | 91 | if( $answer_obj instanceof EE_Answer ){ |
90 | 92 | if($pretty_answer){ |
91 | 93 | $value = $answer_obj->pretty_value(); |
92 | - }else{ |
|
94 | + } else{ |
|
93 | 95 | $value = $answer_obj->value(); |
94 | 96 | } |
95 | 97 | } |
@@ -129,13 +131,13 @@ discard block |
||
129 | 131 | if($field_name == 'STA_ID'){ |
130 | 132 | $state = $registration->attendee()->state_obj(); |
131 | 133 | $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'),$registration->attendee()->state_ID()); |
132 | - }else if($field_name == 'CNT_ISO'){ |
|
134 | + } else if($field_name == 'CNT_ISO'){ |
|
133 | 135 | $country = $registration->attendee()->country_obj(); |
134 | 136 | $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID()); |
135 | - }else{ |
|
137 | + } else{ |
|
136 | 138 | $value = $registration->attendee()->get_pretty($field_name); |
137 | 139 | } |
138 | - }else{ |
|
140 | + } else{ |
|
139 | 141 | $value = $registration->attendee()->get($field_name); |
140 | 142 | } |
141 | 143 | } |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | |
106 | 106 | |
107 | 107 | /** |
108 | - * retrieve a single attendee from db via their ID |
|
109 | - * |
|
110 | - * @access public |
|
111 | - * @param $ATT_ID |
|
112 | - * @return mixed array on success, FALSE on fail |
|
108 | + * retrieve a single attendee from db via their ID |
|
109 | + * |
|
110 | + * @access public |
|
111 | + * @param $ATT_ID |
|
112 | + * @return mixed array on success, FALSE on fail |
|
113 | 113 | * @deprecated |
114 | - */ |
|
114 | + */ |
|
115 | 115 | public function get_attendee_by_ID( $ATT_ID = FALSE ) { |
116 | 116 | // retrieve a particular EE_Attendee |
117 | 117 | return $this->get_one_by_ID( $ATT_ID ); |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | /** |
124 | - * retrieve a single attendee from db via their ID |
|
125 | - * |
|
126 | - * @access public |
|
127 | - * @param array $where_cols_n_values |
|
128 | - * @return mixed array on success, FALSE on fail |
|
129 | - */ |
|
124 | + * retrieve a single attendee from db via their ID |
|
125 | + * |
|
126 | + * @access public |
|
127 | + * @param array $where_cols_n_values |
|
128 | + * @return mixed array on success, FALSE on fail |
|
129 | + */ |
|
130 | 130 | public function get_attendee( $where_cols_n_values = array() ) { |
131 | 131 | |
132 | 132 | if ( empty( $where_cols_n_values )) { |
@@ -174,20 +174,20 @@ discard block |
||
174 | 174 | |
175 | 175 | |
176 | 176 | /** |
177 | - * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate |
|
178 | - * EE_Attendee objects. |
|
179 | - * |
|
180 | - * @since 4.3.0 |
|
181 | - * @param array $ids array of EE_Registration ids |
|
182 | - * @return EE_Attendee[] |
|
183 | - */ |
|
184 | - public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
185 | - $ids = (array) $ids; |
|
186 | - $_where = array( |
|
187 | - 'Registration.REG_ID' => array( 'in', $ids ) |
|
188 | - ); |
|
189 | - return $this->get_all( array( $_where ) ); |
|
190 | - } |
|
177 | + * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate |
|
178 | + * EE_Attendee objects. |
|
179 | + * |
|
180 | + * @since 4.3.0 |
|
181 | + * @param array $ids array of EE_Registration ids |
|
182 | + * @return EE_Attendee[] |
|
183 | + */ |
|
184 | + public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
185 | + $ids = (array) $ids; |
|
186 | + $_where = array( |
|
187 | + 'Registration.REG_ID' => array( 'in', $ids ) |
|
188 | + ); |
|
189 | + return $this->get_all( array( $_where ) ); |
|
190 | + } |
|
191 | 191 | |
192 | 192 | |
193 | 193 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | * QST_ID and QST_systems that relate to attendee attributes. |
20 | 20 | * NOTE: this will be deprecated if we remove system questions |
21 | 21 | */ |
22 | - const fname_question_id=1; |
|
23 | - const lname_question_id=2; |
|
24 | - const email_question_id=3; |
|
25 | - const address_question_id=4; |
|
26 | - const address2_question_id=5; |
|
27 | - const city_question_id=6; |
|
28 | - const state_question_id=7; |
|
29 | - const country_question_id=8; |
|
30 | - const zip_question_id=9; |
|
31 | - const phone_question_id=10; |
|
22 | + const fname_question_id = 1; |
|
23 | + const lname_question_id = 2; |
|
24 | + const email_question_id = 3; |
|
25 | + const address_question_id = 4; |
|
26 | + const address2_question_id = 5; |
|
27 | + const city_question_id = 6; |
|
28 | + const state_question_id = 7; |
|
29 | + const country_question_id = 8; |
|
30 | + const zip_question_id = 9; |
|
31 | + const phone_question_id = 10; |
|
32 | 32 | |
33 | 33 | |
34 | 34 | |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @access protected |
40 | 40 | * @param null $timezone |
41 | 41 | */ |
42 | - protected function __construct( $timezone = NULL ) { |
|
43 | - $this->singular_item = __('Attendee','event_espresso'); |
|
44 | - $this->plural_item = __('Attendees','event_espresso'); |
|
42 | + protected function __construct($timezone = NULL) { |
|
43 | + $this->singular_item = __('Attendee', 'event_espresso'); |
|
44 | + $this->plural_item = __('Attendees', 'event_espresso'); |
|
45 | 45 | $this->_tables = array( |
46 | 46 | 'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'), |
47 | 47 | 'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID') |
@@ -55,36 +55,36 @@ discard block |
||
55 | 55 | 'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, time()), |
56 | 56 | 'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")), |
57 | 57 | 'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, time()), |
58 | - 'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ), |
|
58 | + 'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false), |
|
59 | 59 | 'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0), |
60 | - 'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'),// EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'), |
|
60 | + 'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'), // EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'), |
|
61 | 61 | 'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish') |
62 | 62 | ), |
63 | 63 | 'Attendee_Meta'=>array( |
64 | - 'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false), |
|
64 | + 'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false), |
|
65 | 65 | 'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false), |
66 | - 'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''), |
|
67 | - 'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''), |
|
68 | - 'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''), |
|
69 | - 'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''), |
|
70 | - 'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''), |
|
71 | - 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'), |
|
72 | - 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'), |
|
73 | - 'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''), |
|
74 | - 'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''), |
|
75 | - 'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '') |
|
66 | + 'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''), |
|
67 | + 'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''), |
|
68 | + 'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''), |
|
69 | + 'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''), |
|
70 | + 'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''), |
|
71 | + 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'), |
|
72 | + 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'), |
|
73 | + 'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''), |
|
74 | + 'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''), |
|
75 | + 'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '') |
|
76 | 76 | )); |
77 | 77 | $this->_model_relations = array( |
78 | 78 | 'Registration'=>new EE_Has_Many_Relation(), |
79 | 79 | 'State'=>new EE_Belongs_To_Relation(), |
80 | 80 | 'Country'=>new EE_Belongs_To_Relation(), |
81 | - 'Event'=>new EE_HABTM_Relation('Registration', FALSE ), |
|
81 | + 'Event'=>new EE_HABTM_Relation('Registration', FALSE), |
|
82 | 82 | 'WP_User' => new EE_Belongs_To_Relation(), |
83 | 83 | ); |
84 | 84 | require_once('strategies/EE_CPT_Where_Conditions.strategy.php'); |
85 | 85 | $this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_attendees', 'ATTM_ID'); |
86 | 86 | $this->_caps_slug = 'contacts'; |
87 | - parent::__construct( $timezone ); |
|
87 | + parent::__construct($timezone); |
|
88 | 88 | |
89 | 89 | } |
90 | 90 | |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID |
97 | 97 | * @return EE_Attendee[] |
98 | 98 | */ |
99 | - public function get_attendees_for_transaction( $transaction_id_or_obj ){ |
|
100 | - return $this->get_all( array( array( |
|
99 | + public function get_attendees_for_transaction($transaction_id_or_obj) { |
|
100 | + return $this->get_all(array(array( |
|
101 | 101 | 'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj |
102 | 102 | ))); |
103 | 103 | } |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | * @return mixed array on success, FALSE on fail |
113 | 113 | * @deprecated |
114 | 114 | */ |
115 | - public function get_attendee_by_ID( $ATT_ID = FALSE ) { |
|
115 | + public function get_attendee_by_ID($ATT_ID = FALSE) { |
|
116 | 116 | // retrieve a particular EE_Attendee |
117 | - return $this->get_one_by_ID( $ATT_ID ); |
|
117 | + return $this->get_one_by_ID($ATT_ID); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | * @param array $where_cols_n_values |
128 | 128 | * @return mixed array on success, FALSE on fail |
129 | 129 | */ |
130 | - public function get_attendee( $where_cols_n_values = array() ) { |
|
130 | + public function get_attendee($where_cols_n_values = array()) { |
|
131 | 131 | |
132 | - if ( empty( $where_cols_n_values )) { |
|
132 | + if (empty($where_cols_n_values)) { |
|
133 | 133 | return FALSE; |
134 | 134 | } |
135 | - $attendee = $this->get_all( array($where_cols_n_values )); |
|
136 | - if ( ! empty( $attendee )) { |
|
137 | - return array_shift( $attendee ); |
|
135 | + $attendee = $this->get_all(array($where_cols_n_values)); |
|
136 | + if ( ! empty($attendee)) { |
|
137 | + return array_shift($attendee); |
|
138 | 138 | } else { |
139 | 139 | return FALSE; |
140 | 140 | } |
@@ -150,20 +150,20 @@ discard block |
||
150 | 150 | * @param array $where_cols_n_values |
151 | 151 | * @return bool|mixed |
152 | 152 | */ |
153 | - public function find_existing_attendee( $where_cols_n_values = NULL ) { |
|
153 | + public function find_existing_attendee($where_cols_n_values = NULL) { |
|
154 | 154 | // search by combo of first and last names plus the email address |
155 | - $attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email ); |
|
155 | + $attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email); |
|
156 | 156 | // no search params means attendee object already exists. |
157 | - $where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys; |
|
157 | + $where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys; |
|
158 | 158 | $valid_data = TRUE; |
159 | 159 | // check for required values |
160 | - $valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE; |
|
161 | - $valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE; |
|
162 | - $valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE; |
|
160 | + $valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE; |
|
161 | + $valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE; |
|
162 | + $valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE; |
|
163 | 163 | |
164 | - if ( $valid_data ) { |
|
165 | - $attendee = $this->get_attendee( $where_cols_n_values ); |
|
166 | - if ( $attendee instanceof EE_Attendee ) { |
|
164 | + if ($valid_data) { |
|
165 | + $attendee = $this->get_attendee($where_cols_n_values); |
|
166 | + if ($attendee instanceof EE_Attendee) { |
|
167 | 167 | return $attendee; |
168 | 168 | } |
169 | 169 | } |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | * @param array $ids array of EE_Registration ids |
182 | 182 | * @return EE_Attendee[] |
183 | 183 | */ |
184 | - public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
184 | + public function get_array_of_contacts_from_reg_ids($ids) { |
|
185 | 185 | $ids = (array) $ids; |
186 | 186 | $_where = array( |
187 | - 'Registration.REG_ID' => array( 'in', $ids ) |
|
187 | + 'Registration.REG_ID' => array('in', $ids) |
|
188 | 188 | ); |
189 | - return $this->get_all( array( $_where ) ); |
|
189 | + return $this->get_all(array($_where)); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 |
@@ -256,7 +256,7 @@ |
||
256 | 256 | * @param int $TXN_ID |
257 | 257 | * @param int $ATT_ID |
258 | 258 | * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
259 | - * @return mixed array on success, FALSE on fail |
|
259 | + * @return EE_Soft_Delete_Base_Class|null array on success, FALSE on fail |
|
260 | 260 | */ |
261 | 261 | public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
262 | 262 | return $this->get_one(array( |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |