@@ -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 --> |
@@ -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> |
@@ -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->system_ID(),$questions_to_skip)){ |
|
146 | + foreach ($question_group->questions() as $question) { |
|
147 | + if (in_array($question->system_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='https://eventespresso.com'>","</a>"); |
|
285 | + printf(__("Powered by %sEvent Espresso %s", "event_espresso"), "<a href='https://eventespresso.com'>", "</a>"); |
|
286 | 286 | ?></div> |
287 | 287 | <?php } ?> |
288 | 288 | </div> |
@@ -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,8 +38,8 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
42 | - return parent::get_instance( __CLASS__ ); |
|
41 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
42 | + return parent::get_instance(__CLASS__); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks_admin() { |
86 | 86 | EED_Single_Page_Checkout::set_definitions(); |
87 | - if ( defined( 'DOING_AJAX' )) { |
|
87 | + if (defined('DOING_AJAX')) { |
|
88 | 88 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
89 | 89 | ob_start(); |
90 | 90 | EED_Single_Page_Checkout::load_request_handler(); |
91 | 91 | EED_Single_Page_Checkout::load_reg_steps(); |
92 | 92 | } else { |
93 | 93 | // 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 |
94 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
94 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
95 | 95 | } |
96 | 96 | // set ajax hooks |
97 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
98 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
99 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
100 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
101 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
102 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
97 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
98 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
99 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
100 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
101 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
102 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * process ajax request |
109 | 109 | * @param string $ajax_action |
110 | 110 | */ |
111 | - public static function process_ajax_request( $ajax_action ) { |
|
112 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
111 | + public static function process_ajax_request($ajax_action) { |
|
112 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
113 | 113 | EED_Single_Page_Checkout::instance()->_initialize(); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * ajax display registration step |
120 | 120 | */ |
121 | 121 | public static function display_reg_step() { |
122 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
122 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * ajax process registration step |
129 | 129 | */ |
130 | 130 | public static function process_reg_step() { |
131 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
131 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * ajax process registration step |
138 | 138 | */ |
139 | 139 | public static function update_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public static function update_checkout() { |
152 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
152 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public static function load_request_handler() { |
164 | 164 | // load core Request_Handler class |
165 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
166 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
165 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
166 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | * @return void |
177 | 177 | */ |
178 | 178 | public static function set_definitions() { |
179 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
180 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
181 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
182 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
183 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
184 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
185 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public static function load_reg_steps() { |
200 | 200 | static $reg_steps_loaded = FALSE; |
201 | - if ( $reg_steps_loaded ) { |
|
201 | + if ($reg_steps_loaded) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | // filter list of reg_steps |
@@ -207,24 +207,24 @@ discard block |
||
207 | 207 | EED_Single_Page_Checkout::get_reg_steps() |
208 | 208 | ); |
209 | 209 | // sort by key (order) |
210 | - ksort( $reg_steps_to_load ); |
|
210 | + ksort($reg_steps_to_load); |
|
211 | 211 | // loop through folders |
212 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
212 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
213 | 213 | // we need a |
214 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
214 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
215 | 215 | // copy over to the reg_steps_array |
216 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
216 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
217 | 217 | // register custom key route for each reg step |
218 | 218 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
219 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
219 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
220 | 220 | // add AJAX or other hooks |
221 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
221 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
222 | 222 | // setup autoloaders if necessary |
223 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
224 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
223 | + if ( ! class_exists($reg_step['class_name'])) { |
|
224 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
225 | 225 | } |
226 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
227 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
226 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
227 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
@@ -243,28 +243,28 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public static function get_reg_steps() { |
245 | 245 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
246 | - if ( empty( $reg_steps )) { |
|
246 | + if (empty($reg_steps)) { |
|
247 | 247 | $reg_steps = array( |
248 | 248 | 10 => array( |
249 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
249 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
250 | 250 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
251 | 251 | 'slug' => 'attendee_information', |
252 | 252 | 'has_hooks' => FALSE |
253 | 253 | ), |
254 | 254 | 20 => array( |
255 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
255 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
256 | 256 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
257 | 257 | 'slug' => 'registration_confirmation', |
258 | 258 | 'has_hooks' => FALSE |
259 | 259 | ), |
260 | 260 | 30 => array( |
261 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
261 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
262 | 262 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
263 | 263 | 'slug' => 'payment_options', |
264 | 264 | 'has_hooks' => TRUE |
265 | 265 | ), |
266 | 266 | 999 => array( |
267 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
267 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
268 | 268 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
269 | 269 | 'slug' => 'finalize_registration', |
270 | 270 | 'has_hooks' => FALSE |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public static function registration_checkout_for_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', 'display_spco_reg_step' ); |
|
289 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
287 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
288 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
289 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
290 | 290 | EED_Single_Page_Checkout::instance()->_initialize(); |
291 | 291 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
292 | 292 | return EE_Registry::instance()->REQ->get_output(); |
@@ -302,15 +302,15 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public static function process_registration_from_admin() { |
304 | 304 | EED_Single_Page_Checkout::load_reg_steps(); |
305 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
306 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
307 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
305 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
306 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
307 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
308 | 308 | EED_Single_Page_Checkout::instance()->_initialize(); |
309 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
310 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
311 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
312 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
313 | - if ( $final_reg_step->process_reg_step() ) { |
|
309 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
310 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
311 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
312 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
313 | + if ($final_reg_step->process_reg_step()) { |
|
314 | 314 | $final_reg_step->set_completed(); |
315 | 315 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
316 | 316 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -329,11 +329,11 @@ discard block |
||
329 | 329 | * @param WP_Query $WP_Query |
330 | 330 | * @return void |
331 | 331 | */ |
332 | - public function run( $WP_Query ) { |
|
332 | + public function run($WP_Query) { |
|
333 | 333 | if ( |
334 | 334 | $WP_Query instanceof WP_Query |
335 | 335 | && $WP_Query->is_main_query() |
336 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
336 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
337 | 337 | ) { |
338 | 338 | $this->_initialize(); |
339 | 339 | } |
@@ -349,8 +349,8 @@ discard block |
||
349 | 349 | * @param WP_Query $WP_Query |
350 | 350 | * @return void |
351 | 351 | */ |
352 | - public static function init( $WP_Query ) { |
|
353 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
352 | + public static function init($WP_Query) { |
|
353 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | |
@@ -364,35 +364,35 @@ discard block |
||
364 | 364 | */ |
365 | 365 | private function _initialize() { |
366 | 366 | // ensure SPCO doesn't run twice |
367 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
367 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
368 | 368 | return; |
369 | 369 | } |
370 | 370 | // setup the EE_Checkout object |
371 | 371 | $this->checkout = $this->_initialize_checkout(); |
372 | 372 | // filter checkout |
373 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
373 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
374 | 374 | // get the $_GET |
375 | 375 | $this->_get_request_vars(); |
376 | 376 | // filter continue_reg |
377 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
377 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
378 | 378 | // load the reg steps array |
379 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
379 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
380 | 380 | EED_Single_Page_Checkout::$_initialized = true; |
381 | 381 | return; |
382 | 382 | } |
383 | 383 | // set the current step |
384 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
384 | + $this->checkout->set_current_step($this->checkout->step); |
|
385 | 385 | // and the next step |
386 | 386 | $this->checkout->set_next_step(); |
387 | 387 | // was there already a valid transaction in the checkout from the session ? |
388 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
388 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
389 | 389 | // get transaction from db or session |
390 | 390 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
391 | 391 | ? $this->_get_transaction_and_cart_for_previous_visit() |
392 | 392 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
393 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
393 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
394 | 394 | EE_Error::add_error( |
395 | - __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), |
|
395 | + __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), |
|
396 | 396 | __FILE__, __FUNCTION__, __LINE__ |
397 | 397 | ); |
398 | 398 | // add some style and make it dance |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | return; |
403 | 403 | } |
404 | 404 | // and the registrations for the transaction |
405 | - $this->_get_registrations( $this->checkout->transaction ); |
|
405 | + $this->_get_registrations($this->checkout->transaction); |
|
406 | 406 | } |
407 | 407 | // verify that everything has been setup correctly |
408 | - if ( ! $this->_final_verifications() ) { |
|
408 | + if ( ! $this->_final_verifications()) { |
|
409 | 409 | EED_Single_Page_Checkout::$_initialized = true; |
410 | 410 | return; |
411 | 411 | } |
@@ -430,9 +430,9 @@ discard block |
||
430 | 430 | // set no cache headers and constants |
431 | 431 | EE_System::do_not_cache(); |
432 | 432 | // add anchor |
433 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
433 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
434 | 434 | // remove transaction lock |
435 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
435 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | |
@@ -449,20 +449,20 @@ discard block |
||
449 | 449 | // look in session for existing checkout |
450 | 450 | $checkout = EE_Registry::instance()->SSN->checkout(); |
451 | 451 | // verify |
452 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
452 | + if ( ! $checkout instanceof EE_Checkout) { |
|
453 | 453 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
454 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
454 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
455 | 455 | // verify again |
456 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
457 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
456 | + if ( ! $checkout instanceof EE_Checkout) { |
|
457 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
458 | 458 | } |
459 | 459 | } else { |
460 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
461 | - wp_safe_redirect( $checkout->redirect_url ); |
|
460 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
461 | + wp_safe_redirect($checkout->redirect_url); |
|
462 | 462 | exit(); |
463 | 463 | } |
464 | 464 | } |
465 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
465 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
466 | 466 | // reset anything that needs a clean slate for each request |
467 | 467 | $checkout->reset_for_current_request(); |
468 | 468 | return $checkout; |
@@ -480,24 +480,24 @@ discard block |
||
480 | 480 | // load classes |
481 | 481 | EED_Single_Page_Checkout::load_request_handler(); |
482 | 482 | //make sure this request is marked as belonging to EE |
483 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
483 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
484 | 484 | // which step is being requested ? |
485 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
485 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
486 | 486 | // which step is being edited ? |
487 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
487 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
488 | 488 | // and what we're doing on the current step |
489 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
489 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
490 | 490 | // returning to edit ? |
491 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
491 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
492 | 492 | // or some other kind of revisit ? |
493 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
493 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
494 | 494 | // and whether or not to generate a reg form for this request |
495 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
495 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
496 | 496 | // and whether or not to process a reg form submission for this request |
497 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
497 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
498 | 498 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
499 | 499 | ? $this->checkout->process_form_submission |
500 | - : FALSE; // TRUE FALSE |
|
500 | + : FALSE; // TRUE FALSE |
|
501 | 501 | //$this->_display_request_vars(); |
502 | 502 | } |
503 | 503 | |
@@ -510,17 +510,17 @@ discard block |
||
510 | 510 | * @return void |
511 | 511 | */ |
512 | 512 | protected function _display_request_vars() { |
513 | - if ( ! WP_DEBUG ) { |
|
513 | + if ( ! WP_DEBUG) { |
|
514 | 514 | return; |
515 | 515 | } |
516 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
517 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
518 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
519 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
520 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
521 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
522 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
523 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
516 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
517 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
518 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
519 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
520 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
521 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
522 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
523 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | |
@@ -534,8 +534,8 @@ discard block |
||
534 | 534 | * @return array |
535 | 535 | */ |
536 | 536 | private function _get_first_step() { |
537 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
538 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
537 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
538 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | |
@@ -551,27 +551,27 @@ discard block |
||
551 | 551 | private function _load_and_instantiate_reg_steps() { |
552 | 552 | // have reg_steps already been instantiated ? |
553 | 553 | if ( |
554 | - empty( $this->checkout->reg_steps ) || |
|
555 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
554 | + empty($this->checkout->reg_steps) || |
|
555 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
556 | 556 | ) { |
557 | 557 | // if not, then loop through raw reg steps array |
558 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
559 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
558 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
559 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
560 | 560 | return false; |
561 | 561 | } |
562 | 562 | } |
563 | 563 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
564 | 564 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
565 | 565 | // skip the registration_confirmation page ? |
566 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
566 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
567 | 567 | // just remove it from the reg steps array |
568 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
568 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
569 | 569 | } else if ( |
570 | 570 | EE_Registry::instance()->CFG->registration->reg_confirmation_last |
571 | - && isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
571 | + && isset($this->checkout->reg_steps['registration_confirmation']) |
|
572 | 572 | ) { |
573 | 573 | // set the order to something big like 100 |
574 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
574 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
575 | 575 | } |
576 | 576 | // filter the array for good luck |
577 | 577 | $this->checkout->reg_steps = apply_filters( |
@@ -581,13 +581,13 @@ discard block |
||
581 | 581 | // finally re-sort based on the reg step class order properties |
582 | 582 | $this->checkout->sort_reg_steps(); |
583 | 583 | } else { |
584 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
584 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
585 | 585 | // set all current step stati to FALSE |
586 | - $reg_step->set_is_current_step( FALSE ); |
|
586 | + $reg_step->set_is_current_step(FALSE); |
|
587 | 587 | } |
588 | 588 | } |
589 | - if ( empty( $this->checkout->reg_steps )) { |
|
590 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
589 | + if (empty($this->checkout->reg_steps)) { |
|
590 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
591 | 591 | return false; |
592 | 592 | } |
593 | 593 | // make reg step details available to JS |
@@ -605,10 +605,10 @@ discard block |
||
605 | 605 | * @param int $order |
606 | 606 | * @return bool |
607 | 607 | */ |
608 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
608 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
609 | 609 | |
610 | 610 | // we need a file_path, class_name, and slug to add a reg step |
611 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
611 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
612 | 612 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
613 | 613 | if ( |
614 | 614 | $this->checkout->reg_url_link |
@@ -626,26 +626,26 @@ discard block |
||
626 | 626 | FALSE |
627 | 627 | ); |
628 | 628 | // did we gets the goods ? |
629 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
629 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
630 | 630 | // set reg step order based on config |
631 | - $reg_step_obj->set_order( $order ); |
|
631 | + $reg_step_obj->set_order($order); |
|
632 | 632 | // add instantiated reg step object to the master reg steps array |
633 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
633 | + $this->checkout->add_reg_step($reg_step_obj); |
|
634 | 634 | } else { |
635 | 635 | EE_Error::add_error( |
636 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
636 | + __('The current step could not be set.', 'event_espresso'), |
|
637 | 637 | __FILE__, __FUNCTION__, __LINE__ |
638 | 638 | ); |
639 | 639 | return false; |
640 | 640 | } |
641 | 641 | } else { |
642 | - if ( WP_DEBUG ) { |
|
642 | + if (WP_DEBUG) { |
|
643 | 643 | EE_Error::add_error( |
644 | 644 | sprintf( |
645 | - __( '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' ), |
|
646 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
647 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
648 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
645 | + __('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'), |
|
646 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
647 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
648 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
649 | 649 | '<ul>', |
650 | 650 | '<li>', |
651 | 651 | '</li>', |
@@ -669,16 +669,16 @@ discard block |
||
669 | 669 | */ |
670 | 670 | private function _get_transaction_and_cart_for_previous_visit() { |
671 | 671 | /** @var $TXN_model EEM_Transaction */ |
672 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
672 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
673 | 673 | // 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 |
674 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
674 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
675 | 675 | // verify transaction |
676 | - if ( $transaction instanceof EE_Transaction ) { |
|
676 | + if ($transaction instanceof EE_Transaction) { |
|
677 | 677 | // and get the cart that was used for that transaction |
678 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
678 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
679 | 679 | return $transaction; |
680 | 680 | } else { |
681 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
681 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
682 | 682 | return NULL; |
683 | 683 | } |
684 | 684 | } |
@@ -692,11 +692,11 @@ discard block |
||
692 | 692 | * @param EE_Transaction $transaction |
693 | 693 | * @return EE_Cart |
694 | 694 | */ |
695 | - private function _get_cart_for_transaction( $transaction ) { |
|
696 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
695 | + private function _get_cart_for_transaction($transaction) { |
|
696 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
697 | 697 | // verify cart |
698 | - if ( ! $cart instanceof EE_Cart ) { |
|
699 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
698 | + if ( ! $cart instanceof EE_Cart) { |
|
699 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
700 | 700 | } |
701 | 701 | return $cart; |
702 | 702 | } |
@@ -711,8 +711,8 @@ discard block |
||
711 | 711 | * @param EE_Transaction $transaction |
712 | 712 | * @return EE_Cart |
713 | 713 | */ |
714 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
715 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
714 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
715 | + return EE_Cart::get_cart_from_txn($transaction); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | |
@@ -727,17 +727,17 @@ discard block |
||
727 | 727 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
728 | 728 | // if there's no transaction, then this is the FIRST visit to SPCO |
729 | 729 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
730 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
730 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
731 | 731 | // and then create a new transaction |
732 | 732 | $transaction = $this->_initialize_transaction(); |
733 | 733 | // verify transaction |
734 | - if ( $transaction instanceof EE_Transaction ) { |
|
734 | + if ($transaction instanceof EE_Transaction) { |
|
735 | 735 | // save it so that we have an ID for other objects to use |
736 | 736 | $transaction->save(); |
737 | 737 | // and save TXN data to the cart |
738 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
738 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
739 | 739 | } else { |
740 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
740 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
741 | 741 | } |
742 | 742 | return $transaction; |
743 | 743 | } |
@@ -757,15 +757,15 @@ discard block |
||
757 | 757 | // grab the cart grand total |
758 | 758 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
759 | 759 | // create new TXN |
760 | - return EE_Transaction::new_instance( array( |
|
760 | + return EE_Transaction::new_instance(array( |
|
761 | 761 | 'TXN_timestamp' => time(), |
762 | 762 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
763 | 763 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
764 | 764 | 'TXN_paid' => 0, |
765 | 765 | 'STS_ID' => EEM_Transaction::failed_status_code, |
766 | 766 | )); |
767 | - } catch( Exception $e ) { |
|
768 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
767 | + } catch (Exception $e) { |
|
768 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
769 | 769 | } |
770 | 770 | return NULL; |
771 | 771 | } |
@@ -779,34 +779,34 @@ discard block |
||
779 | 779 | * @param EE_Transaction $transaction |
780 | 780 | * @return EE_Cart |
781 | 781 | */ |
782 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
782 | + private function _get_registrations(EE_Transaction $transaction) { |
|
783 | 783 | // first step: grab the registrants { : o |
784 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
784 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
785 | 785 | // verify registrations have been set |
786 | - if ( empty( $registrations )) { |
|
786 | + if (empty($registrations)) { |
|
787 | 787 | // if no cached registrations, then check the db |
788 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
788 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
789 | 789 | // still nothing ? well as long as this isn't a revisit |
790 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
790 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
791 | 791 | // generate new registrations from scratch |
792 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
792 | + $registrations = $this->_initialize_registrations($transaction); |
|
793 | 793 | } |
794 | 794 | } |
795 | 795 | // sort by their original registration order |
796 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
796 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
797 | 797 | // then loop thru the array |
798 | - foreach ( $registrations as $registration ) { |
|
798 | + foreach ($registrations as $registration) { |
|
799 | 799 | // verify each registration |
800 | - if ( $registration instanceof EE_Registration ) { |
|
800 | + if ($registration instanceof EE_Registration) { |
|
801 | 801 | // we display all attendee info for the primary registrant |
802 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
802 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
803 | 803 | $this->checkout->primary_revisit = TRUE; |
804 | 804 | break; |
805 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
805 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
806 | 806 | // but hide info if it doesn't belong to you |
807 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
807 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
808 | 808 | } |
809 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
809 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
810 | 810 | } |
811 | 811 | } |
812 | 812 | } |
@@ -820,17 +820,17 @@ discard block |
||
820 | 820 | * @param EE_Transaction $transaction |
821 | 821 | * @return array |
822 | 822 | */ |
823 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
823 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
824 | 824 | $att_nmbr = 0; |
825 | 825 | $registrations = array(); |
826 | - if ( $transaction instanceof EE_Transaction ) { |
|
826 | + if ($transaction instanceof EE_Transaction) { |
|
827 | 827 | /** @type EE_Registration_Processor $registration_processor */ |
828 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
828 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
829 | 829 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
830 | 830 | // now let's add the cart items to the $transaction |
831 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
831 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
832 | 832 | //do the following for each ticket of this type they selected |
833 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
833 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
834 | 834 | $att_nmbr++; |
835 | 835 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
836 | 836 | $line_item, |
@@ -838,12 +838,12 @@ discard block |
||
838 | 838 | $att_nmbr, |
839 | 839 | $this->checkout->total_ticket_count |
840 | 840 | ); |
841 | - if ( $registration instanceof EE_Registration ) { |
|
842 | - $registrations[ $registration->ID() ] = $registration; |
|
841 | + if ($registration instanceof EE_Registration) { |
|
842 | + $registrations[$registration->ID()] = $registration; |
|
843 | 843 | } |
844 | 844 | } |
845 | 845 | } |
846 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
846 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
847 | 847 | } |
848 | 848 | return $registrations; |
849 | 849 | } |
@@ -858,12 +858,12 @@ discard block |
||
858 | 858 | * @param EE_Registration $reg_B |
859 | 859 | * @return array() |
860 | 860 | */ |
861 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
861 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
862 | 862 | // this shouldn't ever happen within the same TXN, but oh well |
863 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
863 | + if ($reg_A->count() == $reg_B->count()) { |
|
864 | 864 | return 0; |
865 | 865 | } |
866 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
866 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
867 | 867 | } |
868 | 868 | |
869 | 869 | |
@@ -878,35 +878,35 @@ discard block |
||
878 | 878 | */ |
879 | 879 | private function _final_verifications() { |
880 | 880 | // filter checkout |
881 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
881 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
882 | 882 | //verify that current step is still set correctly |
883 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
884 | - 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__ ); |
|
883 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
884 | + 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__); |
|
885 | 885 | return false; |
886 | 886 | } |
887 | 887 | // if returning to SPCO, then verify that primary registrant is set |
888 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
888 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
889 | 889 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
890 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
891 | - 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__ ); |
|
890 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
891 | + 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__); |
|
892 | 892 | return false; |
893 | 893 | } |
894 | 894 | $valid_registrant = null; |
895 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
896 | - if ( $registration instanceof EE_Registration ) { |
|
897 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
895 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
896 | + if ($registration instanceof EE_Registration) { |
|
897 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
898 | 898 | $valid_registrant = $registration; |
899 | 899 | } |
900 | 900 | } |
901 | 901 | } |
902 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
903 | - 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__ ); |
|
902 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
903 | + 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__); |
|
904 | 904 | return false; |
905 | 905 | } |
906 | 906 | } |
907 | 907 | // now that things have been kinda sufficiently verified, |
908 | 908 | // let's add the checkout to the session so that's available other systems |
909 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
909 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
910 | 910 | return true; |
911 | 911 | } |
912 | 912 | |
@@ -922,28 +922,28 @@ discard block |
||
922 | 922 | * @access private |
923 | 923 | * @param bool $reinitializing |
924 | 924 | */ |
925 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
926 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
925 | + private function _initialize_reg_steps($reinitializing = false) { |
|
926 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
927 | 927 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
928 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
929 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
928 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
929 | + if ( ! $reg_step->initialize_reg_step()) { |
|
930 | 930 | // if not initialized then maybe this step is being removed... |
931 | - if ( $reg_step->is_current_step() && ! $reinitializing ) { |
|
931 | + if ($reg_step->is_current_step() && ! $reinitializing) { |
|
932 | 932 | // if it was the current step, then we need to start over here |
933 | - $this->_initialize_reg_steps( true ); |
|
933 | + $this->_initialize_reg_steps(true); |
|
934 | 934 | return; |
935 | 935 | } |
936 | 936 | continue; |
937 | 937 | } |
938 | 938 | // i18n |
939 | 939 | $reg_step->translate_js_strings(); |
940 | - if ( $reg_step->is_current_step() ) { |
|
940 | + if ($reg_step->is_current_step()) { |
|
941 | 941 | // the text that appears on the reg step form submit button |
942 | 942 | $reg_step->set_submit_button_text(); |
943 | 943 | } |
944 | 944 | } |
945 | 945 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
946 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
946 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | |
@@ -956,39 +956,39 @@ discard block |
||
956 | 956 | */ |
957 | 957 | private function _check_form_submission() { |
958 | 958 | //does this request require the reg form to be generated ? |
959 | - if ( $this->checkout->generate_reg_form ) { |
|
959 | + if ($this->checkout->generate_reg_form) { |
|
960 | 960 | // ever heard that song by Blue Rodeo ? |
961 | 961 | try { |
962 | 962 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
963 | 963 | // if not displaying a form, then check for form submission |
964 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
964 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
965 | 965 | // clear out any old data in case this step is being run again |
966 | - $this->checkout->current_step->set_valid_data( array() ); |
|
966 | + $this->checkout->current_step->set_valid_data(array()); |
|
967 | 967 | // capture submitted form data |
968 | 968 | $this->checkout->current_step->reg_form->receive_form_submission( |
969 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
969 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
970 | 970 | ); |
971 | 971 | // validate submitted form data |
972 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
972 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
973 | 973 | // thou shall not pass !!! |
974 | 974 | $this->checkout->continue_reg = FALSE; |
975 | 975 | // any form validation errors? |
976 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
976 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
977 | 977 | $submission_error_messages = array(); |
978 | 978 | // bad, bad, bad registrant |
979 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
980 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
981 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
979 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
980 | + if ($validation_error instanceof EE_Validation_Error) { |
|
981 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
982 | 982 | } |
983 | 983 | } |
984 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
984 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
985 | 985 | } |
986 | 986 | // well not really... what will happen is we'll just get redirected back to redo the current step |
987 | 987 | $this->go_to_next_step(); |
988 | 988 | return; |
989 | 989 | } |
990 | 990 | } |
991 | - } catch( EE_Error $e ) { |
|
991 | + } catch (EE_Error $e) { |
|
992 | 992 | $e->get_error(); |
993 | 993 | } |
994 | 994 | } |
@@ -1004,38 +1004,38 @@ discard block |
||
1004 | 1004 | */ |
1005 | 1005 | private function _process_form_action() { |
1006 | 1006 | // what cha wanna do? |
1007 | - switch( $this->checkout->action ) { |
|
1007 | + switch ($this->checkout->action) { |
|
1008 | 1008 | // AJAX next step reg form |
1009 | 1009 | case 'display_spco_reg_step' : |
1010 | 1010 | $this->checkout->redirect = FALSE; |
1011 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1012 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1011 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1012 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1013 | 1013 | } |
1014 | 1014 | break; |
1015 | 1015 | |
1016 | 1016 | default : |
1017 | 1017 | // meh... do one of those other steps first |
1018 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1018 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1019 | 1019 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1020 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1020 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1021 | 1021 | // call action on current step |
1022 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1022 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1023 | 1023 | // good registrant, you get to proceed |
1024 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
1025 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
1026 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
1024 | + if ($this->checkout->current_step->success_message() != '') { |
|
1025 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
1026 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
1027 | 1027 | } |
1028 | 1028 | } |
1029 | 1029 | // pack it up, pack it in... |
1030 | 1030 | $this->_setup_redirect(); |
1031 | 1031 | } |
1032 | 1032 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1033 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1033 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1034 | 1034 | |
1035 | 1035 | } else { |
1036 | 1036 | EE_Error::add_error( |
1037 | 1037 | sprintf( |
1038 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1038 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1039 | 1039 | $this->checkout->action, |
1040 | 1040 | $this->checkout->current_step->name() |
1041 | 1041 | ), |
@@ -1061,10 +1061,10 @@ discard block |
||
1061 | 1061 | public function add_styles_and_scripts() { |
1062 | 1062 | // i18n |
1063 | 1063 | $this->translate_js_strings(); |
1064 | - if ( $this->checkout->admin_request ) { |
|
1065 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1064 | + if ($this->checkout->admin_request) { |
|
1065 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1066 | 1066 | } else { |
1067 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1067 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1068 | 1068 | } |
1069 | 1069 | } |
1070 | 1070 | |
@@ -1080,42 +1080,42 @@ discard block |
||
1080 | 1080 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1081 | 1081 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1082 | 1082 | 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'); |
1083 | - 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' ); |
|
1084 | - 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' ); |
|
1085 | - 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' ); |
|
1083 | + 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'); |
|
1084 | + 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'); |
|
1085 | + 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'); |
|
1086 | 1086 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1087 | 1087 | 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'); |
1088 | - 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/>' ); |
|
1089 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1088 | + 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/>'); |
|
1089 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1090 | 1090 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1091 | 1091 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1092 | 1092 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1093 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1094 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1095 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1096 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1097 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1098 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1099 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1100 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1101 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1102 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1103 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1104 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1105 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1106 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1093 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1094 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1095 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1096 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1097 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1098 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1099 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1100 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1101 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1102 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1103 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1104 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1105 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1106 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1107 | 1107 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1108 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1108 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1109 | 1109 | '<h4 class="important-notice">', |
1110 | 1110 | '</h4>', |
1111 | 1111 | '<br />', |
1112 | 1112 | '<p>', |
1113 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1113 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1114 | 1114 | '">', |
1115 | 1115 | '</a>', |
1116 | 1116 | '</p>' |
1117 | 1117 | ); |
1118 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1118 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | |
@@ -1128,25 +1128,25 @@ discard block |
||
1128 | 1128 | */ |
1129 | 1129 | public function enqueue_styles_and_scripts() { |
1130 | 1130 | // load css |
1131 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1132 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1131 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1132 | + wp_enqueue_style('single_page_checkout'); |
|
1133 | 1133 | // load JS |
1134 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1135 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1136 | - 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 ); |
|
1137 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1134 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1135 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1136 | + 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); |
|
1137 | + wp_enqueue_script('single_page_checkout'); |
|
1138 | 1138 | |
1139 | 1139 | /** |
1140 | 1140 | * global action hook for enqueueing styles and scripts with |
1141 | 1141 | * spco calls. |
1142 | 1142 | */ |
1143 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1143 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1144 | 1144 | |
1145 | 1145 | /** |
1146 | 1146 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1147 | 1147 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1148 | 1148 | */ |
1149 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1149 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1150 | 1150 | |
1151 | 1151 | // add css and JS for current step |
1152 | 1152 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1162,20 +1162,20 @@ discard block |
||
1162 | 1162 | */ |
1163 | 1163 | private function _display_spco_reg_form() { |
1164 | 1164 | // if registering via the admin, just display the reg form for the current step |
1165 | - if ( $this->checkout->admin_request ) { |
|
1166 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1165 | + if ($this->checkout->admin_request) { |
|
1166 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1167 | 1167 | } else { |
1168 | 1168 | // add powered by EE msg |
1169 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1169 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1170 | 1170 | |
1171 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1171 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1172 | 1172 | $cookies_not_set_msg = ''; |
1173 | - if ( $empty_cart ) { |
|
1174 | - if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1173 | + if ($empty_cart) { |
|
1174 | + if ( ! isset($_COOKIE['ee_cookie_test'])) { |
|
1175 | 1175 | $cookies_not_set_msg = apply_filters( |
1176 | 1176 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1177 | 1177 | sprintf( |
1178 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1178 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1179 | 1179 | '<div class="ee-attention">', |
1180 | 1180 | '</div>', |
1181 | 1181 | '<h6 class="important-notice">', |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | 'layout_strategy' => |
1197 | 1197 | new EE_Template_Layout( |
1198 | 1198 | array( |
1199 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1199 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1200 | 1200 | 'template_args' => array( |
1201 | 1201 | 'empty_cart' => $empty_cart, |
1202 | 1202 | 'revisit' => $this->checkout->revisit, |
@@ -1205,8 +1205,8 @@ discard block |
||
1205 | 1205 | 'empty_msg' => apply_filters( |
1206 | 1206 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1207 | 1207 | sprintf( |
1208 | - __( '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' ), |
|
1209 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1208 | + __('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'), |
|
1209 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1210 | 1210 | '">', |
1211 | 1211 | '</a>' |
1212 | 1212 | ) |
@@ -1214,14 +1214,14 @@ discard block |
||
1214 | 1214 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1215 | 1215 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1216 | 1216 | 'session_expiration' => |
1217 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1217 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1218 | 1218 | ) |
1219 | 1219 | ) |
1220 | 1220 | ) |
1221 | 1221 | ) |
1222 | 1222 | ); |
1223 | 1223 | // load template and add to output sent that gets filtered into the_content() |
1224 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1224 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | |
@@ -1235,8 +1235,8 @@ discard block |
||
1235 | 1235 | * @internal param string $label |
1236 | 1236 | * @return string |
1237 | 1237 | */ |
1238 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1239 | - if ( $next_step == 'finalize_registration' ) { |
|
1238 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1239 | + if ($next_step == 'finalize_registration') { |
|
1240 | 1240 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1241 | 1241 | } |
1242 | 1242 | } |
@@ -1250,18 +1250,18 @@ discard block |
||
1250 | 1250 | * @return string |
1251 | 1251 | */ |
1252 | 1252 | public static function display_registration_footer() { |
1253 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1254 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1255 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1256 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1253 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1254 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1255 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1256 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1257 | 1257 | echo apply_filters( |
1258 | 1258 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1259 | 1259 | sprintf( |
1260 | - __( '%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' ), |
|
1261 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1260 | + __('%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'), |
|
1261 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1262 | 1262 | '" target="_blank">', |
1263 | 1263 | '</a>', |
1264 | - '<a href="' . $url . '" title="', |
|
1264 | + '<a href="'.$url.'" title="', |
|
1265 | 1265 | '" target="_blank">', |
1266 | 1266 | '</a></div>' |
1267 | 1267 | ) |
@@ -1292,12 +1292,12 @@ discard block |
||
1292 | 1292 | * @return array |
1293 | 1293 | */ |
1294 | 1294 | private function _setup_redirect() { |
1295 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1295 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1296 | 1296 | $this->checkout->redirect = TRUE; |
1297 | - if ( empty( $this->checkout->redirect_url )) { |
|
1297 | + if (empty($this->checkout->redirect_url)) { |
|
1298 | 1298 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1299 | 1299 | } |
1300 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1300 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1301 | 1301 | } |
1302 | 1302 | } |
1303 | 1303 | |
@@ -1310,12 +1310,12 @@ discard block |
||
1310 | 1310 | * @return void |
1311 | 1311 | */ |
1312 | 1312 | public function go_to_next_step() { |
1313 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1313 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1314 | 1314 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1315 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1315 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1316 | 1316 | } |
1317 | 1317 | // just return for these conditions |
1318 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1318 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1319 | 1319 | return; |
1320 | 1320 | } |
1321 | 1321 | // AJAX response |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | */ |
1337 | 1337 | protected function _handle_json_response() { |
1338 | 1338 | // if this is an ajax request |
1339 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1339 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1340 | 1340 | // DEBUG LOG |
1341 | 1341 | //$this->checkout->log( |
1342 | 1342 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1346,10 +1346,10 @@ discard block |
||
1346 | 1346 | // 'continue_reg' => $this->checkout->continue_reg, |
1347 | 1347 | // ) |
1348 | 1348 | //); |
1349 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1350 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1349 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1350 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1351 | 1351 | // just send the ajax ( |
1352 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1352 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1353 | 1353 | $this->unlock_transaction(); |
1354 | 1354 | echo $json_response; |
1355 | 1355 | exit(); |
@@ -1366,9 +1366,9 @@ discard block |
||
1366 | 1366 | */ |
1367 | 1367 | protected function _handle_html_redirects() { |
1368 | 1368 | // going somewhere ? |
1369 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1369 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1370 | 1370 | // store notices in a transient |
1371 | - EE_Error::get_notices( false, true, true ); |
|
1371 | + EE_Error::get_notices(false, true, true); |
|
1372 | 1372 | $this->unlock_transaction(); |
1373 | 1373 | // DEBUG LOG |
1374 | 1374 | //$this->checkout->log( |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | // 'headers_list' => headers_list(), |
1380 | 1380 | // ) |
1381 | 1381 | //); |
1382 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1382 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1383 | 1383 | exit(); |
1384 | 1384 | } |
1385 | 1385 | } |
@@ -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 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | /** |
253 | 253 | * returns true if ANY reg status was updated during checkout |
254 | - * @return array |
|
254 | + * @return boolean |
|
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | 257 | foreach ( $this->reg_status_updated as $reg_status ) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | /** |
278 | 278 | * @param $REG_ID |
279 | - * @param $reg_status |
|
279 | + * @param boolean $reg_status |
|
280 | 280 | */ |
281 | 281 | public function set_reg_status_updated( $REG_ID, $reg_status ) { |
282 | 282 | $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | * reset_reg_steps |
621 | 621 | * |
622 | 622 | * @access public |
623 | - * @return bool |
|
623 | + * @return boolean|null |
|
624 | 624 | */ |
625 | 625 | public function reset_reg_steps() { |
626 | 626 | $this->sort_reg_steps(); |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | * stores whether any updates were made to the TXN or it's related registrations |
734 | 734 | * |
735 | 735 | * @access public |
736 | - * @return bool |
|
736 | + * @return boolean|null |
|
737 | 737 | */ |
738 | 738 | public function track_transaction_and_registration_status_updates() { |
739 | 739 | // verify the transaction |
@@ -1081,6 +1081,7 @@ discard block |
||
1081 | 1081 | * |
1082 | 1082 | * @param string | int $reg_cache_ID |
1083 | 1083 | * @param EE_Registration $registration |
1084 | + * @param integer $reg_cache_ID |
|
1084 | 1085 | * @return void |
1085 | 1086 | */ |
1086 | 1087 | 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->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 | |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | * @return array |
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | - foreach ( $this->reg_status_updated as $reg_status ) { |
|
258 | - if ( $reg_status ) { |
|
257 | + foreach ($this->reg_status_updated as $reg_status) { |
|
258 | + if ($reg_status) { |
|
259 | 259 | return true; |
260 | 260 | } |
261 | 261 | } |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | * @param $REG_ID |
269 | 269 | * @return array |
270 | 270 | */ |
271 | - public function reg_status_updated( $REG_ID ) { |
|
272 | - return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false; |
|
271 | + public function reg_status_updated($REG_ID) { |
|
272 | + return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | * @param $REG_ID |
279 | 279 | * @param $reg_status |
280 | 280 | */ |
281 | - public function set_reg_status_updated( $REG_ID, $reg_status ) { |
|
282 | - $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
|
281 | + public function set_reg_status_updated($REG_ID, $reg_status) { |
|
282 | + $this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * can ONLY be set by the Finalize_Registration reg step |
301 | 301 | */ |
302 | 302 | public function set_exit_spco() { |
303 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
303 | + if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
304 | 304 | $this->exit_spco = true; |
305 | 305 | } |
306 | 306 | } |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function reset_for_current_request() { |
319 | 319 | $this->process_form_submission = FALSE; |
320 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true ); |
|
320 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true); |
|
321 | 321 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
322 | 322 | $this->continue_reg = true; |
323 | 323 | $this->redirect = false; |
324 | 324 | // don't reset the cached redirect form if we're about to be asked to display it !!! |
325 | - if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) { |
|
325 | + if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') { |
|
326 | 326 | $this->redirect_form = ''; |
327 | 327 | } |
328 | 328 | $this->redirect_url = ''; |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_SPCO_Reg_Step $reg_step_obj |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
|
343 | - $this->reg_steps[ $reg_step_obj->slug() ] = $reg_step_obj; |
|
342 | + public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) { |
|
343 | + $this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -356,22 +356,22 @@ discard block |
||
356 | 356 | * @param string $reg_step_slug |
357 | 357 | * @return void |
358 | 358 | */ |
359 | - public function skip_reg_step( $reg_step_slug = '' ) { |
|
360 | - $step_to_skip = $this->find_reg_step( $reg_step_slug ); |
|
361 | - if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) { |
|
362 | - $step_to_skip->set_is_current_step( false ); |
|
359 | + public function skip_reg_step($reg_step_slug = '') { |
|
360 | + $step_to_skip = $this->find_reg_step($reg_step_slug); |
|
361 | + if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) { |
|
362 | + $step_to_skip->set_is_current_step(false); |
|
363 | 363 | $step_to_skip->set_completed(); |
364 | 364 | // advance to the next step |
365 | - $this->set_current_step( $this->next_step->slug() ); |
|
365 | + $this->set_current_step($this->next_step->slug()); |
|
366 | 366 | // also reset the step param in the request in case any other code references that directly |
367 | - EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() ); |
|
367 | + EE_Registry::instance()->REQ->set('step', $this->current_step->slug()); |
|
368 | 368 | // since we are skipping a step and setting the current step to be what was previously the next step, |
369 | 369 | // we need to check that the next step is now correct, and not still set to the current step. |
370 | - if ( $this->current_step->slug() == $this->next_step->slug() ) { |
|
370 | + if ($this->current_step->slug() == $this->next_step->slug()) { |
|
371 | 371 | // correctly setup the next step |
372 | 372 | $this->set_next_step(); |
373 | 373 | } |
374 | - $this->set_reg_step_initiated( $this->current_step ); |
|
374 | + $this->set_reg_step_initiated($this->current_step); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | * @param bool $reset whether to reset reg steps after removal |
386 | 386 | * @throws EE_Error |
387 | 387 | */ |
388 | - public function remove_reg_step( $reg_step_slug = '', $reset = true ) { |
|
389 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
390 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
388 | + public function remove_reg_step($reg_step_slug = '', $reset = true) { |
|
389 | + unset($this->reg_steps[$reg_step_slug]); |
|
390 | + if ($this->transaction instanceof EE_Transaction) { |
|
391 | 391 | /** @type EE_Transaction_Processor $transaction_processor */ |
392 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
392 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
393 | 393 | // now remove reg step from TXN and save |
394 | - $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
|
394 | + $transaction_processor->remove_reg_step($this->transaction, $reg_step_slug); |
|
395 | 395 | $this->transaction->save(); |
396 | 396 | } |
397 | - if ( $reset ) { |
|
397 | + if ($reset) { |
|
398 | 398 | $this->reset_reg_steps(); |
399 | 399 | } |
400 | 400 | } |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | * @param int $order |
410 | 410 | * @return void |
411 | 411 | */ |
412 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
413 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
414 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
412 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
413 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
414 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | |
@@ -424,25 +424,25 @@ discard block |
||
424 | 424 | * @param string $current_step |
425 | 425 | * @return void |
426 | 426 | */ |
427 | - public function set_current_step( $current_step ) { |
|
427 | + public function set_current_step($current_step) { |
|
428 | 428 | // grab what step we're on |
429 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
429 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
430 | 430 | // verify instance |
431 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
431 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
432 | 432 | // we don't want to repeat completed steps if this is the first time through SPCO |
433 | - if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) { |
|
433 | + if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) { |
|
434 | 434 | // so advance to the next step |
435 | 435 | $this->set_next_step(); |
436 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
436 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
437 | 437 | // and attempt to set it as the current step |
438 | - $this->set_current_step( $this->next_step->slug() ); |
|
438 | + $this->set_current_step($this->next_step->slug()); |
|
439 | 439 | } |
440 | 440 | return; |
441 | 441 | } |
442 | - $this->current_step->set_is_current_step( TRUE ); |
|
442 | + $this->current_step->set_is_current_step(TRUE); |
|
443 | 443 | } else { |
444 | 444 | EE_Error::add_error( |
445 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
445 | + __('The current step could not be set.', 'event_espresso'), |
|
446 | 446 | __FILE__, __FUNCTION__, __LINE__ |
447 | 447 | ); |
448 | 448 | } |
@@ -459,20 +459,20 @@ discard block |
||
459 | 459 | */ |
460 | 460 | public function set_next_step() { |
461 | 461 | // set pointer to start of array |
462 | - reset( $this->reg_steps ); |
|
462 | + reset($this->reg_steps); |
|
463 | 463 | // if there is more than one step |
464 | - if ( count( $this->reg_steps ) > 1 ) { |
|
464 | + if (count($this->reg_steps) > 1) { |
|
465 | 465 | // advance to the current step and set pointer |
466 | - while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) { |
|
467 | - next( $this->reg_steps ); |
|
466 | + while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') { |
|
467 | + next($this->reg_steps); |
|
468 | 468 | } |
469 | 469 | } |
470 | 470 | // advance one more spot ( if it exists ) |
471 | - $this->next_step = next( $this->reg_steps ); |
|
471 | + $this->next_step = next($this->reg_steps); |
|
472 | 472 | // verify instance |
473 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
473 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
474 | 474 | // then back to current step to reset |
475 | - prev( $this->reg_steps ); |
|
475 | + prev($this->reg_steps); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -486,8 +486,8 @@ discard block |
||
486 | 486 | * @return EE_SPCO_Reg_Step | null |
487 | 487 | */ |
488 | 488 | public function get_next_reg_step() { |
489 | - $next = next( $this->reg_steps ); |
|
490 | - prev( $this->reg_steps ); |
|
489 | + $next = next($this->reg_steps); |
|
490 | + prev($this->reg_steps); |
|
491 | 491 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
492 | 492 | } |
493 | 493 | |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | * @return EE_SPCO_Reg_Step | null |
503 | 503 | */ |
504 | 504 | public function get_prev_reg_step() { |
505 | - $prev = prev( $this->reg_steps ); |
|
506 | - next( $this->reg_steps ); |
|
505 | + $prev = prev($this->reg_steps); |
|
506 | + next($this->reg_steps); |
|
507 | 507 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
508 | 508 | } |
509 | 509 | |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | * @return void |
517 | 517 | */ |
518 | 518 | public function sort_reg_steps() { |
519 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
520 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
519 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
520 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -530,19 +530,19 @@ discard block |
||
530 | 530 | * @param string $reg_step_slug |
531 | 531 | * @return EE_SPCO_Reg_Step|null |
532 | 532 | */ |
533 | - public function find_reg_step( $reg_step_slug = '' ) { |
|
534 | - if ( ! empty( $reg_step_slug ) ) { |
|
533 | + public function find_reg_step($reg_step_slug = '') { |
|
534 | + if ( ! empty($reg_step_slug)) { |
|
535 | 535 | // copy reg step array |
536 | 536 | $reg_steps = $this->reg_steps; |
537 | 537 | // set pointer to start of array |
538 | - reset( $reg_steps ); |
|
538 | + reset($reg_steps); |
|
539 | 539 | // if there is more than one step |
540 | - if ( count( $reg_steps ) > 1 ) { |
|
540 | + if (count($reg_steps) > 1) { |
|
541 | 541 | // advance to the current step and set pointer |
542 | - while ( key( $reg_steps ) != $reg_step_slug && key( $reg_steps ) != '' ) { |
|
543 | - next( $reg_steps ); |
|
542 | + while (key($reg_steps) != $reg_step_slug && key($reg_steps) != '') { |
|
543 | + next($reg_steps); |
|
544 | 544 | } |
545 | - return current( $reg_steps ); |
|
545 | + return current($reg_steps); |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 | return null; |
@@ -558,17 +558,17 @@ discard block |
||
558 | 558 | * @param EE_SPCO_Reg_Step $reg_step_B |
559 | 559 | * @return array() |
560 | 560 | */ |
561 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
561 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
562 | 562 | // send finalize_registration step to the end of the array |
563 | - if ( $reg_step_A->slug() == 'finalize_registration' ) { |
|
563 | + if ($reg_step_A->slug() == 'finalize_registration') { |
|
564 | 564 | return 1; |
565 | - } else if ( $reg_step_B->slug() == 'finalize_registration' ) { |
|
565 | + } else if ($reg_step_B->slug() == 'finalize_registration') { |
|
566 | 566 | return -1; |
567 | 567 | } |
568 | - if ( $reg_step_A->order() == $reg_step_B->order() ) { |
|
568 | + if ($reg_step_A->order() == $reg_step_B->order()) { |
|
569 | 569 | return 0; |
570 | 570 | } |
571 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
571 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | * @access public |
580 | 580 | * @param EE_SPCO_Reg_Step $reg_step |
581 | 581 | */ |
582 | - public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) { |
|
582 | + public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) { |
|
583 | 583 | // call set_reg_step_initiated ??? |
584 | 584 | if ( |
585 | 585 | // first time visiting SPCO ? |
@@ -592,13 +592,13 @@ discard block |
||
592 | 592 | ) |
593 | 593 | ) { |
594 | 594 | /** @type EE_Transaction_Processor $transaction_processor */ |
595 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
595 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
596 | 596 | // set the start time for this reg step |
597 | - if ( ! $transaction_processor->set_reg_step_initiated( $this->transaction, $reg_step->slug() ) ) { |
|
598 | - if ( WP_DEBUG ) { |
|
597 | + if ( ! $transaction_processor->set_reg_step_initiated($this->transaction, $reg_step->slug())) { |
|
598 | + if (WP_DEBUG) { |
|
599 | 599 | EE_Error::add_error( |
600 | 600 | sprintf( |
601 | - __( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), |
|
601 | + __('The "%1$s" registration step was not initialized properly.', 'event_espresso'), |
|
602 | 602 | $reg_step->name() |
603 | 603 | ), |
604 | 604 | __FILE__, __FUNCTION__, __LINE__ |
@@ -617,10 +617,10 @@ discard block |
||
617 | 617 | * @return void |
618 | 618 | */ |
619 | 619 | public function set_reg_step_JSON_info() { |
620 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
620 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
621 | 621 | // pass basic reg step data to JS |
622 | - foreach ( $this->reg_steps as $reg_step ) { |
|
623 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
622 | + foreach ($this->reg_steps as $reg_step) { |
|
623 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
624 | 624 | } |
625 | 625 | // reset reg step html |
626 | 626 | // $this->json_response->set_reg_step_html( '' ); |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | */ |
637 | 637 | public function reset_reg_steps() { |
638 | 638 | $this->sort_reg_steps(); |
639 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
639 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
640 | 640 | $this->set_next_step(); |
641 | 641 | // the text that appears on the reg step form submit button |
642 | 642 | $this->current_step->set_submit_button_text(); |
@@ -653,9 +653,9 @@ discard block |
||
653 | 653 | */ |
654 | 654 | public function get_registration_time_limit() { |
655 | 655 | |
656 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
656 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
657 | 657 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
658 | - $registration_time_limit = gmdate( $time_limit_format, $registration_time_limit ); |
|
658 | + $registration_time_limit = gmdate($time_limit_format, $registration_time_limit); |
|
659 | 659 | return apply_filters( |
660 | 660 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
661 | 661 | $registration_time_limit |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | // overpaid TXN |
676 | 676 | // free TXN ( total = 0.00 ) |
677 | 677 | // then payment required is TRUE |
678 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
678 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | |
@@ -688,8 +688,8 @@ discard block |
||
688 | 688 | */ |
689 | 689 | public function initialize_txn_reg_steps_array() { |
690 | 690 | $txn_reg_steps_array = array(); |
691 | - foreach ( $this->reg_steps as $reg_step ) { |
|
692 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
691 | + foreach ($this->reg_steps as $reg_step) { |
|
692 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
693 | 693 | } |
694 | 694 | return $txn_reg_steps_array; |
695 | 695 | } |
@@ -705,13 +705,13 @@ discard block |
||
705 | 705 | public function update_txn_reg_steps_array() { |
706 | 706 | $updated = FALSE; |
707 | 707 | /** @type EE_Transaction_Processor $transaction_processor */ |
708 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
709 | - foreach ( $this->reg_steps as $reg_step ) { |
|
710 | - if ( $reg_step->completed() ) { |
|
711 | - $updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated; |
|
708 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
709 | + foreach ($this->reg_steps as $reg_step) { |
|
710 | + if ($reg_step->completed()) { |
|
711 | + $updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated; |
|
712 | 712 | } |
713 | 713 | } |
714 | - if ( $updated ) { |
|
714 | + if ($updated) { |
|
715 | 715 | $this->transaction->save(); |
716 | 716 | } |
717 | 717 | return $updated; |
@@ -726,14 +726,14 @@ discard block |
||
726 | 726 | * @return void |
727 | 727 | */ |
728 | 728 | public function stash_transaction_and_checkout() { |
729 | - if ( ! $this->revisit ) { |
|
729 | + if ( ! $this->revisit) { |
|
730 | 730 | $this->update_txn_reg_steps_array(); |
731 | 731 | } |
732 | 732 | $this->track_transaction_and_registration_status_updates(); |
733 | 733 | // save all data to the db, but suppress errors |
734 | 734 | //$this->save_all_data( FALSE ); |
735 | 735 | // cache the checkout in the session |
736 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
736 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | |
@@ -749,21 +749,21 @@ discard block |
||
749 | 749 | */ |
750 | 750 | public function track_transaction_and_registration_status_updates() { |
751 | 751 | // verify the transaction |
752 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
752 | + if ($this->transaction instanceof EE_Transaction) { |
|
753 | 753 | /** @type EE_Transaction_Payments $transaction_payments */ |
754 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
754 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
755 | 755 | /** @type EE_Transaction_Processor $transaction_processor */ |
756 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
756 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
757 | 757 | // has there been a TXN status change during this checkout? |
758 | - if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) { |
|
758 | + if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) { |
|
759 | 759 | $this->txn_status_updated = true; |
760 | 760 | } |
761 | 761 | /** @type EE_Registration_Processor $registration_processor */ |
762 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
762 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
763 | 763 | // grab the saved registrations from the transaction |
764 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
765 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
766 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
764 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
765 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
766 | + $this->set_reg_status_updated($registration->ID(), true); |
|
767 | 767 | } |
768 | 768 | } |
769 | 769 | } |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | * @param EE_Registration $registration |
786 | 786 | * @return bool |
787 | 787 | */ |
788 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
789 | - return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE; |
|
788 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
789 | + return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE; |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | |
@@ -811,18 +811,18 @@ discard block |
||
811 | 811 | * @param bool $show_errors |
812 | 812 | * @return bool |
813 | 813 | */ |
814 | - public function save_all_data( $show_errors = TRUE ) { |
|
814 | + public function save_all_data($show_errors = TRUE) { |
|
815 | 815 | // verify the transaction |
816 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
816 | + if ($this->transaction instanceof EE_Transaction) { |
|
817 | 817 | // save to ensure that TXN has ID |
818 | 818 | $this->transaction->save(); |
819 | 819 | // grab the saved registrations from the transaction |
820 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
821 | - $this->_save_registration( $registration, $show_errors ); |
|
820 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
821 | + $this->_save_registration($registration, $show_errors); |
|
822 | 822 | } |
823 | 823 | } else { |
824 | - if ( $show_errors ) { |
|
825 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
824 | + if ($show_errors) { |
|
825 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
826 | 826 | } |
827 | 827 | return FALSE; |
828 | 828 | } |
@@ -837,32 +837,32 @@ discard block |
||
837 | 837 | * @param bool $show_errors |
838 | 838 | * @return void |
839 | 839 | */ |
840 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
840 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
841 | 841 | // verify object |
842 | - if ( $registration instanceof EE_Registration ) { |
|
842 | + if ($registration instanceof EE_Registration) { |
|
843 | 843 | // should this registration be processed during this visit ? |
844 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
844 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
845 | 845 | //set TXN ID |
846 | - if ( ! $registration->transaction_ID() ) { |
|
847 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
846 | + if ( ! $registration->transaction_ID()) { |
|
847 | + $registration->set_transaction_id($this->transaction->ID()); |
|
848 | 848 | } |
849 | 849 | // verify and save the attendee |
850 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
850 | + $this->_save_registration_attendee($registration, $show_errors); |
|
851 | 851 | // save answers to reg form questions |
852 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
852 | + $this->_save_registration_answers($registration, $show_errors); |
|
853 | 853 | // save changes |
854 | 854 | $registration->save(); |
855 | 855 | // update txn cache |
856 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
857 | - if ( $show_errors ) { |
|
858 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
856 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
857 | + if ($show_errors) { |
|
858 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
859 | 859 | } |
860 | 860 | } |
861 | 861 | } |
862 | 862 | } else { |
863 | - if ( $show_errors ) { |
|
863 | + if ($show_errors) { |
|
864 | 864 | EE_Error::add_error( |
865 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
865 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
866 | 866 | __FILE__, __FUNCTION__, __LINE__ |
867 | 867 | ); |
868 | 868 | } |
@@ -878,26 +878,26 @@ discard block |
||
878 | 878 | * @param bool $show_errors |
879 | 879 | * @return void |
880 | 880 | */ |
881 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
882 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
881 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
882 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
883 | 883 | // save so that ATT has ID |
884 | 884 | $registration->attendee()->save(); |
885 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) { |
|
886 | - if ( $show_errors ) { |
|
885 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
886 | + if ($show_errors) { |
|
887 | 887 | EE_Error::add_error( |
888 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
888 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
889 | 889 | __FILE__, __FUNCTION__, __LINE__ |
890 | 890 | ); |
891 | 891 | } |
892 | 892 | } |
893 | 893 | } else { |
894 | - if ( $show_errors ) { |
|
894 | + if ($show_errors) { |
|
895 | 895 | ob_start(); |
896 | - var_dump( $registration->attendee() ); |
|
896 | + var_dump($registration->attendee()); |
|
897 | 897 | EE_Error::add_error( |
898 | 898 | sprintf( |
899 | 899 | '%1$s||%1$s $attendee = %2$s', |
900 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
900 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
901 | 901 | ob_get_clean() |
902 | 902 | ), |
903 | 903 | __FILE__, __FUNCTION__, __LINE__ |
@@ -915,25 +915,25 @@ discard block |
||
915 | 915 | * @param bool $show_errors |
916 | 916 | * @return void |
917 | 917 | */ |
918 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
918 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
919 | 919 | // now save the answers |
920 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
920 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
921 | 921 | // verify object |
922 | - if ( $answer instanceof EE_Answer ) { |
|
923 | - $answer->set_registration( $registration->ID() ); |
|
922 | + if ($answer instanceof EE_Answer) { |
|
923 | + $answer->set_registration($registration->ID()); |
|
924 | 924 | $answer->save(); |
925 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
926 | - if ( $show_errors ) { |
|
925 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
926 | + if ($show_errors) { |
|
927 | 927 | EE_Error::add_error( |
928 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
928 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
929 | 929 | __FILE__, __FUNCTION__, __LINE__ |
930 | 930 | ); |
931 | 931 | } |
932 | 932 | } |
933 | 933 | } else { |
934 | - if ( $show_errors ) { |
|
934 | + if ($show_errors) { |
|
935 | 935 | EE_Error::add_error( |
936 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
936 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
937 | 937 | __FILE__, __FUNCTION__, __LINE__ |
938 | 938 | ); |
939 | 939 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | * @param bool $from_db |
952 | 952 | * @return bool |
953 | 953 | */ |
954 | - public function refresh_all_entities( $from_db = false ) { |
|
954 | + public function refresh_all_entities($from_db = false) { |
|
955 | 955 | $from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db; |
956 | 956 | //$this->log( |
957 | 957 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -972,11 +972,11 @@ discard block |
||
972 | 972 | */ |
973 | 973 | protected function refresh_from_db() { |
974 | 974 | // verify the transaction |
975 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
975 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
976 | 976 | // pull fresh TXN data from the db |
977 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
977 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
978 | 978 | // update EE_Checkout's cached primary_attendee object |
979 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
979 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
980 | 980 | // update EE_Checkout's cached payment object |
981 | 981 | $payment = $this->transaction->last_payment(); |
982 | 982 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -984,15 +984,15 @@ discard block |
||
984 | 984 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
985 | 985 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
986 | 986 | //now refresh the cart, based on the TXN |
987 | - $this->cart = EE_Cart::get_cart_from_txn( $this->transaction ); |
|
987 | + $this->cart = EE_Cart::get_cart_from_txn($this->transaction); |
|
988 | 988 | // verify and update the cart because inaccurate totals are not so much fun |
989 | - if ( $this->cart instanceof EE_Cart ) { |
|
989 | + if ($this->cart instanceof EE_Cart) { |
|
990 | 990 | $this->cart->get_grand_total()->recalculate_total_including_taxes(); |
991 | 991 | } else { |
992 | - $this->cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
992 | + $this->cart = EE_Registry::instance()->load_core('Cart'); |
|
993 | 993 | } |
994 | 994 | } else { |
995 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
995 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
996 | 996 | return FALSE; |
997 | 997 | } |
998 | 998 | return TRUE; |
@@ -1006,24 +1006,24 @@ discard block |
||
1006 | 1006 | * @param EE_Transaction $transaction |
1007 | 1007 | * @return EE_Attendee | null |
1008 | 1008 | */ |
1009 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
1009 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
1010 | 1010 | |
1011 | 1011 | $primary_attendee_obj = null; |
1012 | 1012 | // grab the saved registrations from the transaction |
1013 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
1013 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
1014 | 1014 | // verify object |
1015 | - if ( $registration instanceof EE_Registration ) { |
|
1015 | + if ($registration instanceof EE_Registration) { |
|
1016 | 1016 | $attendee = $registration->attendee(); |
1017 | 1017 | // verify object |
1018 | - if ( $attendee instanceof EE_Attendee ) { |
|
1018 | + if ($attendee instanceof EE_Attendee) { |
|
1019 | 1019 | // maybe cache primary_attendee_obj ? |
1020 | - if ( $registration->is_primary_registrant() ) { |
|
1020 | + if ($registration->is_primary_registrant()) { |
|
1021 | 1021 | $primary_attendee_obj = $attendee; |
1022 | 1022 | } |
1023 | 1023 | } |
1024 | 1024 | } else { |
1025 | 1025 | EE_Error::add_error( |
1026 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1026 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1027 | 1027 | __FILE__, __FUNCTION__, __LINE__ |
1028 | 1028 | ); |
1029 | 1029 | } |
@@ -1043,43 +1043,43 @@ discard block |
||
1043 | 1043 | */ |
1044 | 1044 | protected function refresh_entity_map() { |
1045 | 1045 | // verify the transaction |
1046 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1046 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1047 | 1047 | // never cache payment info |
1048 | - $this->transaction->clear_cache( 'Payment' ); |
|
1048 | + $this->transaction->clear_cache('Payment'); |
|
1049 | 1049 | /** @type EE_Transaction_Processor $transaction_processor */ |
1050 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1050 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1051 | 1051 | // is the Payment Options Reg Step completed ? |
1052 | - if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) { |
|
1052 | + if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) { |
|
1053 | 1053 | // then check for payments and update TXN accordingly |
1054 | 1054 | /** @type EE_Transaction_Payments $transaction_payments */ |
1055 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1056 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
1055 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1056 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
1057 | 1057 | } |
1058 | 1058 | // grab the saved registrations from the transaction |
1059 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) { |
|
1060 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
1059 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) { |
|
1060 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
1061 | 1061 | } |
1062 | 1062 | // make sure our cached TXN is added to the model entity mapper |
1063 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
1063 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
1064 | 1064 | |
1065 | 1065 | } else { |
1066 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1066 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1067 | 1067 | return FALSE; |
1068 | 1068 | } |
1069 | 1069 | // verify and update the cart because inaccurate totals are not so much fun |
1070 | - if ( $this->cart instanceof EE_Cart ) { |
|
1070 | + if ($this->cart instanceof EE_Cart) { |
|
1071 | 1071 | $grand_total = $this->cart->get_grand_total(); |
1072 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
1072 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
1073 | 1073 | $grand_total->recalculate_total_including_taxes(); |
1074 | 1074 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
1075 | 1075 | $this->cart->get_grand_total()->ID(), |
1076 | 1076 | $this->cart->get_grand_total() |
1077 | 1077 | ); |
1078 | 1078 | } |
1079 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
1080 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
1079 | + if ($grand_total instanceof EE_Line_Item) { |
|
1080 | + $this->cart = EE_Cart::instance($grand_total); |
|
1081 | 1081 | } else { |
1082 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1082 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1083 | 1083 | return false; |
1084 | 1084 | } |
1085 | 1085 | } |
@@ -1095,19 +1095,19 @@ discard block |
||
1095 | 1095 | * @param EE_Registration $registration |
1096 | 1096 | * @return void |
1097 | 1097 | */ |
1098 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
1098 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
1099 | 1099 | |
1100 | 1100 | // verify object |
1101 | - if ( $registration instanceof EE_Registration ) { |
|
1101 | + if ($registration instanceof EE_Registration) { |
|
1102 | 1102 | // update the entity mapper attendee |
1103 | - $this->_refresh_registration_attendee( $registration ); |
|
1103 | + $this->_refresh_registration_attendee($registration); |
|
1104 | 1104 | // update the entity mapper answers for reg form questions |
1105 | - $this->_refresh_registration_answers( $registration ); |
|
1105 | + $this->_refresh_registration_answers($registration); |
|
1106 | 1106 | // make sure the cached registration is added to the model entity mapper |
1107 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1107 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1108 | 1108 | } else { |
1109 | 1109 | EE_Error::add_error( |
1110 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1110 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1111 | 1111 | __FILE__, __FUNCTION__, __LINE__ |
1112 | 1112 | ); |
1113 | 1113 | } |
@@ -1121,15 +1121,15 @@ discard block |
||
1121 | 1121 | * @param EE_Registration $registration |
1122 | 1122 | * @return void |
1123 | 1123 | */ |
1124 | - protected function _refresh_registration_attendee( $registration ) { |
|
1124 | + protected function _refresh_registration_attendee($registration) { |
|
1125 | 1125 | |
1126 | 1126 | $attendee = $registration->attendee(); |
1127 | 1127 | // verify object |
1128 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1128 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1129 | 1129 | // make sure the cached attendee is added to the model entity mapper |
1130 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1130 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1131 | 1131 | // maybe cache primary_attendee_obj ? |
1132 | - if ( $registration->is_primary_registrant() ) { |
|
1132 | + if ($registration->is_primary_registrant()) { |
|
1133 | 1133 | $this->primary_attendee_obj = $attendee; |
1134 | 1134 | } |
1135 | 1135 | } |
@@ -1143,19 +1143,19 @@ discard block |
||
1143 | 1143 | * @param EE_Registration $registration |
1144 | 1144 | * @return void |
1145 | 1145 | */ |
1146 | - protected function _refresh_registration_answers( $registration ) { |
|
1146 | + protected function _refresh_registration_answers($registration) { |
|
1147 | 1147 | |
1148 | 1148 | // now update the answers |
1149 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1149 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1150 | 1150 | // verify object |
1151 | - if ( $answer instanceof EE_Answer ) { |
|
1152 | - if ( $answer->ID() ) { |
|
1151 | + if ($answer instanceof EE_Answer) { |
|
1152 | + if ($answer->ID()) { |
|
1153 | 1153 | // make sure the cached answer is added to the model entity mapper |
1154 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1154 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1155 | 1155 | } |
1156 | 1156 | } else { |
1157 | 1157 | EE_Error::add_error( |
1158 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1158 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1159 | 1159 | __FILE__, __FUNCTION__, __LINE__ |
1160 | 1160 | ); |
1161 | 1161 | } |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1171 | 1171 | */ |
1172 | 1172 | function __wakeup() { |
1173 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1173 | + foreach ($this->reg_steps as $reg_step) { |
|
1174 | 1174 | $reg_step->checkout = $this; |
1175 | 1175 | } |
1176 | 1176 | } |
@@ -1186,11 +1186,11 @@ discard block |
||
1186 | 1186 | * @param array $info |
1187 | 1187 | * @param bool $display_request |
1188 | 1188 | */ |
1189 | - function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1190 | - if ( WP_DEBUG && false ) { |
|
1191 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1189 | + function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1190 | + if (WP_DEBUG && false) { |
|
1191 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1192 | 1192 | $default_data = array( |
1193 | - $class => $func . '() : ' . $line, |
|
1193 | + $class => $func.'() : '.$line, |
|
1194 | 1194 | 'request->step' => $this->step, |
1195 | 1195 | 'request->action' => $this->action, |
1196 | 1196 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1202,24 +1202,24 @@ discard block |
||
1202 | 1202 | 'reg_url_link' => $this->reg_url_link, |
1203 | 1203 | 'REQ' => $display_request ? $_REQUEST : '', |
1204 | 1204 | ); |
1205 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1206 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1207 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1208 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1209 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1205 | + if ($this->transaction instanceof EE_Transaction) { |
|
1206 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1207 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1208 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1209 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1210 | 1210 | } |
1211 | - if ( $this->transaction->ID() ) { |
|
1212 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1211 | + if ($this->transaction->ID()) { |
|
1212 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1213 | 1213 | // don't serialize objects |
1214 | - $info = $this->_strip_objects( $info ); |
|
1215 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1216 | - $debug_data[ $TXN_ID ] = array(); |
|
1214 | + $info = $this->_strip_objects($info); |
|
1215 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1216 | + $debug_data[$TXN_ID] = array(); |
|
1217 | 1217 | } |
1218 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1218 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1219 | 1219 | $default_data, |
1220 | 1220 | $info |
1221 | 1221 | ); |
1222 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1222 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | } |
@@ -1232,23 +1232,23 @@ discard block |
||
1232 | 1232 | * @param array $info |
1233 | 1233 | * @return array |
1234 | 1234 | */ |
1235 | - function _strip_objects( $info = array() ) { |
|
1236 | - foreach ( $info as $key => $value ) { |
|
1237 | - if ( is_array( $value )) { |
|
1238 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1239 | - } else if ( is_object( $value ) ) { |
|
1240 | - $object_class = get_class( $value ); |
|
1241 | - $info[ $object_class ] = array(); |
|
1242 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1243 | - if ( method_exists( $value, 'status' ) ) { |
|
1244 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1245 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1246 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1235 | + function _strip_objects($info = array()) { |
|
1236 | + foreach ($info as $key => $value) { |
|
1237 | + if (is_array($value)) { |
|
1238 | + $info[$key] = $this->_strip_objects($value); |
|
1239 | + } else if (is_object($value)) { |
|
1240 | + $object_class = get_class($value); |
|
1241 | + $info[$object_class] = array(); |
|
1242 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1243 | + if (method_exists($value, 'status')) { |
|
1244 | + $info[$object_class]['status'] = $value->status(); |
|
1245 | + } else if (method_exists($value, 'status_ID')) { |
|
1246 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1247 | 1247 | } |
1248 | - unset( $info[ $key ] ); |
|
1248 | + unset($info[$key]); |
|
1249 | 1249 | } |
1250 | 1250 | } |
1251 | - return (array)$info; |
|
1251 | + return (array) $info; |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 |
@@ -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 | /** |
@@ -107,71 +107,71 @@ discard block |
||
107 | 107 | public function __toString() { |
108 | 108 | $JSON_response = array(); |
109 | 109 | // grab notices |
110 | - $notices = EE_Error::get_notices( FALSE ); |
|
111 | - $this->set_attention( isset( $notices['attention'] ) ? $notices['attention'] : '' ); |
|
112 | - $this->set_errors( isset( $notices['errors'] ) ? $notices['errors'] : '' ); |
|
113 | - $this->set_success( isset( $notices['success'] ) ? $notices['success'] : '' ); |
|
110 | + $notices = EE_Error::get_notices(FALSE); |
|
111 | + $this->set_attention(isset($notices['attention']) ? $notices['attention'] : ''); |
|
112 | + $this->set_errors(isset($notices['errors']) ? $notices['errors'] : ''); |
|
113 | + $this->set_success(isset($notices['success']) ? $notices['success'] : ''); |
|
114 | 114 | // add notices to JSON response, but only if they exist |
115 | - if ( $this->attention() ) { |
|
115 | + if ($this->attention()) { |
|
116 | 116 | $JSON_response['attention'] = $this->attention(); |
117 | 117 | } |
118 | - if ( $this->errors() ) { |
|
118 | + if ($this->errors()) { |
|
119 | 119 | $JSON_response['errors'] = $this->errors(); |
120 | 120 | } |
121 | - if ( $this->unexpected_errors() ) { |
|
121 | + if ($this->unexpected_errors()) { |
|
122 | 122 | $JSON_response['unexpected_errors'] = $this->unexpected_errors(); |
123 | 123 | } |
124 | - if ( $this->success() ) { |
|
124 | + if ($this->success()) { |
|
125 | 125 | $JSON_response['success'] = $this->success(); |
126 | 126 | } |
127 | 127 | // but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked |
128 | - if ( ! isset( $JSON_response[ 'attention' ] ) && ! isset( $JSON_response[ 'errors' ] ) && ! isset( $JSON_response[ 'success' ] ) ) { |
|
128 | + if ( ! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) { |
|
129 | 129 | $JSON_response['success'] = null; |
130 | 130 | } |
131 | 131 | // set redirect_url, IF it exists |
132 | - if ( $this->redirect_url() ) { |
|
132 | + if ($this->redirect_url()) { |
|
133 | 133 | $JSON_response['redirect_url'] = $this->redirect_url(); |
134 | 134 | } |
135 | 135 | // set registration_time_limit, IF it exists |
136 | - if ( $this->registration_time_limit() ) { |
|
136 | + if ($this->registration_time_limit()) { |
|
137 | 137 | $JSON_response['registration_time_limit'] = $this->registration_time_limit(); |
138 | 138 | } |
139 | 139 | // set payment_amount, IF it exists |
140 | - if ( $this->payment_amount() !== null ) { |
|
141 | - $JSON_response[ 'payment_amount' ] = $this->payment_amount(); |
|
140 | + if ($this->payment_amount() !== null) { |
|
141 | + $JSON_response['payment_amount'] = $this->payment_amount(); |
|
142 | 142 | } |
143 | 143 | // grab generic return data |
144 | 144 | $return_data = $this->return_data(); |
145 | 145 | // add billing form validation rules |
146 | - if ( $this->validation_rules() ) { |
|
146 | + if ($this->validation_rules()) { |
|
147 | 147 | $return_data['validation_rules'] = $this->validation_rules(); |
148 | 148 | } |
149 | 149 | // set reg_step_html, IF it exists |
150 | - if ( $this->reg_step_html() ) { |
|
150 | + if ($this->reg_step_html()) { |
|
151 | 151 | $return_data['reg_step_html'] = $this->reg_step_html(); |
152 | 152 | } |
153 | 153 | // set method of payment, IF it exists |
154 | - if ( $this->method_of_payment() ) { |
|
154 | + if ($this->method_of_payment()) { |
|
155 | 155 | $return_data['method_of_payment'] = $this->method_of_payment(); |
156 | 156 | } |
157 | 157 | // set "plz_select_method_of_payment" message, IF it exists |
158 | - if ( $this->plz_select_method_of_payment() ) { |
|
158 | + if ($this->plz_select_method_of_payment()) { |
|
159 | 159 | $return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment(); |
160 | 160 | } |
161 | 161 | // set redirect_form, IF it exists |
162 | - if ( $this->redirect_form() ) { |
|
162 | + if ($this->redirect_form()) { |
|
163 | 163 | $return_data['redirect_form'] = $this->redirect_form(); |
164 | 164 | } |
165 | 165 | // and finally, add return_data array to main JSON response array, IF it contains anything |
166 | 166 | // why did we add some of the above properties to the return data array? |
167 | 167 | // because it is easier and cleaner in the Javascript to deal with this way |
168 | - if ( ! empty( $return_data )) { |
|
168 | + if ( ! empty($return_data)) { |
|
169 | 169 | $JSON_response['return_data'] = $return_data; |
170 | 170 | } |
171 | 171 | // filter final array |
172 | - $JSON_response = apply_filters( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response ); |
|
172 | + $JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response); |
|
173 | 173 | // return encoded array |
174 | - return json_encode( $JSON_response ); |
|
174 | + return json_encode($JSON_response); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | /** |
180 | 180 | * @param string $attention |
181 | 181 | */ |
182 | - public function set_attention( $attention ) { |
|
182 | + public function set_attention($attention) { |
|
183 | 183 | $this->_attention = $attention; |
184 | 184 | } |
185 | 185 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | /** |
198 | 198 | * @param string $errors |
199 | 199 | */ |
200 | - public function set_errors( $errors ) { |
|
200 | + public function set_errors($errors) { |
|
201 | 201 | $this->_errors = $errors; |
202 | 202 | } |
203 | 203 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | /** |
225 | 225 | * @param string $unexpected_errors |
226 | 226 | */ |
227 | - public function set_unexpected_errors( $unexpected_errors ) { |
|
227 | + public function set_unexpected_errors($unexpected_errors) { |
|
228 | 228 | $this->_unexpected_errors = $unexpected_errors; |
229 | 229 | } |
230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | /** |
234 | 234 | * @param string $success |
235 | 235 | */ |
236 | - public function set_success( $success ) { |
|
236 | + public function set_success($success) { |
|
237 | 237 | $this->_success = $success; |
238 | 238 | } |
239 | 239 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | /** |
252 | 252 | * @param string $method_of_payment |
253 | 253 | */ |
254 | - public function set_method_of_payment( $method_of_payment ) { |
|
254 | + public function set_method_of_payment($method_of_payment) { |
|
255 | 255 | $this->_method_of_payment = $method_of_payment; |
256 | 256 | } |
257 | 257 | |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | /** |
279 | 279 | * @param float $payment_amount |
280 | 280 | */ |
281 | - public function set_payment_amount( $payment_amount ) { |
|
282 | - EE_Registry::instance()->load_helper( 'Money' ); |
|
283 | - $this->_payment_amount = EEH_Money::convert_to_float_from_localized_money( $payment_amount ); |
|
281 | + public function set_payment_amount($payment_amount) { |
|
282 | + EE_Registry::instance()->load_helper('Money'); |
|
283 | + $this->_payment_amount = EEH_Money::convert_to_float_from_localized_money($payment_amount); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | /** |
289 | 289 | * @param string $next_step_html |
290 | 290 | */ |
291 | - public function set_reg_step_html( $next_step_html ) { |
|
291 | + public function set_reg_step_html($next_step_html) { |
|
292 | 292 | $this->_reg_step_html = $next_step_html; |
293 | 293 | } |
294 | 294 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | /** |
307 | 307 | * @param string $redirect_form |
308 | 308 | */ |
309 | - public function set_redirect_form( $redirect_form ) { |
|
309 | + public function set_redirect_form($redirect_form) { |
|
310 | 310 | $this->_redirect_form = $redirect_form; |
311 | 311 | } |
312 | 312 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @return string |
317 | 317 | */ |
318 | 318 | public function redirect_form() { |
319 | - return ! empty( $this->_redirect_form ) ? $this->_redirect_form : FALSE; |
|
319 | + return ! empty($this->_redirect_form) ? $this->_redirect_form : FALSE; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | /** |
325 | 325 | * @param string $plz_select_method_of_payment |
326 | 326 | */ |
327 | - public function set_plz_select_method_of_payment( $plz_select_method_of_payment ) { |
|
327 | + public function set_plz_select_method_of_payment($plz_select_method_of_payment) { |
|
328 | 328 | $this->_plz_select_method_of_payment = $plz_select_method_of_payment; |
329 | 329 | } |
330 | 330 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | /** |
343 | 343 | * @param string $redirect_url |
344 | 344 | */ |
345 | - public function set_redirect_url( $redirect_url ) { |
|
345 | + public function set_redirect_url($redirect_url) { |
|
346 | 346 | $this->_redirect_url = $redirect_url; |
347 | 347 | } |
348 | 348 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | /** |
370 | 370 | * @param string $registration_time_limit |
371 | 371 | */ |
372 | - public function set_registration_time_limit( $registration_time_limit ) { |
|
372 | + public function set_registration_time_limit($registration_time_limit) { |
|
373 | 373 | $this->_registration_time_limit = $registration_time_limit; |
374 | 374 | } |
375 | 375 | |
@@ -378,8 +378,8 @@ discard block |
||
378 | 378 | /** |
379 | 379 | * @param array $return_data |
380 | 380 | */ |
381 | - public function set_return_data( $return_data ) { |
|
382 | - $this->_return_data = array_merge( $this->_return_data, $return_data ); |
|
381 | + public function set_return_data($return_data) { |
|
382 | + $this->_return_data = array_merge($this->_return_data, $return_data); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | |
@@ -396,9 +396,9 @@ discard block |
||
396 | 396 | /** |
397 | 397 | * @param array $validation_rules |
398 | 398 | */ |
399 | - public function add_validation_rules( $validation_rules = array() ) { |
|
400 | - if ( is_array( $validation_rules ) && ! empty( $validation_rules )) { |
|
401 | - $this->_validation_rules = array_merge( $this->_validation_rules, $validation_rules ); |
|
399 | + public function add_validation_rules($validation_rules = array()) { |
|
400 | + if (is_array($validation_rules) && ! empty($validation_rules)) { |
|
401 | + $this->_validation_rules = array_merge($this->_validation_rules, $validation_rules); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @return array | bool |
409 | 409 | */ |
410 | 410 | public function validation_rules() { |
411 | - return ! empty( $this->_validation_rules ) ? $this->_validation_rules : FALSE; |
|
411 | + return ! empty($this->_validation_rules) ? $this->_validation_rules : FALSE; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 |
@@ -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 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | |
57 | 57 | /** |
58 | - * @return boolean |
|
58 | + * @return boolean|null |
|
59 | 59 | */ |
60 | 60 | public function process_reg_step() { |
61 | 61 | return true; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | |
66 | 66 | /** |
67 | - * @return boolean |
|
67 | + * @return boolean|null |
|
68 | 68 | */ |
69 | 69 | public function update_reg_step() { |
70 | 70 | return true; |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -808,7 +808,7 @@ |
||
808 | 808 | |
809 | 809 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
810 | 810 | |
811 | - } else { |
|
811 | + } else { |
|
812 | 812 | EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
813 | 813 | // remove malformed data |
814 | 814 | unset( $valid_data[ $reg_url_link ] ); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * _auto_copy_attendee_info |
349 | 349 | * |
350 | 350 | * @access public |
351 | - * @return EE_Form_Section_Proper |
|
351 | + * @return EE_Form_Section_HTML |
|
352 | 352 | */ |
353 | 353 | private function _auto_copy_attendee_info() { |
354 | 354 | return new EE_Form_Section_HTML( |
@@ -462,6 +462,7 @@ discard block |
||
462 | 462 | * @param EE_Registration $registration |
463 | 463 | * @param EE_Question $question |
464 | 464 | * @param mixed EE_Answer|NULL $answer |
465 | + * @param EE_Answer $answer |
|
465 | 466 | * @return EE_Form_Input_Base |
466 | 467 | */ |
467 | 468 | private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | * @param EE_Checkout $checkout |
38 | 38 | * @return \EE_SPCO_Reg_Step_Attendee_Information |
39 | 39 | */ |
40 | - public function __construct( EE_Checkout $checkout ) { |
|
40 | + public function __construct(EE_Checkout $checkout) { |
|
41 | 41 | $this->_slug = 'attendee_information'; |
42 | 42 | $this->_name = __('Attendee Information', 'event_espresso'); |
43 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
43 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
44 | 44 | $this->checkout = $checkout; |
45 | 45 | $this->_reset_success_message(); |
46 | - $this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
46 | + $this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
53 | 53 | EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso'); |
54 | 54 | EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso'); |
55 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' ); |
|
55 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>'); |
|
56 | 56 | EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso'); |
57 | 57 | EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso'); |
58 | 58 | EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso'); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | EEH_Autoloader::register_line_item_display_autoloaders(); |
86 | 86 | $Line_Item_Display = new EE_Line_Item_Display(); |
87 | 87 | // calculate taxes |
88 | - $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) ); |
|
88 | + $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true)); |
|
89 | 89 | EE_Registry::instance()->load_helper('Line_Item'); |
90 | 90 | /** @var $subsections EE_Form_Section_Proper[] */ |
91 | 91 | $subsections = array( |
@@ -97,33 +97,33 @@ discard block |
||
97 | 97 | 'ticket_count' => array() |
98 | 98 | ); |
99 | 99 | // grab the saved registrations from the transaction |
100 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
101 | - if ( $registrations ) { |
|
102 | - foreach ( $registrations as $registration ) { |
|
103 | - if ( $registration instanceof EE_Registration ) { |
|
100 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
101 | + if ($registrations) { |
|
102 | + foreach ($registrations as $registration) { |
|
103 | + if ($registration instanceof EE_Registration) { |
|
104 | 104 | // can this registration be processed during this visit ? |
105 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
106 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
107 | - if ( ! $this->checkout->admin_request ) { |
|
108 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
109 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
110 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) ); |
|
111 | - $ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item; |
|
112 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item ); |
|
105 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
106 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
107 | + if ( ! $this->checkout->admin_request) { |
|
108 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
109 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
110 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID())); |
|
111 | + $ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item; |
|
112 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item); |
|
113 | 113 | } |
114 | - if ( $registration->is_primary_registrant() ) { |
|
114 | + if ($registration->is_primary_registrant()) { |
|
115 | 115 | $primary_registrant = $registration->reg_url_link(); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
120 | 120 | // print_copy_info ? |
121 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
121 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
122 | 122 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
123 | 123 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info(); |
124 | 124 | // generate hidden input |
125 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
126 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
125 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
126 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -135,8 +135,7 @@ discard block |
||
135 | 135 | 'html_id' => $this->reg_form_name(), |
136 | 136 | 'subsections' => $subsections, |
137 | 137 | 'layout_strategy' => $this->checkout->admin_request ? |
138 | - new EE_Div_Per_Section_Layout() : |
|
139 | - new EE_Template_Layout( |
|
138 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
140 | 139 | array( |
141 | 140 | 'layout_template_file' => $this->_template, // layout_template |
142 | 141 | 'template_args' => $template_args |
@@ -153,61 +152,61 @@ discard block |
||
153 | 152 | * @param EE_Registration $registration |
154 | 153 | * @return EE_Form_Section_Proper |
155 | 154 | */ |
156 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
157 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
155 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
156 | + EE_Registry::instance()->load_helper('Template'); |
|
158 | 157 | static $attendee_nmbr = 1; |
159 | 158 | // array of params to pass to parent constructor |
160 | 159 | $form_args = array( |
161 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
160 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
162 | 161 | 'html_class' => 'ee-reg-form-attendee-dv', |
163 | 162 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
164 | 163 | 'subsections' => array(), |
165 | 164 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
166 | 165 | array( |
167 | 166 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
168 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
167 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
169 | 168 | ) |
170 | 169 | ) |
171 | 170 | ); |
172 | 171 | // verify that registration has valid event |
173 | - if ( $registration->event() instanceof EE_Event ) { |
|
172 | + if ($registration->event() instanceof EE_Event) { |
|
174 | 173 | $query_params = array( |
175 | 174 | array( |
176 | 175 | 'Event.EVT_ID' => $registration->event()->ID(), |
177 | 176 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
178 | 177 | ), |
179 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
178 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
180 | 179 | ); |
181 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
182 | - if ( $question_groups ) { |
|
183 | - foreach ( $question_groups as $question_group ) { |
|
184 | - if ( $question_group instanceof EE_Question_Group ) { |
|
185 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group ); |
|
180 | + $question_groups = $registration->event()->question_groups($query_params); |
|
181 | + if ($question_groups) { |
|
182 | + foreach ($question_groups as $question_group) { |
|
183 | + if ($question_group instanceof EE_Question_Group) { |
|
184 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group); |
|
186 | 185 | // add hidden input |
187 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration ); |
|
186 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration); |
|
188 | 187 | } |
189 | 188 | } |
190 | 189 | // if we have question groups for additional attendees, then display the copy options |
191 | 190 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
192 | 191 | } else { |
193 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
192 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
194 | 193 | EEH_Template::locate_template( |
195 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
196 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
194 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
195 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
197 | 196 | TRUE, |
198 | 197 | TRUE |
199 | 198 | ) |
200 | 199 | ); |
201 | 200 | // add hidden input |
202 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE ); |
|
201 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE); |
|
203 | 202 | } |
204 | 203 | } |
205 | - if ( $registration->is_primary_registrant() ) { |
|
204 | + if ($registration->is_primary_registrant()) { |
|
206 | 205 | // generate hidden input |
207 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
206 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
208 | 207 | } |
209 | 208 | $attendee_nmbr++; |
210 | - return new EE_Form_Section_Proper( $form_args ); |
|
209 | + return new EE_Form_Section_Proper($form_args); |
|
211 | 210 | } |
212 | 211 | |
213 | 212 | |
@@ -220,11 +219,11 @@ discard block |
||
220 | 219 | * @param bool $additional_attendee_reg_info |
221 | 220 | * @return EE_Form_Input_Base |
222 | 221 | */ |
223 | - private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
222 | + private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
224 | 223 | // generate hidden input |
225 | 224 | return new EE_Hidden_Input( |
226 | 225 | array( |
227 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
226 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
228 | 227 | 'default' => $additional_attendee_reg_info |
229 | 228 | ) |
230 | 229 | ); |
@@ -237,22 +236,22 @@ discard block |
||
237 | 236 | * @param EE_Question_Group $question_group |
238 | 237 | * @return EE_Form_Section_Proper |
239 | 238 | */ |
240 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
239 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
241 | 240 | // array of params to pass to parent constructor |
242 | 241 | $form_args = array( |
243 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
242 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
244 | 243 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
245 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
244 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
246 | 245 | 'subsections' => array( |
247 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
246 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
248 | 247 | ), |
249 | 248 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
250 | 249 | ); |
251 | 250 | // where params |
252 | - $query_params = array( 'QST_deleted' => 0 ); |
|
251 | + $query_params = array('QST_deleted' => 0); |
|
253 | 252 | // don't load admin only questions on the frontend |
254 | - if ( ! $this->checkout->admin_request ) { |
|
255 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
253 | + if ( ! $this->checkout->admin_request) { |
|
254 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
256 | 255 | } |
257 | 256 | $questions = $question_group->get_many_related( |
258 | 257 | 'Question', |
@@ -264,21 +263,21 @@ discard block |
||
264 | 263 | ) |
265 | 264 | ); |
266 | 265 | // filter for additional content before questions |
267 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this )); |
|
266 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this)); |
|
268 | 267 | // loop thru questions |
269 | - foreach ( $questions as $question ) { |
|
270 | - if( $question instanceof EE_Question ){ |
|
268 | + foreach ($questions as $question) { |
|
269 | + if ($question instanceof EE_Question) { |
|
271 | 270 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
272 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
271 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
273 | 272 | } |
274 | 273 | } |
275 | - $form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this ); |
|
274 | + $form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this); |
|
276 | 275 | |
277 | 276 | // filter for additional content after questions |
278 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this )); |
|
277 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this)); |
|
279 | 278 | // d( $form_args ); |
280 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
281 | - return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this ); |
|
279 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
280 | + return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this); |
|
282 | 281 | } |
283 | 282 | |
284 | 283 | |
@@ -288,12 +287,12 @@ discard block |
||
288 | 287 | * @param EE_Question_Group $question_group |
289 | 288 | * @return EE_Form_Section_HTML |
290 | 289 | */ |
291 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
290 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
292 | 291 | $html = ''; |
293 | 292 | // group_name |
294 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
293 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
295 | 294 | EE_Registry::instance()->load_helper('HTML'); |
296 | - if ( $this->checkout->admin_request ) { |
|
295 | + if ($this->checkout->admin_request) { |
|
297 | 296 | $html .= EEH_HTML::br(); |
298 | 297 | $html .= EEH_HTML::h3( |
299 | 298 | $question_group->name(), |
@@ -307,7 +306,7 @@ discard block |
||
307 | 306 | } |
308 | 307 | } |
309 | 308 | // group_desc |
310 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
309 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
311 | 310 | $html .= EEH_HTML::p( |
312 | 311 | $question_group->desc(), |
313 | 312 | '', |
@@ -315,7 +314,7 @@ discard block |
||
315 | 314 | ); |
316 | 315 | |
317 | 316 | } |
318 | - return new EE_Form_Section_HTML( $html ); |
|
317 | + return new EE_Form_Section_HTML($html); |
|
319 | 318 | } |
320 | 319 | |
321 | 320 | |
@@ -324,14 +323,14 @@ discard block |
||
324 | 323 | * @access public |
325 | 324 | * @return EE_Form_Section_Proper |
326 | 325 | */ |
327 | - private function _copy_attendee_info_form(){ |
|
326 | + private function _copy_attendee_info_form() { |
|
328 | 327 | // array of params to pass to parent constructor |
329 | 328 | return new EE_Form_Section_Proper( |
330 | 329 | array( |
331 | 330 | 'subsections' => $this->_copy_attendee_info_inputs(), |
332 | 331 | 'layout_strategy' => new EE_Template_Layout( |
333 | 332 | array( |
334 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template |
|
333 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template |
|
335 | 334 | 'begin_template_file' => NULL, |
336 | 335 | 'input_template_file' => NULL, |
337 | 336 | 'subsection_template_file' => NULL, |
@@ -353,8 +352,8 @@ discard block |
||
353 | 352 | private function _auto_copy_attendee_info() { |
354 | 353 | return new EE_Form_Section_HTML( |
355 | 354 | EEH_Template::locate_template( |
356 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
357 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
355 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
356 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
358 | 357 | TRUE, |
359 | 358 | TRUE |
360 | 359 | ) |
@@ -373,25 +372,25 @@ discard block |
||
373 | 372 | $copy_attendee_info_inputs = array(); |
374 | 373 | $prev_ticket = NULL; |
375 | 374 | // grab the saved registrations from the transaction |
376 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
377 | - foreach ( $registrations as $registration ) { |
|
375 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
376 | + foreach ($registrations as $registration) { |
|
378 | 377 | // for all attendees other than the primary attendee |
379 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
378 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
380 | 379 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
381 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
380 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
382 | 381 | $item_name = $registration->ticket()->name(); |
383 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
384 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
385 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
382 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
383 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
384 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
386 | 385 | ); |
387 | 386 | $prev_ticket = $registration->ticket()->ID(); |
388 | 387 | } |
389 | 388 | |
390 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
389 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
391 | 390 | EE_Checkbox_Multi_Input( |
392 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
391 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
393 | 392 | array( |
394 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
393 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
395 | 394 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
396 | 395 | 'display_html_label_text' => FALSE |
397 | 396 | ) |
@@ -410,7 +409,7 @@ discard block |
||
410 | 409 | * @param EE_Registration $registration |
411 | 410 | * @return EE_Form_Input_Base |
412 | 411 | */ |
413 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
412 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
414 | 413 | // generate hidden input |
415 | 414 | return new EE_Hidden_Input( |
416 | 415 | array( |
@@ -428,31 +427,31 @@ discard block |
||
428 | 427 | * @param EE_Question $question |
429 | 428 | * @return EE_Form_Input_Base |
430 | 429 | */ |
431 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
430 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
432 | 431 | |
433 | 432 | // if this question was for an attendee detail, then check for that answer |
434 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() ); |
|
433 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID()); |
|
435 | 434 | $answer = $answer_value === null |
436 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
435 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
437 | 436 | : null; |
438 | 437 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
439 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
438 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
440 | 439 | // create an EE_Answer object for storing everything in |
441 | - $answer = EE_Answer::new_instance ( array( |
|
440 | + $answer = EE_Answer::new_instance(array( |
|
442 | 441 | 'QST_ID'=> $question->ID(), |
443 | 442 | 'REG_ID'=> $registration->ID() |
444 | 443 | )); |
445 | 444 | } |
446 | 445 | // verify instance |
447 | - if( $answer instanceof EE_Answer ){ |
|
448 | - if ( ! empty( $answer_value )) { |
|
449 | - $answer->set( 'ANS_value', $answer_value ); |
|
446 | + if ($answer instanceof EE_Answer) { |
|
447 | + if ( ! empty($answer_value)) { |
|
448 | + $answer->set('ANS_value', $answer_value); |
|
450 | 449 | } |
451 | - $answer->cache( 'Question', $question ); |
|
452 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
453 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
450 | + $answer->cache('Question', $question); |
|
451 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
452 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
454 | 453 | } |
455 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
454 | + return $this->_generate_question_input($registration, $question, $answer); |
|
456 | 455 | |
457 | 456 | } |
458 | 457 | |
@@ -464,31 +463,31 @@ discard block |
||
464 | 463 | * @param mixed EE_Answer|NULL $answer |
465 | 464 | * @return EE_Form_Input_Base |
466 | 465 | */ |
467 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
466 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
468 | 467 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
469 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
470 | - add_filter( 'FHEE__EE_Question__generate_form_input__country_options', array( $this, 'use_cached_countries_for_form_input' ), 10, 4 ); |
|
471 | - add_filter( 'FHEE__EE_Question__generate_form_input__state_options', array( $this, 'use_cached_states_for_form_input' ), 10, 4 ); |
|
468 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
469 | + add_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input'), 10, 4); |
|
470 | + add_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input'), 10, 4); |
|
472 | 471 | $input_constructor_args = array( |
473 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
474 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
475 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
476 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
472 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
473 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
474 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
475 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
477 | 476 | 'html_label_class' => 'ee-reg-qstn', |
478 | 477 | ); |
479 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
480 | - if ( $answer instanceof EE_Answer && $answer->ID() ) { |
|
481 | - $input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']'; |
|
482 | - $input_constructor_args[ 'html_id' ] .= '-' . $answer->ID(); |
|
483 | - $input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID(); |
|
478 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
479 | + if ($answer instanceof EE_Answer && $answer->ID()) { |
|
480 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
481 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
482 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
484 | 483 | } |
485 | - $form_input = $question->generate_form_input( |
|
484 | + $form_input = $question->generate_form_input( |
|
486 | 485 | $registration, |
487 | 486 | $answer, |
488 | 487 | $input_constructor_args |
489 | 488 | ); |
490 | - remove_filter( 'FHEE__EE_Question__generate_form_input__country_options', array( $this, 'use_cached_countries_for_form_input' ) ); |
|
491 | - remove_filter( 'FHEE__EE_Question__generate_form_input__state_options', array( $this, 'use_cached_states_for_form_input' ) ); |
|
489 | + remove_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input')); |
|
490 | + remove_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input')); |
|
492 | 491 | return $form_input; |
493 | 492 | } |
494 | 493 | |
@@ -502,20 +501,20 @@ discard block |
||
502 | 501 | * @param EE_Registration $registration |
503 | 502 | * @return array 2d keys are country IDs, values are their names |
504 | 503 | */ |
505 | - public function use_cached_countries_for_form_input( $countries_list, $question, $registration, $answer ) { |
|
506 | - $country_options = array( '' => '' ); |
|
504 | + public function use_cached_countries_for_form_input($countries_list, $question, $registration, $answer) { |
|
505 | + $country_options = array('' => ''); |
|
507 | 506 | // get possibly cached list of countries |
508 | 507 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
509 | - if ( ! empty( $countries )) { |
|
510 | - foreach( $countries as $country ){ |
|
511 | - if ( $country instanceof EE_Country ) { |
|
512 | - $country_options[ $country->ID() ] = $country->name(); |
|
508 | + if ( ! empty($countries)) { |
|
509 | + foreach ($countries as $country) { |
|
510 | + if ($country instanceof EE_Country) { |
|
511 | + $country_options[$country->ID()] = $country->name(); |
|
513 | 512 | } |
514 | 513 | } |
515 | 514 | } |
516 | - if( $question instanceof EE_Question |
|
517 | - && $registration instanceof EE_Registration ) { |
|
518 | - $answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ); |
|
515 | + if ($question instanceof EE_Question |
|
516 | + && $registration instanceof EE_Registration) { |
|
517 | + $answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))); |
|
519 | 518 | } else { |
520 | 519 | $answer = EE_Answer::new_instance(); |
521 | 520 | } |
@@ -540,19 +539,19 @@ discard block |
||
540 | 539 | * @param EE_Registration $registration |
541 | 540 | * @return array 2d keys are state IDs, values are their names |
542 | 541 | */ |
543 | - public function use_cached_states_for_form_input( $states_list, $question, $registration, $answer ) { |
|
544 | - $state_options = array( '' => array( '' => '')); |
|
542 | + public function use_cached_states_for_form_input($states_list, $question, $registration, $answer) { |
|
543 | + $state_options = array('' => array('' => '')); |
|
545 | 544 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
546 | - if ( ! empty( $states )) { |
|
547 | - foreach( $states as $state ){ |
|
548 | - if ( $state instanceof EE_State ) { |
|
549 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
545 | + if ( ! empty($states)) { |
|
546 | + foreach ($states as $state) { |
|
547 | + if ($state instanceof EE_State) { |
|
548 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
550 | 549 | } |
551 | 550 | } |
552 | 551 | } |
553 | - if( $question instanceof EE_Question |
|
554 | - && $registration instanceof EE_Registration ) { |
|
555 | - $answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ); |
|
552 | + if ($question instanceof EE_Question |
|
553 | + && $registration instanceof EE_Registration) { |
|
554 | + $answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))); |
|
556 | 555 | } else { |
557 | 556 | $answer = EE_Answer::new_instance(); |
558 | 557 | } |
@@ -586,65 +585,65 @@ discard block |
||
586 | 585 | */ |
587 | 586 | public function process_reg_step() { |
588 | 587 | |
589 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
588 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
590 | 589 | // grab validated data from form |
591 | 590 | $valid_data = $this->checkout->current_step->valid_data(); |
592 | 591 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
593 | 592 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
594 | 593 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
595 | - if ( empty( $valid_data )) { |
|
596 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
594 | + if (empty($valid_data)) { |
|
595 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
597 | 596 | return FALSE; |
598 | 597 | } |
599 | 598 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
600 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
601 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
599 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
600 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
602 | 601 | return FALSE; |
603 | 602 | } |
604 | 603 | // get cached registrations |
605 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
604 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
606 | 605 | // verify we got the goods |
607 | - if ( empty( $registrations )) { |
|
608 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
606 | + if (empty($registrations)) { |
|
607 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
609 | 608 | return FALSE; |
610 | 609 | } |
611 | 610 | // extract attendee info from form data and save to model objects |
612 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
611 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
613 | 612 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
614 | - if ( $registrations_processed === FALSE ) { |
|
613 | + if ($registrations_processed === FALSE) { |
|
615 | 614 | // but return immediately if the previous step exited early due to errors |
616 | 615 | return FALSE; |
617 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
616 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
618 | 617 | // generate a correctly translated string for all possible singular/plural combinations |
619 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
618 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
620 | 619 | $error_msg = sprintf( |
621 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
620 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
622 | 621 | $this->checkout->total_ticket_count, |
623 | 622 | $registrations_processed |
624 | 623 | ); |
625 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
624 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
626 | 625 | $error_msg = sprintf( |
627 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
626 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
628 | 627 | $this->checkout->total_ticket_count, |
629 | 628 | $registrations_processed |
630 | 629 | ); |
631 | 630 | } else { |
632 | 631 | $error_msg = sprintf( |
633 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
632 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
634 | 633 | $this->checkout->total_ticket_count, |
635 | 634 | $registrations_processed |
636 | 635 | ); |
637 | 636 | |
638 | 637 | } |
639 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
638 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
640 | 639 | return FALSE; |
641 | 640 | } |
642 | 641 | // mark this reg step as completed |
643 | 642 | $this->set_completed(); |
644 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
643 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
645 | 644 | //do action in case a plugin wants to do something with the data submitted in step 1. |
646 | 645 | //passes EE_Single_Page_Checkout, and it's posted data |
647 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
646 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
648 | 647 | return TRUE; |
649 | 648 | |
650 | 649 | } |
@@ -658,9 +657,9 @@ discard block |
||
658 | 657 | * @param array $valid_data |
659 | 658 | * @return boolean | int |
660 | 659 | */ |
661 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
660 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
662 | 661 | // load resources and set some defaults |
663 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
662 | + EE_Registry::instance()->load_model('Attendee'); |
|
664 | 663 | // holder for primary registrant attendee object |
665 | 664 | $this->checkout->primary_attendee_obj = NULL; |
666 | 665 | // array for tracking reg form data for the primary registrant |
@@ -677,19 +676,19 @@ discard block |
||
677 | 676 | // attendee counter |
678 | 677 | $att_nmbr = 0; |
679 | 678 | // grab the saved registrations from the transaction |
680 | - foreach ( $registrations as $registration ) { |
|
679 | + foreach ($registrations as $registration) { |
|
681 | 680 | // verify EE_Registration object |
682 | - if ( ! $registration instanceof EE_Registration ) { |
|
683 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
681 | + if ( ! $registration instanceof EE_Registration) { |
|
682 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
684 | 683 | return FALSE; |
685 | 684 | } |
686 | 685 | $reg_url_link = $registration->reg_url_link(); |
687 | 686 | // reg_url_link exists ? |
688 | - if ( $reg_url_link ) { |
|
687 | + if ($reg_url_link) { |
|
689 | 688 | // should this registration be processed during this visit ? |
690 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
689 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
691 | 690 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
692 | - if ( ! $this->checkout->revisit ) { |
|
691 | + if ( ! $this->checkout->revisit) { |
|
693 | 692 | $registration->save(); |
694 | 693 | } |
695 | 694 | |
@@ -700,41 +699,41 @@ discard block |
||
700 | 699 | * @var bool if TRUE is returned by the plugin then the |
701 | 700 | * registration processing is halted. |
702 | 701 | */ |
703 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
702 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
704 | 703 | return FALSE; |
705 | 704 | } |
706 | 705 | |
707 | 706 | // Houston, we have a registration! |
708 | 707 | $att_nmbr++; |
709 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
708 | + $this->_attendee_data[$reg_url_link] = array(); |
|
710 | 709 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
711 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
710 | + if (isset($valid_data[$reg_url_link])) { |
|
712 | 711 | // do we need to copy basic info from primary attendee ? |
713 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE; |
|
712 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE; |
|
714 | 713 | // filter form input data for this registration |
715 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
714 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
716 | 715 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
717 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
718 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
719 | - unset( $valid_data['primary_attendee'] ); |
|
716 | + if (isset($valid_data['primary_attendee'])) { |
|
717 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
718 | + unset($valid_data['primary_attendee']); |
|
720 | 719 | } |
721 | 720 | // now loop through our array of valid post data && process attendee reg forms |
722 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
723 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
724 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
721 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
722 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
723 | + foreach ($form_inputs as $form_input => $input_value) { |
|
725 | 724 | // check for critical inputs |
726 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
725 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
727 | 726 | return FALSE; |
728 | 727 | } |
729 | 728 | // store a bit of data about the primary attendee |
730 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
731 | - $primary_registrant[ $form_input ] = $input_value; |
|
732 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
733 | - $input_value = $primary_registrant[ $form_input ]; |
|
729 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
730 | + $primary_registrant[$form_input] = $input_value; |
|
731 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
732 | + $input_value = $primary_registrant[$form_input]; |
|
734 | 733 | } |
735 | 734 | // now attempt to save the input data |
736 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
737 | - EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ ); |
|
735 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
736 | + EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__); |
|
738 | 737 | return FALSE; |
739 | 738 | } |
740 | 739 | } |
@@ -743,51 +742,51 @@ discard block |
||
743 | 742 | } |
744 | 743 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
745 | 744 | // this registration does not require additional attendee information ? |
746 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
745 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
747 | 746 | // just copy the primary registrant |
748 | 747 | $attendee = $this->checkout->primary_attendee_obj; |
749 | 748 | } else { |
750 | 749 | // have we met before? |
751 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
750 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
752 | 751 | // did we find an already existing record for this attendee ? |
753 | - if ( $attendee instanceof EE_Attendee ) { |
|
754 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
752 | + if ($attendee instanceof EE_Attendee) { |
|
753 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
755 | 754 | } else { |
756 | 755 | // ensure critical details are set for additional attendees |
757 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ]; |
|
758 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
756 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link]; |
|
757 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
759 | 758 | } |
760 | 759 | // who's #1 ? |
761 | - if ( $att_nmbr == 1 ) { |
|
760 | + if ($att_nmbr == 1) { |
|
762 | 761 | $this->checkout->primary_attendee_obj = $attendee; |
763 | 762 | } |
764 | 763 | } |
765 | 764 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
766 | 765 | // add relation to registration, set attendee ID, and cache attendee |
767 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
768 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
769 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
766 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
767 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
768 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
770 | 769 | return FALSE; |
771 | 770 | } |
772 | 771 | /** @type EE_Registration_Processor $registration_processor */ |
773 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
772 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
774 | 773 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
775 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
774 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
776 | 775 | /** @type EE_Transaction_Processor $transaction_processor */ |
777 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
776 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
778 | 777 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
779 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
778 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
780 | 779 | // if we've gotten this far, then let's save what we have |
781 | 780 | $registration->save(); |
782 | 781 | // add relation between TXN and registration |
783 | - $this->_associate_registration_with_transaction( $registration ); |
|
782 | + $this->_associate_registration_with_transaction($registration); |
|
784 | 783 | |
785 | 784 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
786 | 785 | |
787 | - } else { |
|
788 | - EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
786 | + } else { |
|
787 | + EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
789 | 788 | // remove malformed data |
790 | - unset( $valid_data[ $reg_url_link ] ); |
|
789 | + unset($valid_data[$reg_url_link]); |
|
791 | 790 | return FALSE; |
792 | 791 | } |
793 | 792 | |
@@ -805,22 +804,22 @@ discard block |
||
805 | 804 | * @param string $input_value |
806 | 805 | * @return boolean |
807 | 806 | */ |
808 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
807 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
809 | 808 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
810 | 809 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
811 | 810 | // allow for plugins to hook in and do their own processing of the form input. |
812 | 811 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
813 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
812 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
814 | 813 | return TRUE; |
815 | 814 | } |
816 | 815 | |
817 | 816 | // grab related answer objects |
818 | 817 | $answers = $registration->answers(); |
819 | 818 | // $answer_cache_id is the key used to find the EE_Answer we want |
820 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
821 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
819 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
820 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
822 | 821 | //rename form_inputs if they are EE_Attendee properties |
823 | - switch( (string)$form_input ) { |
|
822 | + switch ((string) $form_input) { |
|
824 | 823 | |
825 | 824 | case 'state' : |
826 | 825 | case 'STA_ID' : |
@@ -835,33 +834,33 @@ discard block |
||
835 | 834 | break; |
836 | 835 | |
837 | 836 | default : |
838 | - $ATT_input = 'ATT_' . $form_input; |
|
837 | + $ATT_input = 'ATT_'.$form_input; |
|
839 | 838 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
840 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
841 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
839 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
840 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
842 | 841 | } |
843 | 842 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
844 | 843 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
845 | 844 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
846 | 845 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
847 | 846 | // if this form input has a corresponding attendee property |
848 | - if ( $attendee_property ) { |
|
849 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
850 | - if ( $answer_is_obj ) { |
|
847 | + if ($attendee_property) { |
|
848 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
849 | + if ($answer_is_obj) { |
|
851 | 850 | // and delete the corresponding answer since we won't be storing this data in that object |
852 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
853 | - $answers[ $answer_cache_id ]->delete_permanently(); |
|
851 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
852 | + $answers[$answer_cache_id]->delete_permanently(); |
|
854 | 853 | } |
855 | 854 | return TRUE; |
856 | - } elseif ( $answer_is_obj ) { |
|
855 | + } elseif ($answer_is_obj) { |
|
857 | 856 | // save this data to the answer object |
858 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
859 | - $result = $answers[ $answer_cache_id ]->save(); |
|
857 | + $answers[$answer_cache_id]->set_value($input_value); |
|
858 | + $result = $answers[$answer_cache_id]->save(); |
|
860 | 859 | return $result !== false ? true : false; |
861 | 860 | } else { |
862 | - foreach ( $answers as $answer ) { |
|
863 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
864 | - $answer->set_value( $input_value ); |
|
861 | + foreach ($answers as $answer) { |
|
862 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
863 | + $answer->set_value($input_value); |
|
865 | 864 | $result = $answer->save(); |
866 | 865 | return $result !== false ? true : false; |
867 | 866 | } |
@@ -879,31 +878,31 @@ discard block |
||
879 | 878 | * @param string $input_value |
880 | 879 | * @return boolean |
881 | 880 | */ |
882 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
883 | - if ( empty( $input_value )) { |
|
881 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
882 | + if (empty($input_value)) { |
|
884 | 883 | // if the form input isn't marked as being required, then just return |
885 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
884 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
886 | 885 | return true; |
887 | 886 | } |
888 | - switch( $form_input ) { |
|
887 | + switch ($form_input) { |
|
889 | 888 | case 'fname' : |
890 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
889 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
891 | 890 | return FALSE; |
892 | 891 | break; |
893 | 892 | case 'lname' : |
894 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
893 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
895 | 894 | return FALSE; |
896 | 895 | break; |
897 | 896 | case 'email' : |
898 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
897 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
899 | 898 | return FALSE; |
900 | 899 | break; |
901 | 900 | } |
902 | - } else if ( $form_input === 'email' ) { |
|
901 | + } else if ($form_input === 'email') { |
|
903 | 902 | // check that an email was entered |
904 | - if ( empty( $input_value ) ) { |
|
903 | + if (empty($input_value)) { |
|
905 | 904 | // whoops!!! |
906 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
905 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
907 | 906 | return FALSE; |
908 | 907 | } |
909 | 908 | } |
@@ -931,14 +930,14 @@ discard block |
||
931 | 930 | * @param array $attendee_data |
932 | 931 | * @return boolean |
933 | 932 | */ |
934 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
933 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
935 | 934 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
936 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
937 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
938 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
935 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
936 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
937 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
939 | 938 | // but only if those have values |
940 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
941 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
939 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
940 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
942 | 941 | 'ATT_fname' => $ATT_fname, |
943 | 942 | 'ATT_lname' => $ATT_lname, |
944 | 943 | 'ATT_email' => $ATT_email |
@@ -946,7 +945,7 @@ discard block |
||
946 | 945 | } else { |
947 | 946 | $existing_attendee = NULL; |
948 | 947 | } |
949 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
948 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
950 | 949 | } |
951 | 950 | |
952 | 951 | |
@@ -958,13 +957,13 @@ discard block |
||
958 | 957 | * @param array $attendee_data |
959 | 958 | * @return \EE_Attendee |
960 | 959 | */ |
961 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
960 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
962 | 961 | // first remove fname, lname, and email from attendee data |
963 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
962 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
964 | 963 | // now loop thru what's left and add to attendee CPT |
965 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
966 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
967 | - $existing_attendee->set( $property_name, $property_value ); |
|
964 | + foreach ($attendee_data as $property_name => $property_value) { |
|
965 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
966 | + $existing_attendee->set($property_name, $property_value); |
|
968 | 967 | } |
969 | 968 | } |
970 | 969 | // better save that now |
@@ -981,11 +980,11 @@ discard block |
||
981 | 980 | * @param EE_Attendee $attendee |
982 | 981 | * @return void |
983 | 982 | */ |
984 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
983 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
985 | 984 | // add relation to attendee |
986 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
987 | - $registration->set_attendee_id( $attendee->ID() ); |
|
988 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
985 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
986 | + $registration->set_attendee_id($attendee->ID()); |
|
987 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
989 | 988 | } |
990 | 989 | |
991 | 990 | |
@@ -996,10 +995,10 @@ discard block |
||
996 | 995 | * @param EE_Registration $registration |
997 | 996 | * @return void |
998 | 997 | */ |
999 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
998 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1000 | 999 | // add relation to attendee |
1001 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1002 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1000 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1001 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1003 | 1002 | } |
1004 | 1003 | |
1005 | 1004 | |
@@ -1011,17 +1010,17 @@ discard block |
||
1011 | 1010 | * @param array $attendee_data |
1012 | 1011 | * @return array |
1013 | 1012 | */ |
1014 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1013 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1015 | 1014 | // bare minimum critical details include first name, last name, email address |
1016 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1015 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1017 | 1016 | // add address info to critical details? |
1018 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1019 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1020 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1017 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1018 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1019 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1021 | 1020 | } |
1022 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1023 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1024 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1021 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1022 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1023 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1025 | 1024 | } |
1026 | 1025 | } |
1027 | 1026 | return $attendee_data; |
@@ -1036,11 +1035,11 @@ discard block |
||
1036 | 1035 | * @param array $attendee_data |
1037 | 1036 | * @return \EE_Attendee |
1038 | 1037 | */ |
1039 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1038 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1040 | 1039 | // create new attendee object |
1041 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1040 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1042 | 1041 | // set author to event creator |
1043 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1042 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1044 | 1043 | $new_attendee->save(); |
1045 | 1044 | return $new_attendee; |
1046 | 1045 | } |
@@ -1056,7 +1055,7 @@ discard block |
||
1056 | 1055 | */ |
1057 | 1056 | public function update_reg_step() { |
1058 | 1057 | // save everything |
1059 | - if ( $this->process_reg_step() ) { |
|
1058 | + if ($this->process_reg_step()) { |
|
1060 | 1059 | $this->checkout->redirect = TRUE; |
1061 | 1060 | $this->checkout->redirect_url = add_query_arg( |
1062 | 1061 | array( |
@@ -1065,7 +1064,7 @@ discard block |
||
1065 | 1064 | ), |
1066 | 1065 | $this->checkout->thank_you_page_url |
1067 | 1066 | ); |
1068 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1067 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1069 | 1068 | return TRUE; |
1070 | 1069 | } |
1071 | 1070 | return FALSE; |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <p class="spco-attendee-info-not-required-pg smaller-text lt-grey-text"> |
2 | - <?php echo apply_filters( 'FHEE__registration_page_attendee_information__attendee_info_not_required_pg', __( 'This ticket type does not require any information for additional attendees, so attendee #1\'s information will be used for its registration purposes.', 'event_espresso' ));?> |
|
2 | + <?php echo apply_filters('FHEE__registration_page_attendee_information__attendee_info_not_required_pg', __('This ticket type does not require any information for additional attendees, so attendee #1\'s information will be used for its registration purposes.', 'event_espresso')); ?> |
|
3 | 3 | </p> |