@@ -154,12 +154,12 @@ |
||
154 | 154 | <td class="item_r"><?php echo $line_item->total_no_code();?></td> |
155 | 155 | </tr> |
156 | 156 | <?php break; |
157 | - case EEM_Line_Item::type_tax: |
|
158 | - ?> |
|
157 | + case EEM_Line_Item::type_tax: |
|
158 | + ?> |
|
159 | 159 | <tr class="item sub-item tax-total"> |
160 | 160 | <td class="item_l"><?php echo $line_item->name(); ?></td> |
161 | 161 | <?php if ($show_line_item_description){?><td class="item_l"><?php echo $line_item->desc() ?></td><?php }?> |
162 | - <td colspan="2" class="item_c"><?php echo $line_item->percent(); ?>%</td> |
|
162 | + <td colspan="2" class="item_c"><?php echo $line_item->percent(); ?>%</td> |
|
163 | 163 | |
164 | 164 | <td class="item_r"><?php echo $line_item->total_no_code();?></td> |
165 | 165 | </tr><?php break; |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | </div> |
46 | 46 | <!--#client-details vcard--> |
47 | 47 | |
48 | - <h2><?php _e("Purchases",'event_espresso')?></h2> |
|
48 | + <h2><?php _e("Purchases", 'event_espresso')?></h2> |
|
49 | 49 | <table class="invoice-amount"> |
50 | 50 | |
51 | 51 | <thead> |
52 | 52 | <tr class="header_row"> |
53 | 53 | <th class="left ticket_th"><?php _e('Item', 'event_espresso'); ?></th> |
54 | - <?php if ($show_line_item_description){?><th class="left event_th"><?php _e('Description', 'event_espresso'); ?></th><?php }?> |
|
54 | + <?php if ($show_line_item_description) {?><th class="left event_th"><?php _e('Description', 'event_espresso'); ?></th><?php }?> |
|
55 | 55 | <th class="quantity_th"><?php _e('Qty', 'event_espresso'); ?></th> |
56 | 56 | <th class="left event_th"><?php _e('Price', 'event_espresso'); ?></th> |
57 | 57 | <th class="subtotal_th item_r"><?php _e('Total', 'event_espresso'); ?></th> |
@@ -65,56 +65,56 @@ discard block |
||
65 | 65 | * @param EE_Line_Item $line_item |
66 | 66 | * @param boolean $odd for indicating whether to style this line item as an 'odd' or 'even' |
67 | 67 | */ |
68 | - function ee_invoice_display_line_item(EE_Line_Item $line_item, $show_line_item_description, $odd = false){ |
|
69 | - switch($line_item->type()){ |
|
68 | + function ee_invoice_display_line_item(EE_Line_Item $line_item, $show_line_item_description, $odd = false) { |
|
69 | + switch ($line_item->type()) { |
|
70 | 70 | case EEM_Line_Item::type_total: |
71 | - foreach($line_item->children() as $child_line_item){ |
|
72 | - ee_invoice_display_line_item($child_line_item,$show_line_item_description); |
|
71 | + foreach ($line_item->children() as $child_line_item) { |
|
72 | + ee_invoice_display_line_item($child_line_item, $show_line_item_description); |
|
73 | 73 | }?> |
74 | 74 | <tr><td colspan="<?php echo $show_line_item_description ? 5 : 4 ?>"><hr></td></tr> |
75 | 75 | <tr class="total_tr odd"> |
76 | 76 | <td colspan="<?php echo $show_line_item_description ? 2 : 1 ?>"> </td> |
77 | 77 | <td colspan="2" class="total" id="total_currency"><?php _e('Total', 'event_espresso'); ?></td> |
78 | - <td class="total"><?php echo $line_item->total_no_code();?></td> |
|
78 | + <td class="total"><?php echo $line_item->total_no_code(); ?></td> |
|
79 | 79 | </tr> |
80 | 80 | <?php break; |
81 | 81 | |
82 | 82 | |
83 | 83 | case EEM_Line_Item::type_sub_total: |
84 | - foreach($line_item->children() as $child_line_item){ |
|
84 | + foreach ($line_item->children() as $child_line_item) { |
|
85 | 85 | //$odd = !$odd; |
86 | - ee_invoice_display_line_item($child_line_item,$show_line_item_description,$odd); |
|
86 | + ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); |
|
87 | 87 | }?> |
88 | 88 | <tr class="total_tr odd"> |
89 | 89 | <td colspan="<?php echo $show_line_item_description ? 2 : 1 ?>"> </td> |
90 | 90 | <td colspan="2" class="total" id="total_currency"><?php _e('Sub-Total', 'event_espresso'); ?></td> |
91 | - <td class="total"><?php echo $line_item->total_no_code();?></td> |
|
91 | + <td class="total"><?php echo $line_item->total_no_code(); ?></td> |
|
92 | 92 | </tr> |
93 | 93 | <?php break; |
94 | 94 | |
95 | 95 | |
96 | 96 | case EEM_Line_Item::type_tax_sub_total: |
97 | - foreach($line_item->children() as $child_line_item){ |
|
98 | - $odd = !$odd; |
|
97 | + foreach ($line_item->children() as $child_line_item) { |
|
98 | + $odd = ! $odd; |
|
99 | 99 | ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); |
100 | 100 | }?> |
101 | 101 | <tr class="total_tr odd"> |
102 | 102 | <td colspan="<?php echo $show_line_item_description ? 2 : 1 ?>"> </td> |
103 | 103 | <td colspan="2" class="total" id="total_currency"><?php _e('Tax Total', 'event_espresso'); ?></td> |
104 | - <td class="total"><?php echo $line_item->total_no_code();?></td> |
|
104 | + <td class="total"><?php echo $line_item->total_no_code(); ?></td> |
|
105 | 105 | </tr> |
106 | 106 | <?php break; |
107 | 107 | |
108 | 108 | |
109 | 109 | case EEM_Line_Item::type_line_item: |
110 | 110 | $subitems = $line_item->children(); |
111 | - $has_subitems = count($subitems) > 1 ; |
|
112 | - if($has_subitems){ |
|
111 | + $has_subitems = count($subitems) > 1; |
|
112 | + if ($has_subitems) { |
|
113 | 113 | ?> |
114 | - <tr class="item <?php echo $odd ? 'odd' : ''; ?>"> |
|
114 | + <tr class="item <?php echo $odd ? 'odd' : ''; ?>"> |
|
115 | 115 | <td class="item_l"><?php echo $line_item->name() ?></td> |
116 | - <?php if ($show_line_item_description){?><td class="item_l"><?php echo $line_item->desc() ?></td><?php }?> |
|
117 | - <td class="item_l"><?php echo $line_item->quantity();?></td> |
|
116 | + <?php if ($show_line_item_description) {?><td class="item_l"><?php echo $line_item->desc() ?></td><?php }?> |
|
117 | + <td class="item_l"><?php echo $line_item->quantity(); ?></td> |
|
118 | 118 | |
119 | 119 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
120 | 120 | |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | <?php //<td class="item_l"><?php $datetimes_strings = array(); foreach($datetimes as $datetime){ $datetimes_strings[]= $datetime->start_date_and_time();} echo implode(", ",$datetimes_strings); ?> |
123 | 123 | </tr> |
124 | 124 | <?php |
125 | - if( $has_subitems ){ |
|
126 | - foreach($line_item->children() as $child_line_item){ |
|
127 | - ee_invoice_display_line_item($child_line_item,$show_line_item_description, $odd); |
|
125 | + if ($has_subitems) { |
|
126 | + foreach ($line_item->children() as $child_line_item) { |
|
127 | + ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); |
|
128 | 128 | } |
129 | 129 | } |
130 | - }else{//no subitems - just show this line item ?> |
|
131 | - <tr class="item <?php echo $odd ? 'odd' : ''; ?>"> |
|
130 | + } else {//no subitems - just show this line item ?> |
|
131 | + <tr class="item <?php echo $odd ? 'odd' : ''; ?>"> |
|
132 | 132 | <td class="item_l"><?php echo $line_item->name()?></td> |
133 | - <?php if ($show_line_item_description){?><td class="item_l"><?php echo $line_item->desc() ?></td><?php }?> |
|
133 | + <?php if ($show_line_item_description) {?><td class="item_l"><?php echo $line_item->desc() ?></td><?php }?> |
|
134 | 134 | <td class="item_l"><?php echo $line_item->quantity()?></td> |
135 | 135 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
136 | 136 | <td class="item_r"> <?php echo $line_item->total_no_code(); echo $line_item->is_taxable() ? '*' : ''?> </td> |
@@ -143,32 +143,32 @@ discard block |
||
143 | 143 | ?> |
144 | 144 | <tr class="item subitem-row"> |
145 | 145 | <td class="item_l subitem"><?php echo $line_item->name(); ?></td> |
146 | - <?php if ($show_line_item_description){?><td class="item_l"><?php echo $line_item->desc() ?></td><?php }?> |
|
146 | + <?php if ($show_line_item_description) {?><td class="item_l"><?php echo $line_item->desc() ?></td><?php }?> |
|
147 | 147 | <?php if ($line_item->is_percent()) { ?> |
148 | 148 | <td></td> |
149 | - <td class="item_c"><?php echo $line_item->percent();?>%</td> |
|
150 | - <?php }else{//flat discount/surcharge ?> |
|
149 | + <td class="item_c"><?php echo $line_item->percent(); ?>%</td> |
|
150 | + <?php } else {//flat discount/surcharge ?> |
|
151 | 151 | <td></td> |
152 | - <td class="item_c"><?php echo $line_item->unit_price_no_code();?></td> |
|
152 | + <td class="item_c"><?php echo $line_item->unit_price_no_code(); ?></td> |
|
153 | 153 | <?php } ?> |
154 | - <td class="item_r"><?php echo $line_item->total_no_code();?></td> |
|
154 | + <td class="item_r"><?php echo $line_item->total_no_code(); ?></td> |
|
155 | 155 | </tr> |
156 | 156 | <?php break; |
157 | 157 | case EEM_Line_Item::type_tax: |
158 | 158 | ?> |
159 | 159 | <tr class="item sub-item tax-total"> |
160 | 160 | <td class="item_l"><?php echo $line_item->name(); ?></td> |
161 | - <?php if ($show_line_item_description){?><td class="item_l"><?php echo $line_item->desc() ?></td><?php }?> |
|
161 | + <?php if ($show_line_item_description) {?><td class="item_l"><?php echo $line_item->desc() ?></td><?php }?> |
|
162 | 162 | <td colspan="2" class="item_c"><?php echo $line_item->percent(); ?>%</td> |
163 | 163 | |
164 | - <td class="item_r"><?php echo $line_item->total_no_code();?></td> |
|
164 | + <td class="item_r"><?php echo $line_item->total_no_code(); ?></td> |
|
165 | 165 | </tr><?php break; |
166 | 166 | } |
167 | 167 | } |
168 | - $c=false; |
|
168 | + $c = false; |
|
169 | 169 | /* @var $transaction EE_Transaction */ |
170 | 170 | $total_line_item = $transaction->total_line_item(); |
171 | - ee_invoice_display_line_item($total_line_item,$show_line_item_description); |
|
171 | + ee_invoice_display_line_item($total_line_item, $show_line_item_description); |
|
172 | 172 | /* foreach($transaction->registrations() as $registration){ |
173 | 173 | ?> |
174 | 174 | <tr class="item <?php echo ($c = !$c) ? ' odd' : ''; ?>"> |
@@ -183,13 +183,13 @@ discard block |
||
183 | 183 | </tbody> |
184 | 184 | |
185 | 185 | </table> |
186 | - <p><?php _e("* taxable items", "event_espresso");?></p> |
|
187 | - <h2><?php _e("Payments",'event_espresso')?></h2> |
|
186 | + <p><?php _e("* taxable items", "event_espresso"); ?></p> |
|
187 | + <h2><?php _e("Payments", 'event_espresso')?></h2> |
|
188 | 188 | <table class="invoice-amount"> |
189 | 189 | <thead> |
190 | 190 | <tr class="header_row"> |
191 | 191 | <th ><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th> |
192 | - <th class='left datetime_th'><?php _e("Date",'event_espresso')?></th> |
|
192 | + <th class='left datetime_th'><?php _e("Date", 'event_espresso')?></th> |
|
193 | 193 | <th ><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th> |
194 | 194 | <th ><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th> |
195 | 195 | <th ><span class=""><?php _e('Status', 'event_espresso'); ?></span></th> |
@@ -199,29 +199,29 @@ discard block |
||
199 | 199 | <tbody> |
200 | 200 | <?php |
201 | 201 | $c = false; |
202 | - if(!empty($payments)){ |
|
202 | + if ( ! empty($payments)) { |
|
203 | 203 | |
204 | - foreach($payments as $payment){ |
|
204 | + foreach ($payments as $payment) { |
|
205 | 205 | /* @var $payment EE_Payment */?> |
206 | - <tr class='item <?php echo (($c = !$c) ? ' odd' : '')?>'> |
|
206 | + <tr class='item <?php echo (($c = ! $c) ? ' odd' : '')?>'> |
|
207 | 207 | <td><?php $payment->e('PAY_gateway')?></td> |
208 | 208 | <td><?php echo $payment->timestamp('D M j, Y')?></td> |
209 | 209 | <td><?php $payment->e('PAY_txn_id_chq_nmbr')?></td> |
210 | 210 | <td><?php $payment->e('PAY_po_number')?></td> |
211 | 211 | <td><?php $payment->e_pretty_status()?></td> |
212 | - <td class='item_r'><?php echo EEH_Template::format_currency($payment->amount());?></td> |
|
212 | + <td class='item_r'><?php echo EEH_Template::format_currency($payment->amount()); ?></td> |
|
213 | 213 | </tr> |
214 | 214 | <?php } |
215 | - }else{?> |
|
215 | + } else {?> |
|
216 | 216 | <tr class='item'> |
217 | - <td class='aln-cntr' colspan=6><?php _e("No approved payments have been received",'event_espresso')?></td> |
|
217 | + <td class='aln-cntr' colspan=6><?php _e("No approved payments have been received", 'event_espresso')?></td> |
|
218 | 218 | </tr> |
219 | 219 | <?php } |
220 | 220 | ?> |
221 | 221 | </tbody> |
222 | 222 | <tfoot> |
223 | 223 | <tr class='total_tr'><td colspan="4"></td> |
224 | - <td class="item_r"><?php _e('Total Paid','event_espresso')?></td> |
|
224 | + <td class="item_r"><?php _e('Total Paid', 'event_espresso')?></td> |
|
225 | 225 | <td class="item_r"><?php echo EEH_Template::format_currency($amount_pd)?> </td> |
226 | 226 | </tr> |
227 | 227 | <?php //echo $discount; ?> |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | ee_invoice_display_line_item($child_line_item,$show_line_item_description, $odd); |
128 | 128 | } |
129 | 129 | } |
130 | - }else{//no subitems - just show this line item ?> |
|
130 | + } else{//no subitems - just show this line item ?> |
|
131 | 131 | <tr class="item <?php echo $odd ? 'odd' : ''; ?>"> |
132 | 132 | <td class="item_l"><?php echo $line_item->name()?></td> |
133 | 133 | <?php if ($show_line_item_description){?><td class="item_l"><?php echo $line_item->desc() ?></td><?php }?> |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | <?php if ($line_item->is_percent()) { ?> |
148 | 148 | <td></td> |
149 | 149 | <td class="item_c"><?php echo $line_item->percent();?>%</td> |
150 | - <?php }else{//flat discount/surcharge ?> |
|
150 | + <?php } else{//flat discount/surcharge ?> |
|
151 | 151 | <td></td> |
152 | 152 | <td class="item_c"><?php echo $line_item->unit_price_no_code();?></td> |
153 | 153 | <?php } ?> |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | <td class='item_r'><?php echo EEH_Template::format_currency($payment->amount());?></td> |
213 | 213 | </tr> |
214 | 214 | <?php } |
215 | - }else{?> |
|
215 | + } else{?> |
|
216 | 216 | <tr class='item'> |
217 | 217 | <td class='aln-cntr' colspan=6><?php _e("No approved payments have been received",'event_espresso')?></td> |
218 | 218 | </tr> |
@@ -6,7 +6,7 @@ |
||
6 | 6 | <!-- Base Stylesheet do not change or remove --> |
7 | 7 | <link rel="stylesheet" type="text/css" href="[base_url]base.css" media="screen" /> |
8 | 8 | <!-- Print Style Sheet --> |
9 | -<link rel="stylesheet" type="text/css" href="[base_url]css/print/<?php echo str_replace('.css', '',$invoice_css); ?>_print.css" media="print" /> |
|
9 | +<link rel="stylesheet" type="text/css" href="[base_url]css/print/<?php echo str_replace('.css', '', $invoice_css); ?>_print.css" media="print" /> |
|
10 | 10 | <!-- Primary Style Sheet --> |
11 | 11 | <link rel="stylesheet" type="text/css" href="[base_url]css/<?php echo $invoice_css; ?>" /> |
12 | 12 | <!-- Make sure the buttons don't print --> |
@@ -36,53 +36,53 @@ discard block |
||
36 | 36 | <h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso')?></h2> |
37 | 37 | <h3 id="invoice-date"><?php _e('Date:', 'event_espresso')?> <span class="plain-text">[registration_date]</span></h3> |
38 | 38 | <h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso')?> <span class="plain-text">[transaction_id]</span></h3> |
39 | - <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status();?></span></h3> |
|
39 | + <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status(); ?></span></h3> |
|
40 | 40 | </div> |
41 | 41 | </td> |
42 | 42 | </tr> |
43 | 43 | </table> |
44 | 44 | <div class="events"> |
45 | - <?php foreach($events_for_txn as $event_id => $event){ |
|
46 | - ?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png';?>"><?php _e("Event Name:","event_espresso")?> <span class="plain-text"><?php echo $event->name();?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3> |
|
47 | - <?php if (strlen($event->description()>1)){?><p class="event-description"><?php $event->description()?></p><?php }?> |
|
45 | + <?php foreach ($events_for_txn as $event_id => $event) { |
|
46 | + ?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png'; ?>"><?php _e("Event Name:", "event_espresso")?> <span class="plain-text"><?php echo $event->name(); ?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3> |
|
47 | + <?php if (strlen($event->description() > 1)) {?><p class="event-description"><?php $event->description()?></p><?php }?> |
|
48 | 48 | <ul class="tickets-per-event"> |
49 | - <?php foreach($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item){ |
|
49 | + <?php foreach ($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item) { |
|
50 | 50 | $ticket = $line_item->ticket(); |
51 | - $taxable_html = $ticket->taxable() ? '*': ''; |
|
51 | + $taxable_html = $ticket->taxable() ? '*' : ''; |
|
52 | 52 | $subitems = $line_item->children(); |
53 | - $ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso")); |
|
53 | + $ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso")); |
|
54 | 54 | ?> |
55 | 55 | <li class="event-ticket"> |
56 | 56 | <div class="ticket-details"> |
57 | 57 | <table class="invoice-amount"> |
58 | 58 | <thead> |
59 | 59 | <tr class="header_row"> |
60 | - <th class="name-column"><?php _e("Ticket", "event_espresso");?></th> |
|
61 | - <th colspan="2" class="desc-column"><?php _e("Description", "event_espresso");?></th> |
|
62 | - <th class="number-column item_c"><?php _e("Quantity", "event_espresso");?></th> |
|
63 | - <th class="number-column item_c"><?php _e("Price", "event_espresso");?></th> |
|
64 | - <th class="number-column item_r"><?php _e("Total", "event_espresso");?></th> |
|
60 | + <th class="name-column"><?php _e("Ticket", "event_espresso"); ?></th> |
|
61 | + <th colspan="2" class="desc-column"><?php _e("Description", "event_espresso"); ?></th> |
|
62 | + <th class="number-column item_c"><?php _e("Quantity", "event_espresso"); ?></th> |
|
63 | + <th class="number-column item_c"><?php _e("Price", "event_espresso"); ?></th> |
|
64 | + <th class="number-column item_r"><?php _e("Total", "event_espresso"); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if( count($subitems) < 2){?> |
|
68 | + <?php if (count($subitems) < 2) {?> |
|
69 | 69 | <tr class="item"> |
70 | 70 | <td><?php echo $line_item->name().$taxable_html?></td> |
71 | - <td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
71 | + <td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
72 | 72 | <td class="item_c"><?php echo $line_item->quantity()?></td> |
73 | 73 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
74 | 74 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
75 | 75 | </tr> |
76 | - <?php }else{?> |
|
76 | + <?php } else {?> |
|
77 | 77 | <tr class="item"> |
78 | 78 | <td class="aln-left"><?php echo $line_item->name().$taxable_html?></td> |
79 | - <td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
79 | + <td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
80 | 80 | <td class="item_c"><?php echo $line_item->quantity()?></td> |
81 | 81 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
82 | 82 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
83 | 83 | </tr> |
84 | - <?php foreach($subitems as $sub_line_item){ |
|
85 | - $is_percent = $sub_line_item->is_percent();?> |
|
84 | + <?php foreach ($subitems as $sub_line_item) { |
|
85 | + $is_percent = $sub_line_item->is_percent(); ?> |
|
86 | 86 | <tr class="subitem-row"> |
87 | 87 | <td class="subitem"><?php echo $sub_line_item->name()?></td> |
88 | 88 | <td colspan="2"><?php echo $sub_line_item->desc()?></td> |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | <?php } ?> |
94 | 94 | <tr class="total_tr odd"> |
95 | 95 | <td colspan="4"></td> |
96 | - <td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso");?></td> |
|
96 | + <td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso"); ?></td> |
|
97 | 97 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
98 | 98 | </tr> |
99 | 99 | <?php }?> |
@@ -104,22 +104,22 @@ discard block |
||
104 | 104 | <div class="reg-details-for-ticket"> |
105 | 105 | <div class="ticket-time-and-place-details"> |
106 | 106 | <div class="ticket-time-details"> |
107 | - <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png';?>"><?php echo _n("Date/Time:","Dates/Times:",count($ticket->datetimes()), "event_espresso");?></h4> |
|
107 | + <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png'; ?>"><?php echo _n("Date/Time:", "Dates/Times:", count($ticket->datetimes()), "event_espresso"); ?></h4> |
|
108 | 108 | <ul class="event-dates"> |
109 | - <?php foreach($ticket->datetimes_ordered() as $datetime){ |
|
109 | + <?php foreach ($ticket->datetimes_ordered() as $datetime) { |
|
110 | 110 | /* @var $datetime EE_Datetime */ ?> |
111 | 111 | <li><?php |
112 | - echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : '' ; |
|
113 | - echo sprintf(__("%s - %s (%s)", "event_espresso"),$datetime->start_date_and_time(),$datetime->end_date_and_time(),$datetime->get_timezone()); |
|
112 | + echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : ''; |
|
113 | + echo sprintf(__("%s - %s (%s)", "event_espresso"), $datetime->start_date_and_time(), $datetime->end_date_and_time(), $datetime->get_timezone()); |
|
114 | 114 | echo $datetime->description() ? '<p class="ticket-note">'.$datetime->description().'</p>' : '' ?></li> |
115 | 115 | <?php }?> |
116 | 116 | </ul> |
117 | 117 | </div> |
118 | - <?php if ($event->venues()){?> |
|
118 | + <?php if ($event->venues()) {?> |
|
119 | 119 | <div class="ticket-place-details"> |
120 | - <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png';?>"><?php echo _n("Venue:","Venues:",count($event->venues()), "event_espresso");?></h4> |
|
120 | + <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png'; ?>"><?php echo _n("Venue:", "Venues:", count($event->venues()), "event_espresso"); ?></h4> |
|
121 | 121 | <ul class="event-venues"> |
122 | - <?php foreach($event->venues() as $venue){?> |
|
122 | + <?php foreach ($event->venues() as $venue) {?> |
|
123 | 123 | <li><?php echo $venue->name()?> <span class="small-text">[ <a href='<?php echo $venue->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></li> |
124 | 124 | <?php } ?> |
125 | 125 | </ul> |
@@ -127,34 +127,34 @@ discard block |
||
127 | 127 | <?php }?> |
128 | 128 | </div> |
129 | 129 | <div class="ticket-registrations-area"> |
130 | - <h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png';?>"><?php echo __("Registration Details", "event_espresso");?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4> |
|
130 | + <h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png'; ?>"><?php echo __("Registration Details", "event_espresso"); ?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4> |
|
131 | 131 | <ul class="ticket-registrations-list"> |
132 | - <?php foreach($registrations_per_line_item[$line_item_id] as $registration){ |
|
132 | + <?php foreach ($registrations_per_line_item[$line_item_id] as $registration) { |
|
133 | 133 | /* @var $registration EE_Registration */ |
134 | 134 | $attendee = $registration->attendee(); |
135 | - $answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC')));?> |
|
135 | + $answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC'))); ?> |
|
136 | 136 | <li class="ticket-registration"> |
137 | 137 | <table class="registration-details"> |
138 | 138 | <tr class="odd"> |
139 | - <th><?php echo _e("Registration Code:", "event_espresso");?></th> |
|
140 | - <td><?php echo $registration->reg_code();?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td> |
|
139 | + <th><?php echo _e("Registration Code:", "event_espresso"); ?></th> |
|
140 | + <td><?php echo $registration->reg_code(); ?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td> |
|
141 | 141 | </tr> |
142 | 142 | <?php |
143 | - foreach($event->question_groups() as $question_group){ |
|
144 | - ?><tr><th><?php $question_group->e('QSG_name');?></th><td></td></tr><?php |
|
143 | + foreach ($event->question_groups() as $question_group) { |
|
144 | + ?><tr><th><?php $question_group->e('QSG_name'); ?></th><td></td></tr><?php |
|
145 | 145 | $has_personal_info = false; |
146 | - foreach($question_group->questions() as $question){ |
|
147 | - if( in_array($question->ID(),$questions_to_skip)){ |
|
146 | + foreach ($question_group->questions() as $question) { |
|
147 | + if (in_array($question->ID(), $questions_to_skip)) { |
|
148 | 148 | $has_personal_info = true; |
149 | 149 | continue; |
150 | 150 | } |
151 | 151 | ?><tr> |
152 | 152 | <th><?php echo $question->display_text()?></th> |
153 | - <td><?php echo $registration->answer_value_to_question($question);?></td> |
|
153 | + <td><?php echo $registration->answer_value_to_question($question); ?></td> |
|
154 | 154 | </tr><?php |
155 | 155 | } |
156 | - if($has_personal_info){ |
|
157 | - ?><tr><th><?php _e('Attendee', 'event_espresso');?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"),$attendee->full_name(),$attendee->email())?></td></tr><?php |
|
156 | + if ($has_personal_info) { |
|
157 | + ?><tr><th><?php _e('Attendee', 'event_espresso'); ?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"), $attendee->full_name(), $attendee->email())?></td></tr><?php |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | ?> |
@@ -171,21 +171,21 @@ discard block |
||
171 | 171 | <?php }?> |
172 | 172 | </div> |
173 | 173 | <div class="taxes"> |
174 | - <?php if ($tax_total_line_item && $tax_total_line_item->children()){?> |
|
175 | - <h3 class="section-title"><?php _e("Taxes",'event_espresso')?></h3> |
|
174 | + <?php if ($tax_total_line_item && $tax_total_line_item->children()) {?> |
|
175 | + <h3 class="section-title"><?php _e("Taxes", 'event_espresso')?></h3> |
|
176 | 176 | <table class="invoice-amount"> |
177 | 177 | |
178 | 178 | <thead> |
179 | 179 | <tr class="header_row"> |
180 | - <th class="left ticket_th"><?php _e("Tax Name", "event_espresso");?></th> |
|
181 | - <th class="left"><?php _e('Description', 'event_espresso');?></th> |
|
180 | + <th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th> |
|
181 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
182 | 182 | <th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th> |
183 | 183 | <th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th> |
184 | 184 | </tr> |
185 | 185 | </thead> |
186 | 186 | <tbody> |
187 | 187 | <?php |
188 | - foreach($tax_total_line_item->children() as $child_tax){?> |
|
188 | + foreach ($tax_total_line_item->children() as $child_tax) {?> |
|
189 | 189 | <tr> |
190 | 190 | <td><?php echo $child_tax->name()?></td> |
191 | 191 | <td><?php echo $child_tax->desc()?></td> |
@@ -195,26 +195,26 @@ discard block |
||
195 | 195 | <?php } ?> |
196 | 196 | <tr class="total_tr odd"> |
197 | 197 | <td class="total_tr" colspan="2"></td> |
198 | - <td class="total"><?php _e("Tax Total:", "event_espresso");?></td> |
|
198 | + <td class="total"><?php _e("Tax Total:", "event_espresso"); ?></td> |
|
199 | 199 | <td class="item_r"><?php echo $tax_total_line_item->total_no_code()?></td> |
200 | 200 | </tr> |
201 | 201 | </tbody> |
202 | 202 | |
203 | 203 | </table> |
204 | 204 | <?php }?> |
205 | - <p><?php _e("* taxable items", "event_espresso");?></p> |
|
205 | + <p><?php _e("* taxable items", "event_espresso"); ?></p> |
|
206 | 206 | </div> |
207 | 207 | <div class="grand-total-dv"> |
208 | - <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"),EEH_Template::format_currency($total_cost));?></h2> |
|
208 | + <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), EEH_Template::format_currency($total_cost)); ?></h2> |
|
209 | 209 | </div> |
210 | 210 | <div class="payment-dv"> |
211 | - <h3 class="section-title"><?php _e("Payments",'event_espresso')?></h3> |
|
211 | + <h3 class="section-title"><?php _e("Payments", 'event_espresso')?></h3> |
|
212 | 212 | <p>[instructions]</p> |
213 | 213 | <table class="invoice-amount"> |
214 | 214 | <thead> |
215 | 215 | <tr class="header_row"> |
216 | 216 | <th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th> |
217 | - <th class='left datetime_th'><?php _e("Date",'event_espresso')?></th> |
|
217 | + <th class='left datetime_th'><?php _e("Date", 'event_espresso')?></th> |
|
218 | 218 | <th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th> |
219 | 219 | <th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th> |
220 | 220 | <th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th> |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | <tbody> |
225 | 225 | <?php |
226 | 226 | $c = false; |
227 | - if(!empty($payments)){ |
|
227 | + if ( ! empty($payments)) { |
|
228 | 228 | |
229 | - foreach($payments as $payment){ |
|
229 | + foreach ($payments as $payment) { |
|
230 | 230 | /* @var $payment EE_Payment */?> |
231 | - <tr class='item <?php echo (($c = !$c) ? ' odd' : '')?>'> |
|
231 | + <tr class='item <?php echo (($c = ! $c) ? ' odd' : '')?>'> |
|
232 | 232 | <td><?php $payment->e('PAY_gateway')?></td> |
233 | 233 | <td><?php echo $payment->timestamp()?></td> |
234 | 234 | <td><?php $payment->e('PAY_txn_id_chq_nmbr')?></td> |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | <td class='item_r'><?php echo $payment->amount_no_code()?></td> |
238 | 238 | </tr> |
239 | 239 | <?php } |
240 | - }else{?> |
|
240 | + } else {?> |
|
241 | 241 | <tr class='item'> |
242 | - <td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.",'event_espresso')?> </td> |
|
242 | + <td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.", 'event_espresso')?> </td> |
|
243 | 243 | </tr> |
244 | 244 | <?php } |
245 | - ?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if($amount_owed){?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso");}?></a></td></tr> |
|
245 | + ?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if ($amount_owed) {?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso"); }?></a></td></tr> |
|
246 | 246 | </tbody> |
247 | 247 | <tfoot> |
248 | 248 | <tr class='total_tr'><td colspan="4"> </td> |
249 | - <td class="item_r"><?php _e('Total Paid','event_espresso')?></td> |
|
250 | - <td class="item_r"><?php echo EEH_Template::format_currency($amount_pd,false,false)?> </td> |
|
249 | + <td class="item_r"><?php _e('Total Paid', 'event_espresso')?></td> |
|
250 | + <td class="item_r"><?php echo EEH_Template::format_currency($amount_pd, false, false)?> </td> |
|
251 | 251 | </tr> |
252 | 252 | <?php //echo $discount; ?> |
253 | 253 | <tr class="total_tr odd"> |
@@ -259,20 +259,20 @@ discard block |
||
259 | 259 | </table> |
260 | 260 | </div> |
261 | 261 | <div class="additional-info-dv"> |
262 | - <h3 class="section-title"><?php _e("Additional Information:", "event_espresso");?></h3> |
|
262 | + <h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3> |
|
263 | 263 | <div class="additional-info"> |
264 | - <?php if($venues_for_events){?> |
|
265 | - <h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso",count($venues_for_events));?></h2> |
|
264 | + <?php if ($venues_for_events) {?> |
|
265 | + <h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso", count($venues_for_events)); ?></h2> |
|
266 | 266 | <table class="venue-list"> |
267 | - <?php foreach($venues_for_events as $venue){?> |
|
267 | + <?php foreach ($venues_for_events as $venue) {?> |
|
268 | 268 | <tr class="venue-details"> |
269 | 269 | <td class="venue-details-part venue-address-dv"> |
270 | 270 | <h3><a href='<?php echo $venue->get_permalink()?>'><?php |
271 | 271 | echo $venue->name() |
272 | 272 | ?></a></h3> |
273 | 273 | <p><?php echo $venue->description()?></p> |
274 | - <?php echo EEH_Address::format($venue);?></td> |
|
275 | - <?php if($venue->enable_for_gmap()){?> |
|
274 | + <?php echo EEH_Address::format($venue); ?></td> |
|
275 | + <?php if ($venue->enable_for_gmap()) {?> |
|
276 | 276 | <td class="venue-details-part venue-image-dv"><?php echo EEH_Venue_View::espresso_google_static_map($venue)?></td> |
277 | 277 | <?php } ?> |
278 | 278 | </tr> |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | </table> |
281 | 281 | <?php } ?> |
282 | 282 | |
283 | - <?php if($shameless_plug){?> |
|
283 | + <?php if ($shameless_plug) {?> |
|
284 | 284 | <div class='aln-cntr'><?php |
285 | - printf(__("Powered by %sEvent Espresso %s", "event_espresso"),"<a href='http://eventespresso.com'>","</a>"); |
|
285 | + printf(__("Powered by %sEvent Espresso %s", "event_espresso"), "<a href='http://eventespresso.com'>", "</a>"); |
|
286 | 286 | ?></div> |
287 | 287 | <?php } ?> |
288 | 288 | </div> |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
74 | 74 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
75 | 75 | </tr> |
76 | - <?php }else{?> |
|
76 | + <?php } else{?> |
|
77 | 77 | <tr class="item"> |
78 | 78 | <td class="aln-left"><?php echo $line_item->name().$taxable_html?></td> |
79 | 79 | <td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | <td class='item_r'><?php echo $payment->amount_no_code()?></td> |
238 | 238 | </tr> |
239 | 239 | <?php } |
240 | - }else{?> |
|
240 | + } else{?> |
|
241 | 241 | <tr class='item'> |
242 | 242 | <td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.",'event_espresso')?> </td> |
243 | 243 | </tr> |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return EED_Ical |
33 | 33 | */ |
34 | 34 | public static function instance() { |
35 | - return parent::get_instance( __CLASS__ ); |
|
35 | + return parent::get_instance(__CLASS__); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function set_hooks() { |
47 | 47 | // create download buttons |
48 | - add_filter( 'FHEE__espresso_list_of_event_dates__datetime_html', array( 'EED_Ical', 'generate_add_to_iCal_button' ), 10, 2 ); |
|
48 | + add_filter('FHEE__espresso_list_of_event_dates__datetime_html', array('EED_Ical', 'generate_add_to_iCal_button'), 10, 2); |
|
49 | 49 | // process ics download request |
50 | - EE_Config::register_route( 'download_ics_file', 'EED_Ical', 'download_ics_file' ); |
|
50 | + EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param WP $WP |
71 | 71 | * @return void |
72 | 72 | */ |
73 | - public function run( $WP ) {} |
|
73 | + public function run($WP) {} |
|
74 | 74 | |
75 | 75 | |
76 | 76 | |
@@ -82,30 +82,30 @@ discard block |
||
82 | 82 | * @param $datetime |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - public static function generate_add_to_iCal_button( $html, $datetime ) { |
|
85 | + public static function generate_add_to_iCal_button($html, $datetime) { |
|
86 | 86 | // first verify a proper datetime object has been received |
87 | - if ( $datetime instanceof EE_Datetime ) { |
|
87 | + if ($datetime instanceof EE_Datetime) { |
|
88 | 88 | // set whether a link or submit button is shown |
89 | - $iCal_type = apply_filters( 'FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit' ); |
|
89 | + $iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit'); |
|
90 | 90 | // generate a link to the route we registered in set_hooks() |
91 | - $URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $datetime->ID() ), site_url() ); |
|
91 | + $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url()); |
|
92 | 92 | // what type ? |
93 | - switch ( $iCal_type ) { |
|
93 | + switch ($iCal_type) { |
|
94 | 94 | // submit buttons appear as buttons and are very compatible with a theme's style |
95 | 95 | case 'submit' : |
96 | - $html .= '<form id="download-iCal-frm-' . $datetime->ID() . '" class="download-iCal-frm" action="' . $URL . '" method="post" >'; |
|
97 | - $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '"/>'; |
|
96 | + $html .= '<form id="download-iCal-frm-'.$datetime->ID().'" class="download-iCal-frm" action="'.$URL.'" method="post" >'; |
|
97 | + $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="'.__('Add to iCal Calendar', 'event_espresso').'"/>'; |
|
98 | 98 | $html .= '</form>'; |
99 | 99 | break; |
100 | 100 | // buttons are just links that have been styled to appear as buttons, but may not be blend with a theme as well as submit buttons |
101 | 101 | case 'button' : |
102 | - $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">'; |
|
102 | + $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">'; |
|
103 | 103 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
104 | 104 | $html .= '</a>'; |
105 | 105 | break; |
106 | 106 | // links are just links that use the calendar dashicon |
107 | 107 | case 'icon' : |
108 | - $html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">'; |
|
108 | + $html .= '<a class="ee-ical-lnk" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">'; |
|
109 | 109 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
110 | 110 | $html .= '</a>'; |
111 | 111 | break; |
@@ -123,73 +123,73 @@ discard block |
||
123 | 123 | * @return void |
124 | 124 | */ |
125 | 125 | public static function download_ics_file() { |
126 | - if ( EE_Registry::instance()->REQ->is_set( 'ics_id' )) { |
|
127 | - $DTT_ID = absint( EE_Registry::instance()->REQ->get( 'ics_id' )); |
|
128 | - $datetime = EE_Registry::instance()->load_model( 'Datetime' )->get_one_by_ID( $DTT_ID ); |
|
129 | - if ( $datetime instanceof EE_Datetime ) { |
|
126 | + if (EE_Registry::instance()->REQ->is_set('ics_id')) { |
|
127 | + $DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id')); |
|
128 | + $datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID); |
|
129 | + if ($datetime instanceof EE_Datetime) { |
|
130 | 130 | // get related event, venues, and event categories |
131 | 131 | $event = $datetime->event(); |
132 | 132 | // get related category Term object and it's name |
133 | 133 | $category = $event->first_event_category(); |
134 | - if ( $category instanceof EE_Term ) { |
|
134 | + if ($category instanceof EE_Term) { |
|
135 | 135 | $category = $category->name(); |
136 | 136 | } |
137 | 137 | $location = ''; |
138 | 138 | // get first related venue and convert to CSV string |
139 | - $venue = $event->venues(array( 'limit'=>1 )); |
|
140 | - if ( is_array( $venue ) && ! empty( $venue )) { |
|
141 | - $venue = array_shift( $venue ); |
|
142 | - if ( $venue instanceof EE_Venue ) { |
|
143 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
144 | - $location = espresso_venue_raw_address( 'inline', $venue->ID(), FALSE ); |
|
139 | + $venue = $event->venues(array('limit'=>1)); |
|
140 | + if (is_array($venue) && ! empty($venue)) { |
|
141 | + $venue = array_shift($venue); |
|
142 | + if ($venue instanceof EE_Venue) { |
|
143 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
144 | + $location = espresso_venue_raw_address('inline', $venue->ID(), FALSE); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | // set variables, escape strings, convert timestamps to ics format, etc |
148 | - $filename = $event->slug() . '-' . $datetime->start_date( 'Y-m-d' ) . '.ics'; |
|
149 | - $organizer = EED_Ical::_escape_ICal_data( EE_Registry::instance()->CFG->organization->name ); |
|
150 | - $UID = EED_Ical::_escape_ICal_data( md5( $event->name() . $event->ID() . $datetime->ID() )); |
|
151 | - $org_email = EED_Ical::_escape_ICal_data( $datetime->ID() ); |
|
152 | - $timestamp = date( EED_Ical::iCal_datetime_format ); |
|
153 | - $location = EED_Ical::_escape_ICal_data( $location ); |
|
154 | - $summary = EED_Ical::_escape_ICal_data( $event->name() ); |
|
155 | - $description = EED_Ical::_escape_ICal_data( wp_strip_all_tags( $event->description() )); |
|
148 | + $filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics'; |
|
149 | + $organizer = EED_Ical::_escape_ICal_data(EE_Registry::instance()->CFG->organization->name); |
|
150 | + $UID = EED_Ical::_escape_ICal_data(md5($event->name().$event->ID().$datetime->ID())); |
|
151 | + $org_email = EED_Ical::_escape_ICal_data($datetime->ID()); |
|
152 | + $timestamp = date(EED_Ical::iCal_datetime_format); |
|
153 | + $location = EED_Ical::_escape_ICal_data($location); |
|
154 | + $summary = EED_Ical::_escape_ICal_data($event->name()); |
|
155 | + $description = EED_Ical::_escape_ICal_data(wp_strip_all_tags($event->description())); |
|
156 | 156 | $status = $datetime->get_active_status(); |
157 | 157 | $status = $status == EE_Datetime::cancelled ? 'Cancelled' : 'Confirmed'; |
158 | - $status = EED_Ical::_escape_ICal_data( $status ); |
|
159 | - $categories = EED_Ical::_escape_ICal_data( $category ); |
|
160 | - $url = EED_Ical::_escape_ICal_data( get_permalink( $event->ID() )); |
|
161 | - $dtt_start = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->start() )); |
|
162 | - $dtt_end = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->end() )); |
|
158 | + $status = EED_Ical::_escape_ICal_data($status); |
|
159 | + $categories = EED_Ical::_escape_ICal_data($category); |
|
160 | + $url = EED_Ical::_escape_ICal_data(get_permalink($event->ID())); |
|
161 | + $dtt_start = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->start())); |
|
162 | + $dtt_end = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->end())); |
|
163 | 163 | // set headers |
164 | - header( 'Content-type: text/calendar; charset=utf-8' ); |
|
165 | - header( 'Content-Disposition: attachment; filename="' . $filename . '"' ); |
|
166 | - header( 'Cache-Control: private, max-age=0, must-revalidate' ); |
|
167 | - header( 'Pragma: public' ); |
|
168 | - header( 'Content-Type: application/octet-stream' ); |
|
169 | - header( 'Content-Type: application/force-download' ); |
|
170 | - header( 'Cache-Control: no-cache, must-revalidate' ); |
|
171 | - header( 'Content-Transfer-Encoding: binary' ); |
|
172 | - header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); // past date |
|
173 | - ini_set( 'zlib.output_compression', '0' ); |
|
164 | + header('Content-type: text/calendar; charset=utf-8'); |
|
165 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
166 | + header('Cache-Control: private, max-age=0, must-revalidate'); |
|
167 | + header('Pragma: public'); |
|
168 | + header('Content-Type: application/octet-stream'); |
|
169 | + header('Content-Type: application/force-download'); |
|
170 | + header('Cache-Control: no-cache, must-revalidate'); |
|
171 | + header('Content-Transfer-Encoding: binary'); |
|
172 | + header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date |
|
173 | + ini_set('zlib.output_compression', '0'); |
|
174 | 174 | // echo the output |
175 | - echo "BEGIN:VCALENDAR" . PHP_EOL; |
|
176 | - echo "VERSION:2.0" . PHP_EOL; |
|
177 | - echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN" . PHP_EOL; |
|
178 | - echo "CALSCALE:GREGORIAN" . PHP_EOL; |
|
179 | - echo "BEGIN:VEVENT" . PHP_EOL; |
|
180 | - echo "UID:{$UID}" . PHP_EOL; |
|
181 | - echo "ORGANIZER:MAILTO:{$org_email}" . PHP_EOL; |
|
182 | - echo "DTSTAMP:{$timestamp}" . PHP_EOL; |
|
183 | - echo "LOCATION:{$location}" . PHP_EOL; |
|
184 | - echo "SUMMARY:{$summary}" . PHP_EOL; |
|
185 | - echo "DESCRIPTION:{$description}" . PHP_EOL; |
|
186 | - echo "STATUS:{$status}" . PHP_EOL; |
|
187 | - echo "CATEGORIES:{$categories}" . PHP_EOL; |
|
188 | - echo "URL;VALUE=URI:{$url}" . PHP_EOL; |
|
189 | - echo "DTSTART:{$dtt_start}" . PHP_EOL; |
|
190 | - echo "DTEND:{$dtt_end}" . PHP_EOL; |
|
191 | - echo "END:VEVENT" . PHP_EOL; |
|
192 | - echo "END:VCALENDAR" . PHP_EOL; |
|
175 | + echo "BEGIN:VCALENDAR".PHP_EOL; |
|
176 | + echo "VERSION:2.0".PHP_EOL; |
|
177 | + echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN".PHP_EOL; |
|
178 | + echo "CALSCALE:GREGORIAN".PHP_EOL; |
|
179 | + echo "BEGIN:VEVENT".PHP_EOL; |
|
180 | + echo "UID:{$UID}".PHP_EOL; |
|
181 | + echo "ORGANIZER:MAILTO:{$org_email}".PHP_EOL; |
|
182 | + echo "DTSTAMP:{$timestamp}".PHP_EOL; |
|
183 | + echo "LOCATION:{$location}".PHP_EOL; |
|
184 | + echo "SUMMARY:{$summary}".PHP_EOL; |
|
185 | + echo "DESCRIPTION:{$description}".PHP_EOL; |
|
186 | + echo "STATUS:{$status}".PHP_EOL; |
|
187 | + echo "CATEGORIES:{$categories}".PHP_EOL; |
|
188 | + echo "URL;VALUE=URI:{$url}".PHP_EOL; |
|
189 | + echo "DTSTART:{$dtt_start}".PHP_EOL; |
|
190 | + echo "DTEND:{$dtt_end}".PHP_EOL; |
|
191 | + echo "END:VEVENT".PHP_EOL; |
|
192 | + echo "END:VCALENDAR".PHP_EOL; |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | die(); |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | * @param string $string |
205 | 205 | * @return string |
206 | 206 | */ |
207 | - private static function _escape_ICal_data( $string = '' ) { |
|
208 | - return preg_replace( '/([\,;])/', '\\\$1', $string ); |
|
207 | + private static function _escape_ICal_data($string = '') { |
|
208 | + return preg_replace('/([\,;])/', '\\\$1', $string); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Invoice |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | public static function set_hooks() { |
44 | - EE_Config::register_route( 'download_invoice', 'EED_Invoice', 'download_invoice' ); |
|
45 | - EE_Config::register_route( 'launch_invoice', 'EED_Invoice', 'launch_invoice' ); |
|
44 | + EE_Config::register_route('download_invoice', 'EED_Invoice', 'download_invoice'); |
|
45 | + EE_Config::register_route('launch_invoice', 'EED_Invoice', 'launch_invoice'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * @access public |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function run( $WP ) { |
|
67 | - if ( is_readable( EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php' )) { |
|
68 | - require_once( EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php' ); |
|
66 | + public function run($WP) { |
|
67 | + if (is_readable(EE_MODULES.'gateways/Invoice/lib/Invoice.class.php')) { |
|
68 | + require_once(EE_MODULES.'gateways/Invoice/lib/Invoice.class.php'); |
|
69 | 69 | } else { |
70 | - $msg = __( 'The Invoice.class.php file could not be loaded.', 'event_espresso' ); |
|
71 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
70 | + $msg = __('The Invoice.class.php file could not be loaded.', 'event_espresso'); |
|
71 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
72 | 72 | } |
73 | 73 | // add_filter( 'FHEE_load_ee_config', '__return_true' ); |
74 | 74 | // add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function launch_invoice() { |
91 | 91 | $this->run(null); |
92 | - if ( EE_Registry::instance()->REQ->is_set( 'id' )) { |
|
93 | - $id = sanitize_key( EE_Registry::instance()->REQ->get( 'id' )); |
|
94 | - $invoice = new Invoice( $id ); |
|
92 | + if (EE_Registry::instance()->REQ->is_set('id')) { |
|
93 | + $id = sanitize_key(EE_Registry::instance()->REQ->get('id')); |
|
94 | + $invoice = new Invoice($id); |
|
95 | 95 | $invoice->send_invoice(); |
96 | 96 | } |
97 | 97 | } |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function download_invoice() { |
108 | 108 | $this->run(null); |
109 | - if ( EE_Registry::instance()->REQ->is_set( 'id' )) { |
|
110 | - $id = sanitize_key( EE_Registry::instance()->REQ->get( 'id' )); |
|
109 | + if (EE_Registry::instance()->REQ->is_set('id')) { |
|
110 | + $id = sanitize_key(EE_Registry::instance()->REQ->get('id')); |
|
111 | 111 | $invoice = new Invoice($_REQUEST['id']); |
112 | 112 | // send invoice but force download |
113 | - $invoice->send_invoice( TRUE ); |
|
113 | + $invoice->send_invoice(TRUE); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Single Page Checkout (SPCO) |
4 | 6 | * |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * process_registration_from_admin |
281 | 281 | * |
282 | 282 | * @access public |
283 | - * @return int |
|
283 | + * @return EE_Transaction |
|
284 | 284 | */ |
285 | 285 | public static function process_registration_from_admin() { |
286 | 286 | EED_Single_Page_Checkout::load_reg_steps(); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * _get_transaction_and_cart_for_previous_visit |
609 | 609 | * |
610 | 610 | * @access private |
611 | - * @return mixed EE_Transaction|NULL |
|
611 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
612 | 612 | */ |
613 | 613 | private function _get_transaction_and_cart_for_previous_visit() { |
614 | 614 | /** @var $TXN_model EEM_Transaction */ |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | * generates a new EE_Transaction object and adds it to the $_transaction property. |
678 | 678 | * |
679 | 679 | * @access private |
680 | - * @return mixed EE_Transaction|NULL |
|
680 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
681 | 681 | */ |
682 | 682 | private function _initialize_transaction() { |
683 | 683 | try { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - return parent::get_instance( __CLASS__ ); |
|
41 | + return parent::get_instance(__CLASS__); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -83,20 +83,20 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function set_hooks_admin() { |
85 | 85 | EED_Single_Page_Checkout::set_definitions(); |
86 | - if ( defined( 'DOING_AJAX' )) { |
|
86 | + if (defined('DOING_AJAX')) { |
|
87 | 87 | EED_Single_Page_Checkout::load_request_handler(); |
88 | 88 | EED_Single_Page_Checkout::load_reg_steps(); |
89 | 89 | } else { |
90 | 90 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
91 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
91 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
92 | 92 | } |
93 | 93 | // set ajax hooks |
94 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
95 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
96 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
97 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
98 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
99 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
94 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
95 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
96 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
97 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
98 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
99 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | * process ajax request |
106 | 106 | * @param string $ajax_action |
107 | 107 | */ |
108 | - public static function process_ajax_request( $ajax_action ) { |
|
109 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
108 | + public static function process_ajax_request($ajax_action) { |
|
109 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
110 | 110 | EED_Single_Page_Checkout::instance()->_initialize(); |
111 | 111 | } |
112 | 112 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * ajax display registration step |
117 | 117 | */ |
118 | 118 | public static function display_reg_step() { |
119 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
119 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * ajax process registration step |
126 | 126 | */ |
127 | 127 | public static function process_reg_step() { |
128 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
128 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * ajax process registration step |
135 | 135 | */ |
136 | 136 | public static function update_reg_step() { |
137 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
137 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public static function load_request_handler() { |
149 | 149 | // load core Request_Handler class |
150 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
151 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
150 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
151 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | * @return void |
162 | 162 | */ |
163 | 163 | public static function set_definitions() { |
164 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
165 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
166 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
167 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
168 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
169 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
170 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
164 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
165 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
166 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
167 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
168 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
169 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
170 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
@@ -182,31 +182,31 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public static function load_reg_steps() { |
184 | 184 | static $reg_steps_loaded = FALSE; |
185 | - if ( $reg_steps_loaded ) { |
|
185 | + if ($reg_steps_loaded) { |
|
186 | 186 | return; |
187 | 187 | } |
188 | 188 | // load EE_SPCO_Reg_Step base class |
189 | - EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class' ); |
|
189 | + EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class'); |
|
190 | 190 | // filter list of reg_steps |
191 | - $reg_steps_to_load = apply_filters( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps() ); |
|
191 | + $reg_steps_to_load = apply_filters('AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps()); |
|
192 | 192 | // sort by key (order) |
193 | - ksort( $reg_steps_to_load ); |
|
193 | + ksort($reg_steps_to_load); |
|
194 | 194 | // loop through folders |
195 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
195 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
196 | 196 | // we need a |
197 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
197 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
198 | 198 | // copy over to the reg_steps_array |
199 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
199 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
200 | 200 | // register custom key route for each reg step ( ie: step=>"slug" - this is the entire reason we load the reg steps array now ) |
201 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
201 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
202 | 202 | // add AJAX or other hooks |
203 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
203 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
204 | 204 | // setup autoloaders if necessary |
205 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
206 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
205 | + if ( ! class_exists($reg_step['class_name'])) { |
|
206 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
207 | 207 | } |
208 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
209 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
208 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
209 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public static function get_reg_steps() { |
227 | 227 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
228 | - if ( empty( $reg_steps )) { |
|
228 | + if (empty($reg_steps)) { |
|
229 | 229 | $reg_steps = array( |
230 | 230 | 10 => array( |
231 | 231 | 'file_path' => SPCO_INC_PATH, |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public static function registration_checkout_for_admin() { |
268 | 268 | EED_Single_Page_Checkout::load_reg_steps(); |
269 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
270 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
271 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
269 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
270 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
271 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
272 | 272 | EED_Single_Page_Checkout::instance()->_initialize(); |
273 | 273 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
274 | 274 | return EE_Registry::instance()->REQ->get_output(); |
@@ -284,14 +284,14 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public static function process_registration_from_admin() { |
286 | 286 | EED_Single_Page_Checkout::load_reg_steps(); |
287 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
288 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
289 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
287 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
288 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
289 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
290 | 290 | EED_Single_Page_Checkout::instance()->_initialize(); |
291 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
292 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
293 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
294 | - if ( $final_reg_step->process_reg_step() ) { |
|
291 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
292 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
293 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
294 | + if ($final_reg_step->process_reg_step()) { |
|
295 | 295 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
296 | 296 | } |
297 | 297 | } |
@@ -308,8 +308,8 @@ discard block |
||
308 | 308 | * @param WP_Query $WP_Query |
309 | 309 | * @return void |
310 | 310 | */ |
311 | - public function run( $WP_Query ) { |
|
312 | - if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() ) { |
|
311 | + public function run($WP_Query) { |
|
312 | + if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query()) { |
|
313 | 313 | $this->_initialize(); |
314 | 314 | } |
315 | 315 | } |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | * @param WP_Query $WP_Query |
325 | 325 | * @return void |
326 | 326 | */ |
327 | - public static function init( $WP_Query ) { |
|
328 | - if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() ) { |
|
327 | + public static function init($WP_Query) { |
|
328 | + if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query()) { |
|
329 | 329 | EED_Single_Page_Checkout::instance()->_initialize(); |
330 | 330 | } |
331 | 331 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | */ |
342 | 342 | private function _initialize() { |
343 | 343 | // ensure SPCO doesn't run twice |
344 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
344 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
345 | 345 | return; |
346 | 346 | } |
347 | 347 | // setup the EE_Checkout object |
@@ -349,22 +349,22 @@ discard block |
||
349 | 349 | // get the $_GET |
350 | 350 | $this->_get_request_vars(); |
351 | 351 | // filter continue_reg |
352 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
352 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
353 | 353 | // load the reg steps array |
354 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
354 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
355 | 355 | EED_Single_Page_Checkout::$_initialized = true; |
356 | 356 | return; |
357 | 357 | } |
358 | 358 | // set the current step |
359 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
359 | + $this->checkout->set_current_step($this->checkout->step); |
|
360 | 360 | // and the next step |
361 | 361 | $this->checkout->set_next_step(); |
362 | 362 | // was there already a valid transaction in the checkout from the session ? |
363 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
363 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
364 | 364 | // get transaction from db or session |
365 | 365 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() ? $this->_get_transaction_and_cart_for_previous_visit() : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
366 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
367 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
366 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
367 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
368 | 368 | // add some style and make it dance |
369 | 369 | $this->checkout->transaction = EE_Transaction::new_instance(); |
370 | 370 | $this->add_styles_and_scripts(); |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | return; |
373 | 373 | } |
374 | 374 | // and the registrations for the transaction |
375 | - $this->_get_registrations( $this->checkout->transaction ); |
|
375 | + $this->_get_registrations($this->checkout->transaction); |
|
376 | 376 | } |
377 | 377 | // verify that everything has been setup correctly |
378 | - if ( ! $this->_final_verifications() ) { |
|
378 | + if ( ! $this->_final_verifications()) { |
|
379 | 379 | EED_Single_Page_Checkout::$_initialized = true; |
380 | 380 | return; |
381 | 381 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | // set no cache headers and constants |
401 | 401 | EE_System::do_not_cache(); |
402 | 402 | // remove transaction lock |
403 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
403 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -417,16 +417,16 @@ discard block |
||
417 | 417 | // look in session for existing checkout |
418 | 418 | $checkout = EE_Registry::instance()->SSN->checkout(); |
419 | 419 | // verify |
420 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
420 | + if ( ! $checkout instanceof EE_Checkout) { |
|
421 | 421 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
422 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
422 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
423 | 423 | // verify again |
424 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
425 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
424 | + if ( ! $checkout instanceof EE_Checkout) { |
|
425 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
426 | 426 | } |
427 | 427 | } else { |
428 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
429 | - wp_safe_redirect( $checkout->redirect_url ); |
|
428 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
429 | + wp_safe_redirect($checkout->redirect_url); |
|
430 | 430 | exit(); |
431 | 431 | } |
432 | 432 | } |
@@ -447,22 +447,22 @@ discard block |
||
447 | 447 | // load classes |
448 | 448 | EED_Single_Page_Checkout::load_request_handler(); |
449 | 449 | //make sure this request is marked as belonging to EE |
450 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
450 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
451 | 451 | // which step is being requested ? |
452 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
452 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
453 | 453 | // which step is being edited ? |
454 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
454 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
455 | 455 | // and what we're doing on the current step |
456 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
456 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
457 | 457 | // returning to edit ? |
458 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
458 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
459 | 459 | // or some other kind of revisit ? |
460 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
460 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
461 | 461 | // and whether or not to generate a reg form for this request |
462 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
462 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
463 | 463 | // and whether or not to process a reg form submission for this request |
464 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
465 | - $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
464 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
465 | + $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
466 | 466 | //$this->_display_request_vars(); |
467 | 467 | } |
468 | 468 | |
@@ -477,14 +477,14 @@ discard block |
||
477 | 477 | * @return array |
478 | 478 | */ |
479 | 479 | protected function _display_request_vars() { |
480 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
481 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
482 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
483 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
484 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
485 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
486 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
487 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
480 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
481 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
482 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
483 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
484 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
485 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
486 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
487 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | * @return array |
499 | 499 | */ |
500 | 500 | private function _get_first_step() { |
501 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
502 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
501 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
502 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | |
@@ -514,35 +514,35 @@ discard block |
||
514 | 514 | */ |
515 | 515 | private function _load_and_instantiate_reg_steps() { |
516 | 516 | // have reg_steps already been instantiated ? |
517 | - if ( empty( $this->checkout->reg_steps )) { |
|
517 | + if (empty($this->checkout->reg_steps)) { |
|
518 | 518 | // if not, then loop through raw reg steps array |
519 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
520 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
519 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
520 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
521 | 521 | return false; |
522 | 522 | } |
523 | 523 | } |
524 | 524 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
525 | 525 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
526 | 526 | // skip the registration_confirmation page ? |
527 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
527 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
528 | 528 | // just remove it from the reg steps array |
529 | - $this->checkout->remove_reg_step( 'registration_confirmation' ); |
|
530 | - } else if ( EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset( $this->checkout->reg_steps['registration_confirmation'] )) { |
|
529 | + $this->checkout->remove_reg_step('registration_confirmation'); |
|
530 | + } else if (EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset($this->checkout->reg_steps['registration_confirmation'])) { |
|
531 | 531 | // set the order to something big like 100 |
532 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
532 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
533 | 533 | } |
534 | 534 | // filter the array for good luck |
535 | - $this->checkout->reg_steps = apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps ); |
|
535 | + $this->checkout->reg_steps = apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps); |
|
536 | 536 | // finally re-sort based on the reg step class order properties |
537 | 537 | $this->checkout->sort_reg_steps(); |
538 | 538 | } else { |
539 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
539 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
540 | 540 | // set all current step stati to FALSE |
541 | - $reg_step->set_is_current_step( FALSE ); |
|
541 | + $reg_step->set_is_current_step(FALSE); |
|
542 | 542 | } |
543 | 543 | } |
544 | - if ( empty( $this->checkout->reg_steps )) { |
|
545 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
544 | + if (empty($this->checkout->reg_steps)) { |
|
545 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
546 | 546 | return false; |
547 | 547 | } |
548 | 548 | // make reg step details available to JS |
@@ -560,34 +560,34 @@ discard block |
||
560 | 560 | * @param int $order |
561 | 561 | * @return bool |
562 | 562 | */ |
563 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
563 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
564 | 564 | |
565 | 565 | // we need a file_path, class_name, and slug to add a reg step |
566 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
566 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
567 | 567 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
568 | - if ( $this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration' ) { |
|
568 | + if ($this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration') { |
|
569 | 569 | return true; |
570 | 570 | } |
571 | 571 | // instantiate step class using file path and class name |
572 | - $reg_step_obj = EE_Registry::instance()->load_file( $reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE ); |
|
572 | + $reg_step_obj = EE_Registry::instance()->load_file($reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE); |
|
573 | 573 | // did we gets the goods ? |
574 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
574 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
575 | 575 | // set reg step order based on config |
576 | - $reg_step_obj->set_order( $order ); |
|
576 | + $reg_step_obj->set_order($order); |
|
577 | 577 | // add instantiated reg step object to the master reg steps array |
578 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
578 | + $this->checkout->add_reg_step($reg_step_obj); |
|
579 | 579 | } else { |
580 | - EE_Error::add_error( __( 'The current step could not be set.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
580 | + EE_Error::add_error(__('The current step could not be set.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
581 | 581 | return false; |
582 | 582 | } |
583 | 583 | } else { |
584 | - if ( WP_DEBUG ) { |
|
584 | + if (WP_DEBUG) { |
|
585 | 585 | EE_Error::add_error( |
586 | 586 | sprintf( |
587 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
588 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
589 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
590 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
587 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
588 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
589 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
590 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
591 | 591 | '<ul>', |
592 | 592 | '<li>', |
593 | 593 | '</li>', |
@@ -611,16 +611,16 @@ discard block |
||
611 | 611 | */ |
612 | 612 | private function _get_transaction_and_cart_for_previous_visit() { |
613 | 613 | /** @var $TXN_model EEM_Transaction */ |
614 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
614 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
615 | 615 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
616 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
616 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
617 | 617 | // verify transaction |
618 | - if ( $transaction instanceof EE_Transaction ) { |
|
618 | + if ($transaction instanceof EE_Transaction) { |
|
619 | 619 | // and get the cart that was used for that transaction |
620 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
620 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
621 | 621 | return $transaction; |
622 | 622 | } else { |
623 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
623 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
624 | 624 | return NULL; |
625 | 625 | } |
626 | 626 | } |
@@ -634,11 +634,11 @@ discard block |
||
634 | 634 | * @param EE_Transaction $transaction |
635 | 635 | * @return EE_Cart |
636 | 636 | */ |
637 | - private function _get_cart_for_transaction( $transaction ) { |
|
638 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
637 | + private function _get_cart_for_transaction($transaction) { |
|
638 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
639 | 639 | // verify cart |
640 | - if ( ! $cart instanceof EE_Cart ) { |
|
641 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
640 | + if ( ! $cart instanceof EE_Cart) { |
|
641 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
642 | 642 | } |
643 | 643 | return $cart; |
644 | 644 | } |
@@ -655,17 +655,17 @@ discard block |
||
655 | 655 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
656 | 656 | // if there's no transaction, then this is the FIRST visit to SPCO |
657 | 657 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
658 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
658 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
659 | 659 | // and then create a new transaction |
660 | 660 | $transaction = $this->_initialize_transaction(); |
661 | 661 | // verify transaction |
662 | - if ( $transaction instanceof EE_Transaction ) { |
|
662 | + if ($transaction instanceof EE_Transaction) { |
|
663 | 663 | // save it so that we have an ID for other objects to use |
664 | 664 | $transaction->save(); |
665 | 665 | // and save TXN data to the cart |
666 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
666 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
667 | 667 | } else { |
668 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
668 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
669 | 669 | } |
670 | 670 | return $transaction; |
671 | 671 | } |
@@ -681,15 +681,15 @@ discard block |
||
681 | 681 | private function _initialize_transaction() { |
682 | 682 | try { |
683 | 683 | // create new TXN |
684 | - return EE_Transaction::new_instance( array( |
|
685 | - 'TXN_timestamp' => current_time( 'timestamp' ), |
|
684 | + return EE_Transaction::new_instance(array( |
|
685 | + 'TXN_timestamp' => current_time('timestamp'), |
|
686 | 686 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
687 | 687 | 'TXN_total' => $this->checkout->cart->get_cart_grand_total(), |
688 | 688 | 'TXN_paid' => 0, |
689 | 689 | 'STS_ID' => EEM_Transaction::failed_status_code, |
690 | 690 | )); |
691 | - } catch( Exception $e ) { |
|
692 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
691 | + } catch (Exception $e) { |
|
692 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
693 | 693 | } |
694 | 694 | return NULL; |
695 | 695 | } |
@@ -703,34 +703,34 @@ discard block |
||
703 | 703 | * @param EE_Transaction $transaction |
704 | 704 | * @return EE_Cart |
705 | 705 | */ |
706 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
706 | + private function _get_registrations(EE_Transaction $transaction) { |
|
707 | 707 | // first step: grab the registrants { : o |
708 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
708 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params); |
|
709 | 709 | // verify registrations have been set |
710 | - if ( empty( $registrations )) { |
|
710 | + if (empty($registrations)) { |
|
711 | 711 | // if no cached registrations, then check the db |
712 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
712 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params); |
|
713 | 713 | // still nothing ? well as long as this isn't a revisit |
714 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
714 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
715 | 715 | // generate new registrations from scratch |
716 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
716 | + $registrations = $this->_initialize_registrations($transaction); |
|
717 | 717 | } |
718 | 718 | } |
719 | 719 | // sort by their original registration order |
720 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
720 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
721 | 721 | // then loop thru the array |
722 | - foreach ( $registrations as $registration ) { |
|
722 | + foreach ($registrations as $registration) { |
|
723 | 723 | // verify each registration |
724 | - if ( $registration instanceof EE_Registration ) { |
|
724 | + if ($registration instanceof EE_Registration) { |
|
725 | 725 | // we display all attendee info for the primary registrant |
726 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
726 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
727 | 727 | $this->checkout->primary_revisit = TRUE; |
728 | 728 | break; |
729 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
729 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
730 | 730 | // but hide info if it doesn't belong to you |
731 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
731 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
732 | 732 | } |
733 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
733 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
734 | 734 | } |
735 | 735 | } |
736 | 736 | } |
@@ -744,37 +744,37 @@ discard block |
||
744 | 744 | * @param EE_Transaction $transaction |
745 | 745 | * @return array |
746 | 746 | */ |
747 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
747 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
748 | 748 | $registrations = array(); |
749 | - if ( $transaction instanceof EE_Transaction ) { |
|
749 | + if ($transaction instanceof EE_Transaction) { |
|
750 | 750 | /** @type EE_Registration_Processor $registration_processor */ |
751 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
751 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
752 | 752 | $att_nmbr = 0; |
753 | 753 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
754 | 754 | // now let's add the cart items to the $transaction |
755 | - foreach ( $this->checkout->cart->get_tickets() as $item ) { |
|
755 | + foreach ($this->checkout->cart->get_tickets() as $item) { |
|
756 | 756 | // grab the related ticket object for this line_item |
757 | 757 | $ticket = $item->ticket(); |
758 | - if ( ! $ticket instanceof EE_Ticket ){ |
|
759 | - EE_Error::add_error(sprintf(__("Line item %s did not contain a valid ticket", "event_espresso"),$item->ID()), __FILE__, __FUNCTION__, __LINE__); |
|
758 | + if ( ! $ticket instanceof EE_Ticket) { |
|
759 | + EE_Error::add_error(sprintf(__("Line item %s did not contain a valid ticket", "event_espresso"), $item->ID()), __FILE__, __FUNCTION__, __LINE__); |
|
760 | 760 | break; |
761 | 761 | } |
762 | - $first_datetime = $ticket->get_first_related( 'Datetime' ); |
|
763 | - if ( ! $first_datetime instanceof EE_Datetime ){ |
|
764 | - EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with any valid datetimes.", "event_espresso"),$ticket->name()), __FILE__, __FUNCTION__, __LINE__ ); |
|
762 | + $first_datetime = $ticket->get_first_related('Datetime'); |
|
763 | + if ( ! $first_datetime instanceof EE_Datetime) { |
|
764 | + EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with any valid datetimes.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__); |
|
765 | 765 | continue; |
766 | 766 | } |
767 | - $event = $first_datetime->get_first_related( 'Event' ); |
|
768 | - if ( ! $event instanceof EE_Event ){ |
|
769 | - EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with a valid event.", "event_espresso"),$ticket->name()),__FILE__,__FUNCTION__,__LINE__); |
|
767 | + $event = $first_datetime->get_first_related('Event'); |
|
768 | + if ( ! $event instanceof EE_Event) { |
|
769 | + EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with a valid event.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__); |
|
770 | 770 | continue; |
771 | 771 | } |
772 | 772 | //do the following for each ticket of this type they selected |
773 | - for ( $x = 1; $x <= $item->quantity(); $x++ ) { |
|
773 | + for ($x = 1; $x <= $item->quantity(); $x++) { |
|
774 | 774 | $att_nmbr++; |
775 | - $reg_url_link = $registration_processor->generate_reg_url_link( $att_nmbr, $item ); |
|
775 | + $reg_url_link = $registration_processor->generate_reg_url_link($att_nmbr, $item); |
|
776 | 776 | // now create a new registration for the ticket |
777 | - $registration = EE_Registration::new_instance( array( |
|
777 | + $registration = EE_Registration::new_instance(array( |
|
778 | 778 | 'EVT_ID' => $event->ID(), |
779 | 779 | 'TXN_ID' => $transaction->ID(), |
780 | 780 | 'TKT_ID' => $ticket->ID(), |
@@ -786,12 +786,12 @@ discard block |
||
786 | 786 | 'REG_group_size' => $this->checkout->total_ticket_count, |
787 | 787 | 'REG_url_link' => $reg_url_link |
788 | 788 | )); |
789 | - $registration->set_reg_code( $registration_processor->generate_reg_code( $registration )); |
|
789 | + $registration->set_reg_code($registration_processor->generate_reg_code($registration)); |
|
790 | 790 | $registration->save(); |
791 | - $registration->_add_relation_to( $event, 'Event', array(), $event->ID() ); |
|
792 | - $registration->_add_relation_to( $item->ticket(), 'Ticket', array(), $item->ticket()->ID() ); |
|
793 | - $transaction->_add_relation_to( $registration, 'Registration' ); |
|
794 | - $registrations[ $registration->ID() ] = $registration; |
|
791 | + $registration->_add_relation_to($event, 'Event', array(), $event->ID()); |
|
792 | + $registration->_add_relation_to($item->ticket(), 'Ticket', array(), $item->ticket()->ID()); |
|
793 | + $transaction->_add_relation_to($registration, 'Registration'); |
|
794 | + $registrations[$registration->ID()] = $registration; |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | } |
@@ -808,12 +808,12 @@ discard block |
||
808 | 808 | * @param EE_Registration $reg_B |
809 | 809 | * @return array() |
810 | 810 | */ |
811 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
811 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
812 | 812 | // this shouldn't ever happen within the same TXN, but oh well |
813 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
813 | + if ($reg_A->count() == $reg_B->count()) { |
|
814 | 814 | return 0; |
815 | 815 | } |
816 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
816 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | |
@@ -827,30 +827,30 @@ discard block |
||
827 | 827 | * @return bool |
828 | 828 | */ |
829 | 829 | private function _final_verifications() { |
830 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
831 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
830 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
831 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
832 | 832 | return false; |
833 | 833 | } |
834 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
834 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
835 | 835 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
836 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
837 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
836 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
837 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
838 | 838 | return false; |
839 | 839 | } |
840 | 840 | $valid_registrant = null; |
841 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
842 | - if ( $registration instanceof EE_Registration ) { |
|
843 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
841 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
842 | + if ($registration instanceof EE_Registration) { |
|
843 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
844 | 844 | $valid_registrant = $registration; |
845 | 845 | } |
846 | 846 | } |
847 | 847 | } |
848 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
849 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
848 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
849 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
850 | 850 | return false; |
851 | 851 | } |
852 | 852 | } |
853 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
853 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
854 | 854 | return true; |
855 | 855 | } |
856 | 856 | |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | */ |
868 | 868 | private function _initialize_reg_steps() { |
869 | 869 | /** @type EE_Transaction_Processor $transaction_processor */ |
870 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
870 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
871 | 871 | // call set_reg_step_initiated ??? |
872 | 872 | if ( |
873 | 873 | // first time visiting SPCO ? |
@@ -876,24 +876,24 @@ discard block |
||
876 | 876 | && $this->checkout->action === 'display_spco_reg_step' |
877 | 877 | ) { |
878 | 878 | // set the start time for this reg step |
879 | - if ( ! $transaction_processor->set_reg_step_initiated( $this->checkout->transaction, $this->checkout->current_step->slug() ) ) { |
|
880 | - if ( WP_DEBUG ) { |
|
881 | - EE_Error::add_error( sprintf(__( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), $this->checkout->current_step->name() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
879 | + if ( ! $transaction_processor->set_reg_step_initiated($this->checkout->transaction, $this->checkout->current_step->slug())) { |
|
880 | + if (WP_DEBUG) { |
|
881 | + EE_Error::add_error(sprintf(__('The "%1$s" registration step was not initialized properly.', 'event_espresso'), $this->checkout->current_step->name()), __FILE__, __FUNCTION__, __LINE__); |
|
882 | 882 | } |
883 | 883 | }; |
884 | 884 | } |
885 | 885 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
886 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
886 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
887 | 887 | $reg_step->initialize_reg_step(); |
888 | 888 | // i18n |
889 | 889 | $reg_step->translate_js_strings(); |
890 | - if ( $reg_step->is_current_step() ) { |
|
890 | + if ($reg_step->is_current_step()) { |
|
891 | 891 | // the text that appears on the reg step form submit button |
892 | 892 | $reg_step->set_submit_button_text(); |
893 | 893 | } |
894 | 894 | } |
895 | 895 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
896 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
896 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
897 | 897 | } |
898 | 898 | |
899 | 899 | |
@@ -906,38 +906,38 @@ discard block |
||
906 | 906 | */ |
907 | 907 | private function _check_form_submission() { |
908 | 908 | //does this request require the reg form to be generated ? |
909 | - if ( $this->checkout->generate_reg_form ) { |
|
909 | + if ($this->checkout->generate_reg_form) { |
|
910 | 910 | // ever heard that song by Blue Rodeo ? |
911 | 911 | try { |
912 | 912 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
913 | 913 | // if not displaying a form, then check for form submission |
914 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
914 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
915 | 915 | // clear out any old data in case this step is being run again |
916 | - $this->checkout->current_step->set_valid_data( array() ); |
|
916 | + $this->checkout->current_step->set_valid_data(array()); |
|
917 | 917 | // capture submitted form data |
918 | 918 | $this->checkout->current_step->reg_form->receive_form_submission( |
919 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
919 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
920 | 920 | ); |
921 | 921 | // validate submitted form data |
922 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
922 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
923 | 923 | // thou shall not pass !!! |
924 | 924 | $this->checkout->continue_reg = FALSE; |
925 | 925 | // any form validation errors? |
926 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
926 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
927 | 927 | $submission_error_messages = array(); |
928 | 928 | // bad, bad, bad registrant |
929 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
930 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
931 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
929 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
930 | + if ($validation_error instanceof EE_Validation_Error) { |
|
931 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
932 | 932 | } |
933 | 933 | } |
934 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
934 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
935 | 935 | } |
936 | 936 | // well not really... what will happen is we'll just get redirected back to redo the current step |
937 | 937 | $this->go_to_next_step(); |
938 | 938 | } |
939 | 939 | } |
940 | - } catch( EE_Error $e ) { |
|
940 | + } catch (EE_Error $e) { |
|
941 | 941 | $e->get_error(); |
942 | 942 | } |
943 | 943 | } |
@@ -953,38 +953,38 @@ discard block |
||
953 | 953 | */ |
954 | 954 | private function _process_form_action() { |
955 | 955 | // what cha wanna do? |
956 | - switch( $this->checkout->action ) { |
|
956 | + switch ($this->checkout->action) { |
|
957 | 957 | // AJAX next step reg form |
958 | 958 | case 'display_spco_reg_step' : |
959 | 959 | $this->checkout->redirect = FALSE; |
960 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
961 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
960 | + if (EE_Registry::instance()->REQ->ajax) { |
|
961 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
962 | 962 | } |
963 | 963 | break; |
964 | 964 | |
965 | 965 | default : |
966 | 966 | // meh... do one of those other steps first |
967 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
967 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
968 | 968 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
969 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
969 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
970 | 970 | // call action on current step |
971 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
971 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
972 | 972 | // good registrant, you get to proceed |
973 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
974 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
975 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
973 | + if ($this->checkout->current_step->success_message() != '') { |
|
974 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
975 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
976 | 976 | } |
977 | 977 | } |
978 | 978 | // pack it up, pack it in... |
979 | 979 | $this->_setup_redirect(); |
980 | 980 | } |
981 | 981 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
982 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
982 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
983 | 983 | |
984 | 984 | } else { |
985 | 985 | EE_Error::add_error( |
986 | 986 | sprintf( |
987 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
987 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
988 | 988 | $this->checkout->action, |
989 | 989 | $this->checkout->current_step->name() |
990 | 990 | ), |
@@ -1008,10 +1008,10 @@ discard block |
||
1008 | 1008 | * @return void |
1009 | 1009 | */ |
1010 | 1010 | public function add_styles_and_scripts() { |
1011 | - if ( $this->checkout->admin_request ) { |
|
1012 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1011 | + if ($this->checkout->admin_request) { |
|
1012 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1013 | 1013 | } else { |
1014 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1014 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1015 | 1015 | } |
1016 | 1016 | } |
1017 | 1017 | |
@@ -1027,45 +1027,45 @@ discard block |
||
1027 | 1027 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1028 | 1028 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1029 | 1029 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1030 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1031 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1032 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1030 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1031 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1032 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1033 | 1033 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1034 | 1034 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1035 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1036 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1035 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1036 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1037 | 1037 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1038 | 1038 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1039 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1040 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1041 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1042 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1043 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1044 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1045 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1046 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1047 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1048 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1049 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1050 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1051 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1052 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1039 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1040 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1041 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1042 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1043 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1044 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1045 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1046 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1047 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1048 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1049 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1050 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1051 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1052 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1053 | 1053 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1054 | - __( '%1$sWe\'re sorry, but you\'re registration time has expired |
|
1054 | + __('%1$sWe\'re sorry, but you\'re registration time has expired |
|
1055 | 1055 | .%2$s%3$s%4$sIf you still wish to complete your registration, please |
1056 | 1056 | return to the %5$sEvent List%6$sEvent List%7$s and reselect your |
1057 | 1057 | tickets if available. Please except our apologies for any inconvenience this |
1058 | - may have caused.%8$s', 'event_espresso' ), |
|
1058 | + may have caused.%8$s', 'event_espresso'), |
|
1059 | 1059 | '<h4 class="important-notice">', |
1060 | 1060 | '</h4>', |
1061 | 1061 | '<br />', |
1062 | 1062 | '<p>', |
1063 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1063 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1064 | 1064 | '">', |
1065 | 1065 | '</a>', |
1066 | 1066 | '</p>' |
1067 | 1067 | ); |
1068 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1068 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | |
@@ -1078,28 +1078,28 @@ discard block |
||
1078 | 1078 | */ |
1079 | 1079 | public function enqueue_styles_and_scripts() { |
1080 | 1080 | // load css |
1081 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1082 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1081 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1082 | + wp_enqueue_style('single_page_checkout'); |
|
1083 | 1083 | // i18n |
1084 | 1084 | $this->translate_js_strings(); |
1085 | 1085 | // load JS |
1086 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1087 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1088 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1089 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1090 | - wp_localize_script( 'single_page_checkout', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1086 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1087 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1088 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1089 | + wp_enqueue_script('single_page_checkout'); |
|
1090 | + wp_localize_script('single_page_checkout', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1091 | 1091 | |
1092 | 1092 | /** |
1093 | 1093 | * global action hook for enqueueing styles and scripts with |
1094 | 1094 | * spco calls. |
1095 | 1095 | */ |
1096 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1096 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1097 | 1097 | |
1098 | 1098 | /** |
1099 | 1099 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1100 | 1100 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1101 | 1101 | */ |
1102 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1102 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1103 | 1103 | |
1104 | 1104 | // add css and JS for current step |
1105 | 1105 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1115,11 +1115,11 @@ discard block |
||
1115 | 1115 | */ |
1116 | 1116 | private function _display_spco_reg_form() { |
1117 | 1117 | // if registering via the admin, just display the reg form for the current step |
1118 | - if ( $this->checkout->admin_request ) { |
|
1119 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1118 | + if ($this->checkout->admin_request) { |
|
1119 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1120 | 1120 | } else { |
1121 | 1121 | // add powered by EE msg |
1122 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1122 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1123 | 1123 | $this->checkout->registration_form = new EE_Form_Section_Proper( |
1124 | 1124 | array( |
1125 | 1125 | 'name' => 'single-page-checkout', |
@@ -1127,17 +1127,17 @@ discard block |
||
1127 | 1127 | 'layout_strategy' => |
1128 | 1128 | new EE_Template_Layout( |
1129 | 1129 | array( |
1130 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1130 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1131 | 1131 | 'template_args' => array( |
1132 | - 'empty_cart' => count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params )) < 1 ? TRUE : FALSE, |
|
1132 | + 'empty_cart' => count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? TRUE : FALSE, |
|
1133 | 1133 | 'revisit' => $this->checkout->revisit, |
1134 | 1134 | 'reg_steps' => $this->checkout->reg_steps, |
1135 | 1135 | 'next_step' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '', |
1136 | 1136 | 'empty_msg' => apply_filters( |
1137 | 1137 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1138 | 1138 | sprintf( |
1139 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1140 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1139 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1140 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1141 | 1141 | '">', |
1142 | 1142 | '</a>' |
1143 | 1143 | ) |
@@ -1145,16 +1145,16 @@ discard block |
||
1145 | 1145 | 'registration_time_limit' => |
1146 | 1146 | $this->checkout->get_registration_time_limit(), |
1147 | 1147 | 'session_expiration' => |
1148 | - gmdate( 'M d, Y H:i:s', |
|
1148 | + gmdate('M d, Y H:i:s', |
|
1149 | 1149 | EE_Registry::instance() |
1150 | - ->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1150 | + ->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1151 | 1151 | ) |
1152 | 1152 | ) |
1153 | 1153 | ) |
1154 | 1154 | ) |
1155 | 1155 | ); |
1156 | 1156 | // load template and add to output sent that gets filtered into the_content() |
1157 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1157 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1158 | 1158 | } |
1159 | 1159 | } |
1160 | 1160 | |
@@ -1168,8 +1168,8 @@ discard block |
||
1168 | 1168 | * @internal param string $label |
1169 | 1169 | * @return string |
1170 | 1170 | */ |
1171 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1172 | - if ( $next_step == 'finalize_registration' ) { |
|
1171 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1172 | + if ($next_step == 'finalize_registration') { |
|
1173 | 1173 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1174 | 1174 | } |
1175 | 1175 | } |
@@ -1183,18 +1183,18 @@ discard block |
||
1183 | 1183 | * @return string |
1184 | 1184 | */ |
1185 | 1185 | public static function display_registration_footer() { |
1186 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1187 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1188 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'http://eventespresso.com/' ); |
|
1189 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1186 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1187 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1188 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'http://eventespresso.com/'); |
|
1189 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1190 | 1190 | echo apply_filters( |
1191 | 1191 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1192 | 1192 | sprintf( |
1193 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1194 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1193 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1194 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1195 | 1195 | '" target="_blank">', |
1196 | 1196 | '</a>', |
1197 | - '<a href="' . $url . '" title="', |
|
1197 | + '<a href="'.$url.'" title="', |
|
1198 | 1198 | '" target="_blank">', |
1199 | 1199 | '</a></div>' |
1200 | 1200 | ) |
@@ -1225,12 +1225,12 @@ discard block |
||
1225 | 1225 | * @return array |
1226 | 1226 | */ |
1227 | 1227 | private function _setup_redirect() { |
1228 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1228 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1229 | 1229 | $this->checkout->redirect = TRUE; |
1230 | - if ( empty( $this->checkout->redirect_url )) { |
|
1230 | + if (empty($this->checkout->redirect_url)) { |
|
1231 | 1231 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1232 | 1232 | } |
1233 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1233 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1234 | 1234 | } |
1235 | 1235 | } |
1236 | 1236 | |
@@ -1243,7 +1243,7 @@ discard block |
||
1243 | 1243 | * @return void |
1244 | 1244 | */ |
1245 | 1245 | public function go_to_next_step() { |
1246 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' ) { |
|
1246 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form') { |
|
1247 | 1247 | return; |
1248 | 1248 | } |
1249 | 1249 | // AJAX response |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | */ |
1265 | 1265 | protected function _handle_json_response() { |
1266 | 1266 | // if this is an ajax request |
1267 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1267 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1268 | 1268 | // DEBUG LOG |
1269 | 1269 | //$this->checkout->log( |
1270 | 1270 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1274,9 +1274,9 @@ discard block |
||
1274 | 1274 | // 'continue_reg' => $this->checkout->continue_reg, |
1275 | 1275 | // ) |
1276 | 1276 | //); |
1277 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1277 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1278 | 1278 | // just send the ajax ( |
1279 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1279 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1280 | 1280 | $this->unlock_transaction(); |
1281 | 1281 | echo $json_response; |
1282 | 1282 | exit(); |
@@ -1293,9 +1293,9 @@ discard block |
||
1293 | 1293 | */ |
1294 | 1294 | protected function _handle_html_redirects() { |
1295 | 1295 | // going somewhere ? |
1296 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1296 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1297 | 1297 | // store notices in a transient |
1298 | - EE_Error::get_notices( false, true, true ); |
|
1298 | + EE_Error::get_notices(false, true, true); |
|
1299 | 1299 | $this->unlock_transaction(); |
1300 | 1300 | // DEBUG LOG |
1301 | 1301 | //$this->checkout->log( |
@@ -1306,7 +1306,7 @@ discard block |
||
1306 | 1306 | // 'headers_list' => headers_list(), |
1307 | 1307 | // ) |
1308 | 1308 | //); |
1309 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1309 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1310 | 1310 | exit(); |
1311 | 1311 | } |
1312 | 1312 | } |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Checkout |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Checkout |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_Checkout { |
15 | 15 | |
16 | 16 | /** |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | /** |
263 | 263 | * @param $REG_ID |
264 | - * @param $reg_status |
|
264 | + * @param boolean $reg_status |
|
265 | 265 | */ |
266 | 266 | public function set_reg_status_updated( $REG_ID, $reg_status ) { |
267 | 267 | $this->reg_status_updated[ $REG_ID ] = $reg_status; |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * reset_reg_steps |
516 | 516 | * |
517 | 517 | * @access public |
518 | - * @return bool |
|
518 | + * @return boolean|null |
|
519 | 519 | */ |
520 | 520 | public function reset_reg_steps() { |
521 | 521 | $this->sort_reg_steps(); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | * stash_transaction_and_checkout |
607 | 607 | * |
608 | 608 | * @access public |
609 | - * @return bool |
|
609 | + * @return boolean|null |
|
610 | 610 | */ |
611 | 611 | public function stash_transaction_and_checkout() { |
612 | 612 | if ( ! $this->revisit ) { |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | * stores whether any updates were made to the TXN or it's related registrations |
629 | 629 | * |
630 | 630 | * @access public |
631 | - * @return bool |
|
631 | + * @return boolean|null |
|
632 | 632 | */ |
633 | 633 | public function track_transaction_and_registration_status_updates() { |
634 | 634 | // verify the transaction |
@@ -969,6 +969,7 @@ discard block |
||
969 | 969 | * |
970 | 970 | * @param string | int $reg_cache_ID |
971 | 971 | * @param EE_Registration $registration |
972 | + * @param integer $reg_cache_ID |
|
972 | 973 | * @return void |
973 | 974 | */ |
974 | 975 | protected function _refresh_registration( $reg_cache_ID, $registration ) { |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | $this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url(); |
243 | 243 | $this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url(); |
244 | 244 | $this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url(); |
245 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE ); |
|
245 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE); |
|
246 | 246 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
247 | - $this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
247 | + $this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC')); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | * @param $REG_ID |
254 | 254 | * @return array |
255 | 255 | */ |
256 | - public function reg_status_updated( $REG_ID ) { |
|
257 | - return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false; |
|
256 | + public function reg_status_updated($REG_ID) { |
|
257 | + return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | * @param $REG_ID |
264 | 264 | * @param $reg_status |
265 | 265 | */ |
266 | - public function set_reg_status_updated( $REG_ID, $reg_status ) { |
|
267 | - $this->reg_status_updated[ $REG_ID ] = $reg_status; |
|
266 | + public function set_reg_status_updated($REG_ID, $reg_status) { |
|
267 | + $this->reg_status_updated[$REG_ID] = $reg_status; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * can ONLY be set by the Finalize_Registration reg step |
286 | 286 | */ |
287 | 287 | public function set_exit_spco() { |
288 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
288 | + if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
289 | 289 | $this->exit_spco = true; |
290 | 290 | } |
291 | 291 | } |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | * @return void |
302 | 302 | */ |
303 | 303 | public function reset_for_current_request() { |
304 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true ); |
|
304 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true); |
|
305 | 305 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
306 | 306 | $this->continue_reg = true; |
307 | 307 | $this->redirect = false; |
308 | 308 | // don't reset the cached redirect form if we're about to be asked to display it !!! |
309 | - if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) { |
|
309 | + if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') { |
|
310 | 310 | $this->redirect_form = ''; |
311 | 311 | } |
312 | 312 | $this->redirect_url = ''; |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | * @param EE_SPCO_Reg_Step $reg_step_obj |
324 | 324 | * @return void |
325 | 325 | */ |
326 | - public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
|
327 | - $this->reg_steps[ $reg_step_obj->slug() ] = $reg_step_obj; |
|
326 | + public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) { |
|
327 | + $this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | |
@@ -336,13 +336,13 @@ discard block |
||
336 | 336 | * @param string $reg_step_slug |
337 | 337 | * @return void |
338 | 338 | */ |
339 | - public function remove_reg_step( $reg_step_slug = '' ) { |
|
340 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
341 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
339 | + public function remove_reg_step($reg_step_slug = '') { |
|
340 | + unset($this->reg_steps[$reg_step_slug]); |
|
341 | + if ($this->transaction instanceof EE_Transaction) { |
|
342 | 342 | /** @type EE_Transaction_Processor $transaction_processor */ |
343 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
343 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
344 | 344 | // now remove reg step from TXN and save |
345 | - $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
|
345 | + $transaction_processor->remove_reg_step($this->transaction, $reg_step_slug); |
|
346 | 346 | $this->transaction->save(); |
347 | 347 | } |
348 | 348 | } |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | * @param int $order |
358 | 358 | * @return void |
359 | 359 | */ |
360 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
361 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
362 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
360 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
361 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
362 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | |
@@ -372,25 +372,25 @@ discard block |
||
372 | 372 | * @param string $current_step |
373 | 373 | * @return void |
374 | 374 | */ |
375 | - public function set_current_step( $current_step ) { |
|
375 | + public function set_current_step($current_step) { |
|
376 | 376 | // grab what step we're on |
377 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
377 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
378 | 378 | // verify instance |
379 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
379 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
380 | 380 | // we don't want to repeat completed steps if this is the first time through SPCO |
381 | - if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) { |
|
381 | + if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) { |
|
382 | 382 | // so advance to the next step |
383 | 383 | $this->set_next_step(); |
384 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
384 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
385 | 385 | // and attempt to set it as the current step |
386 | - $this->set_current_step( $this->next_step->slug() ); |
|
386 | + $this->set_current_step($this->next_step->slug()); |
|
387 | 387 | } |
388 | 388 | return; |
389 | 389 | } |
390 | - $this->current_step->set_is_current_step( TRUE ); |
|
390 | + $this->current_step->set_is_current_step(TRUE); |
|
391 | 391 | } else { |
392 | 392 | EE_Error::add_error( |
393 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
393 | + __('The current step could not be set.', 'event_espresso'), |
|
394 | 394 | __FILE__, __FUNCTION__, __LINE__ |
395 | 395 | ); |
396 | 396 | } |
@@ -407,20 +407,20 @@ discard block |
||
407 | 407 | */ |
408 | 408 | public function set_next_step() { |
409 | 409 | // set pointer to start of array |
410 | - reset( $this->reg_steps ); |
|
410 | + reset($this->reg_steps); |
|
411 | 411 | // if there is more than one step |
412 | - if ( count( $this->reg_steps ) > 1 ) { |
|
412 | + if (count($this->reg_steps) > 1) { |
|
413 | 413 | // advance to the current step and set pointer |
414 | - while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) { |
|
415 | - next( $this->reg_steps ); |
|
414 | + while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') { |
|
415 | + next($this->reg_steps); |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | // advance one more spot ( if it exists ) |
419 | - $this->next_step = next( $this->reg_steps ); |
|
419 | + $this->next_step = next($this->reg_steps); |
|
420 | 420 | // verify instance |
421 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
421 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
422 | 422 | // then back to current step to reset |
423 | - prev( $this->reg_steps ); |
|
423 | + prev($this->reg_steps); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | |
@@ -434,8 +434,8 @@ discard block |
||
434 | 434 | * @return EE_SPCO_Reg_Step | null |
435 | 435 | */ |
436 | 436 | public function get_next_reg_step() { |
437 | - $next = next( $this->reg_steps ); |
|
438 | - prev( $this->reg_steps ); |
|
437 | + $next = next($this->reg_steps); |
|
438 | + prev($this->reg_steps); |
|
439 | 439 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
440 | 440 | } |
441 | 441 | |
@@ -450,8 +450,8 @@ discard block |
||
450 | 450 | * @return EE_SPCO_Reg_Step | null |
451 | 451 | */ |
452 | 452 | public function get_prev_reg_step() { |
453 | - $prev = prev( $this->reg_steps ); |
|
454 | - next( $this->reg_steps ); |
|
453 | + $prev = prev($this->reg_steps); |
|
454 | + next($this->reg_steps); |
|
455 | 455 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
456 | 456 | } |
457 | 457 | |
@@ -464,8 +464,8 @@ discard block |
||
464 | 464 | * @return void |
465 | 465 | */ |
466 | 466 | public function sort_reg_steps() { |
467 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
468 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
467 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
468 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | |
@@ -478,17 +478,17 @@ discard block |
||
478 | 478 | * @param EE_SPCO_Reg_Step $reg_step_B |
479 | 479 | * @return array() |
480 | 480 | */ |
481 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
481 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
482 | 482 | // send finalize_registration step to the end of the array |
483 | - if ( $reg_step_A->slug() == 'finalize_registration' ) { |
|
483 | + if ($reg_step_A->slug() == 'finalize_registration') { |
|
484 | 484 | return 1; |
485 | - } else if ( $reg_step_B->slug() == 'finalize_registration' ) { |
|
485 | + } else if ($reg_step_B->slug() == 'finalize_registration') { |
|
486 | 486 | return -1; |
487 | 487 | } |
488 | - if ( $reg_step_A->order() == $reg_step_B->order() ) { |
|
488 | + if ($reg_step_A->order() == $reg_step_B->order()) { |
|
489 | 489 | return 0; |
490 | 490 | } |
491 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
491 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | |
@@ -500,10 +500,10 @@ discard block |
||
500 | 500 | * @return void |
501 | 501 | */ |
502 | 502 | public function set_reg_step_JSON_info() { |
503 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
503 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
504 | 504 | // pass basic reg step data to JS |
505 | - foreach ( $this->reg_steps as $reg_step ) { |
|
506 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
505 | + foreach ($this->reg_steps as $reg_step) { |
|
506 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
507 | 507 | } |
508 | 508 | // reset reg step html |
509 | 509 | // $this->json_response->set_reg_step_html( '' ); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | */ |
520 | 520 | public function reset_reg_steps() { |
521 | 521 | $this->sort_reg_steps(); |
522 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
522 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
523 | 523 | $this->set_next_step(); |
524 | 524 | // the text that appears on the reg step form submit button |
525 | 525 | $this->current_step->set_submit_button_text(); |
@@ -536,9 +536,9 @@ discard block |
||
536 | 536 | */ |
537 | 537 | public function get_registration_time_limit() { |
538 | 538 | |
539 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
539 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
540 | 540 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
541 | - $registration_time_limit = gmdate( $time_limit_format, $registration_time_limit ); |
|
541 | + $registration_time_limit = gmdate($time_limit_format, $registration_time_limit); |
|
542 | 542 | return apply_filters( |
543 | 543 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
544 | 544 | $registration_time_limit |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | // overpaid TXN |
559 | 559 | // free TXN ( total = 0.00 ) |
560 | 560 | // then payment required is TRUE |
561 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
561 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | |
@@ -571,8 +571,8 @@ discard block |
||
571 | 571 | */ |
572 | 572 | public function initialize_txn_reg_steps_array() { |
573 | 573 | $txn_reg_steps_array = array(); |
574 | - foreach ( $this->reg_steps as $reg_step ) { |
|
575 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
574 | + foreach ($this->reg_steps as $reg_step) { |
|
575 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
576 | 576 | } |
577 | 577 | return $txn_reg_steps_array; |
578 | 578 | } |
@@ -588,13 +588,13 @@ discard block |
||
588 | 588 | public function update_txn_reg_steps_array() { |
589 | 589 | $updated = FALSE; |
590 | 590 | /** @type EE_Transaction_Processor $transaction_processor */ |
591 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
592 | - foreach ( $this->reg_steps as $reg_step ) { |
|
593 | - if ( $reg_step->completed() ) { |
|
594 | - $updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated; |
|
591 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
592 | + foreach ($this->reg_steps as $reg_step) { |
|
593 | + if ($reg_step->completed()) { |
|
594 | + $updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated; |
|
595 | 595 | } |
596 | 596 | } |
597 | - if ( $updated ) { |
|
597 | + if ($updated) { |
|
598 | 598 | $this->transaction->save(); |
599 | 599 | } |
600 | 600 | return $updated; |
@@ -609,14 +609,14 @@ discard block |
||
609 | 609 | * @return bool |
610 | 610 | */ |
611 | 611 | public function stash_transaction_and_checkout() { |
612 | - if ( ! $this->revisit ) { |
|
612 | + if ( ! $this->revisit) { |
|
613 | 613 | $this->update_txn_reg_steps_array(); |
614 | 614 | } |
615 | 615 | $this->track_transaction_and_registration_status_updates(); |
616 | 616 | // save all data to the db, but suppress errors |
617 | 617 | //$this->save_all_data( FALSE ); |
618 | 618 | // cache the checkout in the session |
619 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
619 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | |
@@ -632,21 +632,21 @@ discard block |
||
632 | 632 | */ |
633 | 633 | public function track_transaction_and_registration_status_updates() { |
634 | 634 | // verify the transaction |
635 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
635 | + if ($this->transaction instanceof EE_Transaction) { |
|
636 | 636 | /** @type EE_Transaction_Payments $transaction_payments */ |
637 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
637 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
638 | 638 | /** @type EE_Transaction_Processor $transaction_processor */ |
639 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
639 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
640 | 640 | // has there been a TXN status change during this checkout? |
641 | - if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) { |
|
641 | + if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) { |
|
642 | 642 | $this->txn_status_updated = true; |
643 | 643 | } |
644 | 644 | /** @type EE_Registration_Processor $registration_processor */ |
645 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
645 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
646 | 646 | // grab the saved registrations from the transaction |
647 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
648 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
649 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
647 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
648 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
649 | + $this->set_reg_status_updated($registration->ID(), true); |
|
650 | 650 | } |
651 | 651 | } |
652 | 652 | } |
@@ -668,8 +668,8 @@ discard block |
||
668 | 668 | * @param EE_Registration $registration |
669 | 669 | * @return bool |
670 | 670 | */ |
671 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
672 | - return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE; |
|
671 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
672 | + return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE; |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | |
@@ -694,18 +694,18 @@ discard block |
||
694 | 694 | * @param bool $show_errors |
695 | 695 | * @return bool |
696 | 696 | */ |
697 | - public function save_all_data( $show_errors = TRUE ) { |
|
697 | + public function save_all_data($show_errors = TRUE) { |
|
698 | 698 | // verify the transaction |
699 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
699 | + if ($this->transaction instanceof EE_Transaction) { |
|
700 | 700 | // save to ensure that TXN has ID |
701 | 701 | $this->transaction->save(); |
702 | 702 | // grab the saved registrations from the transaction |
703 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
704 | - $this->_save_registration( $registration, $show_errors ); |
|
703 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
704 | + $this->_save_registration($registration, $show_errors); |
|
705 | 705 | } |
706 | 706 | } else { |
707 | - if ( $show_errors ) { |
|
708 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
707 | + if ($show_errors) { |
|
708 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
709 | 709 | } |
710 | 710 | return FALSE; |
711 | 711 | } |
@@ -720,32 +720,32 @@ discard block |
||
720 | 720 | * @param bool $show_errors |
721 | 721 | * @return void |
722 | 722 | */ |
723 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
723 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
724 | 724 | // verify object |
725 | - if ( $registration instanceof EE_Registration ) { |
|
725 | + if ($registration instanceof EE_Registration) { |
|
726 | 726 | // should this registration be processed during this visit ? |
727 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
727 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
728 | 728 | //set TXN ID |
729 | - if ( ! $registration->transaction_ID() ) { |
|
730 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
729 | + if ( ! $registration->transaction_ID()) { |
|
730 | + $registration->set_transaction_id($this->transaction->ID()); |
|
731 | 731 | } |
732 | 732 | // verify and save the attendee |
733 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
733 | + $this->_save_registration_attendee($registration, $show_errors); |
|
734 | 734 | // save answers to reg form questions |
735 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
735 | + $this->_save_registration_answers($registration, $show_errors); |
|
736 | 736 | // save changes |
737 | 737 | $registration->save(); |
738 | 738 | // update txn cache |
739 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
740 | - if ( $show_errors ) { |
|
741 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
739 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
740 | + if ($show_errors) { |
|
741 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
742 | 742 | } |
743 | 743 | } |
744 | 744 | } |
745 | 745 | } else { |
746 | - if ( $show_errors ) { |
|
746 | + if ($show_errors) { |
|
747 | 747 | EE_Error::add_error( |
748 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
748 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
749 | 749 | __FILE__, __FUNCTION__, __LINE__ |
750 | 750 | ); |
751 | 751 | } |
@@ -761,26 +761,26 @@ discard block |
||
761 | 761 | * @param bool $show_errors |
762 | 762 | * @return void |
763 | 763 | */ |
764 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
765 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
764 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
765 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
766 | 766 | // save so that ATT has ID |
767 | 767 | $registration->attendee()->save(); |
768 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) { |
|
769 | - if ( $show_errors ) { |
|
768 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
769 | + if ($show_errors) { |
|
770 | 770 | EE_Error::add_error( |
771 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
771 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
772 | 772 | __FILE__, __FUNCTION__, __LINE__ |
773 | 773 | ); |
774 | 774 | } |
775 | 775 | } |
776 | 776 | } else { |
777 | - if ( $show_errors ) { |
|
777 | + if ($show_errors) { |
|
778 | 778 | ob_start(); |
779 | - var_dump( $registration->attendee() ); |
|
779 | + var_dump($registration->attendee()); |
|
780 | 780 | EE_Error::add_error( |
781 | 781 | sprintf( |
782 | 782 | '%1$s||%1$s $attendee = %2$s', |
783 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
783 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
784 | 784 | ob_get_clean() |
785 | 785 | ), |
786 | 786 | __FILE__, __FUNCTION__, __LINE__ |
@@ -798,25 +798,25 @@ discard block |
||
798 | 798 | * @param bool $show_errors |
799 | 799 | * @return void |
800 | 800 | */ |
801 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
801 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
802 | 802 | // now save the answers |
803 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
803 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
804 | 804 | // verify object |
805 | - if ( $answer instanceof EE_Answer ) { |
|
806 | - $answer->set_registration( $registration->ID() ); |
|
805 | + if ($answer instanceof EE_Answer) { |
|
806 | + $answer->set_registration($registration->ID()); |
|
807 | 807 | $answer->save(); |
808 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
809 | - if ( $show_errors ) { |
|
808 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
809 | + if ($show_errors) { |
|
810 | 810 | EE_Error::add_error( |
811 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
811 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
812 | 812 | __FILE__, __FUNCTION__, __LINE__ |
813 | 813 | ); |
814 | 814 | } |
815 | 815 | } |
816 | 816 | } else { |
817 | - if ( $show_errors ) { |
|
817 | + if ($show_errors) { |
|
818 | 818 | EE_Error::add_error( |
819 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
819 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
820 | 820 | __FILE__, __FUNCTION__, __LINE__ |
821 | 821 | ); |
822 | 822 | } |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | * @param bool $from_db |
835 | 835 | * @return bool |
836 | 836 | */ |
837 | - public function refresh_all_entities( $from_db = false ) { |
|
837 | + public function refresh_all_entities($from_db = false) { |
|
838 | 838 | $from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db; |
839 | 839 | //$this->log( |
840 | 840 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -855,11 +855,11 @@ discard block |
||
855 | 855 | */ |
856 | 856 | protected function refresh_from_db() { |
857 | 857 | // verify the transaction |
858 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
858 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
859 | 859 | // pull fresh TXN data from the db |
860 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
860 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
861 | 861 | // update EE_Checkout's cached primary_attendee object |
862 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
862 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
863 | 863 | // update EE_Checkout's cached payment object |
864 | 864 | $payment = $this->transaction->last_payment(); |
865 | 865 | $this->payment = $payment instanceof EE_Payment ? $payment : null; |
@@ -867,13 +867,13 @@ discard block |
||
867 | 867 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
868 | 868 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : null; |
869 | 869 | //now refresh the cart, based on the TXN |
870 | - $this->cart = EE_Cart::get_cart_from_txn( $this->transaction ); |
|
870 | + $this->cart = EE_Cart::get_cart_from_txn($this->transaction); |
|
871 | 871 | // verify cart |
872 | - if ( ! $this->cart instanceof EE_Cart ) { |
|
873 | - $this->cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
872 | + if ( ! $this->cart instanceof EE_Cart) { |
|
873 | + $this->cart = EE_Registry::instance()->load_core('Cart'); |
|
874 | 874 | } |
875 | 875 | } else { |
876 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
876 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
877 | 877 | return FALSE; |
878 | 878 | } |
879 | 879 | return TRUE; |
@@ -887,24 +887,24 @@ discard block |
||
887 | 887 | * @param EE_Transaction $transaction |
888 | 888 | * @return EE_Attendee | null |
889 | 889 | */ |
890 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
890 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
891 | 891 | |
892 | 892 | $primary_attendee_obj = null; |
893 | 893 | // grab the saved registrations from the transaction |
894 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
894 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
895 | 895 | // verify object |
896 | - if ( $registration instanceof EE_Registration ) { |
|
896 | + if ($registration instanceof EE_Registration) { |
|
897 | 897 | $attendee = $registration->attendee(); |
898 | 898 | // verify object |
899 | - if ( $attendee instanceof EE_Attendee ) { |
|
899 | + if ($attendee instanceof EE_Attendee) { |
|
900 | 900 | // maybe cache primary_attendee_obj ? |
901 | - if ( $registration->is_primary_registrant() ) { |
|
901 | + if ($registration->is_primary_registrant()) { |
|
902 | 902 | $primary_attendee_obj = $attendee; |
903 | 903 | } |
904 | 904 | } |
905 | 905 | } else { |
906 | 906 | EE_Error::add_error( |
907 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
907 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
908 | 908 | __FILE__, __FUNCTION__, __LINE__ |
909 | 909 | ); |
910 | 910 | } |
@@ -924,38 +924,38 @@ discard block |
||
924 | 924 | */ |
925 | 925 | protected function refresh_entity_map() { |
926 | 926 | // verify the transaction |
927 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
927 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
928 | 928 | // never cache payment info |
929 | - $this->transaction->clear_cache( 'Payment' ); |
|
929 | + $this->transaction->clear_cache('Payment'); |
|
930 | 930 | /** @type EE_Transaction_Processor $transaction_processor */ |
931 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
931 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
932 | 932 | // is the Payment Options Reg Step completed ? |
933 | - if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) { |
|
933 | + if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) { |
|
934 | 934 | // then check for payments and update TXN accordingly |
935 | 935 | /** @type EE_Transaction_Payments $transaction_payments */ |
936 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
937 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
936 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
937 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
938 | 938 | } |
939 | 939 | // grab the saved registrations from the transaction |
940 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) { |
|
941 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
940 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) { |
|
941 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
942 | 942 | } |
943 | 943 | // make sure our cached TXN is added to the model entity mapper |
944 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
944 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
945 | 945 | |
946 | 946 | } else { |
947 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
947 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
948 | 948 | return FALSE; |
949 | 949 | } |
950 | - if ( $this->cart instanceof EE_Cart ) { |
|
950 | + if ($this->cart instanceof EE_Cart) { |
|
951 | 951 | $grand_total = $this->cart->get_grand_total()->get_model()->refresh_entity_map_with( |
952 | 952 | $this->cart->get_grand_total()->ID(), |
953 | 953 | $this->cart->get_grand_total() |
954 | 954 | ); |
955 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
956 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
955 | + if ($grand_total instanceof EE_Line_Item) { |
|
956 | + $this->cart = EE_Cart::instance($grand_total); |
|
957 | 957 | } else { |
958 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
958 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
959 | 959 | return false; |
960 | 960 | } |
961 | 961 | } |
@@ -971,19 +971,19 @@ discard block |
||
971 | 971 | * @param EE_Registration $registration |
972 | 972 | * @return void |
973 | 973 | */ |
974 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
974 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
975 | 975 | |
976 | 976 | // verify object |
977 | - if ( $registration instanceof EE_Registration ) { |
|
977 | + if ($registration instanceof EE_Registration) { |
|
978 | 978 | // update the entity mapper attendee |
979 | - $this->_refresh_registration_attendee( $registration ); |
|
979 | + $this->_refresh_registration_attendee($registration); |
|
980 | 980 | // update the entity mapper answers for reg form questions |
981 | - $this->_refresh_registration_answers( $registration ); |
|
981 | + $this->_refresh_registration_answers($registration); |
|
982 | 982 | // make sure the cached registration is added to the model entity mapper |
983 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
983 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
984 | 984 | } else { |
985 | 985 | EE_Error::add_error( |
986 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
986 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
987 | 987 | __FILE__, __FUNCTION__, __LINE__ |
988 | 988 | ); |
989 | 989 | } |
@@ -997,15 +997,15 @@ discard block |
||
997 | 997 | * @param EE_Registration $registration |
998 | 998 | * @return void |
999 | 999 | */ |
1000 | - protected function _refresh_registration_attendee( $registration ) { |
|
1000 | + protected function _refresh_registration_attendee($registration) { |
|
1001 | 1001 | |
1002 | 1002 | $attendee = $registration->attendee(); |
1003 | 1003 | // verify object |
1004 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1004 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1005 | 1005 | // make sure the cached attendee is added to the model entity mapper |
1006 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1006 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1007 | 1007 | // maybe cache primary_attendee_obj ? |
1008 | - if ( $registration->is_primary_registrant() ) { |
|
1008 | + if ($registration->is_primary_registrant()) { |
|
1009 | 1009 | $this->primary_attendee_obj = $attendee; |
1010 | 1010 | } |
1011 | 1011 | } |
@@ -1019,19 +1019,19 @@ discard block |
||
1019 | 1019 | * @param EE_Registration $registration |
1020 | 1020 | * @return void |
1021 | 1021 | */ |
1022 | - protected function _refresh_registration_answers( $registration ) { |
|
1022 | + protected function _refresh_registration_answers($registration) { |
|
1023 | 1023 | |
1024 | 1024 | // now update the answers |
1025 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1025 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1026 | 1026 | // verify object |
1027 | - if ( $answer instanceof EE_Answer ) { |
|
1028 | - if ( $answer->ID() ) { |
|
1027 | + if ($answer instanceof EE_Answer) { |
|
1028 | + if ($answer->ID()) { |
|
1029 | 1029 | // make sure the cached answer is added to the model entity mapper |
1030 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1030 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1031 | 1031 | } |
1032 | 1032 | } else { |
1033 | 1033 | EE_Error::add_error( |
1034 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1034 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1035 | 1035 | __FILE__, __FUNCTION__, __LINE__ |
1036 | 1036 | ); |
1037 | 1037 | } |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1047 | 1047 | */ |
1048 | 1048 | function __wakeup() { |
1049 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1049 | + foreach ($this->reg_steps as $reg_step) { |
|
1050 | 1050 | $reg_step->checkout = $this; |
1051 | 1051 | } |
1052 | 1052 | } |
@@ -1062,11 +1062,11 @@ discard block |
||
1062 | 1062 | * @param array $info |
1063 | 1063 | * @param bool $display_request |
1064 | 1064 | */ |
1065 | - function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1066 | - if ( WP_DEBUG && false ) { |
|
1067 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1065 | + function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1066 | + if (WP_DEBUG && false) { |
|
1067 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1068 | 1068 | $default_data = array( |
1069 | - $class => $func . '() : ' . $line, |
|
1069 | + $class => $func.'() : '.$line, |
|
1070 | 1070 | 'request->step' => $this->step, |
1071 | 1071 | 'request->action' => $this->action, |
1072 | 1072 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1078,24 +1078,24 @@ discard block |
||
1078 | 1078 | 'reg_url_link' => $this->reg_url_link, |
1079 | 1079 | 'REQ' => $display_request ? $_REQUEST : '', |
1080 | 1080 | ); |
1081 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1082 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1083 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1084 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1085 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1081 | + if ($this->transaction instanceof EE_Transaction) { |
|
1082 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1083 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1084 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1085 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1086 | 1086 | } |
1087 | - if ( $this->transaction->ID() ) { |
|
1088 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1087 | + if ($this->transaction->ID()) { |
|
1088 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1089 | 1089 | // don't serialize objects |
1090 | - $info = $this->_strip_objects( $info ); |
|
1091 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1092 | - $debug_data[ $TXN_ID ] = array(); |
|
1090 | + $info = $this->_strip_objects($info); |
|
1091 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1092 | + $debug_data[$TXN_ID] = array(); |
|
1093 | 1093 | } |
1094 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1094 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1095 | 1095 | $default_data, |
1096 | 1096 | $info |
1097 | 1097 | ); |
1098 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1098 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1099 | 1099 | } |
1100 | 1100 | } |
1101 | 1101 | } |
@@ -1108,23 +1108,23 @@ discard block |
||
1108 | 1108 | * @param array $info |
1109 | 1109 | * @return array |
1110 | 1110 | */ |
1111 | - function _strip_objects( $info = array() ) { |
|
1112 | - foreach ( $info as $key => $value ) { |
|
1113 | - if ( is_array( $value )) { |
|
1114 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1115 | - } else if ( is_object( $value ) ) { |
|
1116 | - $object_class = get_class( $value ); |
|
1117 | - $info[ $object_class ] = array(); |
|
1118 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1119 | - if ( method_exists( $value, 'status' ) ) { |
|
1120 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1121 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1122 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1111 | + function _strip_objects($info = array()) { |
|
1112 | + foreach ($info as $key => $value) { |
|
1113 | + if (is_array($value)) { |
|
1114 | + $info[$key] = $this->_strip_objects($value); |
|
1115 | + } else if (is_object($value)) { |
|
1116 | + $object_class = get_class($value); |
|
1117 | + $info[$object_class] = array(); |
|
1118 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1119 | + if (method_exists($value, 'status')) { |
|
1120 | + $info[$object_class]['status'] = $value->status(); |
|
1121 | + } else if (method_exists($value, 'status_ID')) { |
|
1122 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1123 | 1123 | } |
1124 | - unset( $info[ $key ] ); |
|
1124 | + unset($info[$key]); |
|
1125 | 1125 | } |
1126 | 1126 | } |
1127 | - return (array)$info; |
|
1127 | + return (array) $info; |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 |
@@ -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_JSON_Response |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since $VID:$ |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_JSON_Response |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since $VID:$ |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_JSON_Response { |
15 | 15 | |
16 | 16 | /** |
@@ -97,64 +97,64 @@ discard block |
||
97 | 97 | public function __toString() { |
98 | 98 | $JSON_response = array(); |
99 | 99 | // grab notices |
100 | - $notices = EE_Error::get_notices( FALSE ); |
|
101 | - $this->set_attention( isset( $notices['attention'] ) ? $notices['attention'] : '' ); |
|
102 | - $this->set_errors( isset( $notices['errors'] ) ? $notices['errors'] : '' ); |
|
103 | - $this->set_success( isset( $notices['success'] ) ? $notices['success'] : '' ); |
|
100 | + $notices = EE_Error::get_notices(FALSE); |
|
101 | + $this->set_attention(isset($notices['attention']) ? $notices['attention'] : ''); |
|
102 | + $this->set_errors(isset($notices['errors']) ? $notices['errors'] : ''); |
|
103 | + $this->set_success(isset($notices['success']) ? $notices['success'] : ''); |
|
104 | 104 | // add notices to JSON response, but only if they exist |
105 | - if ( $this->attention() ) { |
|
105 | + if ($this->attention()) { |
|
106 | 106 | $JSON_response['attention'] = $this->attention(); |
107 | 107 | } |
108 | - if ( $this->errors() ) { |
|
108 | + if ($this->errors()) { |
|
109 | 109 | $JSON_response['errors'] = $this->errors(); |
110 | 110 | } |
111 | - if ( $this->success() ) { |
|
111 | + if ($this->success()) { |
|
112 | 112 | $JSON_response['success'] = $this->success(); |
113 | 113 | } |
114 | 114 | // but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked |
115 | - if ( ! isset( $JSON_response[ 'attention' ] ) && ! isset( $JSON_response[ 'errors' ] ) && ! isset( $JSON_response[ 'success' ] ) ) { |
|
115 | + if ( ! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) { |
|
116 | 116 | $JSON_response['success'] = null; |
117 | 117 | } |
118 | 118 | // set redirect_url, IF it exists |
119 | - if ( $this->redirect_url() ) { |
|
119 | + if ($this->redirect_url()) { |
|
120 | 120 | $JSON_response['redirect_url'] = $this->redirect_url(); |
121 | 121 | } |
122 | 122 | // set registration_time_limit, IF it exists |
123 | - if ( $this->registration_time_limit() ) { |
|
123 | + if ($this->registration_time_limit()) { |
|
124 | 124 | $JSON_response['registration_time_limit'] = $this->registration_time_limit(); |
125 | 125 | } |
126 | 126 | // grab generic return data |
127 | 127 | $return_data = $this->return_data(); |
128 | 128 | // add billing form validation rules |
129 | - if ( $this->validation_rules() ) { |
|
129 | + if ($this->validation_rules()) { |
|
130 | 130 | $return_data['validation_rules'] = $this->validation_rules(); |
131 | 131 | } |
132 | 132 | // set reg_step_html, IF it exists |
133 | - if ( $this->reg_step_html() ) { |
|
133 | + if ($this->reg_step_html()) { |
|
134 | 134 | $return_data['reg_step_html'] = $this->reg_step_html(); |
135 | 135 | } |
136 | 136 | // set method of payment, IF it exists |
137 | - if ( $this->method_of_payment() ) { |
|
137 | + if ($this->method_of_payment()) { |
|
138 | 138 | $return_data['method_of_payment'] = $this->method_of_payment(); |
139 | 139 | } |
140 | 140 | // set "plz_select_method_of_payment" message, IF it exists |
141 | - if ( $this->plz_select_method_of_payment() ) { |
|
141 | + if ($this->plz_select_method_of_payment()) { |
|
142 | 142 | $return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment(); |
143 | 143 | } |
144 | 144 | // set redirect_form, IF it exists |
145 | - if ( $this->redirect_form() ) { |
|
145 | + if ($this->redirect_form()) { |
|
146 | 146 | $return_data['redirect_form'] = $this->redirect_form(); |
147 | 147 | } |
148 | 148 | // and finally, add return_data array to main JSON response array, IF it contains anything |
149 | 149 | // why did we add some of the above properties to the return data array? |
150 | 150 | // because it is easier and cleaner in the Javascript to deal with this way |
151 | - if ( ! empty( $return_data )) { |
|
151 | + if ( ! empty($return_data)) { |
|
152 | 152 | $JSON_response['return_data'] = $return_data; |
153 | 153 | } |
154 | 154 | // filter final array |
155 | - $JSON_response = apply_filters( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response ); |
|
155 | + $JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response); |
|
156 | 156 | // return encoded array |
157 | - return json_encode( $JSON_response ); |
|
157 | + return json_encode($JSON_response); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | /** |
163 | 163 | * @param string $attention |
164 | 164 | */ |
165 | - public function set_attention( $attention ) { |
|
165 | + public function set_attention($attention) { |
|
166 | 166 | $this->_attention = $attention; |
167 | 167 | } |
168 | 168 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | /** |
181 | 181 | * @param string $errors |
182 | 182 | */ |
183 | - public function set_errors( $errors ) { |
|
183 | + public function set_errors($errors) { |
|
184 | 184 | $this->_errors = $errors; |
185 | 185 | } |
186 | 186 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | /** |
199 | 199 | * @param string $success |
200 | 200 | */ |
201 | - public function set_success( $success ) { |
|
201 | + public function set_success($success) { |
|
202 | 202 | $this->_success = $success; |
203 | 203 | } |
204 | 204 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | /** |
217 | 217 | * @param string $method_of_payment |
218 | 218 | */ |
219 | - public function set_method_of_payment( $method_of_payment ) { |
|
219 | + public function set_method_of_payment($method_of_payment) { |
|
220 | 220 | $this->_method_of_payment = $method_of_payment; |
221 | 221 | } |
222 | 222 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | /** |
235 | 235 | * @param string $next_step_html |
236 | 236 | */ |
237 | - public function set_reg_step_html( $next_step_html ) { |
|
237 | + public function set_reg_step_html($next_step_html) { |
|
238 | 238 | $this->_reg_step_html = $next_step_html; |
239 | 239 | } |
240 | 240 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | /** |
253 | 253 | * @param string $redirect_form |
254 | 254 | */ |
255 | - public function set_redirect_form( $redirect_form ) { |
|
255 | + public function set_redirect_form($redirect_form) { |
|
256 | 256 | $this->_redirect_form = $redirect_form; |
257 | 257 | } |
258 | 258 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @return string |
263 | 263 | */ |
264 | 264 | public function redirect_form() { |
265 | - return ! empty( $this->_redirect_form ) ? $this->_redirect_form : FALSE; |
|
265 | + return ! empty($this->_redirect_form) ? $this->_redirect_form : FALSE; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | /** |
271 | 271 | * @param string $plz_select_method_of_payment |
272 | 272 | */ |
273 | - public function set_plz_select_method_of_payment( $plz_select_method_of_payment ) { |
|
273 | + public function set_plz_select_method_of_payment($plz_select_method_of_payment) { |
|
274 | 274 | $this->_plz_select_method_of_payment = $plz_select_method_of_payment; |
275 | 275 | } |
276 | 276 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | /** |
289 | 289 | * @param string $redirect_url |
290 | 290 | */ |
291 | - public function set_redirect_url( $redirect_url ) { |
|
291 | + public function set_redirect_url($redirect_url) { |
|
292 | 292 | $this->_redirect_url = $redirect_url; |
293 | 293 | } |
294 | 294 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | /** |
316 | 316 | * @param string $registration_time_limit |
317 | 317 | */ |
318 | - public function set_registration_time_limit( $registration_time_limit ) { |
|
318 | + public function set_registration_time_limit($registration_time_limit) { |
|
319 | 319 | $this->_registration_time_limit = $registration_time_limit; |
320 | 320 | } |
321 | 321 | |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | /** |
325 | 325 | * @param array $return_data |
326 | 326 | */ |
327 | - public function set_return_data( $return_data ) { |
|
328 | - $this->_return_data = array_merge( $this->_return_data, $return_data ); |
|
327 | + public function set_return_data($return_data) { |
|
328 | + $this->_return_data = array_merge($this->_return_data, $return_data); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -342,9 +342,9 @@ discard block |
||
342 | 342 | /** |
343 | 343 | * @param array $validation_rules |
344 | 344 | */ |
345 | - public function add_validation_rules( $validation_rules = array() ) { |
|
346 | - if ( is_array( $validation_rules ) && ! empty( $validation_rules )) { |
|
347 | - $this->_validation_rules = array_merge( $this->_validation_rules, $validation_rules ); |
|
345 | + public function add_validation_rules($validation_rules = array()) { |
|
346 | + if (is_array($validation_rules) && ! empty($validation_rules)) { |
|
347 | + $this->_validation_rules = array_merge($this->_validation_rules, $validation_rules); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @return array | bool |
355 | 355 | */ |
356 | 356 | public function validation_rules() { |
357 | - return ! empty( $this->_validation_rules ) ? $this->_validation_rules : FALSE; |
|
357 | + return ! empty($this->_validation_rules) ? $this->_validation_rules : FALSE; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 |
@@ -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_Registration_Confirmation |
|
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_Registration_Confirmation |
|
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_Registration_Confirmation extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * @param EE_Checkout $checkout |
21 | 21 | * @return \EE_SPCO_Reg_Step_Registration_Confirmation |
22 | 22 | */ |
23 | - public function __construct( EE_Checkout $checkout ) { |
|
23 | + public function __construct(EE_Checkout $checkout) { |
|
24 | 24 | $this->_slug = 'registration_confirmation'; |
25 | 25 | $this->_name = __('Registration Confirmation', 'event_espresso'); |
26 | - $this->_template = SPCO_TEMPLATES_PATH . 'registration_page_confirmation.template.php'; |
|
26 | + $this->_template = SPCO_TEMPLATES_PATH.'registration_page_confirmation.template.php'; |
|
27 | 27 | $this->checkout = $checkout; |
28 | 28 | } |
29 | 29 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return string |
50 | 50 | */ |
51 | 51 | public function generate_reg_form() { |
52 | - EE_Registry::instance()->REQ->add_output( 'generate_reg_form' ); |
|
52 | + EE_Registry::instance()->REQ->add_output('generate_reg_form'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
41 | - * @return boolean |
|
41 | + * @return boolean|null |
|
42 | 42 | */ |
43 | 43 | public function initialize_reg_step() { |
44 | 44 | } |