@@ -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,11 +470,11 @@ 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 | |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * @return float |
484 | 484 | */ |
485 | 485 | public function get_ticket_subtotal() { |
486 | - return EE_Taxes::get_subtotal_for_admin( $this ); |
|
486 | + return EE_Taxes::get_subtotal_for_admin($this); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @return float |
494 | 494 | */ |
495 | 495 | public function get_ticket_taxes_total_for_admin() { |
496 | - return EE_Taxes::get_total_taxes_for_admin( $this ); |
|
496 | + return EE_Taxes::get_total_taxes_for_admin($this); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | |
@@ -503,8 +503,8 @@ discard block |
||
503 | 503 | * @param string $name |
504 | 504 | * @return boolean |
505 | 505 | */ |
506 | - function set_name( $name ) { |
|
507 | - $this->set( 'TKT_name', $name ); |
|
506 | + function set_name($name) { |
|
507 | + $this->set('TKT_name', $name); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @return string |
515 | 515 | */ |
516 | 516 | function description() { |
517 | - return $this->get( 'TKT_description' ); |
|
517 | + return $this->get('TKT_description'); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | * @param string $description |
525 | 525 | * @return boolean |
526 | 526 | */ |
527 | - function set_description( $description ) { |
|
528 | - $this->set( 'TKT_description', $description ); |
|
527 | + function set_description($description) { |
|
528 | + $this->set('TKT_description', $description); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | |
@@ -536,8 +536,8 @@ discard block |
||
536 | 536 | * @param string $tm_frmt |
537 | 537 | * @return string |
538 | 538 | */ |
539 | - function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
540 | - return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
|
539 | + function start_date($dt_frmt = '', $tm_frmt = '') { |
|
540 | + return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | * @param string $start_date |
548 | 548 | * @return void |
549 | 549 | */ |
550 | - function set_start_date( $start_date ) { |
|
551 | - $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
|
550 | + function set_start_date($start_date) { |
|
551 | + $this->_set_date_time('B', $start_date, 'TKT_start_date'); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | * @param string $tm_frmt |
560 | 560 | * @return string |
561 | 561 | */ |
562 | - function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
563 | - return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
|
562 | + function end_date($dt_frmt = '', $tm_frmt = '') { |
|
563 | + return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -570,8 +570,8 @@ discard block |
||
570 | 570 | * @param string $end_date |
571 | 571 | * @return void |
572 | 572 | */ |
573 | - function set_end_date( $end_date ) { |
|
574 | - $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
|
573 | + function set_end_date($end_date) { |
|
574 | + $this->_set_date_time('B', $end_date, 'TKT_end_date'); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
@@ -583,8 +583,8 @@ discard block |
||
583 | 583 | * |
584 | 584 | * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
585 | 585 | */ |
586 | - function set_end_time( $time ) { |
|
587 | - $this->_set_time_for( $time, 'TKT_end_date' ); |
|
586 | + function set_end_time($time) { |
|
587 | + $this->_set_time_for($time, 'TKT_end_date'); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | * @param int $min |
595 | 595 | * @return boolean |
596 | 596 | */ |
597 | - function set_min( $min ) { |
|
598 | - $this->set( 'TKT_min', $min ); |
|
597 | + function set_min($min) { |
|
598 | + $this->set('TKT_min', $min); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @return int |
606 | 606 | */ |
607 | 607 | function max() { |
608 | - return $this->get( 'TKT_max' ); |
|
608 | + return $this->get('TKT_max'); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | |
@@ -615,8 +615,8 @@ discard block |
||
615 | 615 | * @param int $max |
616 | 616 | * @return boolean |
617 | 617 | */ |
618 | - function set_max( $max ) { |
|
619 | - $this->set( 'TKT_max', $max ); |
|
618 | + function set_max($max) { |
|
619 | + $this->set('TKT_max', $max); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | |
@@ -626,8 +626,8 @@ discard block |
||
626 | 626 | * @param float $price |
627 | 627 | * @return boolean |
628 | 628 | */ |
629 | - function set_price( $price ) { |
|
630 | - $this->set( 'TKT_price', $price ); |
|
629 | + function set_price($price) { |
|
630 | + $this->set('TKT_price', $price); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | * @return int |
638 | 638 | */ |
639 | 639 | function sold() { |
640 | - return $this->get( 'TKT_sold' ); |
|
640 | + return $this->get('TKT_sold'); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | |
@@ -647,9 +647,9 @@ discard block |
||
647 | 647 | * @param int $qty |
648 | 648 | * @return boolean |
649 | 649 | */ |
650 | - function increase_sold( $qty = 1 ) { |
|
651 | - $sold = $this->get_raw( 'TKT_sold' ) + $qty; |
|
652 | - return $this->set_sold( $sold ); |
|
650 | + function increase_sold($qty = 1) { |
|
651 | + $sold = $this->get_raw('TKT_sold') + $qty; |
|
652 | + return $this->set_sold($sold); |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | |
@@ -659,8 +659,8 @@ discard block |
||
659 | 659 | * @param int $sold |
660 | 660 | * @return boolean |
661 | 661 | */ |
662 | - function set_sold( $sold ) { |
|
663 | - $this->set( 'TKT_sold', $sold ); |
|
662 | + function set_sold($sold) { |
|
663 | + $this->set('TKT_sold', $sold); |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | |
@@ -670,11 +670,11 @@ discard block |
||
670 | 670 | * @param int $qty |
671 | 671 | * @return boolean |
672 | 672 | */ |
673 | - function decrease_sold( $qty = 1 ) { |
|
674 | - $sold = $this->get_raw( 'TKT_sold' ) - $qty; |
|
673 | + function decrease_sold($qty = 1) { |
|
674 | + $sold = $this->get_raw('TKT_sold') - $qty; |
|
675 | 675 | // sold can not go below zero |
676 | - $sold = max( 0, $sold ); |
|
677 | - return $this->set_sold( $sold ); |
|
676 | + $sold = max(0, $sold); |
|
677 | + return $this->set_sold($sold); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | * @return int |
685 | 685 | */ |
686 | 686 | function qty() { |
687 | - return $this->get( 'TKT_qty' ); |
|
687 | + return $this->get('TKT_qty'); |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | |
@@ -694,8 +694,8 @@ discard block |
||
694 | 694 | * @param int $qty |
695 | 695 | * @return boolean |
696 | 696 | */ |
697 | - function set_qty( $qty ) { |
|
698 | - $this->set( 'TKT_qty', $qty ); |
|
697 | + function set_qty($qty) { |
|
698 | + $this->set('TKT_qty', $qty); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | * @return int |
706 | 706 | */ |
707 | 707 | function uses() { |
708 | - return $this->get( 'TKT_uses' ); |
|
708 | + return $this->get('TKT_uses'); |
|
709 | 709 | } |
710 | 710 | |
711 | 711 | |
@@ -715,8 +715,8 @@ discard block |
||
715 | 715 | * @param int $uses |
716 | 716 | * @return boolean |
717 | 717 | */ |
718 | - function set_uses( $uses ) { |
|
719 | - $this->set( 'TKT_uses', $uses ); |
|
718 | + function set_uses($uses) { |
|
719 | + $this->set('TKT_uses', $uses); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | * @return boolean |
727 | 727 | */ |
728 | 728 | public function required() { |
729 | - return $this->get( 'TKT_required' ); |
|
729 | + return $this->get('TKT_required'); |
|
730 | 730 | } |
731 | 731 | |
732 | 732 | |
@@ -736,8 +736,8 @@ discard block |
||
736 | 736 | * @param boolean $required |
737 | 737 | * @return boolean |
738 | 738 | */ |
739 | - public function set_required( $required ) { |
|
740 | - $this->set( 'TKT_required', $required ); |
|
739 | + public function set_required($required) { |
|
740 | + $this->set('TKT_required', $required); |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | * @return boolean |
748 | 748 | */ |
749 | 749 | function taxable() { |
750 | - return $this->get( 'TKT_taxable' ); |
|
750 | + return $this->get('TKT_taxable'); |
|
751 | 751 | } |
752 | 752 | |
753 | 753 | |
@@ -757,8 +757,8 @@ discard block |
||
757 | 757 | * @param boolean $taxable |
758 | 758 | * @return boolean |
759 | 759 | */ |
760 | - function set_taxable( $taxable ) { |
|
761 | - $this->set( 'TKT_taxable', $taxable ); |
|
760 | + function set_taxable($taxable) { |
|
761 | + $this->set('TKT_taxable', $taxable); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | * @return boolean |
769 | 769 | */ |
770 | 770 | function is_default() { |
771 | - return $this->get( 'TKT_is_default' ); |
|
771 | + return $this->get('TKT_is_default'); |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | |
@@ -778,8 +778,8 @@ discard block |
||
778 | 778 | * @param boolean $is_default |
779 | 779 | * @return boolean |
780 | 780 | */ |
781 | - function set_is_default( $is_default ) { |
|
782 | - $this->set( 'TKT_is_default', $is_default ); |
|
781 | + function set_is_default($is_default) { |
|
782 | + $this->set('TKT_is_default', $is_default); |
|
783 | 783 | } |
784 | 784 | |
785 | 785 | |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | * @return int |
790 | 790 | */ |
791 | 791 | function order() { |
792 | - return $this->get( 'TKT_order' ); |
|
792 | + return $this->get('TKT_order'); |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | |
@@ -799,8 +799,8 @@ discard block |
||
799 | 799 | * @param int $order |
800 | 800 | * @return boolean |
801 | 801 | */ |
802 | - function set_order( $order ) { |
|
803 | - $this->set( 'TKT_order', $order ); |
|
802 | + function set_order($order) { |
|
803 | + $this->set('TKT_order', $order); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | * @return int |
811 | 811 | */ |
812 | 812 | function row() { |
813 | - return $this->get( 'TKT_row' ); |
|
813 | + return $this->get('TKT_row'); |
|
814 | 814 | } |
815 | 815 | |
816 | 816 | |
@@ -820,8 +820,8 @@ discard block |
||
820 | 820 | * @param int $row |
821 | 821 | * @return boolean |
822 | 822 | */ |
823 | - function set_row( $row ) { |
|
824 | - $this->set( 'TKT_row', $row ); |
|
823 | + function set_row($row) { |
|
824 | + $this->set('TKT_row', $row); |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | * @return boolean |
832 | 832 | */ |
833 | 833 | function deleted() { |
834 | - return $this->get( 'TKT_deleted' ); |
|
834 | + return $this->get('TKT_deleted'); |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | |
@@ -841,8 +841,8 @@ discard block |
||
841 | 841 | * @param boolean $deleted |
842 | 842 | * @return boolean |
843 | 843 | */ |
844 | - function set_deleted( $deleted ) { |
|
845 | - $this->set( 'TKT_deleted', $deleted ); |
|
844 | + function set_deleted($deleted) { |
|
845 | + $this->set('TKT_deleted', $deleted); |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | * @return int |
853 | 853 | */ |
854 | 854 | function parent_ID() { |
855 | - return $this->get( 'TKT_parent' ); |
|
855 | + return $this->get('TKT_parent'); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | |
@@ -862,8 +862,8 @@ discard block |
||
862 | 862 | * @param int $parent |
863 | 863 | * @return boolean |
864 | 864 | */ |
865 | - function set_parent_ID( $parent ) { |
|
866 | - $this->set( 'TKT_parent', $parent ); |
|
865 | + function set_parent_ID($parent) { |
|
866 | + $this->set('TKT_parent', $parent); |
|
867 | 867 | } |
868 | 868 | |
869 | 869 | |
@@ -874,10 +874,10 @@ discard block |
||
874 | 874 | */ |
875 | 875 | function name_and_info() { |
876 | 876 | $times = array(); |
877 | - foreach ( $this->datetimes() as $datetime ) { |
|
877 | + foreach ($this->datetimes() as $datetime) { |
|
878 | 878 | $times[] = $datetime->start_date_and_time(); |
879 | 879 | } |
880 | - return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price(); |
|
880 | + return $this->name()." @ ".implode(", ", $times)." for ".$this->price(); |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | * @return string |
888 | 888 | */ |
889 | 889 | function name() { |
890 | - return $this->get( 'TKT_name' ); |
|
890 | + return $this->get('TKT_name'); |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | * @return float |
898 | 898 | */ |
899 | 899 | function price() { |
900 | - return $this->get( 'TKT_price' ); |
|
900 | + return $this->get('TKT_price'); |
|
901 | 901 | } |
902 | 902 | |
903 | 903 | |
@@ -907,8 +907,8 @@ discard block |
||
907 | 907 | * @param array $query_params like EEM_Base::get_all's |
908 | 908 | * @return EE_Registration[] |
909 | 909 | */ |
910 | - public function registrations( $query_params = array() ) { |
|
911 | - return $this->get_many_related( 'Registration', $query_params ); |
|
910 | + public function registrations($query_params = array()) { |
|
911 | + return $this->get_many_related('Registration', $query_params); |
|
912 | 912 | } |
913 | 913 | |
914 | 914 | |
@@ -919,8 +919,8 @@ discard block |
||
919 | 919 | * @return int |
920 | 920 | */ |
921 | 921 | public function update_tickets_sold() { |
922 | - $count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) ); |
|
923 | - $this->set_sold( $count_regs_for_this_ticket ); |
|
922 | + $count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0))); |
|
923 | + $this->set_sold($count_regs_for_this_ticket); |
|
924 | 924 | $this->save(); |
925 | 925 | return $count_regs_for_this_ticket; |
926 | 926 | } |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | * @param array $query_params like EEM_Base::get_all's |
933 | 933 | * @return int |
934 | 934 | */ |
935 | - public function count_registrations( $query_params = array() ) { |
|
935 | + public function count_registrations($query_params = array()) { |
|
936 | 936 | return $this->count_related('Registration', $query_params); |
937 | 937 | } |
938 | 938 | } //end EE_Ticket class |
@@ -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 |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | /** |
52 | - * @param $table_column |
|
52 | + * @param string $table_column |
|
53 | 53 | * @param $nice_name |
54 | - * @param $nullable |
|
54 | + * @param boolean $nullable |
|
55 | 55 | * @param null $default_value |
56 | - * @param null $timezone |
|
56 | + * @param string|null $timezone |
|
57 | 57 | * @param null $date_format |
58 | 58 | * @param null $time_format |
59 | 59 | * @param null $pretty_date_format |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | |
88 | 88 | /** |
89 | - * @return DateTimeZone|null |
|
89 | + * @return DateTimeZone |
|
90 | 90 | */ |
91 | 91 | public static function get_UTC_DateTimeZone() { |
92 | 92 | return EE_Datetime_Field::$_UTC_DateTimeZone instanceof DateTimeZone ? EE_Datetime_Field::$_UTC_DateTimeZone : new DateTimeZone( 'UTC' ); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | /** |
98 | 98 | * this prepares any incoming date data and make sure its converted to a utc unix timestamp |
99 | - * @param string|int $value_inputted_for_field_on_model_object could be a string formatted date time or int unix timestamp |
|
99 | + * @param string $value_inputted_for_field_on_model_object could be a string formatted date time or int unix timestamp |
|
100 | 100 | * @return int unix timestamp (utc) |
101 | 101 | */ |
102 | 102 | public function prepare_for_set($value_inputted_for_field_on_model_object) { |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @param mixed $datetime_value |
309 | 309 | * @param string $schema if set to "no_html", even if the timezone is shown, there will be no tags next to it. |
310 | 310 | * @internal param mixed $value_on_field_to_be_outputted |
311 | - * @return mixed |
|
311 | + * @return string |
|
312 | 312 | */ |
313 | 313 | public function prepare_for_pretty_echoing( $datetime_value, $schema = null ) { |
314 | 314 | if( $this->_display_timezone() ) { |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | |
430 | 430 | /** |
431 | 431 | * @param $datetime |
432 | - * @return bool|int|string |
|
432 | + * @return integer |
|
433 | 433 | * @throws EE_Error |
434 | 434 | */ |
435 | 435 | private function _convert_from_numeric_value_to_utc_unix_timestamp( $datetime ) { |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | |
454 | 454 | |
455 | 455 | /** |
456 | - * @param $datetime |
|
456 | + * @param string $datetime |
|
457 | 457 | * @return string |
458 | 458 | * @throws EE_Error |
459 | 459 | */ |
@@ -550,7 +550,7 @@ |
||
550 | 550 | } |
551 | 551 | } |
552 | 552 | } |
553 | - return FALSE; |
|
553 | + return FALSE; |
|
554 | 554 | } |
555 | 555 | |
556 | 556 |
@@ -59,19 +59,19 @@ discard block |
||
59 | 59 | * @param null $pretty_date_format |
60 | 60 | * @param null $pretty_time_format |
61 | 61 | */ |
62 | - public function __construct( $table_column, $nice_name, $nullable, $default_value, $timezone = NULL, $date_format = NULL, $time_format = NULL, $pretty_date_format = NULL, $pretty_time_format = NULL ){ |
|
62 | + public function __construct($table_column, $nice_name, $nullable, $default_value, $timezone = NULL, $date_format = NULL, $time_format = NULL, $pretty_date_format = NULL, $pretty_time_format = NULL) { |
|
63 | 63 | |
64 | 64 | parent::__construct($table_column, $nice_name, $nullable, $default_value); |
65 | 65 | $this->_date_format = empty($date_format) ? get_option('date_format') : $date_format; |
66 | - $this->_date_format = EE_Base_Class::fix_date_format_for_use_with_strtotime( $this->_date_format ); |
|
66 | + $this->_date_format = EE_Base_Class::fix_date_format_for_use_with_strtotime($this->_date_format); |
|
67 | 67 | $this->_time_format = empty($time_format) ? get_option('time_format') : $time_format; |
68 | 68 | |
69 | - $this->set_timezone( $timezone ); |
|
69 | + $this->set_timezone($timezone); |
|
70 | 70 | |
71 | 71 | |
72 | 72 | $this->_pretty_date_format = empty($pretty_date_format) ? get_option('date_format') : $pretty_date_format; |
73 | - $this->_pretty_date_format = EE_Base_Class::fix_date_format_for_use_with_strtotime( $this->_pretty_date_format ); |
|
74 | - $this->_pretty_time_format = empty( $pretty_time_format ) ? get_option('time_format') : $pretty_time_format; |
|
73 | + $this->_pretty_date_format = EE_Base_Class::fix_date_format_for_use_with_strtotime($this->_pretty_date_format); |
|
74 | + $this->_pretty_time_format = empty($pretty_time_format) ? get_option('time_format') : $pretty_time_format; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return DateTimeZone|null |
90 | 90 | */ |
91 | 91 | public static function get_UTC_DateTimeZone() { |
92 | - return EE_Datetime_Field::$_UTC_DateTimeZone instanceof DateTimeZone ? EE_Datetime_Field::$_UTC_DateTimeZone : new DateTimeZone( 'UTC' ); |
|
92 | + return EE_Datetime_Field::$_UTC_DateTimeZone instanceof DateTimeZone ? EE_Datetime_Field::$_UTC_DateTimeZone : new DateTimeZone('UTC'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @return int unix timestamp (utc) |
101 | 101 | */ |
102 | 102 | public function prepare_for_set($value_inputted_for_field_on_model_object) { |
103 | - return $this->_convert_to_utc_unix_timestamp( $value_inputted_for_field_on_model_object); |
|
103 | + return $this->_convert_to_utc_unix_timestamp($value_inputted_for_field_on_model_object); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | * @param bool $pretty If we're returning the pretty formats or standard format string. |
117 | 117 | * @return string The final assembled format string. |
118 | 118 | */ |
119 | - private function _get_date_time_output( $pretty = FALSE ) { |
|
119 | + private function _get_date_time_output($pretty = FALSE) { |
|
120 | 120 | |
121 | - switch ( $this->_date_time_output ) { |
|
121 | + switch ($this->_date_time_output) { |
|
122 | 122 | case 'time' : |
123 | 123 | return $pretty ? $this->_pretty_time_format : $this->_time_format; |
124 | 124 | break; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | break; |
129 | 129 | |
130 | 130 | default : |
131 | - return $pretty ? $this->_pretty_date_format . ' ' . $this->_pretty_time_format : $this->_date_format . ' ' . $this->_time_format; |
|
131 | + return $pretty ? $this->_pretty_date_format.' '.$this->_pretty_time_format : $this->_date_format.' '.$this->_time_format; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param string $what acceptable values are 'time' or 'date'. Any other value will be set but will always result in both 'date' and 'time' being returned. |
143 | 143 | * @return void |
144 | 144 | */ |
145 | - public function set_date_time_output( $what = NULL ) { |
|
145 | + public function set_date_time_output($what = NULL) { |
|
146 | 146 | $this->_date_time_output = $what; |
147 | 147 | } |
148 | 148 | |
@@ -158,23 +158,23 @@ discard block |
||
158 | 158 | * @param string $timezone A valid timezone string as described by @link http://www.php.net/manual/en/timezones.php |
159 | 159 | * @return void |
160 | 160 | */ |
161 | - public function set_timezone( $timezone ) { |
|
162 | - if( $timezone === NULL && $this->_timezone != NULL){ |
|
161 | + public function set_timezone($timezone) { |
|
162 | + if ($timezone === NULL && $this->_timezone != NULL) { |
|
163 | 163 | //leave the timezone AS-IS if we already have one and |
164 | 164 | //the function arg didn't provide one |
165 | 165 | return; |
166 | 166 | } |
167 | - $this->_timezone = empty( $timezone ) ? get_option('timezone_string') : $timezone; |
|
167 | + $this->_timezone = empty($timezone) ? get_option('timezone_string') : $timezone; |
|
168 | 168 | |
169 | 169 | //if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter |
170 | - if ( empty( $this->_timezone ) ) { |
|
170 | + if (empty($this->_timezone)) { |
|
171 | 171 | //let's get a the WordPress UTC offset |
172 | 172 | $offset = get_option('gmt_offset'); |
173 | 173 | $this->_blog_offset = $offset; |
174 | - $this->_timezone = self::timezone_convert_to_string_from_offset( $offset ); |
|
174 | + $this->_timezone = self::timezone_convert_to_string_from_offset($offset); |
|
175 | 175 | } |
176 | 176 | |
177 | - self::validate_timezone( $this->_timezone ); //just running validation on the timezone. |
|
177 | + self::validate_timezone($this->_timezone); //just running validation on the timezone. |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param string $format a new date format (corresponding to formats accepted by PHP date() function) |
199 | 199 | * @return void |
200 | 200 | */ |
201 | - public function set_date_format( $format ) { |
|
201 | + public function set_date_format($format) { |
|
202 | 202 | $this->_date_format = $format; |
203 | 203 | } |
204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @param string $format a new time format (corresponding to formats accepted by PHP date() function) |
213 | 213 | * @return void |
214 | 214 | */ |
215 | - public function set_time_format( $format ) { |
|
215 | + public function set_time_format($format) { |
|
216 | 216 | $this->_time_format = $format; |
217 | 217 | } |
218 | 218 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @param string $format a new pretty date format (corresponding to formats accepted by PHP date() function) |
228 | 228 | * @return void |
229 | 229 | */ |
230 | - public function set_pretty_date_format( $format ) { |
|
230 | + public function set_pretty_date_format($format) { |
|
231 | 231 | $this->_pretty_date_format = $format; |
232 | 232 | } |
233 | 233 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param string $format a new pretty time format (corresponding to formats accepted by PHP date() function) |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - public function set_pretty_time_format( $format ) { |
|
247 | + public function set_pretty_time_format($format) { |
|
248 | 248 | $this->_pretty_time_format = $format; |
249 | 249 | } |
250 | 250 | |
@@ -257,12 +257,12 @@ discard block |
||
257 | 257 | * @throws EE_Error |
258 | 258 | * @return int updated timestamp |
259 | 259 | */ |
260 | - public function prepare_for_set_with_new_time($time_to_set_string, $current_datetime_value ){ |
|
261 | - $this->_set_date_obj( date( $this->_date_format . ' ' . $this->_time_format, $current_datetime_value), 'UTC' ); |
|
262 | - if ( ! $this->_date instanceof DateTime && ! $this->_nullable ) { |
|
263 | - throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) ); |
|
260 | + public function prepare_for_set_with_new_time($time_to_set_string, $current_datetime_value) { |
|
261 | + $this->_set_date_obj(date($this->_date_format.' '.$this->_time_format, $current_datetime_value), 'UTC'); |
|
262 | + if ( ! $this->_date instanceof DateTime && ! $this->_nullable) { |
|
263 | + throw new EE_Error(__('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso')); |
|
264 | 264 | } |
265 | - return $this->_prepare_for_set_new( $time_to_set_string, TRUE ); |
|
265 | + return $this->_prepare_for_set_new($time_to_set_string, TRUE); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | * @throws EE_Error |
275 | 275 | * @return int updated timestamp |
276 | 276 | */ |
277 | - public function prepare_for_set_with_new_date($date_to_set_string, $current_datetime_value ){ |
|
278 | - $this->_set_date_obj( date( $this->_date_format . ' ' . $this->_time_format, $current_datetime_value ), 'UTC' ); |
|
279 | - if ( ! $this->_date instanceof DateTime && ! $this->_nullable ) { |
|
280 | - throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) ); |
|
277 | + public function prepare_for_set_with_new_date($date_to_set_string, $current_datetime_value) { |
|
278 | + $this->_set_date_obj(date($this->_date_format.' '.$this->_time_format, $current_datetime_value), 'UTC'); |
|
279 | + if ( ! $this->_date instanceof DateTime && ! $this->_nullable) { |
|
280 | + throw new EE_Error(__('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso')); |
|
281 | 281 | } |
282 | - return $this->_prepare_for_set_new( $date_to_set_string ); |
|
282 | + return $this->_prepare_for_set_new($date_to_set_string); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -292,11 +292,11 @@ discard block |
||
292 | 292 | * @param int $datetime_value This will always be a unix timestamp in UTC because that's what the internal data type of the date time property is. |
293 | 293 | * @return string formatted date time for given timezone |
294 | 294 | */ |
295 | - public function prepare_for_get( $datetime_value ) { |
|
295 | + public function prepare_for_get($datetime_value) { |
|
296 | 296 | |
297 | 297 | $format_string = $this->_get_date_time_output(); |
298 | 298 | //send this to our formatter to return localized time for the timezone |
299 | - return $this->_convert_to_timezone_from_utc_unix_timestamp( $datetime_value, $format_string ); |
|
299 | + return $this->_convert_to_timezone_from_utc_unix_timestamp($datetime_value, $format_string); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | |
@@ -310,19 +310,19 @@ discard block |
||
310 | 310 | * @internal param mixed $value_on_field_to_be_outputted |
311 | 311 | * @return mixed |
312 | 312 | */ |
313 | - public function prepare_for_pretty_echoing( $datetime_value, $schema = null ) { |
|
314 | - if( $this->_display_timezone() ) { |
|
315 | - if( $schema == 'no_html' ){ |
|
316 | - $timezone_string = '(' . self::get_timezone_abbrev( $this->_timezone ) . ')'; |
|
317 | - }else{ |
|
318 | - $timezone_string = '<span class="ee_dtt_timezone_string">(' . self::get_timezone_abbrev($this->_timezone) . ')</span>'; |
|
313 | + public function prepare_for_pretty_echoing($datetime_value, $schema = null) { |
|
314 | + if ($this->_display_timezone()) { |
|
315 | + if ($schema == 'no_html') { |
|
316 | + $timezone_string = '('.self::get_timezone_abbrev($this->_timezone).')'; |
|
317 | + } else { |
|
318 | + $timezone_string = '<span class="ee_dtt_timezone_string">('.self::get_timezone_abbrev($this->_timezone).')</span>'; |
|
319 | 319 | } |
320 | 320 | } else { |
321 | 321 | $timezone_string = ''; |
322 | 322 | } |
323 | 323 | |
324 | - $format_string = $this->_get_date_time_output( TRUE ); |
|
325 | - return $this->_convert_to_timezone_from_utc_unix_timestamp( $datetime_value, $format_string ) . $timezone_string; |
|
324 | + $format_string = $this->_get_date_time_output(TRUE); |
|
325 | + return $this->_convert_to_timezone_from_utc_unix_timestamp($datetime_value, $format_string).$timezone_string; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | * @param int $datetime_value unix timestamp in UTC |
334 | 334 | * @return string mysql timestamp in UTC |
335 | 335 | */ |
336 | - public function prepare_for_use_in_db( $datetime_value ) { |
|
337 | - return $this->_nullable && empty( $datetime_value) ? NULL : date( "Y-m-d H:i:s", $datetime_value ); |
|
336 | + public function prepare_for_use_in_db($datetime_value) { |
|
337 | + return $this->_nullable && empty($datetime_value) ? NULL : date("Y-m-d H:i:s", $datetime_value); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | * @param string $datetime_value mysql timestamp in UTC |
347 | 347 | * @return int UnixTime in UTC |
348 | 348 | */ |
349 | - public function prepare_for_set_from_db( $datetime_value ) { |
|
350 | - return $this->_nullable && empty( $datetime_value ) ? NULL : strtotime( $datetime_value ); |
|
349 | + public function prepare_for_set_from_db($datetime_value) { |
|
350 | + return $this->_nullable && empty($datetime_value) ? NULL : strtotime($datetime_value); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -359,17 +359,17 @@ discard block |
||
359 | 359 | * @throws EE_Error |
360 | 360 | * @return string final converted date-time-zone. |
361 | 361 | */ |
362 | - private function _convert_to_timezone_from_utc_unix_timestamp( $datetime_value, $format ) { |
|
363 | - if ( $this->_nullable && empty( $datetime_value )) { |
|
362 | + private function _convert_to_timezone_from_utc_unix_timestamp($datetime_value, $format) { |
|
363 | + if ($this->_nullable && empty($datetime_value)) { |
|
364 | 364 | return NULL; |
365 | 365 | } |
366 | - $datetime = date( 'Y-m-d H:i:s', (int)$datetime_value ); |
|
367 | - $this->_set_date_obj( $datetime, 'UTC' ); |
|
368 | - if ( ! $this->_date instanceof DateTime ) { |
|
369 | - throw new EE_Error( sprintf( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used on %s', 'event_espresso' ) , $this->get_model_name() ) ); |
|
366 | + $datetime = date('Y-m-d H:i:s', (int) $datetime_value); |
|
367 | + $this->_set_date_obj($datetime, 'UTC'); |
|
368 | + if ( ! $this->_date instanceof DateTime) { |
|
369 | + throw new EE_Error(sprintf(__('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used on %s', 'event_espresso'), $this->get_model_name())); |
|
370 | 370 | } |
371 | - $this->_date->setTimezone( new DateTimeZone( $this->_timezone ) ); |
|
372 | - return $this->_date->format( $format ); |
|
371 | + $this->_date->setTimezone(new DateTimeZone($this->_timezone)); |
|
372 | + return $this->_date->format($format); |
|
373 | 373 | |
374 | 374 | } |
375 | 375 | |
@@ -388,22 +388,22 @@ discard block |
||
388 | 388 | * @param boolean $is_time If this is a time adjustment set this boolean flag to true, otherwise it is a date adjustment |
389 | 389 | * @return int UTC UnixTimestamp |
390 | 390 | */ |
391 | - private function _prepare_for_set_new( $datetime_adjustment, $is_time = FALSE ) { |
|
392 | - if ( $this->_nullable && empty( $datetime_adjustment ) ) { |
|
391 | + private function _prepare_for_set_new($datetime_adjustment, $is_time = FALSE) { |
|
392 | + if ($this->_nullable && empty($datetime_adjustment)) { |
|
393 | 393 | return NULL; |
394 | 394 | } |
395 | 395 | //first let's parse the incoming string |
396 | - $parsed = date_parse( $datetime_adjustment ); |
|
396 | + $parsed = date_parse($datetime_adjustment); |
|
397 | 397 | //set the timezone to the incoming timezone for the current date_object |
398 | - $this->_date->setTimezone( new DateTimeZone( $this->_timezone ) ); |
|
398 | + $this->_date->setTimezone(new DateTimeZone($this->_timezone)); |
|
399 | 399 | //let's adjust the time or date depending on our $is_time boolean |
400 | - if ( $is_time ) { |
|
401 | - $this->_date->setTime( $parsed['hour'], $parsed['minute'] ); |
|
400 | + if ($is_time) { |
|
401 | + $this->_date->setTime($parsed['hour'], $parsed['minute']); |
|
402 | 402 | } else { |
403 | - $this->_date->setDate( $parsed['year'], $parsed['month'], $parsed['day'] ); |
|
403 | + $this->_date->setDate($parsed['year'], $parsed['month'], $parsed['day']); |
|
404 | 404 | } |
405 | 405 | //return to UTC time |
406 | - $this->_date->setTimezone( EE_Datetime_Field::get_UTC_DateTimeZone() ); |
|
406 | + $this->_date->setTimezone(EE_Datetime_Field::get_UTC_DateTimeZone()); |
|
407 | 407 | //return unix timestamp |
408 | 408 | return $this->_date->format('U'); |
409 | 409 | } |
@@ -418,10 +418,10 @@ discard block |
||
418 | 418 | * @param string|int $datetime This can be either an integer timestamp (in which case this method will convert from int to string first to make sure we get the right timezone setup ) |
419 | 419 | * @return string unix timestamp for utc |
420 | 420 | */ |
421 | - private function _convert_to_utc_unix_timestamp( $datetime ) { |
|
422 | - if ( $this->_nullable && empty( $datetime ) ) |
|
421 | + private function _convert_to_utc_unix_timestamp($datetime) { |
|
422 | + if ($this->_nullable && empty($datetime)) |
|
423 | 423 | return NULL; |
424 | - $timestamp = is_numeric( $datetime ) ? $this->_convert_from_numeric_value_to_utc_unix_timestamp( $datetime ) : $this->_convert_from_string_value_to_utc_unix_timestamp( $datetime ); |
|
424 | + $timestamp = is_numeric($datetime) ? $this->_convert_from_numeric_value_to_utc_unix_timestamp($datetime) : $this->_convert_from_string_value_to_utc_unix_timestamp($datetime); |
|
425 | 425 | return $timestamp; |
426 | 426 | } |
427 | 427 | |
@@ -432,15 +432,15 @@ discard block |
||
432 | 432 | * @return bool|int|string |
433 | 433 | * @throws EE_Error |
434 | 434 | */ |
435 | - private function _convert_from_numeric_value_to_utc_unix_timestamp( $datetime ) { |
|
436 | - $datetime = date( 'Y-m-d H:i:s', (int) $datetime); |
|
435 | + private function _convert_from_numeric_value_to_utc_unix_timestamp($datetime) { |
|
436 | + $datetime = date('Y-m-d H:i:s', (int) $datetime); |
|
437 | 437 | |
438 | - date_default_timezone_set( $this->_timezone ); |
|
438 | + date_default_timezone_set($this->_timezone); |
|
439 | 439 | $timestamp = strtotime($datetime); |
440 | 440 | |
441 | 441 | //if we don't have a datetime at this point then something has gone wrong |
442 | - if ( $timestamp === NULL || $timestamp === FALSE) { |
|
443 | - throw new EE_Error( sprintf( __('Something went wrong with setting the date/time. Likely, either there is an invalid timezone string or invalid timestamp being used. Datetime passed in: %s producted timestamp: %s', 'event_espresso' ), $datetime, $timestamp ) ); |
|
442 | + if ($timestamp === NULL || $timestamp === FALSE) { |
|
443 | + throw new EE_Error(sprintf(__('Something went wrong with setting the date/time. Likely, either there is an invalid timezone string or invalid timestamp being used. Datetime passed in: %s producted timestamp: %s', 'event_espresso'), $datetime, $timestamp)); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | //return to default for PHP |
@@ -457,15 +457,15 @@ discard block |
||
457 | 457 | * @return string |
458 | 458 | * @throws EE_Error |
459 | 459 | */ |
460 | - private function _convert_from_string_value_to_utc_unix_timestamp( $datetime ) { |
|
460 | + private function _convert_from_string_value_to_utc_unix_timestamp($datetime) { |
|
461 | 461 | //create a new datetime object using the given string and timezone |
462 | - $this->_set_date_obj( $datetime, $this->_timezone ); |
|
462 | + $this->_set_date_obj($datetime, $this->_timezone); |
|
463 | 463 | |
464 | - if ( ! $this->_date instanceof DateTime && ! $this->_nullable ) { |
|
465 | - throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) ); |
|
464 | + if ( ! $this->_date instanceof DateTime && ! $this->_nullable) { |
|
465 | + throw new EE_Error(__('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso')); |
|
466 | 466 | } |
467 | 467 | |
468 | - $this->_date->setTimezone( EE_Datetime_Field::get_UTC_DateTimeZone() ); |
|
468 | + $this->_date->setTimezone(EE_Datetime_Field::get_UTC_DateTimeZone()); |
|
469 | 469 | return $this->_date->format('U'); |
470 | 470 | |
471 | 471 | } |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | * @throws EE_Error |
482 | 482 | * @return boolean Return True if Valid, False if Invalid |
483 | 483 | */ |
484 | - public static function validate_timezone( $timezone_string ) { |
|
484 | + public static function validate_timezone($timezone_string) { |
|
485 | 485 | // easiest way to test a timezone string is just see if it throws an error when you try to create a DateTimeZone object with it |
486 | 486 | try { |
487 | - new DateTimeZone( $timezone_string ); |
|
488 | - } catch ( Exception $e ) { |
|
489 | - throw new EE_Error( sprintf( |
|
490 | - __( 'The timezone given (%s), is invalid, please check with %sthis list%s for what valid timezones can be used', 'event_espresso' ), |
|
487 | + new DateTimeZone($timezone_string); |
|
488 | + } catch (Exception $e) { |
|
489 | + throw new EE_Error(sprintf( |
|
490 | + __('The timezone given (%s), is invalid, please check with %sthis list%s for what valid timezones can be used', 'event_espresso'), |
|
491 | 491 | $timezone_string, |
492 | 492 | '<a href="http://www.php.net/manual/en/timezones.php">', |
493 | 493 | '</a>' |
@@ -506,13 +506,13 @@ discard block |
||
506 | 506 | * @param string $offset GMT offset |
507 | 507 | * @return string timezone_string (valid for DateTimeZone) |
508 | 508 | */ |
509 | - public static function timezone_convert_to_string_from_offset( $offset ) { |
|
509 | + public static function timezone_convert_to_string_from_offset($offset) { |
|
510 | 510 | $offset *= 3600; // convert hour offset to seconds |
511 | 511 | //make sure $offset is int (cause if incoming was int then converted to float); |
512 | 512 | $offset = (int) $offset; |
513 | 513 | |
514 | 514 | //account for WP offsets that aren't valid UTC |
515 | - switch ( $offset ) { |
|
515 | + switch ($offset) { |
|
516 | 516 | case -1800 : |
517 | 517 | $offset = -3600; |
518 | 518 | break; |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | } |
544 | 544 | |
545 | 545 | $abbreviations = timezone_abbreviations_list(); |
546 | - foreach ( $abbreviations as $abbreviation ) { |
|
547 | - foreach ( $abbreviation as $city ) { |
|
548 | - if ( $city['offset'] === $offset && $city['dst'] === FALSE ) { |
|
546 | + foreach ($abbreviations as $abbreviation) { |
|
547 | + foreach ($abbreviation as $city) { |
|
548 | + if ($city['offset'] === $offset && $city['dst'] === FALSE) { |
|
549 | 549 | return $city['timezone_id']; |
550 | 550 | } |
551 | 551 | } |
@@ -561,18 +561,18 @@ discard block |
||
561 | 561 | * @param string $tz valid timezone string |
562 | 562 | * @return int if conversion can happen then we return the offset, if not then we return FALSE (or EE_Error) |
563 | 563 | */ |
564 | - public static function timezone_convert_to_offset_from_string( $tz ) { |
|
564 | + public static function timezone_convert_to_offset_from_string($tz) { |
|
565 | 565 | $abbreviations = timezone_abbreviations_list(); |
566 | 566 | $offset = NULL; |
567 | - foreach ( $abbreviations as $abbreviation ) { |
|
568 | - foreach ( $abbreviation as $city ) { |
|
569 | - if ( $city['timezone_id'] == $tz ) { |
|
567 | + foreach ($abbreviations as $abbreviation) { |
|
568 | + foreach ($abbreviation as $city) { |
|
569 | + if ($city['timezone_id'] == $tz) { |
|
570 | 570 | $offset = $city['offset']; |
571 | 571 | } |
572 | 572 | } |
573 | 573 | } |
574 | 574 | //$offset will be in seconds so let's convert to hours and make sure its an int |
575 | - return ! empty( $offset) ? (int)( $offset / 3600 ) : 0; |
|
575 | + return ! empty($offset) ? (int) ($offset / 3600) : 0; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | |
@@ -588,15 +588,15 @@ discard block |
||
588 | 588 | |
589 | 589 | //first let's do a comparison of timezone strings. If they match then we can get out without any further calculations |
590 | 590 | $blog_string = get_option('timezone_string'); |
591 | - if ( $blog_string == $this->_timezone ) |
|
591 | + if ($blog_string == $this->_timezone) |
|
592 | 592 | return FALSE; |
593 | 593 | |
594 | 594 | //now we need to calc the offset for the timezone string so we can compare with the blog offset. |
595 | - $this_offset = self::timezone_convert_to_offset_from_string( $this->_timezone ); |
|
596 | - $blog_offset = !empty( $this->_blog_offset ) ? $this->_blog_offset : self::timezone_convert_to_offset_from_string( $blog_string ); |
|
595 | + $this_offset = self::timezone_convert_to_offset_from_string($this->_timezone); |
|
596 | + $blog_offset = ! empty($this->_blog_offset) ? $this->_blog_offset : self::timezone_convert_to_offset_from_string($blog_string); |
|
597 | 597 | |
598 | 598 | //now compare |
599 | - if ( $blog_offset === $this_offset ) |
|
599 | + if ($blog_offset === $this_offset) |
|
600 | 600 | return FALSE; |
601 | 601 | |
602 | 602 | return TRUE; |
@@ -612,32 +612,32 @@ discard block |
||
612 | 612 | * @throws Exception |
613 | 613 | * @return void |
614 | 614 | */ |
615 | - private function _set_date_obj( $date_string, $timezone ) { |
|
616 | - if ( $this->_nullable && empty( $date_string ) ) { |
|
615 | + private function _set_date_obj($date_string, $timezone) { |
|
616 | + if ($this->_nullable && empty($date_string)) { |
|
617 | 617 | $this->_date = NULL; |
618 | 618 | return; |
619 | 619 | } |
620 | 620 | try { |
621 | 621 | //start off assuming it's a wonky excel format |
622 | - if ( version_compare( PHP_VERSION, '5.3.0' ) >= 0 ) { |
|
622 | + if (version_compare(PHP_VERSION, '5.3.0') >= 0) { |
|
623 | 623 | // maybe it's the Microsoft excel format '16/08/2013 8:58' ? |
624 | - $this->_date = DateTime::createFromFormat( 'd/m/Y H:i', $date_string, new DateTimeZone( $timezone )); |
|
624 | + $this->_date = DateTime::createFromFormat('d/m/Y H:i', $date_string, new DateTimeZone($timezone)); |
|
625 | 625 | } else { |
626 | 626 | //change 'd/m/Y H:i' to 'd-m-Y H:i' because of how strtotime() interprets date formats. see: http://www.php.net/manual/en/datetime.formats.date.php |
627 | - $this->_date = new DateTime( date( 'd-m-Y H:i', strtotime( $date_string )), new DateTimeZone( $timezone )); |
|
627 | + $this->_date = new DateTime(date('d-m-Y H:i', strtotime($date_string)), new DateTimeZone($timezone)); |
|
628 | 628 | } |
629 | - } catch( Exception $e ) {} |
|
629 | + } catch (Exception $e) {} |
|
630 | 630 | |
631 | - if( ! $this->_date ){ |
|
631 | + if ( ! $this->_date) { |
|
632 | 632 | try { |
633 | - $this->_date = new DateTime( $date_string, new DateTimeZone( $timezone )); |
|
634 | - } catch( Exception $e ) { |
|
633 | + $this->_date = new DateTime($date_string, new DateTimeZone($timezone)); |
|
634 | + } catch (Exception $e) { |
|
635 | 635 | // because DateTime chokes on some formats, check if strtotime fails, and throw error regarding bad format |
636 | - if ( strtotime( $date_string ) == 0 ) { |
|
637 | - throw new Exception( sprintf( __('The following date time \'%s\' can not be parsed by PHP due to its formatting.%sYou may need to choose a more standard date time format. Please check your WordPress Settings.', 'event_espresso' ), $date_string, '<br />' )); |
|
636 | + if (strtotime($date_string) == 0) { |
|
637 | + throw new Exception(sprintf(__('The following date time \'%s\' can not be parsed by PHP due to its formatting.%sYou may need to choose a more standard date time format. Please check your WordPress Settings.', 'event_espresso'), $date_string, '<br />')); |
|
638 | 638 | } else { |
639 | 639 | //ok give up, but don't throw an error |
640 | - $this->_date = new DateTime( NULL, new DateTimeZone( $timezone )); |
|
640 | + $this->_date = new DateTime(NULL, new DateTimeZone($timezone)); |
|
641 | 641 | } |
642 | 642 | } |
643 | 643 | } |
@@ -651,9 +651,9 @@ discard block |
||
651 | 651 | * @param string $timezone Valid timezone String |
652 | 652 | * @return string abbreviation |
653 | 653 | */ |
654 | - public static function get_timezone_abbrev( $timezone ) { |
|
654 | + public static function get_timezone_abbrev($timezone) { |
|
655 | 655 | $dateTime = new DateTime(); |
656 | - $dateTime->setTimeZone( new DateTimeZone($timezone) ); |
|
656 | + $dateTime->setTimeZone(new DateTimeZone($timezone)); |
|
657 | 657 | return $dateTime->format('T'); |
658 | 658 | } |
659 | 659 |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | if( $this->_display_timezone() ) { |
315 | 315 | if( $schema == 'no_html' ){ |
316 | 316 | $timezone_string = '(' . self::get_timezone_abbrev( $this->_timezone ) . ')'; |
317 | - }else{ |
|
317 | + } else{ |
|
318 | 318 | $timezone_string = '<span class="ee_dtt_timezone_string">(' . self::get_timezone_abbrev($this->_timezone) . ')</span>'; |
319 | 319 | } |
320 | 320 | } else { |
@@ -419,8 +419,9 @@ discard block |
||
419 | 419 | * @return string unix timestamp for utc |
420 | 420 | */ |
421 | 421 | private function _convert_to_utc_unix_timestamp( $datetime ) { |
422 | - if ( $this->_nullable && empty( $datetime ) ) |
|
423 | - return NULL; |
|
422 | + if ( $this->_nullable && empty( $datetime ) ) { |
|
423 | + return NULL; |
|
424 | + } |
|
424 | 425 | $timestamp = is_numeric( $datetime ) ? $this->_convert_from_numeric_value_to_utc_unix_timestamp( $datetime ) : $this->_convert_from_string_value_to_utc_unix_timestamp( $datetime ); |
425 | 426 | return $timestamp; |
426 | 427 | } |
@@ -588,16 +589,18 @@ discard block |
||
588 | 589 | |
589 | 590 | //first let's do a comparison of timezone strings. If they match then we can get out without any further calculations |
590 | 591 | $blog_string = get_option('timezone_string'); |
591 | - if ( $blog_string == $this->_timezone ) |
|
592 | - return FALSE; |
|
592 | + if ( $blog_string == $this->_timezone ) { |
|
593 | + return FALSE; |
|
594 | + } |
|
593 | 595 | |
594 | 596 | //now we need to calc the offset for the timezone string so we can compare with the blog offset. |
595 | 597 | $this_offset = self::timezone_convert_to_offset_from_string( $this->_timezone ); |
596 | 598 | $blog_offset = !empty( $this->_blog_offset ) ? $this->_blog_offset : self::timezone_convert_to_offset_from_string( $blog_string ); |
597 | 599 | |
598 | 600 | //now compare |
599 | - if ( $blog_offset === $this_offset ) |
|
600 | - return FALSE; |
|
601 | + if ( $blog_offset === $this_offset ) { |
|
602 | + return FALSE; |
|
603 | + } |
|
601 | 604 | |
602 | 605 | return TRUE; |
603 | 606 |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @access public |
118 | 118 | * @param int $EVT_ID |
119 | - * @return string |
|
119 | + * @return boolean |
|
120 | 120 | */ |
121 | 121 | public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
122 | 122 | $event = EEH_Event_View::get_event( $EVT_ID ); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * event_active_status |
137 | 137 | * |
138 | 138 | * @access public |
139 | - * @param null $num_words |
|
139 | + * @param integer $num_words |
|
140 | 140 | * @param null $more |
141 | 141 | * @return string |
142 | 142 | */ |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * |
319 | 319 | * @access public |
320 | 320 | * @param int $EVT_ID |
321 | - * @return string |
|
321 | + * @return string|null |
|
322 | 322 | */ |
323 | 323 | public static function get_primary_date_obj( $EVT_ID = 0 ) { |
324 | 324 | $event = EEH_Event_View::get_event( $EVT_ID ); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @access public |
345 | 345 | * @param int $EVT_ID |
346 | - * @return string |
|
346 | + * @return boolean|string |
|
347 | 347 | */ |
348 | 348 | public static function get_last_date_obj( $EVT_ID = 0 ) { |
349 | 349 | $event = EEH_Event_View::get_event( $EVT_ID ); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @access public |
370 | 370 | * @param int $EVT_ID |
371 | - * @return string |
|
371 | + * @return string|null |
|
372 | 372 | */ |
373 | 373 | public static function get_earliest_date_obj( $EVT_ID = 0 ) { |
374 | 374 | $event = EEH_Event_View::get_event( $EVT_ID ); |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @access public |
420 | 420 | * @param int $EVT_ID |
421 | - * @param null $include_expired |
|
421 | + * @param false|null $include_expired |
|
422 | 422 | * @param bool $include_deleted |
423 | 423 | * @param null $limit |
424 | 424 | * @return EE_Datetime[] |
@@ -40,27 +40,27 @@ discard block |
||
40 | 40 | * @param int $EVT_ID |
41 | 41 | * @return object |
42 | 42 | */ |
43 | - public static function get_event( $EVT_ID = 0 ) { |
|
44 | - $EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint( $EVT_ID ); |
|
43 | + public static function get_event($EVT_ID = 0) { |
|
44 | + $EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint($EVT_ID); |
|
45 | 45 | // do we already have the Event you are looking for? |
46 | - if ( EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID ) { |
|
46 | + if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) { |
|
47 | 47 | return EEH_Event_View::$_event; |
48 | 48 | } |
49 | 49 | EEH_Event_View::$_event = NULL; |
50 | 50 | // international newspaper? |
51 | 51 | global $post; |
52 | 52 | // if this is being called from an EE_Event post, then we can just grab the attached EE_Event object |
53 | - if ( isset( $post->post_type ) && $post->post_type == 'espresso_events' || $EVT_ID ) { |
|
53 | + if (isset($post->post_type) && $post->post_type == 'espresso_events' || $EVT_ID) { |
|
54 | 54 | // d( $post ); |
55 | 55 | // grab the event we're looking for |
56 | - if ( isset( $post->EE_Event ) && ( $EVT_ID == 0 || ( $EVT_ID == $post->ID ))) { |
|
56 | + if (isset($post->EE_Event) && ($EVT_ID == 0 || ($EVT_ID == $post->ID))) { |
|
57 | 57 | EEH_Event_View::$_event = $post->EE_Event; |
58 | 58 | // d( EEH_Event_View::$_event ); |
59 | 59 | } |
60 | 60 | // now if we STILL do NOT have an EE_Event model object, BUT we have an Event ID... |
61 | - if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID ) { |
|
61 | + if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
62 | 62 | // sigh... pull it from the db |
63 | - EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
63 | + EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
64 | 64 | // d( EEH_Event_View::$_event ); |
65 | 65 | } |
66 | 66 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param int $EVT_ID |
77 | 77 | * @return boolean |
78 | 78 | */ |
79 | - public static function display_ticket_selector( $EVT_ID = 0 ) { |
|
80 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
79 | + public static function display_ticket_selector($EVT_ID = 0) { |
|
80 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
81 | 81 | return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE; |
82 | 82 | } |
83 | 83 | |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * @param int $EVT_ID |
91 | 91 | * @return string |
92 | 92 | */ |
93 | - public static function event_status( $EVT_ID = 0 ) { |
|
94 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
95 | - return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : ''; |
|
93 | + public static function event_status($EVT_ID = 0) { |
|
94 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
95 | + return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : ''; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param int $EVT_ID |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public static function event_active_status( $EVT_ID = 0 ) { |
|
108 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
107 | + public static function event_active_status($EVT_ID = 0) { |
|
108 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
109 | 109 | return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive'; |
110 | 110 | } |
111 | 111 | |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | * @param int $EVT_ID |
119 | 119 | * @return string |
120 | 120 | */ |
121 | - public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
|
122 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
121 | + public static function event_has_content_or_excerpt($EVT_ID = 0) { |
|
122 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
123 | 123 | $has_content_or_excerpt = FALSE; |
124 | - if ( $event instanceof EE_Event ) { |
|
125 | - $has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE; |
|
124 | + if ($event instanceof EE_Event) { |
|
125 | + $has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE; |
|
126 | 126 | } |
127 | - if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) { |
|
127 | + if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) { |
|
128 | 128 | $has_content_or_excerpt = FALSE; |
129 | 129 | } |
130 | 130 | return $has_content_or_excerpt; |
@@ -140,39 +140,39 @@ discard block |
||
140 | 140 | * @param null $more |
141 | 141 | * @return string |
142 | 142 | */ |
143 | - public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) { |
|
143 | + public static function event_content_or_excerpt($num_words = NULL, $more = NULL) { |
|
144 | 144 | |
145 | 145 | global $post; |
146 | 146 | $content = ''; |
147 | 147 | |
148 | 148 | ob_start(); |
149 | - if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) { |
|
149 | + if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) { |
|
150 | 150 | //echo '<h2 style="color:#E76700;">the_content<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>'; |
151 | 151 | the_content(); |
152 | - } else if (( is_archive() && has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() ) || apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', FALSE )) { |
|
152 | + } else if ((is_archive() && has_excerpt($post->ID) && espresso_display_excerpt_in_event_list()) || apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', FALSE)) { |
|
153 | 153 | //echo '<h2 style="color:#E76700;">the_excerpt<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>'; |
154 | 154 | the_excerpt(); |
155 | - } else if (( is_archive() && ! has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() )) { |
|
155 | + } else if ((is_archive() && ! has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) { |
|
156 | 156 | //echo '<h2 style="color:#E76700;">get_the_content<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span><b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>'; |
157 | - if ( ! empty( $num_words )) { |
|
158 | - if ( empty( $more )) { |
|
159 | - $more = ' <a href="' . get_permalink() . '" class="more-link">' . __( '(more…)' ) . '</a>'; |
|
160 | - $more = apply_filters( 'the_content_more_link', $more ); |
|
157 | + if ( ! empty($num_words)) { |
|
158 | + if (empty($more)) { |
|
159 | + $more = ' <a href="'.get_permalink().'" class="more-link">'.__('(more…)').'</a>'; |
|
160 | + $more = apply_filters('the_content_more_link', $more); |
|
161 | 161 | } |
162 | - $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
162 | + $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK')); |
|
163 | 163 | |
164 | - $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
164 | + $content = wp_trim_words($content, $num_words, ' ').$more; |
|
165 | 165 | } else { |
166 | - $content = get_the_content(); |
|
166 | + $content = get_the_content(); |
|
167 | 167 | } |
168 | 168 | global $allowedtags; |
169 | - $content = wp_kses( $content, $allowedtags ); |
|
170 | - $content = strip_shortcodes( $content ); |
|
171 | - echo apply_filters( 'the_content', $content ); |
|
169 | + $content = wp_kses($content, $allowedtags); |
|
170 | + $content = strip_shortcodes($content); |
|
171 | + echo apply_filters('the_content', $content); |
|
172 | 172 | |
173 | 173 | } else { |
174 | 174 | //echo '<h2 style="color:#E76700;">nothing<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>'; |
175 | - echo apply_filters( 'the_content', $content ); |
|
175 | + echo apply_filters('the_content', $content); |
|
176 | 176 | } |
177 | 177 | return ob_get_clean(); |
178 | 178 | } |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | * @param int $EVT_ID |
187 | 187 | * @return string |
188 | 188 | */ |
189 | - public static function event_tickets_available( $EVT_ID = 0 ) { |
|
190 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
189 | + public static function event_tickets_available($EVT_ID = 0) { |
|
190 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
191 | 191 | $tickets_available_for_purchase = array(); |
192 | - if( $event instanceof EE_Event ) { |
|
193 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE ); |
|
194 | - foreach( $datetimes as $datetime ) { |
|
195 | - $tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() ); |
|
192 | + if ($event instanceof EE_Event) { |
|
193 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE); |
|
194 | + foreach ($datetimes as $datetime) { |
|
195 | + $tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase()); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | return $tickets_available_for_purchase; |
@@ -208,22 +208,22 @@ discard block |
||
208 | 208 | * @param bool $hide_uncategorized |
209 | 209 | * @return string |
210 | 210 | */ |
211 | - public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) { |
|
211 | + public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) { |
|
212 | 212 | $category_links = array(); |
213 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
214 | - if ( $event instanceof EE_Event ) { |
|
215 | - $event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' ); |
|
216 | - if ( $event_categories ) { |
|
213 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
214 | + if ($event instanceof EE_Event) { |
|
215 | + $event_categories = get_the_terms($event->ID(), 'espresso_event_categories'); |
|
216 | + if ($event_categories) { |
|
217 | 217 | // loop thru terms and create links |
218 | - foreach ( $event_categories as $term ) { |
|
219 | - $url = get_term_link( $term, 'espresso_venue_categories' ); |
|
220 | - if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
|
221 | - $category_links[] = '<a href="' . esc_url( $url ) . '" rel="tag">' . $term->name . '</a>'; |
|
218 | + foreach ($event_categories as $term) { |
|
219 | + $url = get_term_link($term, 'espresso_venue_categories'); |
|
220 | + if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) { |
|
221 | + $category_links[] = '<a href="'.esc_url($url).'" rel="tag">'.$term->name.'</a>'; |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | } |
225 | 225 | } |
226 | - return implode( ', ', $category_links ); |
|
226 | + return implode(', ', $category_links); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | * @param int $EVT_ID |
238 | 238 | * @return string |
239 | 239 | */ |
240 | - public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
241 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
242 | - return $datetime instanceof EE_Datetime ? $datetime->start_date_and_time( $dt_frmt, $tm_frmt ) : ''; |
|
240 | + public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
241 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
242 | + return $datetime instanceof EE_Datetime ? $datetime->start_date_and_time($dt_frmt, $tm_frmt) : ''; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | * @param int $EVT_ID |
254 | 254 | * @return string |
255 | 255 | */ |
256 | - public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
257 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
258 | - return $datetime instanceof EE_Datetime ? $datetime->end_date_and_time( $dt_frmt, $tm_frmt ) : ''; |
|
256 | + public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
257 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
258 | + return $datetime instanceof EE_Datetime ? $datetime->end_date_and_time($dt_frmt, $tm_frmt) : ''; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -269,9 +269,9 @@ discard block |
||
269 | 269 | * @param int $EVT_ID |
270 | 270 | * @return string |
271 | 271 | */ |
272 | - public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
273 | - $datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID ); |
|
274 | - return $datetime instanceof EE_Datetime ? $datetime->start_date_and_time( $dt_frmt, $tm_frmt ) : ''; |
|
272 | + public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
273 | + $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID); |
|
274 | + return $datetime instanceof EE_Datetime ? $datetime->start_date_and_time($dt_frmt, $tm_frmt) : ''; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | * @param int $EVT_ID |
286 | 286 | * @return string |
287 | 287 | */ |
288 | - public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
289 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
290 | - return $datetime instanceof EE_Datetime ? $datetime->end_date_and_time( $dt_frmt, $tm_frmt ) : ''; |
|
288 | + public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
289 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
290 | + return $datetime instanceof EE_Datetime ? $datetime->end_date_and_time($dt_frmt, $tm_frmt) : ''; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
@@ -299,13 +299,13 @@ discard block |
||
299 | 299 | * @param int $EVT_ID |
300 | 300 | * @return string |
301 | 301 | */ |
302 | - public static function event_date_as_calendar_page( $EVT_ID = 0 ) { |
|
303 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
304 | - if ( $datetime instanceof EE_Datetime ) { |
|
302 | + public static function event_date_as_calendar_page($EVT_ID = 0) { |
|
303 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
304 | + if ($datetime instanceof EE_Datetime) { |
|
305 | 305 | ?> |
306 | 306 | <div class="event-date-calendar-page-dv"> |
307 | - <div class="event-date-calendar-page-month-dv"><?php echo date_i18n( 'M', strtotime( $datetime->start_date()));?></div> |
|
308 | - <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div> |
|
307 | + <div class="event-date-calendar-page-month-dv"><?php echo date_i18n('M', strtotime($datetime->start_date())); ?></div> |
|
308 | + <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div> |
|
309 | 309 | </div> |
310 | 310 | <?php |
311 | 311 | } |
@@ -320,17 +320,17 @@ discard block |
||
320 | 320 | * @param int $EVT_ID |
321 | 321 | * @return string |
322 | 322 | */ |
323 | - public static function get_primary_date_obj( $EVT_ID = 0 ) { |
|
324 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
325 | - if ( $event instanceof EE_Event ) { |
|
323 | + public static function get_primary_date_obj($EVT_ID = 0) { |
|
324 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
325 | + if ($event instanceof EE_Event) { |
|
326 | 326 | $datetimes = $event->get_many_related( |
327 | 327 | 'Datetime', |
328 | 328 | array( |
329 | 329 | 'limit' => 1, |
330 | - 'order_by' => array( 'DTT_order' => 'ASC' ) |
|
330 | + 'order_by' => array('DTT_order' => 'ASC') |
|
331 | 331 | ) |
332 | 332 | ); |
333 | - return reset( $datetimes ); |
|
333 | + return reset($datetimes); |
|
334 | 334 | } else { |
335 | 335 | return FALSE; |
336 | 336 | } |
@@ -345,17 +345,17 @@ discard block |
||
345 | 345 | * @param int $EVT_ID |
346 | 346 | * @return string |
347 | 347 | */ |
348 | - public static function get_last_date_obj( $EVT_ID = 0 ) { |
|
349 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
350 | - if ( $event instanceof EE_Event ) { |
|
348 | + public static function get_last_date_obj($EVT_ID = 0) { |
|
349 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
350 | + if ($event instanceof EE_Event) { |
|
351 | 351 | $datetimes = $event->get_many_related( |
352 | 352 | 'Datetime', |
353 | 353 | array( |
354 | 354 | 'limit' => 1, |
355 | - 'order_by' => array( 'DTT_order' => 'DESC' ) |
|
355 | + 'order_by' => array('DTT_order' => 'DESC') |
|
356 | 356 | ) |
357 | 357 | ); |
358 | - return end( $datetimes ); |
|
358 | + return end($datetimes); |
|
359 | 359 | } else { |
360 | 360 | return FALSE; |
361 | 361 | } |
@@ -370,17 +370,17 @@ discard block |
||
370 | 370 | * @param int $EVT_ID |
371 | 371 | * @return string |
372 | 372 | */ |
373 | - public static function get_earliest_date_obj( $EVT_ID = 0 ) { |
|
374 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
375 | - if ( $event instanceof EE_Event ) { |
|
373 | + public static function get_earliest_date_obj($EVT_ID = 0) { |
|
374 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
375 | + if ($event instanceof EE_Event) { |
|
376 | 376 | $datetimes = $event->get_many_related( |
377 | 377 | 'Datetime', |
378 | 378 | array( |
379 | 379 | 'limit' => 1, |
380 | - 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) |
|
380 | + 'order_by' => array('DTT_EVT_start' => 'ASC') |
|
381 | 381 | ) |
382 | 382 | ); |
383 | - return reset( $datetimes ); |
|
383 | + return reset($datetimes); |
|
384 | 384 | } else { |
385 | 385 | return FALSE; |
386 | 386 | } |
@@ -395,17 +395,17 @@ discard block |
||
395 | 395 | * @param int $EVT_ID |
396 | 396 | * @return string |
397 | 397 | */ |
398 | - public static function get_latest_date_obj( $EVT_ID = 0 ) { |
|
399 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
400 | - if ( $event instanceof EE_Event ) { |
|
398 | + public static function get_latest_date_obj($EVT_ID = 0) { |
|
399 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
400 | + if ($event instanceof EE_Event) { |
|
401 | 401 | $datetimes = $event->get_many_related( |
402 | 402 | 'Datetime', |
403 | 403 | array( |
404 | 404 | 'limit' => 1, |
405 | - 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) |
|
405 | + 'order_by' => array('DTT_EVT_start' => 'DESC') |
|
406 | 406 | ) |
407 | 407 | ); |
408 | - return end( $datetimes ); |
|
408 | + return end($datetimes); |
|
409 | 409 | } else { |
410 | 410 | return FALSE; |
411 | 411 | } |
@@ -423,18 +423,18 @@ discard block |
||
423 | 423 | * @param null $limit |
424 | 424 | * @return EE_Datetime[] |
425 | 425 | */ |
426 | - public static function get_all_date_obj( $EVT_ID = 0, $include_expired = NULL, $include_deleted = false, $limit = NULL ) { |
|
427 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
428 | - if($include_expired === NULL){ |
|
429 | - if($event->is_expired()){ |
|
426 | + public static function get_all_date_obj($EVT_ID = 0, $include_expired = NULL, $include_deleted = false, $limit = NULL) { |
|
427 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
428 | + if ($include_expired === NULL) { |
|
429 | + if ($event->is_expired()) { |
|
430 | 430 | $include_expired = TRUE; |
431 | - }else{ |
|
431 | + } else { |
|
432 | 432 | $include_expired = FALSE; |
433 | 433 | } |
434 | - }else{ |
|
434 | + } else { |
|
435 | 435 | $include_expired = TRUE; |
436 | 436 | } |
437 | - if ( $event instanceof EE_Event ) { |
|
437 | + if ($event instanceof EE_Event) { |
|
438 | 438 | return $event->datetimes_ordered($include_expired, $include_deleted, $limit); |
439 | 439 | } else { |
440 | 440 | return array(); |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | * @param int $EVT_ID |
451 | 451 | * @return string |
452 | 452 | */ |
453 | - public static function event_link_url( $EVT_ID = 0 ) { |
|
454 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
455 | - if ( $event instanceof EE_Event ) { |
|
456 | - $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() ); |
|
457 | - return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url; |
|
453 | + public static function event_link_url($EVT_ID = 0) { |
|
454 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
455 | + if ($event instanceof EE_Event) { |
|
456 | + $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID()); |
|
457 | + return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url; |
|
458 | 458 | } |
459 | 459 | return NULL; |
460 | 460 | } |
@@ -468,11 +468,11 @@ discard block |
||
468 | 468 | * @param int $EVT_ID |
469 | 469 | * @return string |
470 | 470 | */ |
471 | - public static function event_phone( $EVT_ID = 0 ) { |
|
472 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
473 | - if ( $event instanceof EE_Event ) { |
|
474 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
475 | - return EEH_Schema::telephone( $event->phone() ); |
|
471 | + public static function event_phone($EVT_ID = 0) { |
|
472 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
473 | + if ($event instanceof EE_Event) { |
|
474 | + EE_Registry::instance()->load_helper('Formatter'); |
|
475 | + return EEH_Schema::telephone($event->phone()); |
|
476 | 476 | } |
477 | 477 | return NULL; |
478 | 478 | } |
@@ -489,23 +489,23 @@ discard block |
||
489 | 489 | * @param string $after |
490 | 490 | * @return string |
491 | 491 | */ |
492 | - public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) { |
|
493 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
494 | - if ( $event instanceof EE_Event ) { |
|
492 | + public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') { |
|
493 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
494 | + if ($event instanceof EE_Event) { |
|
495 | 495 | // can the user edit this post ? |
496 | - if ( current_user_can( 'edit_post', $event->ID() )) { |
|
496 | + if (current_user_can('edit_post', $event->ID())) { |
|
497 | 497 | // set link text |
498 | - $link = ! empty( $link ) ? $link : __('edit this event'); |
|
498 | + $link = ! empty($link) ? $link : __('edit this event'); |
|
499 | 499 | // generate nonce |
500 | - $nonce = wp_create_nonce( 'edit_nonce' ); |
|
500 | + $nonce = wp_create_nonce('edit_nonce'); |
|
501 | 501 | // generate url to event editor for this event |
502 | - $url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() ); |
|
502 | + $url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url()); |
|
503 | 503 | // get edit CPT text |
504 | - $post_type_obj = get_post_type_object( 'espresso_events' ); |
|
504 | + $post_type_obj = get_post_type_object('espresso_events'); |
|
505 | 505 | // build final link html |
506 | - $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>'; |
|
506 | + $link = '<a class="post-edit-link" href="'.$url.'" title="'.esc_attr($post_type_obj->labels->edit_item).'">'.$link.'</a>'; |
|
507 | 507 | // put it all together |
508 | - return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after; |
|
508 | + return $before.apply_filters('edit_post_link', $link, $event->ID()).$after; |
|
509 | 509 | } |
510 | 510 | } |
511 | 511 | return ''; |
@@ -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 | * |
@@ -428,10 +430,10 @@ discard block |
||
428 | 430 | if($include_expired === NULL){ |
429 | 431 | if($event->is_expired()){ |
430 | 432 | $include_expired = TRUE; |
431 | - }else{ |
|
433 | + } else{ |
|
432 | 434 | $include_expired = FALSE; |
433 | 435 | } |
434 | - }else{ |
|
436 | + } else{ |
|
435 | 437 | $include_expired = TRUE; |
436 | 438 | } |
437 | 439 | if ( $event instanceof EE_Event ) { |
@@ -91,6 +91,7 @@ |
||
91 | 91 | * @param EE_Registration $registration |
92 | 92 | * @param EE_Question $question |
93 | 93 | * @param mixed EE_Answer|NULL $answer |
94 | + * @param EE_Answer $answer |
|
94 | 95 | * @return EE_Form_Input_Base |
95 | 96 | */ |
96 | 97 | public function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Registration_Question_Group_Reg_Form |
|
5 | - * |
|
6 | - * For auto-generating form sections for an EE_Transaction |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Registration_Question_Group_Reg_Form |
|
5 | + * |
|
6 | + * For auto-generating form sections for an EE_Transaction |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class EE_Registration_Question_Group_Reg_Form extends EE_Form_Section_Proper { |
16 | 16 |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | * @param EE_Question_Group $question_group |
21 | 21 | * @return EE_Registration_Question_Group_Reg_Form |
22 | 22 | */ |
23 | - public function __construct( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
23 | + public function __construct(EE_Registration $registration, EE_Question_Group $question_group) { |
|
24 | 24 | // array of params to pass to parent constructor |
25 | 25 | $form_args = array( |
26 | 26 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
27 | 27 | 'subsections' => array(), |
28 | 28 | 'name' => $question_group->identifier(), |
29 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
29 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
30 | 30 | 'html_class' => 'ee-reg-form-qstn-grp-dv', |
31 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl' |
|
31 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl' |
|
32 | 32 | ); |
33 | 33 | |
34 | 34 | $questions = $question_group->get_many_related( |
@@ -37,20 +37,20 @@ discard block |
||
37 | 37 | array( |
38 | 38 | // where params |
39 | 39 | 'QST_deleted' => 0, |
40 | - 'QST_admin_only' => is_admin() ? 1 :0 |
|
40 | + 'QST_admin_only' => is_admin() ? 1 : 0 |
|
41 | 41 | ), |
42 | 42 | 'order_by'=>array( |
43 | 43 | 'Question_Group_Question.QGQ_order' =>'ASC' |
44 | 44 | ) |
45 | 45 | ) |
46 | 46 | ); |
47 | - foreach ( $questions as $question ) { |
|
48 | - if( $question instanceof EE_Question ){ |
|
49 | - $form_args['subsections'][] = $this->_reg_form_question( $registration, $question ); |
|
47 | + foreach ($questions as $question) { |
|
48 | + if ($question instanceof EE_Question) { |
|
49 | + $form_args['subsections'][] = $this->_reg_form_question($registration, $question); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | // d( $form_args ); |
53 | - parent::__construct( $form_args ); |
|
53 | + parent::__construct($form_args); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -59,29 +59,29 @@ discard block |
||
59 | 59 | * @param EE_Question $question |
60 | 60 | * @return EE_Form_Input_Base |
61 | 61 | */ |
62 | - public function _reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
62 | + public function _reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
63 | 63 | |
64 | 64 | // if this question was for an attendee detail, then check for that answer |
65 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->ID() ); |
|
66 | - $answer = $registration->reg_url_link() || ! $answer_value ? EEM_Answer::instance()->get_one( array( array( 'QST_ID'=>$question->ID(), 'REG_ID'=>$registration->ID() ))) : NULL; |
|
65 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->ID()); |
|
66 | + $answer = $registration->reg_url_link() || ! $answer_value ? EEM_Answer::instance()->get_one(array(array('QST_ID'=>$question->ID(), 'REG_ID'=>$registration->ID()))) : NULL; |
|
67 | 67 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
68 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
68 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
69 | 69 | // create an EE_Answer object for storing everything in |
70 | - $answer = EE_Answer::new_instance ( array( |
|
70 | + $answer = EE_Answer::new_instance(array( |
|
71 | 71 | 'QST_ID'=> $question->ID(), |
72 | 72 | 'REG_ID'=> $registration->ID() |
73 | 73 | )); |
74 | 74 | } |
75 | 75 | // verify instance |
76 | - if( $answer instanceof EE_Answer ){ |
|
77 | - if ( ! empty( $answer_value )) { |
|
78 | - $answer->set( 'ANS_value', $answer_value ); |
|
76 | + if ($answer instanceof EE_Answer) { |
|
77 | + if ( ! empty($answer_value)) { |
|
78 | + $answer->set('ANS_value', $answer_value); |
|
79 | 79 | } |
80 | - $answer->cache( 'Question', $question ); |
|
81 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
82 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
80 | + $answer->cache('Question', $question); |
|
81 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
82 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
83 | 83 | } |
84 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
84 | + return $this->_generate_question_input($registration, $question, $answer); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param mixed EE_Answer|NULL $answer |
94 | 94 | * @return EE_Form_Input_Base |
95 | 95 | */ |
96 | - public function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
96 | + public function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
97 | 97 | // d( $registration ); |
98 | 98 | // d( $question ); |
99 | 99 | // d( $answer ); |
@@ -115,22 +115,22 @@ discard block |
||
115 | 115 | // raw_value; |
116 | 116 | $input_constructor_args = array( |
117 | 117 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
118 | - 'name' => $registration->reg_url_link() . '-' . $question->ID(), |
|
119 | - 'html_name' => 'ee_reg_qstn[' . $registration->reg_url_link() . '][' . $question->ID() . ']', |
|
120 | - 'html_id' => 'ee-reg-qstn-' . $registration->reg_url_link() . '-' . $question->ID(), |
|
118 | + 'name' => $registration->reg_url_link().'-'.$question->ID(), |
|
119 | + 'html_name' => 'ee_reg_qstn['.$registration->reg_url_link().']['.$question->ID().']', |
|
120 | + 'html_id' => 'ee-reg-qstn-'.$registration->reg_url_link().'-'.$question->ID(), |
|
121 | 121 | 'html_class' => 'ee-reg-qstn', |
122 | 122 | 'required' => $question->required(), |
123 | - 'html_label_id' => 'ee-reg-qstn-' . $registration->reg_url_link() . '-' . $question->ID() . '-lbl', |
|
123 | + 'html_label_id' => 'ee-reg-qstn-'.$registration->reg_url_link().'-'.$question->ID().'-lbl', |
|
124 | 124 | 'html_label_class' => 'ee-reg-qstn-lbl', |
125 | 125 | 'html_label_text' => $question->display_text() |
126 | 126 | ); |
127 | 127 | |
128 | - if ( $answer instanceof EE_Answer ) { |
|
129 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
128 | + if ($answer instanceof EE_Answer) { |
|
129 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
130 | 130 | $input_constructor_args['default'] .= $answer->value(); |
131 | 131 | } |
132 | 132 | |
133 | - switch ( $question->type() ) { |
|
133 | + switch ($question->type()) { |
|
134 | 134 | // Text |
135 | 135 | case EEM_Question::QST_type_text : |
136 | 136 | $input_class = 'EE_Text_Input'; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | break; |
158 | 158 | } |
159 | 159 | // d( $input_constructor_args ); |
160 | - return new $input_class( $input_constructor_args ); |
|
160 | + return new $input_class($input_constructor_args); |
|
161 | 161 | |
162 | 162 | } |
163 | 163 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | /** |
65 | - * @return boolean |
|
65 | + * @return boolean|null |
|
66 | 66 | */ |
67 | 67 | public function initialize_reg_step() { |
68 | 68 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * _auto_copy_attendee_info |
343 | 343 | * |
344 | 344 | * @access public |
345 | - * @return EE_Form_Section_Proper |
|
345 | + * @return EE_Form_Section_HTML |
|
346 | 346 | */ |
347 | 347 | private function _auto_copy_attendee_info() { |
348 | 348 | return new EE_Form_Section_HTML( |
@@ -456,6 +456,7 @@ discard block |
||
456 | 456 | * @param EE_Registration $registration |
457 | 457 | * @param EE_Question $question |
458 | 458 | * @param mixed EE_Answer|NULL $answer |
459 | + * @param EE_Answer $answer |
|
459 | 460 | * @return EE_Form_Input_Base |
460 | 461 | */ |
461 | 462 | private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | case EEM_Question::QST_type_text : |
508 | 508 | if( $identifier == 'email' ){ |
509 | 509 | return new EE_Email_Input( $input_constructor_args ); |
510 | - }else{ |
|
510 | + } else{ |
|
511 | 511 | return new EE_Text_Input( $input_constructor_args ); |
512 | 512 | } |
513 | 513 | break; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
794 | 794 | |
795 | - } else { |
|
795 | + } else { |
|
796 | 796 | EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
797 | 797 | // remove malformed data |
798 | 798 | unset( $valid_data[ $reg_url_link ] ); |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | * @param EE_Checkout $checkout |
33 | 33 | * @return \EE_SPCO_Reg_Step_Attendee_Information |
34 | 34 | */ |
35 | - public function __construct( EE_Checkout $checkout ) { |
|
35 | + public function __construct(EE_Checkout $checkout) { |
|
36 | 36 | $this->_slug = 'attendee_information'; |
37 | 37 | $this->_name = __('Attendee Information', 'event_espresso'); |
38 | - $this->_template = SPCO_TEMPLATES_PATH . $this->slug() . DS . 'attendee_info_main.template.php'; |
|
38 | + $this->_template = SPCO_TEMPLATES_PATH.$this->slug().DS.'attendee_info_main.template.php'; |
|
39 | 39 | $this->checkout = $checkout; |
40 | 40 | $this->_reset_success_message(); |
41 | - $this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
41 | + $this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
48 | 48 | EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso'); |
49 | 49 | EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso'); |
50 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' ); |
|
50 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>'); |
|
51 | 51 | EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso'); |
52 | 52 | EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso'); |
53 | 53 | EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso'); |
@@ -85,30 +85,30 @@ discard block |
||
85 | 85 | 'ticket_count' => array() |
86 | 86 | ); |
87 | 87 | // grab the saved registrations from the transaction |
88 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
89 | - if ( $registrations ) { |
|
90 | - foreach ( $registrations as $registration ) { |
|
91 | - if ( $registration instanceof EE_Registration ) { |
|
88 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
89 | + if ($registrations) { |
|
90 | + foreach ($registrations as $registration) { |
|
91 | + if ($registration instanceof EE_Registration) { |
|
92 | 92 | // can this registration be processed during this visit ? |
93 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
94 | - $subsections[ $registration->reg_url_link() ] = $this->registrations_reg_form( $registration ); |
|
95 | - if ( ! $this->checkout->admin_request ) { |
|
96 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
97 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
93 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
94 | + $subsections[$registration->reg_url_link()] = $this->registrations_reg_form($registration); |
|
95 | + if ( ! $this->checkout->admin_request) { |
|
96 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
97 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
98 | 98 | } |
99 | - if ( $registration->is_primary_registrant() ) { |
|
99 | + if ($registration->is_primary_registrant()) { |
|
100 | 100 | $primary_registrant = $registration->reg_url_link(); |
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | 105 | // print_copy_info ? |
106 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
106 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
107 | 107 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
108 | 108 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->copy_attendee_info_form() : $this->auto_copy_attendee_info(); |
109 | 109 | // generate hidden input |
110 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
111 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options ); |
|
110 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
111 | + $subsections[$primary_registrant]->add_subsections($copy_options); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
@@ -120,8 +120,7 @@ discard block |
||
120 | 120 | 'html_id' => $this->reg_form_name(), |
121 | 121 | 'subsections' => $subsections, |
122 | 122 | 'layout_strategy' => $this->checkout->admin_request ? |
123 | - new EE_Div_Per_Section_Layout() : |
|
124 | - new EE_Template_Layout( |
|
123 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
125 | 124 | array( |
126 | 125 | 'layout_template_file' => $this->_template, // layout_template |
127 | 126 | 'template_args' => $template_args |
@@ -138,61 +137,61 @@ discard block |
||
138 | 137 | * @param EE_Registration $registration |
139 | 138 | * @return EE_Form_Section_Proper |
140 | 139 | */ |
141 | - public function registrations_reg_form( EE_Registration $registration ) { |
|
142 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
140 | + public function registrations_reg_form(EE_Registration $registration) { |
|
141 | + EE_Registry::instance()->load_helper('Template'); |
|
143 | 142 | static $attendee_nmbr = 1; |
144 | 143 | // array of params to pass to parent constructor |
145 | 144 | $form_args = array( |
146 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
145 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
147 | 146 | 'html_class' => 'ee-reg-form-attendee-dv', |
148 | 147 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
149 | 148 | 'subsections' => array(), |
150 | 149 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
151 | 150 | array( |
152 | 151 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
153 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
152 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
154 | 153 | ) |
155 | 154 | ) |
156 | 155 | ); |
157 | 156 | // verify that registration has valid event |
158 | - if ( $registration->event() instanceof EE_Event ) { |
|
157 | + if ($registration->event() instanceof EE_Event) { |
|
159 | 158 | $query_params = array( |
160 | 159 | array( |
161 | 160 | 'Event.EVT_ID' => $registration->event()->ID(), |
162 | 161 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
163 | 162 | ), |
164 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
163 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
165 | 164 | ); |
166 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
167 | - if ( $question_groups ) { |
|
168 | - foreach ( $question_groups as $question_group ) { |
|
169 | - if ( $question_group instanceof EE_Question_Group ) { |
|
170 | - $form_args['subsections'][ $question_group->identifier() ] = $this->question_group_reg_form( $registration, $question_group ); |
|
165 | + $question_groups = $registration->event()->question_groups($query_params); |
|
166 | + if ($question_groups) { |
|
167 | + foreach ($question_groups as $question_group) { |
|
168 | + if ($question_group instanceof EE_Question_Group) { |
|
169 | + $form_args['subsections'][$question_group->identifier()] = $this->question_group_reg_form($registration, $question_group); |
|
171 | 170 | // add hidden input |
172 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->additional_attendee_reg_info_input( $registration ); |
|
171 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->additional_attendee_reg_info_input($registration); |
|
173 | 172 | } |
174 | 173 | } |
175 | 174 | // if we have question groups for additional attendees, then display the copy options |
176 | 175 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
177 | 176 | } else { |
178 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
177 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
179 | 178 | EEH_Template::locate_template( |
180 | - SPCO_TEMPLATES_PATH . 'attendee_information' . DS . 'attendee_info_not_required.template.php', |
|
181 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
179 | + SPCO_TEMPLATES_PATH.'attendee_information'.DS.'attendee_info_not_required.template.php', |
|
180 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
182 | 181 | TRUE, |
183 | 182 | TRUE |
184 | 183 | ) |
185 | 184 | ); |
186 | 185 | // add hidden input |
187 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->additional_attendee_reg_info_input( $registration, FALSE ); |
|
186 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->additional_attendee_reg_info_input($registration, FALSE); |
|
188 | 187 | } |
189 | 188 | } |
190 | - if ( $registration->is_primary_registrant() ) { |
|
189 | + if ($registration->is_primary_registrant()) { |
|
191 | 190 | // generate hidden input |
192 | - $form_args['subsections']['primary_registrant'] = $this->additional_primary_registrant_inputs( $registration ); |
|
191 | + $form_args['subsections']['primary_registrant'] = $this->additional_primary_registrant_inputs($registration); |
|
193 | 192 | } |
194 | 193 | $attendee_nmbr++; |
195 | - return new EE_Form_Section_Proper( $form_args ); |
|
194 | + return new EE_Form_Section_Proper($form_args); |
|
196 | 195 | } |
197 | 196 | |
198 | 197 | |
@@ -205,11 +204,11 @@ discard block |
||
205 | 204 | * @param bool $additional_attendee_reg_info |
206 | 205 | * @return EE_Form_Input_Base |
207 | 206 | */ |
208 | - public function additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
207 | + public function additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
209 | 208 | // generate hidden input |
210 | 209 | return new EE_Hidden_Input( |
211 | 210 | array( |
212 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
211 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
213 | 212 | 'default' => $additional_attendee_reg_info |
214 | 213 | ) |
215 | 214 | ); |
@@ -222,22 +221,22 @@ discard block |
||
222 | 221 | * @param EE_Question_Group $question_group |
223 | 222 | * @return EE_Form_Section_Proper |
224 | 223 | */ |
225 | - public function question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
224 | + public function question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
226 | 225 | // array of params to pass to parent constructor |
227 | 226 | $form_args = array( |
228 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
227 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
229 | 228 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
230 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
229 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
231 | 230 | 'subsections' => array( |
232 | - 'reg_form_qstn_grp_hdr' => $this->question_group_header( $question_group ) |
|
231 | + 'reg_form_qstn_grp_hdr' => $this->question_group_header($question_group) |
|
233 | 232 | ), |
234 | 233 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
235 | 234 | ); |
236 | 235 | // where params |
237 | - $query_params = array( 'QST_deleted' => 0 ); |
|
236 | + $query_params = array('QST_deleted' => 0); |
|
238 | 237 | // don't load admin only questions on the frontend |
239 | - if ( ! $this->checkout->admin_request ) { |
|
240 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
238 | + if ( ! $this->checkout->admin_request) { |
|
239 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
241 | 240 | } |
242 | 241 | $questions = $question_group->get_many_related( |
243 | 242 | 'Question', |
@@ -249,21 +248,21 @@ discard block |
||
249 | 248 | ) |
250 | 249 | ); |
251 | 250 | // filter for additional content before questions |
252 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this )); |
|
251 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this)); |
|
253 | 252 | // loop thru questions |
254 | - foreach ( $questions as $question ) { |
|
255 | - if( $question instanceof EE_Question ){ |
|
253 | + foreach ($questions as $question) { |
|
254 | + if ($question instanceof EE_Question) { |
|
256 | 255 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
257 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
256 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
258 | 257 | } |
259 | 258 | } |
260 | - $form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this ); |
|
259 | + $form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this); |
|
261 | 260 | |
262 | 261 | // filter for additional content after questions |
263 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this )); |
|
262 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this)); |
|
264 | 263 | // d( $form_args ); |
265 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
266 | - return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this ); |
|
264 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
265 | + return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this); |
|
267 | 266 | } |
268 | 267 | |
269 | 268 | |
@@ -273,12 +272,12 @@ discard block |
||
273 | 272 | * @param EE_Question_Group $question_group |
274 | 273 | * @return EE_Form_Section_HTML |
275 | 274 | */ |
276 | - public function question_group_header( EE_Question_Group $question_group ){ |
|
275 | + public function question_group_header(EE_Question_Group $question_group) { |
|
277 | 276 | $html = ''; |
278 | 277 | // group_name |
279 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
278 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
280 | 279 | EE_Registry::instance()->load_helper('HTML'); |
281 | - if ( $this->checkout->admin_request ) { |
|
280 | + if ($this->checkout->admin_request) { |
|
282 | 281 | $html .= EEH_HTML::br(); |
283 | 282 | $html .= EEH_HTML::h3( |
284 | 283 | $question_group->name(), |
@@ -292,7 +291,7 @@ discard block |
||
292 | 291 | } |
293 | 292 | } |
294 | 293 | // group_desc |
295 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
294 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
296 | 295 | $html .= EEH_HTML::p( |
297 | 296 | $question_group->desc(), |
298 | 297 | '', |
@@ -300,7 +299,7 @@ discard block |
||
300 | 299 | ); |
301 | 300 | |
302 | 301 | } |
303 | - return new EE_Form_Section_HTML( $html ); |
|
302 | + return new EE_Form_Section_HTML($html); |
|
304 | 303 | } |
305 | 304 | |
306 | 305 | |
@@ -309,14 +308,14 @@ discard block |
||
309 | 308 | * @access public |
310 | 309 | * @return EE_Form_Section_Proper |
311 | 310 | */ |
312 | - public function copy_attendee_info_form(){ |
|
311 | + public function copy_attendee_info_form() { |
|
313 | 312 | // array of params to pass to parent constructor |
314 | 313 | return new EE_Form_Section_Proper( |
315 | 314 | array( |
316 | 315 | 'subsections' => $this->copy_attendee_info_inputs(), |
317 | 316 | 'layout_strategy' => new EE_Template_Layout( |
318 | 317 | array( |
319 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'attendee_information' . DS . 'copy_attendee_info.template.php', // layout_template |
|
318 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'attendee_information'.DS.'copy_attendee_info.template.php', // layout_template |
|
320 | 319 | 'begin_template_file' => NULL, |
321 | 320 | 'input_template_file' => NULL, |
322 | 321 | 'subsection_template_file' => NULL, |
@@ -338,8 +337,8 @@ discard block |
||
338 | 337 | public function auto_copy_attendee_info() { |
339 | 338 | return new EE_Form_Section_HTML( |
340 | 339 | EEH_Template::locate_template( |
341 | - SPCO_TEMPLATES_PATH . 'attendee_information' . DS . 'auto_copy_attendee_info.template.php', |
|
342 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
340 | + SPCO_TEMPLATES_PATH.'attendee_information'.DS.'auto_copy_attendee_info.template.php', |
|
341 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
343 | 342 | TRUE, |
344 | 343 | TRUE |
345 | 344 | ) |
@@ -358,25 +357,25 @@ discard block |
||
358 | 357 | $copy_attendee_info_inputs = array(); |
359 | 358 | $prev_ticket = NULL; |
360 | 359 | // grab the saved registrations from the transaction |
361 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
362 | - foreach ( $registrations as $registration ) { |
|
360 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
361 | + foreach ($registrations as $registration) { |
|
363 | 362 | // for all attendees other than the primary attendee |
364 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
363 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
365 | 364 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
366 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
365 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
367 | 366 | $item_name = $registration->ticket()->name(); |
368 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
369 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
370 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
367 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
368 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
369 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
371 | 370 | ); |
372 | 371 | $prev_ticket = $registration->ticket()->ID(); |
373 | 372 | } |
374 | 373 | |
375 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
374 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
376 | 375 | EE_Checkbox_Multi_Input( |
377 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
376 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
378 | 377 | array( |
379 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
378 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
380 | 379 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
381 | 380 | 'display_html_label_text' => FALSE |
382 | 381 | ) |
@@ -395,7 +394,7 @@ discard block |
||
395 | 394 | * @param EE_Registration $registration |
396 | 395 | * @return EE_Form_Input_Base |
397 | 396 | */ |
398 | - public function additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
397 | + public function additional_primary_registrant_inputs(EE_Registration $registration) { |
|
399 | 398 | // generate hidden input |
400 | 399 | return new EE_Hidden_Input( |
401 | 400 | array( |
@@ -413,31 +412,31 @@ discard block |
||
413 | 412 | * @param EE_Question $question |
414 | 413 | * @return EE_Form_Input_Base |
415 | 414 | */ |
416 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
415 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
417 | 416 | |
418 | 417 | // if this question was for an attendee detail, then check for that answer |
419 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->ID() ); |
|
418 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->ID()); |
|
420 | 419 | $answer = $answer_value === null |
421 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
420 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
422 | 421 | : null; |
423 | 422 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
424 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
423 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
425 | 424 | // create an EE_Answer object for storing everything in |
426 | - $answer = EE_Answer::new_instance ( array( |
|
425 | + $answer = EE_Answer::new_instance(array( |
|
427 | 426 | 'QST_ID'=> $question->ID(), |
428 | 427 | 'REG_ID'=> $registration->ID() |
429 | 428 | )); |
430 | 429 | } |
431 | 430 | // verify instance |
432 | - if( $answer instanceof EE_Answer ){ |
|
433 | - if ( ! empty( $answer_value )) { |
|
434 | - $answer->set( 'ANS_value', $answer_value ); |
|
431 | + if ($answer instanceof EE_Answer) { |
|
432 | + if ( ! empty($answer_value)) { |
|
433 | + $answer->set('ANS_value', $answer_value); |
|
435 | 434 | } |
436 | - $answer->cache( 'Question', $question ); |
|
437 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
438 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
435 | + $answer->cache('Question', $question); |
|
436 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
437 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
439 | 438 | } |
440 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
439 | + return $this->_generate_question_input($registration, $question, $answer); |
|
441 | 440 | |
442 | 441 | } |
443 | 442 | |
@@ -449,7 +448,7 @@ discard block |
||
449 | 448 | * @param mixed EE_Answer|NULL $answer |
450 | 449 | * @return EE_Form_Input_Base |
451 | 450 | */ |
452 | - public function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
451 | + public function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
453 | 452 | // d( $registration ); |
454 | 453 | // d( $question ); |
455 | 454 | // d( $answer ); |
@@ -472,88 +471,88 @@ discard block |
||
472 | 471 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
473 | 472 | |
474 | 473 | $input_constructor_args = array( |
475 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
476 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
477 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
474 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
475 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
476 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
478 | 477 | 'required' => $question->required() ? TRUE : FALSE, |
479 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
478 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
480 | 479 | 'html_label_class' => 'ee-reg-qstn', |
481 | 480 | 'html_label_text' => $question->display_text(), |
482 | 481 | 'required_validation_error_message' => $question->required_text() |
483 | 482 | ); |
484 | 483 | // has this question been answered ? |
485 | - if ( $answer instanceof EE_Answer ) { |
|
486 | - if ( $answer->ID() ) { |
|
487 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
488 | - $input_constructor_args['html_id'] .= '-' . $answer->ID(); |
|
489 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); |
|
484 | + if ($answer instanceof EE_Answer) { |
|
485 | + if ($answer->ID()) { |
|
486 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
487 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
488 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
490 | 489 | } |
491 | 490 | $input_constructor_args['default'] = $answer->value(); |
492 | 491 | } |
493 | 492 | //add "-lbl" to the end of the label id |
494 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
493 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
495 | 494 | |
496 | - switch ( $question->type() ) { |
|
495 | + switch ($question->type()) { |
|
497 | 496 | // Text |
498 | 497 | case EEM_Question::QST_type_text : |
499 | - if( $identifier == 'email' ){ |
|
500 | - return new EE_Email_Input( $input_constructor_args ); |
|
501 | - }else{ |
|
502 | - return new EE_Text_Input( $input_constructor_args ); |
|
498 | + if ($identifier == 'email') { |
|
499 | + return new EE_Email_Input($input_constructor_args); |
|
500 | + } else { |
|
501 | + return new EE_Text_Input($input_constructor_args); |
|
503 | 502 | } |
504 | 503 | break; |
505 | 504 | // Textarea |
506 | 505 | case EEM_Question::QST_type_textarea : |
507 | - return new EE_Text_Area_Input( $input_constructor_args ); |
|
506 | + return new EE_Text_Area_Input($input_constructor_args); |
|
508 | 507 | break; |
509 | 508 | // Radio Buttons |
510 | 509 | case EEM_Question::QST_type_radio : |
511 | - return new EE_Radio_Button_Input( $question->options(), $input_constructor_args ); |
|
510 | + return new EE_Radio_Button_Input($question->options(), $input_constructor_args); |
|
512 | 511 | break; |
513 | 512 | // Dropdown |
514 | 513 | case EEM_Question::QST_type_dropdown : |
515 | - return new EE_Select_Input( $question->options(), $input_constructor_args ); |
|
514 | + return new EE_Select_Input($question->options(), $input_constructor_args); |
|
516 | 515 | break; |
517 | 516 | // State Dropdown |
518 | 517 | case EEM_Question::QST_type_state : |
519 | - $state_options = array( '' => array( '' => '')); |
|
518 | + $state_options = array('' => array('' => '')); |
|
520 | 519 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
521 | - if ( ! empty( $states )) { |
|
522 | - foreach( $states as $state ){ |
|
523 | - if ( $state instanceof EE_State ) { |
|
524 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
520 | + if ( ! empty($states)) { |
|
521 | + foreach ($states as $state) { |
|
522 | + if ($state instanceof EE_State) { |
|
523 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
525 | 524 | } |
526 | 525 | } |
527 | 526 | } |
528 | - $state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this ); |
|
529 | - return new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
527 | + $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this); |
|
528 | + return new EE_State_Select_Input($state_options, $input_constructor_args); |
|
530 | 529 | break; |
531 | 530 | // Country Dropdown |
532 | 531 | case EEM_Question::QST_type_country : |
533 | - $country_options = array( '' => '' ); |
|
532 | + $country_options = array('' => ''); |
|
534 | 533 | // get possibly cached list of countries |
535 | 534 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
536 | - if ( ! empty( $countries )) { |
|
537 | - foreach( $countries as $country ){ |
|
538 | - if ( $country instanceof EE_Country ) { |
|
539 | - $country_options[ $country->ID() ] = $country->name(); |
|
535 | + if ( ! empty($countries)) { |
|
536 | + foreach ($countries as $country) { |
|
537 | + if ($country instanceof EE_Country) { |
|
538 | + $country_options[$country->ID()] = $country->name(); |
|
540 | 539 | } |
541 | 540 | } |
542 | 541 | } |
543 | - $country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this ); |
|
544 | - return new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
542 | + $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this); |
|
543 | + return new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
545 | 544 | break; |
546 | 545 | // Checkboxes |
547 | 546 | case EEM_Question::QST_type_checkbox : |
548 | - return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args ); |
|
547 | + return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args); |
|
549 | 548 | break; |
550 | 549 | // Date |
551 | 550 | case EEM_Question::QST_type_date : |
552 | - return new EE_Datepicker_Input( $input_constructor_args ); |
|
551 | + return new EE_Datepicker_Input($input_constructor_args); |
|
553 | 552 | break; |
554 | 553 | // fallback |
555 | 554 | default : |
556 | - return new EE_Text_Input( $input_constructor_args ); |
|
555 | + return new EE_Text_Input($input_constructor_args); |
|
557 | 556 | } |
558 | 557 | } |
559 | 558 | |
@@ -576,65 +575,65 @@ discard block |
||
576 | 575 | */ |
577 | 576 | public function process_reg_step() { |
578 | 577 | |
579 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
578 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
580 | 579 | // grab validated data from form |
581 | 580 | $valid_data = $this->checkout->current_step->valid_data(); |
582 | 581 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
583 | 582 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
584 | 583 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
585 | - if ( empty( $valid_data )) { |
|
586 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
584 | + if (empty($valid_data)) { |
|
585 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
587 | 586 | return FALSE; |
588 | 587 | } |
589 | 588 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
590 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
591 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
589 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
590 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
592 | 591 | return FALSE; |
593 | 592 | } |
594 | 593 | // get cached registrations |
595 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
594 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
596 | 595 | // verify we got the goods |
597 | - if ( empty( $registrations )) { |
|
598 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
596 | + if (empty($registrations)) { |
|
597 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
599 | 598 | return FALSE; |
600 | 599 | } |
601 | 600 | // extract attendee info from form data and save to model objects |
602 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
601 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
603 | 602 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
604 | - if ( $registrations_processed === FALSE ) { |
|
603 | + if ($registrations_processed === FALSE) { |
|
605 | 604 | // but return immediately if the previous step exited early due to errors |
606 | 605 | return FALSE; |
607 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
606 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
608 | 607 | // generate a correctly translated string for all possible singular/plural combinations |
609 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
608 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
610 | 609 | $error_msg = sprintf( |
611 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
610 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
612 | 611 | $this->checkout->total_ticket_count, |
613 | 612 | $registrations_processed |
614 | 613 | ); |
615 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
614 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
616 | 615 | $error_msg = sprintf( |
617 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
616 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
618 | 617 | $this->checkout->total_ticket_count, |
619 | 618 | $registrations_processed |
620 | 619 | ); |
621 | 620 | } else { |
622 | 621 | $error_msg = sprintf( |
623 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
622 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
624 | 623 | $this->checkout->total_ticket_count, |
625 | 624 | $registrations_processed |
626 | 625 | ); |
627 | 626 | |
628 | 627 | } |
629 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
628 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
630 | 629 | return FALSE; |
631 | 630 | } |
632 | 631 | // mark this reg step as completed |
633 | 632 | $this->checkout->current_step->set_completed(); |
634 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
633 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
635 | 634 | //do action in case a plugin wants to do something with the data submitted in step 1. |
636 | 635 | //passes EE_Single_Page_Checkout, and it's posted data |
637 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
636 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
638 | 637 | return TRUE; |
639 | 638 | |
640 | 639 | } |
@@ -648,9 +647,9 @@ discard block |
||
648 | 647 | * @param array $valid_data |
649 | 648 | * @return boolean | int |
650 | 649 | */ |
651 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
650 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
652 | 651 | // load resources and set some defaults |
653 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
652 | + EE_Registry::instance()->load_model('Attendee'); |
|
654 | 653 | // holder for primary registrant attendee object |
655 | 654 | $this->checkout->primary_attendee_obj = NULL; |
656 | 655 | // array for tracking reg form data for the primary registrant |
@@ -667,19 +666,19 @@ discard block |
||
667 | 666 | // attendee counter |
668 | 667 | $att_nmbr = 0; |
669 | 668 | // grab the saved registrations from the transaction |
670 | - foreach ( $registrations as $registration ) { |
|
669 | + foreach ($registrations as $registration) { |
|
671 | 670 | // verify EE_Registration object |
672 | - if ( ! $registration instanceof EE_Registration ) { |
|
673 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
671 | + if ( ! $registration instanceof EE_Registration) { |
|
672 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
674 | 673 | return FALSE; |
675 | 674 | } |
676 | 675 | $reg_url_link = $registration->reg_url_link(); |
677 | 676 | // reg_url_link exists ? |
678 | - if ( $reg_url_link ) { |
|
677 | + if ($reg_url_link) { |
|
679 | 678 | // should this registration be processed during this visit ? |
680 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
679 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
681 | 680 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
682 | - if ( ! $this->checkout->revisit ) { |
|
681 | + if ( ! $this->checkout->revisit) { |
|
683 | 682 | $registration->save(); |
684 | 683 | } |
685 | 684 | |
@@ -690,41 +689,41 @@ discard block |
||
690 | 689 | * @var bool if TRUE is returned by the plugin then the |
691 | 690 | * registration processing is halted. |
692 | 691 | */ |
693 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
692 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
694 | 693 | return FALSE; |
695 | 694 | } |
696 | 695 | |
697 | 696 | // Houston, we have a registration! |
698 | 697 | $att_nmbr++; |
699 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
698 | + $this->_attendee_data[$reg_url_link] = array(); |
|
700 | 699 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
701 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
700 | + if (isset($valid_data[$reg_url_link])) { |
|
702 | 701 | // do we need to copy basic info from primary attendee ? |
703 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE; |
|
702 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE; |
|
704 | 703 | // filter form input data for this registration |
705 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
704 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
706 | 705 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
707 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
708 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
709 | - unset( $valid_data['primary_attendee'] ); |
|
706 | + if (isset($valid_data['primary_attendee'])) { |
|
707 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
708 | + unset($valid_data['primary_attendee']); |
|
710 | 709 | } |
711 | 710 | // now loop through our array of valid post data && process attendee reg forms |
712 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
713 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
714 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
711 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
712 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
713 | + foreach ($form_inputs as $form_input => $input_value) { |
|
715 | 714 | // check for critical inputs |
716 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
715 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
717 | 716 | return FALSE; |
718 | 717 | } |
719 | 718 | // store a bit of data about the primary attendee |
720 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
721 | - $primary_registrant[ $form_input ] = $input_value; |
|
722 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
723 | - $input_value = $primary_registrant[ $form_input ]; |
|
719 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
720 | + $primary_registrant[$form_input] = $input_value; |
|
721 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
722 | + $input_value = $primary_registrant[$form_input]; |
|
724 | 723 | } |
725 | 724 | // now attempt to save the input data |
726 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
727 | - EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ ); |
|
725 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
726 | + EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__); |
|
728 | 727 | return FALSE; |
729 | 728 | } |
730 | 729 | } |
@@ -733,51 +732,51 @@ discard block |
||
733 | 732 | } |
734 | 733 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
735 | 734 | // this registration does not require additional attendee information ? |
736 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
735 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
737 | 736 | // just copy the primary registrant |
738 | 737 | $attendee = $this->checkout->primary_attendee_obj; |
739 | 738 | } else { |
740 | 739 | // have we met before? |
741 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
740 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
742 | 741 | // did we find an already existing record for this attendee ? |
743 | - if ( $attendee instanceof EE_Attendee ) { |
|
744 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
742 | + if ($attendee instanceof EE_Attendee) { |
|
743 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
745 | 744 | } else { |
746 | 745 | // ensure critical details are set for additional attendees |
747 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ]; |
|
748 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
746 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link]; |
|
747 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
749 | 748 | } |
750 | 749 | // who's #1 ? |
751 | - if ( $att_nmbr == 1 ) { |
|
750 | + if ($att_nmbr == 1) { |
|
752 | 751 | $this->checkout->primary_attendee_obj = $attendee; |
753 | 752 | } |
754 | 753 | } |
755 | 754 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
756 | 755 | // add relation to registration, set attendee ID, and cache attendee |
757 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
758 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
759 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
756 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
757 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
758 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
760 | 759 | return FALSE; |
761 | 760 | } |
762 | 761 | /** @type EE_Registration_Processor $registration_processor */ |
763 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
762 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
764 | 763 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
765 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
764 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
766 | 765 | /** @type EE_Transaction_Processor $transaction_processor */ |
767 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
766 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
768 | 767 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
769 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
768 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
770 | 769 | // if we've gotten this far, then let's save what we have |
771 | 770 | $registration->save(); |
772 | 771 | // add relation between TXN and registration |
773 | - $this->_associate_registration_with_transaction( $registration ); |
|
772 | + $this->_associate_registration_with_transaction($registration); |
|
774 | 773 | |
775 | 774 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
776 | 775 | |
777 | - } else { |
|
778 | - EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
776 | + } else { |
|
777 | + EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
779 | 778 | // remove malformed data |
780 | - unset( $valid_data[ $reg_url_link ] ); |
|
779 | + unset($valid_data[$reg_url_link]); |
|
781 | 780 | return FALSE; |
782 | 781 | } |
783 | 782 | |
@@ -795,22 +794,22 @@ discard block |
||
795 | 794 | * @param string $input_value |
796 | 795 | * @return boolean |
797 | 796 | */ |
798 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
797 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
799 | 798 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
800 | 799 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
801 | 800 | // allow for plugins to hook in and do their own processing of the form input. |
802 | 801 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
803 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
802 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
804 | 803 | return TRUE; |
805 | 804 | } |
806 | 805 | |
807 | 806 | // grab related answer objects |
808 | 807 | $answers = $registration->answers(); |
809 | 808 | // $answer_cache_id is the key used to find the EE_Answer we want |
810 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
811 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
809 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
810 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
812 | 811 | //rename form_inputs if they are EE_Attendee properties |
813 | - switch( (string)$form_input ) { |
|
812 | + switch ((string) $form_input) { |
|
814 | 813 | |
815 | 814 | case 'state' : |
816 | 815 | case 'STA_ID' : |
@@ -825,31 +824,31 @@ discard block |
||
825 | 824 | break; |
826 | 825 | |
827 | 826 | default : |
828 | - $ATT_input = 'ATT_' . $form_input; |
|
827 | + $ATT_input = 'ATT_'.$form_input; |
|
829 | 828 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
830 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
831 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
829 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
830 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
832 | 831 | } |
833 | 832 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
834 | 833 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
835 | 834 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
836 | 835 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
837 | 836 | // if this form input has a corresponding attendee property |
838 | - if ( $attendee_property ) { |
|
839 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
840 | - if ( $answer_is_obj ) { |
|
837 | + if ($attendee_property) { |
|
838 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
839 | + if ($answer_is_obj) { |
|
841 | 840 | // and delete the corresponding answer since we won't be storing this data in that object |
842 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
841 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
843 | 842 | } |
844 | 843 | return TRUE; |
845 | - } elseif ( $answer_is_obj ) { |
|
844 | + } elseif ($answer_is_obj) { |
|
846 | 845 | // save this data to the answer object |
847 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
848 | - return $answers[ $answer_cache_id ]->save(); |
|
846 | + $answers[$answer_cache_id]->set_value($input_value); |
|
847 | + return $answers[$answer_cache_id]->save(); |
|
849 | 848 | } else { |
850 | - foreach ( $answers as $answer ) { |
|
851 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
852 | - $answer->set_value( $input_value ); |
|
849 | + foreach ($answers as $answer) { |
|
850 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
851 | + $answer->set_value($input_value); |
|
853 | 852 | return $answer->save() !== FALSE ? TRUE : FALSE; |
854 | 853 | } |
855 | 854 | } |
@@ -866,29 +865,29 @@ discard block |
||
866 | 865 | * @param string $input_value |
867 | 866 | * @return boolean |
868 | 867 | */ |
869 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
870 | - if ( empty( $input_value )) { |
|
871 | - switch( $form_input ) { |
|
868 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
869 | + if (empty($input_value)) { |
|
870 | + switch ($form_input) { |
|
872 | 871 | case 'fname' : |
873 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
872 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
874 | 873 | return FALSE; |
875 | 874 | break; |
876 | 875 | case 'lname' : |
877 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
876 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
878 | 877 | return FALSE; |
879 | 878 | break; |
880 | 879 | case 'email' : |
881 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
880 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
882 | 881 | return FALSE; |
883 | 882 | break; |
884 | 883 | } |
885 | - } else if ( $form_input === 'email' ) { |
|
884 | + } else if ($form_input === 'email') { |
|
886 | 885 | // clean the email address |
887 | - $valid_email = sanitize_email( $input_value ); |
|
886 | + $valid_email = sanitize_email($input_value); |
|
888 | 887 | // check if it matches |
889 | - if ( $input_value != $valid_email ) { |
|
888 | + if ($input_value != $valid_email) { |
|
890 | 889 | // whoops!!! |
891 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
890 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
892 | 891 | return FALSE; |
893 | 892 | } |
894 | 893 | } |
@@ -916,14 +915,14 @@ discard block |
||
916 | 915 | * @param array $attendee_data |
917 | 916 | * @return boolean |
918 | 917 | */ |
919 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
918 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
920 | 919 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
921 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
922 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
923 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
920 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
921 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
922 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
924 | 923 | // but only if those have values |
925 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
926 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
924 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
925 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
927 | 926 | 'ATT_fname' => $ATT_fname, |
928 | 927 | 'ATT_lname' => $ATT_lname, |
929 | 928 | 'ATT_email' => $ATT_email |
@@ -931,7 +930,7 @@ discard block |
||
931 | 930 | } else { |
932 | 931 | $existing_attendee = NULL; |
933 | 932 | } |
934 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
933 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
935 | 934 | } |
936 | 935 | |
937 | 936 | |
@@ -943,13 +942,13 @@ discard block |
||
943 | 942 | * @param array $attendee_data |
944 | 943 | * @return \EE_Attendee |
945 | 944 | */ |
946 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
945 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
947 | 946 | // first remove fname, lname, and email from attendee data |
948 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
947 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
949 | 948 | // now loop thru what's left and add to attendee CPT |
950 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
951 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
952 | - $existing_attendee->set( $property_name, $property_value ); |
|
949 | + foreach ($attendee_data as $property_name => $property_value) { |
|
950 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
951 | + $existing_attendee->set($property_name, $property_value); |
|
953 | 952 | } |
954 | 953 | } |
955 | 954 | // better save that now |
@@ -966,11 +965,11 @@ discard block |
||
966 | 965 | * @param EE_Attendee $attendee |
967 | 966 | * @return void |
968 | 967 | */ |
969 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
968 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
970 | 969 | // add relation to attendee |
971 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
972 | - $registration->set_attendee_id( $attendee->ID() ); |
|
973 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
970 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
971 | + $registration->set_attendee_id($attendee->ID()); |
|
972 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
974 | 973 | } |
975 | 974 | |
976 | 975 | |
@@ -981,10 +980,10 @@ discard block |
||
981 | 980 | * @param EE_Registration $registration |
982 | 981 | * @return void |
983 | 982 | */ |
984 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
983 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
985 | 984 | // add relation to attendee |
986 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
987 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
985 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
986 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
988 | 987 | } |
989 | 988 | |
990 | 989 | |
@@ -996,17 +995,17 @@ discard block |
||
996 | 995 | * @param array $attendee_data |
997 | 996 | * @return array |
998 | 997 | */ |
999 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
998 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1000 | 999 | // bare minimum critical details include first name, last name, email address |
1001 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1000 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1002 | 1001 | // add address info to critical details? |
1003 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1004 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1005 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1002 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1003 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1004 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1006 | 1005 | } |
1007 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1008 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1009 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1006 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1007 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1008 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1010 | 1009 | } |
1011 | 1010 | } |
1012 | 1011 | return $attendee_data; |
@@ -1021,11 +1020,11 @@ discard block |
||
1021 | 1020 | * @param array $attendee_data |
1022 | 1021 | * @return \EE_Attendee |
1023 | 1022 | */ |
1024 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1023 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1025 | 1024 | // create new attendee object |
1026 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1025 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1027 | 1026 | // set author to event creator |
1028 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1027 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1029 | 1028 | $new_attendee->save(); |
1030 | 1029 | return $new_attendee; |
1031 | 1030 | } |
@@ -1041,7 +1040,7 @@ discard block |
||
1041 | 1040 | */ |
1042 | 1041 | public function update_reg_step() { |
1043 | 1042 | // save everything |
1044 | - if ( $this->process_reg_step() ) { |
|
1043 | + if ($this->process_reg_step()) { |
|
1045 | 1044 | $this->checkout->redirect = TRUE; |
1046 | 1045 | $this->checkout->redirect_url = add_query_arg( |
1047 | 1046 | array( |
@@ -1050,7 +1049,7 @@ discard block |
||
1050 | 1049 | ), |
1051 | 1050 | $this->checkout->thank_you_page_url |
1052 | 1051 | ); |
1053 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1052 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1054 | 1053 | return TRUE; |
1055 | 1054 | } |
1056 | 1055 | return FALSE; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
45 | - * @return boolean |
|
45 | + * @return boolean|null |
|
46 | 46 | */ |
47 | 47 | public function initialize_reg_step() { |
48 | 48 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | |
171 | 171 | /** |
172 | - * @return boolean |
|
172 | + * @return boolean|null |
|
173 | 173 | */ |
174 | 174 | public function update_reg_step() { |
175 | 175 | EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Finalize_Registration |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step_Finalize_Registration |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Finalize_Registration extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param EE_Checkout $checkout |
21 | 21 | * @return \EE_SPCO_Reg_Step_Finalize_Registration |
22 | 22 | */ |
23 | - public function __construct( EE_Checkout $checkout ) { |
|
23 | + public function __construct(EE_Checkout $checkout) { |
|
24 | 24 | $this->_slug = 'finalize_registration'; |
25 | 25 | $this->_name = __('Finalize Registration', 'event_espresso'); |
26 | 26 | $this->_submit_button_text = $this->_name; |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | public function initialize_reg_step() { |
48 | 48 | |
49 | 49 | // there's actually no reg form to process if this is the final step |
50 | - if ( $this->is_current_step() ) { |
|
50 | + if ($this->is_current_step()) { |
|
51 | 51 | $this->checkout->step = $_REQUEST['step'] = $this->slug(); |
52 | - $this->checkout->action = $_REQUEST[ 'action' ] = 'process_reg_step'; |
|
52 | + $this->checkout->action = $_REQUEST['action'] = 'process_reg_step'; |
|
53 | 53 | $this->checkout->generate_reg_form = false; |
54 | 54 | } |
55 | 55 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function process_reg_step() { |
74 | 74 | // ensure all data gets refreshed from the db |
75 | - $this->checkout->refresh_all_entities( true ); |
|
75 | + $this->checkout->refresh_all_entities(true); |
|
76 | 76 | // ensures that all details and statuses for transaction, registration, and payments are updated |
77 | 77 | $txn_update_params = $this->_finalize_transaction(); |
78 | 78 | // DEBUG LOG |
@@ -87,16 +87,16 @@ discard block |
||
87 | 87 | // ) |
88 | 88 | //); |
89 | 89 | // set a hook point |
90 | - do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params ); |
|
90 | + do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params); |
|
91 | 91 | // check if transaction has a primary registrant and that it has a related Attendee object |
92 | - if ( $this->checkout->transaction_has_primary_registrant() ) { |
|
92 | + if ($this->checkout->transaction_has_primary_registrant()) { |
|
93 | 93 | // setup URL for redirect |
94 | 94 | $this->checkout->redirect_url = add_query_arg( |
95 | - array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ), |
|
95 | + array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()), |
|
96 | 96 | $this->checkout->thank_you_page_url |
97 | 97 | ); |
98 | 98 | } else { |
99 | - EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
99 | + EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
100 | 100 | $this->checkout->redirect = false; |
101 | 101 | $this->checkout->continue_reg = false; |
102 | 102 | return false; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | // you don't have to go home but you can't stay here ! |
105 | 105 | $this->checkout->redirect = true; |
106 | 106 | $this->checkout->continue_reg = true; |
107 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
107 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
108 | 108 | // mark this reg step as completed |
109 | 109 | $this->checkout->current_step->set_completed(); |
110 | 110 | $this->checkout->set_exit_spco(); |
@@ -120,21 +120,21 @@ discard block |
||
120 | 120 | */ |
121 | 121 | protected function _finalize_transaction() { |
122 | 122 | /** @type EE_Transaction_Processor $transaction_processor */ |
123 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
123 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
124 | 124 | //set revisit flag in txn processor |
125 | - $transaction_processor->set_revisit( $this->checkout->revisit ); |
|
125 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
126 | 126 | // at this point we'll consider a TXN to not have been abandoned |
127 | - $transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction ); |
|
128 | - if ( $this->checkout->cart instanceof EE_Cart ) { |
|
127 | + $transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction); |
|
128 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
129 | 129 | // save TXN data to the cart |
130 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
130 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
131 | 131 | } |
132 | 132 | /** @type EE_Transaction_Payments $transaction_payments */ |
133 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
133 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
134 | 134 | // maybe update status, but don't save transaction just yet |
135 | - $transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false ); |
|
135 | + $transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false); |
|
136 | 136 | // If the selected method of payment used an off-site gateway... |
137 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
137 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
138 | 138 | // if SPCO revisit and TXN status has changed due to a payment |
139 | 139 | //if ( |
140 | 140 | // filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN ) && |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | // add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
145 | 145 | //} |
146 | 146 | |
147 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) { |
|
148 | - $gateway= $this->checkout->payment_method->type_obj()->get_gateway(); |
|
149 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
147 | + if ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site()) { |
|
148 | + $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
149 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
150 | 150 | // do NOT trigger notifications because it was already done during the IPN |
151 | - remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' ); |
|
152 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
151 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
152 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
156 | 156 | // this will result in the base session properties getting saved to the TXN_Session_data field |
157 | - $this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true )); |
|
157 | + $this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true)); |
|
158 | 158 | // update the TXN if payment conditions have changed |
159 | 159 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
160 | 160 | $this->checkout->transaction, |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @return boolean |
170 | 170 | */ |
171 | 171 | public function update_reg_step() { |
172 | - EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
|
172 | + EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0'); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 |
@@ -4,14 +4,14 @@ discard block |
||
4 | 4 | */ |
5 | 5 | ?> |
6 | 6 | <h1> |
7 | - <?php _e( 'Reset/Delete Data for Event Espresso', 'event_espresso' );?> |
|
7 | + <?php _e('Reset/Delete Data for Event Espresso', 'event_espresso'); ?> |
|
8 | 8 | </h1> |
9 | 9 | <br /> |
10 | 10 | |
11 | 11 | <!-- reset DB url is here. Just need to make it look pretty and unhide it--> |
12 | 12 | <div class="padding"> |
13 | - <h3 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php _e('Reset Event Espresso Capabilities', 'event_espresso');?></h3> |
|
14 | - <p><?php _e('Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities. Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.', 'event_espresso');?></p> |
|
13 | + <h3 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php _e('Reset Event Espresso Capabilities', 'event_espresso'); ?></h3> |
|
14 | + <p><?php _e('Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities. Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.', 'event_espresso'); ?></p> |
|
15 | 15 | <div class="float-right"><?php echo $reset_capabilities_button; ?></div> |
16 | 16 | <div class="clear"></div> |
17 | 17 | </div> |
@@ -19,24 +19,24 @@ discard block |
||
19 | 19 | <br /> |
20 | 20 | |
21 | 21 | <div class="padding"> |
22 | - <h3 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php _e('Reset Event Espresso Tables', 'event_espresso');?></h3> |
|
23 | - <p><?php _e('Use this to reset Event Espresso Data and return your site to how it was just after first activating Event Espresso.', 'event_espresso');?></p> |
|
24 | - <div class="float-right"><a class="button button-primary" href="<?php echo $reset_db_url;?>"><?php _e('Reset Event Espresso Tables', 'event_espresso');?></a></div> |
|
22 | + <h3 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php _e('Reset Event Espresso Tables', 'event_espresso'); ?></h3> |
|
23 | + <p><?php _e('Use this to reset Event Espresso Data and return your site to how it was just after first activating Event Espresso.', 'event_espresso'); ?></p> |
|
24 | + <div class="float-right"><a class="button button-primary" href="<?php echo $reset_db_url; ?>"><?php _e('Reset Event Espresso Tables', 'event_espresso'); ?></a></div> |
|
25 | 25 | <div class="clear"></div> |
26 | 26 | </div> |
27 | 27 | <br /> |
28 | 28 | <br /> |
29 | 29 | |
30 | 30 | <div class="padding"> |
31 | - <h3 class="espresso-header"><span class="dashicons dashicons-post-trash ee-icon-size-22"></span><?php _e('Permanently Delete ALL Event Espresso Tables and Data', 'event_espresso');?></h3> |
|
32 | - <p><?php _e('If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', 'event_espresso');?></p> |
|
33 | - <p class="important-notice"><?php printf( __('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), '<strong>', '</strong>' ); ?><br/></p> |
|
31 | + <h3 class="espresso-header"><span class="dashicons dashicons-post-trash ee-icon-size-22"></span><?php _e('Permanently Delete ALL Event Espresso Tables and Data', 'event_espresso'); ?></h3> |
|
32 | + <p><?php _e('If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', 'event_espresso'); ?></p> |
|
33 | + <p class="important-notice"><?php printf(__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), '<strong>', '</strong>'); ?><br/></p> |
|
34 | 34 | <ol> |
35 | - <li><?php _e('First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database', 'event_espresso');?></li> |
|
36 | - <li><?php printf( __('Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s', 'event_espresso'), '<strong>', '</strong>' ); ?></li> |
|
37 | - <li><?php printf( __('Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s', 'event_espresso'), '<strong>', '</strong>' ); ?></li> |
|
35 | + <li><?php _e('First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database', 'event_espresso'); ?></li> |
|
36 | + <li><?php printf(__('Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s', 'event_espresso'), '<strong>', '</strong>'); ?></li> |
|
37 | + <li><?php printf(__('Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s', 'event_espresso'), '<strong>', '</strong>'); ?></li> |
|
38 | 38 | </ol> |
39 | - <div class="float-right"><a href="<?php echo $delete_db_url; ?>" id="delete-all-data-btn" class="button-primary"><?php _e('Permanently Delete All Event Espresso Data', 'event_espresso');?></a></div> |
|
39 | + <div class="float-right"><a href="<?php echo $delete_db_url; ?>" id="delete-all-data-btn" class="button-primary"><?php _e('Permanently Delete All Event Espresso Data', 'event_espresso'); ?></a></div> |
|
40 | 40 | <div class="clear"></div> |
41 | 41 | </div> |
42 | 42 | <br/> |
@@ -12,70 +12,70 @@ discard block |
||
12 | 12 | * @var $update_migration_script_page_link string |
13 | 13 | */ |
14 | 14 | |
15 | -if ( $show_backup_db_text ) { ?> |
|
16 | -<h1><span class="dashicons dashicons-migrate"></span><?php _e("Database Migration Manager", "event_espresso");?></h1> |
|
15 | +if ($show_backup_db_text) { ?> |
|
16 | +<h1><span class="dashicons dashicons-migrate"></span><?php _e("Database Migration Manager", "event_espresso"); ?></h1> |
|
17 | 17 | <?php } ?> |
18 | 18 | <div class="padding"> |
19 | 19 | <div id="migration-prep"> |
20 | 20 | |
21 | - <?php if ( $script_names ) { ?> |
|
21 | + <?php if ($script_names) { ?> |
|
22 | 22 | <h3 class="espresso-header"> |
23 | 23 | <span class="dashicons dashicons-flag ee-icon-size-22"></span> |
24 | - <?php echo apply_filters('FHEE__ee_migration_page__header', sprintf(__("Event Espresso has detected event data from version %s that can be migrated (updated) to work with version %s.", "event_espresso"),$current_db_state,$next_db_state),$current_db_state,$next_db_state);?> |
|
24 | + <?php echo apply_filters('FHEE__ee_migration_page__header', sprintf(__("Event Espresso has detected event data from version %s that can be migrated (updated) to work with version %s.", "event_espresso"), $current_db_state, $next_db_state), $current_db_state, $next_db_state); ?> |
|
25 | 25 | </h3> |
26 | 26 | <p> |
27 | - <?php echo apply_filters('FHEE__ee_migration_page__p_after_header',sprintf(__("Since you have already been using Event Espresso and have previous event and registration data in your database, you have the option to migrate, or copy over, this existing data into a format that is compatible with %s.", "event_espresso"),$next_db_state),$next_db_state);?> |
|
27 | + <?php echo apply_filters('FHEE__ee_migration_page__p_after_header', sprintf(__("Since you have already been using Event Espresso and have previous event and registration data in your database, you have the option to migrate, or copy over, this existing data into a format that is compatible with %s.", "event_espresso"), $next_db_state), $next_db_state); ?> |
|
28 | 28 | </p> |
29 | - <?php } elseif ( $show_most_recent_migration ) { ?> |
|
29 | + <?php } elseif ($show_most_recent_migration) { ?> |
|
30 | 30 | <h3 class="espresso-header"> |
31 | 31 | <span class="dashicons dashicons-awards ee-icon-size-22"></span> |
32 | - <?php echo apply_filters('FHEE__ee_migration_page__done_migration_header',sprintf(__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s', "event_espresso"),$ultimate_db_state));?> |
|
32 | + <?php echo apply_filters('FHEE__ee_migration_page__done_migration_header', sprintf(__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s', "event_espresso"), $ultimate_db_state)); ?> |
|
33 | 33 | </h3> |
34 | 34 | <p> |
35 | - <?php echo apply_filters('FHEE__ee_migration_page__p_after_done_migration_header',sprintf(__("Time to find out about all the great new features %s has to offer.", "event_espresso"),$ultimate_db_state));?> |
|
36 | - <b><a id="get-started-after-migrate" class="button-primary" href="<?php echo add_query_arg( array( 'page' => 'espresso_about' ), admin_url( 'admin.php' )); ?>"> |
|
37 | - <?php _e("Let's Get Started", "event_espresso");?> <span class="dashicons dashicons-arrow-right ee-icon-size-22" style="margin:0;"></span> |
|
35 | + <?php echo apply_filters('FHEE__ee_migration_page__p_after_done_migration_header', sprintf(__("Time to find out about all the great new features %s has to offer.", "event_espresso"), $ultimate_db_state)); ?> |
|
36 | + <b><a id="get-started-after-migrate" class="button-primary" href="<?php echo add_query_arg(array('page' => 'espresso_about'), admin_url('admin.php')); ?>"> |
|
37 | + <?php _e("Let's Get Started", "event_espresso"); ?> <span class="dashicons dashicons-arrow-right ee-icon-size-22" style="margin:0;"></span> |
|
38 | 38 | </a></b> |
39 | 39 | </p> |
40 | 40 | <?php } ?> |
41 | 41 | |
42 | 42 | |
43 | - <?php if ($show_backup_db_text){ ?> |
|
43 | + <?php if ($show_backup_db_text) { ?> |
|
44 | 44 | <div id="migration-options-dv"> |
45 | 45 | <h2> |
46 | 46 | <span class="dashicons dashicons-admin-tools"></span> |
47 | - <?php _e("Migration Options", "event_espresso");?> |
|
48 | - <span class="tiny-text lt-grey-text"> <?php _e(' to migrate or not to migrate?', "event_espresso");?></span> |
|
47 | + <?php _e("Migration Options", "event_espresso"); ?> |
|
48 | + <span class="tiny-text lt-grey-text"> <?php _e(' to migrate or not to migrate?', "event_espresso"); ?></span> |
|
49 | 49 | </h2> |
50 | 50 | <div class="ee-table-wrap"> |
51 | 51 | <table> |
52 | 52 | <tbody> |
53 | 53 | <tr> |
54 | - <td><h3><?php _e('1', 'event_espresso');?></h3></td> |
|
54 | + <td><h3><?php _e('1', 'event_espresso'); ?></h3></td> |
|
55 | 55 | <td> |
56 | 56 | <?php |
57 | - echo apply_filters('FHEE__ee_migration_page__option_1_main',sprintf( |
|
57 | + echo apply_filters('FHEE__ee_migration_page__option_1_main', sprintf( |
|
58 | 58 | __('%1$sYes. I have backed up my database%2$s, %3$sunderstand the risks involved%4$s, and am ready to migrate my existing %5$s data to %6$s.', "event_espresso"), |
59 | 59 | '<strong>', |
60 | 60 | '</strong>', |
61 | - '<a id="migration-risks" class="" title="' . esc_attr__('click for more details', "event_espresso") . '">', |
|
61 | + '<a id="migration-risks" class="" title="'.esc_attr__('click for more details', "event_espresso").'">', |
|
62 | 62 | '</a>', |
63 | 63 | $current_db_state, |
64 | 64 | $next_db_state |
65 | - ),$current_db_state,$next_db_state); |
|
65 | + ), $current_db_state, $next_db_state); |
|
66 | 66 | ?> |
67 | - <a id="display-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="migration-details" ><?php _e('click for more details', "event_espresso");?> +</a> |
|
68 | - <a id="hide-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="migration-details" style="display:none;" ><?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?></a> |
|
67 | + <a id="display-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="migration-details" ><?php _e('click for more details', "event_espresso"); ?> +</a> |
|
68 | + <a id="hide-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="migration-details" style="display:none;" ><?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?></a> |
|
69 | 69 | </td> |
70 | 70 | <td> |
71 | - <a id="db-backed-up" class="toggle-migration-monitor button-primary"><?php echo apply_filters('FHEE__ee_migration_page__option_1_button_text',sprintf(__("Migrate My %s Data to %s", "event_espresso"),$current_db_state,$next_db_state),$current_db_state,$next_db_state);?></a> |
|
71 | + <a id="db-backed-up" class="toggle-migration-monitor button-primary"><?php echo apply_filters('FHEE__ee_migration_page__option_1_button_text', sprintf(__("Migrate My %s Data to %s", "event_espresso"), $current_db_state, $next_db_state), $current_db_state, $next_db_state); ?></a> |
|
72 | 72 | </td> |
73 | 73 | </tr> |
74 | 74 | <tr> |
75 | 75 | <td colspan="3" style="padding: 0"> |
76 | 76 | <div id="migration-details-dv" style="display: none; padding: 1em;"> |
77 | 77 | |
78 | - <span class="reminder-spn"><?php printf(__("%s Important: %s Before migrating, please back up your database and files.", "event_espresso"),"<b>","</b>");?></span> |
|
78 | + <span class="reminder-spn"><?php printf(__("%s Important: %s Before migrating, please back up your database and files.", "event_espresso"), "<b>", "</b>"); ?></span> |
|
79 | 79 | <p> |
80 | 80 | <?php |
81 | 81 | printf( |
@@ -91,27 +91,27 @@ discard block |
||
91 | 91 | ); |
92 | 92 | ?> |
93 | 93 | </p> |
94 | - <?php do_action('AHEE__ee_migration_page__option_1_extra_details');?> |
|
94 | + <?php do_action('AHEE__ee_migration_page__option_1_extra_details'); ?> |
|
95 | 95 | </div> |
96 | 96 | </td> |
97 | 97 | </tr> |
98 | 98 | <tr> |
99 | - <td><h3><?php _e('2', 'event_espresso');?></h3></td> |
|
99 | + <td><h3><?php _e('2', 'event_espresso'); ?></h3></td> |
|
100 | 100 | <td> |
101 | - <?php echo apply_filters( 'FHEE__ee_migration_page__option_2_main',sprintf(__('I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.', "event_espresso"),$current_db_state,$next_db_state,$ultimate_db_state),$current_db_state,$next_db_state,$ultimate_db_state);?><br /> |
|
102 | - <span class="reminder-spn"><?php _e( 'Please Note: In order to avoid errors, any existing Event Espresso data (events, ticket, registrations, etc) in your db will be erased! Regular WP data will NOT be affected.', 'event_espresso' );?></span> |
|
103 | - <a id="display-no-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details"><?php _e('click for more details', "event_espresso");?> +</a> |
|
104 | - <a id="hide-no-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details" style="display:none;" ><?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?></a> |
|
101 | + <?php echo apply_filters('FHEE__ee_migration_page__option_2_main', sprintf(__('I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.', "event_espresso"), $current_db_state, $next_db_state, $ultimate_db_state), $current_db_state, $next_db_state, $ultimate_db_state); ?><br /> |
|
102 | + <span class="reminder-spn"><?php _e('Please Note: In order to avoid errors, any existing Event Espresso data (events, ticket, registrations, etc) in your db will be erased! Regular WP data will NOT be affected.', 'event_espresso'); ?></span> |
|
103 | + <a id="display-no-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details"><?php _e('click for more details', "event_espresso"); ?> +</a> |
|
104 | + <a id="hide-no-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details" style="display:none;" ><?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?></a> |
|
105 | 105 | </td> |
106 | 106 | <td> |
107 | - <a id="do-not-migrate" class="do-not-migrate button-primary" href="<?php echo $reset_db_page_link;?>"><?php echo apply_filters('FHEE__ee_migration_page__option_2_button_text',sprintf(__("Just Start %s and Delete Existing Data", "event_espresso"),$ultimate_db_state),$ultimate_db_state);?></a> |
|
107 | + <a id="do-not-migrate" class="do-not-migrate button-primary" href="<?php echo $reset_db_page_link; ?>"><?php echo apply_filters('FHEE__ee_migration_page__option_2_button_text', sprintf(__("Just Start %s and Delete Existing Data", "event_espresso"), $ultimate_db_state), $ultimate_db_state); ?></a> |
|
108 | 108 | </td> |
109 | 109 | </tr> |
110 | 110 | <tr> |
111 | 111 | <td colspan="3" style="padding: 0"> |
112 | 112 | <div id="no-migration-details-dv" style="display: none; padding: 1em;"> |
113 | 113 | <p> |
114 | - <?php echo apply_filters('FHEE__ee_migration_page__option_2_details',sprintf(__("If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.", "event_espresso"),$ultimate_db_state),$ultimate_db_state);?> |
|
114 | + <?php echo apply_filters('FHEE__ee_migration_page__option_2_details', sprintf(__("If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.", "event_espresso"), $ultimate_db_state), $ultimate_db_state); ?> |
|
115 | 115 | </p> |
116 | 116 | </div> |
117 | 117 | </td> |
@@ -119,20 +119,20 @@ discard block |
||
119 | 119 | </tbody> |
120 | 120 | </table> |
121 | 121 | </div> |
122 | - <?php do_action('AHEE__ee_migration_page__after_migration_options_table');?> |
|
122 | + <?php do_action('AHEE__ee_migration_page__after_migration_options_table'); ?> |
|
123 | 123 | </div> |
124 | 124 | <?php } ?> |
125 | 125 | |
126 | 126 | <?php |
127 | - if ( $show_most_recent_migration ) { |
|
128 | - if( $most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base ) { |
|
129 | - if( $most_recent_migration->can_continue() ) { |
|
127 | + if ($show_most_recent_migration) { |
|
128 | + if ($most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base) { |
|
129 | + if ($most_recent_migration->can_continue()) { |
|
130 | 130 | //tell the user they shoudl continue their migration because it appears to be unfinished... well, assuming there were no errors ?> |
131 | 131 | <h3 class="espresso-header"> |
132 | 132 | <span class="dashicons dashicons-star-half ee-icon-size-22"></span> |
133 | - <?php printf(__("It appears that your previous Data Migration Task (%s) is incomplete, and should be resumed", "event_espresso"),$most_recent_migration->pretty_name());?> |
|
133 | + <?php printf(__("It appears that your previous Data Migration Task (%s) is incomplete, and should be resumed", "event_espresso"), $most_recent_migration->pretty_name()); ?> |
|
134 | 134 | </h3> |
135 | - <?php } elseif ( $most_recent_migration->is_broken() ) { |
|
135 | + <?php } elseif ($most_recent_migration->is_broken()) { |
|
136 | 136 | //tell the user the migration failed and they should notify EE?> |
137 | 137 | <h3 class="espresso-header"> |
138 | 138 | <span class="dashicons dashicons-no ee-icon-size-22"></span> |
@@ -141,19 +141,19 @@ discard block |
||
141 | 141 | <?php } |
142 | 142 | |
143 | 143 | //display errors or not of the most recent migration ran |
144 | - if ( $most_recent_migration->get_errors() ){ ?> |
|
144 | + if ($most_recent_migration->get_errors()) { ?> |
|
145 | 145 | <div class="ee-attention"> |
146 | - <strong><?php printf(__("Warnings occurred during your last migration (%s):",'event_espresso'),$most_recent_migration->pretty_name()) ?></strong> |
|
147 | - <a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Warnings", 'event_espresso');?></a> |
|
146 | + <strong><?php printf(__("Warnings occurred during your last migration (%s):", 'event_espresso'), $most_recent_migration->pretty_name()) ?></strong> |
|
147 | + <a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Warnings", 'event_espresso'); ?></a> |
|
148 | 148 | <ul class="migration-warnings" style="display:none"> |
149 | - <?php foreach($most_recent_migration->get_errors() as $error){ ?> |
|
149 | + <?php foreach ($most_recent_migration->get_errors() as $error) { ?> |
|
150 | 150 | <li><?php echo $error ?></li> |
151 | 151 | <?php }?> |
152 | 152 | </ul> |
153 | 153 | </div> |
154 | 154 | <?php } else { |
155 | 155 | //there were no errors during the last migration, just say so?> |
156 | - <h2><?php printf(__("The last data migration task (%s) ran successfully without errors.", "event_espresso"),$most_recent_migration->pretty_name())?></h2> |
|
156 | + <h2><?php printf(__("The last data migration task (%s) ran successfully without errors.", "event_espresso"), $most_recent_migration->pretty_name())?></h2> |
|
157 | 157 | <?php } |
158 | 158 | } else { |
159 | 159 | } |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | </div> |
165 | 165 | <!--end of #migration-prep--> |
166 | 166 | |
167 | - <?php if ($show_migration_progress){?> |
|
167 | + <?php if ($show_migration_progress) {?> |
|
168 | 168 | <div id='migration-monitor' <?php echo $show_backup_db_text ? "style='display:none'" : ''?>> |
169 | - <?php if( $show_backup_db_text){?> |
|
169 | + <?php if ($show_backup_db_text) {?> |
|
170 | 170 | <p> |
171 | 171 | <a class="toggle-migration-monitor small-text" style="cursor: pointer;"> |
172 | - <span class="dashicons dashicons-arrow-left-alt2" style="top:0px;"></span><?php _e("return to previous screen", "event_espresso");?> |
|
172 | + <span class="dashicons dashicons-arrow-left-alt2" style="top:0px;"></span><?php _e("return to previous screen", "event_espresso"); ?> |
|
173 | 173 | </a> |
174 | 174 | <br/> |
175 | 175 | |
@@ -178,33 +178,33 @@ discard block |
||
178 | 178 | <div id='progress-area'> |
179 | 179 | <h3 class="espresso-header"> |
180 | 180 | <?php |
181 | - echo sprintf( _n( |
|
181 | + echo sprintf(_n( |
|
182 | 182 | "In order to import all of your existing Event Espresso data, the following upgrade task needs to be performed:", |
183 | 183 | "In order to import all of your existing Event Espresso data, the following %s upgrade tasks need to be performed:", |
184 | 184 | count($script_names), |
185 | 185 | "event_espresso" |
186 | - ), count( $script_names ) );?> |
|
186 | + ), count($script_names)); ?> |
|
187 | 187 | </h3> |
188 | 188 | <ul style="list-style: inside;"> |
189 | - <?php foreach($script_names as $script_name){?> |
|
189 | + <?php foreach ($script_names as $script_name) {?> |
|
190 | 190 | <li style="margin: 0 0 1em 1em; line-height: 1.1em;"><?php echo $script_name?></li> |
191 | 191 | <?php }?> |
192 | 192 | </ul> |
193 | 193 | <br/> |
194 | 194 | <?php if (count($script_names) > 1) {?> |
195 | - <p><?php _e("Please note: after each task is completed you will need to continue the data migration, or report an error to Event Espresso.", "event_espresso");?></p> |
|
195 | + <p><?php _e("Please note: after each task is completed you will need to continue the data migration, or report an error to Event Espresso.", "event_espresso"); ?></p> |
|
196 | 196 | <?php }?> |
197 | 197 | |
198 | 198 | <div class="ee-attention"> |
199 | 199 | <p> |
200 | 200 | <span class="reminder-spn"> |
201 | - <strong><?php _e("Please Note:", "event_espresso");?></strong> |
|
201 | + <strong><?php _e("Please Note:", "event_espresso"); ?></strong> |
|
202 | 202 | </span> |
203 | 203 | <br/> |
204 | - <?php _e("Depending on the number of events and the complexity of the information in your database, this could take a few minutes.", "event_espresso");?> |
|
204 | + <?php _e("Depending on the number of events and the complexity of the information in your database, this could take a few minutes.", "event_espresso"); ?> |
|
205 | 205 | </p> |
206 | 206 | <p> |
207 | - <?php printf(__("%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.", "event_espresso"),'<strong>', '</strong>' );?> |
|
207 | + <?php printf(__("%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.", "event_espresso"), '<strong>', '</strong>'); ?> |
|
208 | 208 | </p> |
209 | 209 | <p> |
210 | 210 | <?php _e("Click the button below to begin the migration process.", "event_espresso") ?> |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | <!-- #progress-responsive --> |
220 | 220 | |
221 | 221 | <button id='start-migration' class='button-primary'> |
222 | - <?php echo $show_continue_current_migration_script ? __("Continue Migration", "event_espresso") : __("Begin Migration", "event_espresso");?> |
|
222 | + <?php echo $show_continue_current_migration_script ? __("Continue Migration", "event_espresso") : __("Begin Migration", "event_espresso"); ?> |
|
223 | 223 | </button> |
224 | 224 | <br class="clear"/> |
225 | 225 | |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | </div> |
236 | 236 | |
237 | 237 | <?php } |
238 | - if ( $show_maintenance_switch ) { |
|
238 | + if ($show_maintenance_switch) { |
|
239 | 239 | ?> |
240 | - <h2><span class="dashicons dashicons-admin-tools"></span><?php _e('Set Event Espresso Maintenance Mode', 'event_espresso');?></h2> |
|
240 | + <h2><span class="dashicons dashicons-admin-tools"></span><?php _e('Set Event Espresso Maintenance Mode', 'event_espresso'); ?></h2> |
|
241 | 241 | <form method='post' action='<?php echo $update_migration_script_page_link?>'> |
242 | 242 | <div class="ee-table-wrap"> |
243 | 243 | <table> |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | <input type="radio" id="maintenance_mode_level_off" name="maintenance_mode_level" value="0" <?php echo EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_0_not_in_maintenance ? 'checked="checked"' : ''?>> |
247 | 247 | </td> |
248 | 248 | <th align="left"> |
249 | - <label for="maintenance_mode_level_off"><?php _e('Maintenance Mode OFF', 'event_espresso');?></label> |
|
249 | + <label for="maintenance_mode_level_off"><?php _e('Maintenance Mode OFF', 'event_espresso'); ?></label> |
|
250 | 250 | <p class='description' style="font-weight: normal;"> |
251 | - <?php _e("This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.", "event_espresso");?> |
|
251 | + <?php _e("This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.", "event_espresso"); ?> |
|
252 | 252 | </p> |
253 | 253 | </th> |
254 | 254 | </tr> |
@@ -261,14 +261,14 @@ discard block |
||
261 | 261 | <?php _e('Maintenance Mode ON', 'event_espresso')?> |
262 | 262 | </label> |
263 | 263 | <p class='description' style="font-weight: normal;"> |
264 | - <?php _e("This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.", "event_espresso");?> |
|
264 | + <?php _e("This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.", "event_espresso"); ?> |
|
265 | 265 | </p> |
266 | 266 | </th> |
267 | 267 | </tr> |
268 | 268 | </table> |
269 | 269 | </div> |
270 | 270 | <p> |
271 | - <input type='submit' class="button-primary" value='<?php _e("Update Maintenance Mode", "event_espresso");?>'> |
|
271 | + <input type='submit' class="button-primary" value='<?php _e("Update Maintenance Mode", "event_espresso"); ?>'> |
|
272 | 272 | </p> |
273 | 273 | </form> |
274 | 274 | <?php |