@@ -21,23 +21,23 @@ discard block |
||
21 | 21 | private $EE; |
22 | 22 | public function __construct($url_link = 0) { |
23 | 23 | |
24 | - if ( $this->registration = EE_Registry::instance()->load_model( 'Registration' )->get_registration_for_reg_url_link( $url_link)) { |
|
24 | + if ($this->registration = EE_Registry::instance()->load_model('Registration')->get_registration_for_reg_url_link($url_link)) { |
|
25 | 25 | $this->transaction = $this->registration->transaction(); |
26 | 26 | |
27 | - $payment_settings = EE_Config::instance()->gateway->payment_settings;//get_user_meta(EE_Registry::instance()->CFG->wp_user, 'payment_settings', TRUE); |
|
28 | - $this->invoice_payment_method = EEM_Payment_Method::instance()->get_one_of_type( 'Invoice' ); |
|
27 | + $payment_settings = EE_Config::instance()->gateway->payment_settings; //get_user_meta(EE_Registry::instance()->CFG->wp_user, 'payment_settings', TRUE); |
|
28 | + $this->invoice_payment_method = EEM_Payment_Method::instance()->get_one_of_type('Invoice'); |
|
29 | 29 | } else { |
30 | - EE_Error::add_error( __( 'Your request appears to be missing some required data, and no information for your transaction could be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
30 | + EE_Error::add_error(__('Your request appears to be missing some required data, and no information for your transaction could be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | } |
34 | 34 | |
35 | - public function send_invoice( $download = FALSE ) { |
|
35 | + public function send_invoice($download = FALSE) { |
|
36 | 36 | $template_args = array(); |
37 | 37 | $EE = EE_Registry::instance(); |
38 | 38 | |
39 | 39 | //allow the request to override the default theme defined in the invoice settings |
40 | - $theme_requested = ( isset( $_REQUEST['theme'] ) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8 ) ? absint( $_REQUEST['theme'] ) : null; |
|
40 | + $theme_requested = (isset($_REQUEST['theme']) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8) ? absint($_REQUEST['theme']) : null; |
|
41 | 41 | $themes = array( |
42 | 42 | 1 => "simple.css", |
43 | 43 | 2 => "bauhaus.css", |
@@ -48,26 +48,26 @@ discard block |
||
48 | 48 | 7 => "union.css" |
49 | 49 | ); |
50 | 50 | //Get the CSS file |
51 | - if( isset( $themes[ $theme_requested ] ) ) { |
|
52 | - $template_args['invoice_css'] = $themes[ $theme_requested ]; |
|
53 | - }else{ |
|
54 | - $template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta( 'legacy_invoice_css', TRUE, 'simple.css' ); |
|
51 | + if (isset($themes[$theme_requested])) { |
|
52 | + $template_args['invoice_css'] = $themes[$theme_requested]; |
|
53 | + } else { |
|
54 | + $template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta('legacy_invoice_css', TRUE, 'simple.css'); |
|
55 | 55 | } |
56 | 56 | |
57 | - if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) { |
|
58 | - $template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/'; |
|
57 | + if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR.'/invoice')) { |
|
58 | + $template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL.'Invoice/lib/templates/'; |
|
59 | 59 | } else { |
60 | - $template_args['base_url'] = EE_GATEWAYS . '/Invoice/lib/templates/'; |
|
60 | + $template_args['base_url'] = EE_GATEWAYS.'/Invoice/lib/templates/'; |
|
61 | 61 | } |
62 | 62 | $primary_attendee = $this->transaction->primary_registration()->attendee(); |
63 | 63 | |
64 | - $template_args['organization'] = $EE->CFG->organization->get_pretty( 'name' ); |
|
65 | - $template_args['street'] = empty( $EE->CFG->organization->address_2 ) ? $EE->CFG->organization->get_pretty( 'address_1' ) : $EE->CFG->organization->get_pretty( 'address_1' ) . '<br>' . $EE->CFG->organization->get_pretty( 'address_2' ); |
|
66 | - $template_args['city'] = $EE->CFG->organization->get_pretty( 'city' ); |
|
67 | - $template_args['state'] = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID ); |
|
68 | - $template_args['country'] = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $EE->CFG->organization->CNT_ISO ); |
|
69 | - $template_args['zip'] = $EE->CFG->organization->get_pretty( 'zip' ); |
|
70 | - $template_args['email'] = $EE->CFG->organization->get_pretty( 'email' ); |
|
64 | + $template_args['organization'] = $EE->CFG->organization->get_pretty('name'); |
|
65 | + $template_args['street'] = empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1').'<br>'.$EE->CFG->organization->get_pretty('address_2'); |
|
66 | + $template_args['city'] = $EE->CFG->organization->get_pretty('city'); |
|
67 | + $template_args['state'] = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID); |
|
68 | + $template_args['country'] = EE_Registry::instance()->load_model('Country')->get_one_by_ID($EE->CFG->organization->CNT_ISO); |
|
69 | + $template_args['zip'] = $EE->CFG->organization->get_pretty('zip'); |
|
70 | + $template_args['email'] = $EE->CFG->organization->get_pretty('email'); |
|
71 | 71 | |
72 | 72 | $template_args['registration_code'] = $this->registration->reg_code(); |
73 | 73 | $template_args['registration_date'] = $this->registration->date(); |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $template_args['attendee_address2'] = $primary_attendee->address2(); |
77 | 77 | $template_args['attendee_city'] = $primary_attendee->city(); |
78 | 78 | $attendee_state = $primary_attendee->state_obj(); |
79 | - if($attendee_state){ |
|
79 | + if ($attendee_state) { |
|
80 | 80 | $attendee_state_name = $attendee_state->name(); |
81 | - }else{ |
|
81 | + } else { |
|
82 | 82 | $attendee_state_name = ''; |
83 | 83 | } |
84 | 84 | $template_args['attendee_state'] = $attendee_state_name; |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | if ($template_args['amount_pd'] != $template_args['total_cost']) { |
103 | 103 | //$template_args['net_total'] = $this->espressoInvoiceTotals( __('SubTotal', 'event_espresso'), $this->transaction->total());//$this->session_data['cart']['REG']['sub_total']); |
104 | 104 | $tax_items = $this->transaction->tax_items(); |
105 | - if(!empty($tax_items) ){ |
|
105 | + if ( ! empty($tax_items)) { |
|
106 | 106 | foreach ($tax_items as $tax) { |
107 | - $template_args['net_total'] .= $this->espressoInvoiceTotals( $tax->name(), $tax->total()); |
|
107 | + $template_args['net_total'] .= $this->espressoInvoiceTotals($tax->name(), $tax->total()); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
@@ -114,30 +114,30 @@ discard block |
||
114 | 114 | } else { |
115 | 115 | $text = __('Extra', 'event_espresso'); |
116 | 116 | } |
117 | - $template_args['discount'] = $this->espressoInvoiceTotals( $text, $difference ); |
|
117 | + $template_args['discount'] = $this->espressoInvoiceTotals($text, $difference); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $template_args['currency_symbol'] = $EE->CFG->currency->sign; |
121 | - $template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta( 'pdf_instructions', TRUE ), ENT_QUOTES))); |
|
122 | - $template_args['shameless_plug'] = apply_filters( 'FHEE_Invoice__send_invoice__shameless_plug',true ); |
|
123 | - if(isset($_GET['receipt'])){ |
|
121 | + $template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE), ENT_QUOTES))); |
|
122 | + $template_args['shameless_plug'] = apply_filters('FHEE_Invoice__send_invoice__shameless_plug', true); |
|
123 | + if (isset($_GET['receipt'])) { |
|
124 | 124 | //receipt-specific stuff |
125 | 125 | $events_for_txn = EEM_Event::instance()->get_all(array(array('Registration.TXN_ID'=>$this->transaction->ID()))); |
126 | 126 | $ticket_line_items_per_event = array(); |
127 | 127 | $registrations_per_line_item = array(); |
128 | 128 | $venues_for_events = array(); |
129 | - foreach($events_for_txn as $event_id => $event){ |
|
130 | - $line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID'=>$event_id,'TXN_ID'=>$this->transaction->ID()))); |
|
129 | + foreach ($events_for_txn as $event_id => $event) { |
|
130 | + $line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID'=>$event_id, 'TXN_ID'=>$this->transaction->ID()))); |
|
131 | 131 | $ticket_line_items_per_event[$event_id] = $line_items_for_this_event; |
132 | - foreach($line_items_for_this_event as $line_item_id => $line_item){ |
|
132 | + foreach ($line_items_for_this_event as $line_item_id => $line_item) { |
|
133 | 133 | $ticket = $line_item->ticket(); |
134 | - $registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID'=>$ticket->ID(),'TXN_ID'=>$this->transaction->ID()))); |
|
134 | + $registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID'=>$ticket->ID(), 'TXN_ID'=>$this->transaction->ID()))); |
|
135 | 135 | $registrations_per_line_item[$line_item_id] = $registrations_for_this_ticket; |
136 | 136 | } |
137 | 137 | $venues_for_events = array_merge($venues_for_events, $event->venues()); |
138 | 138 | } |
139 | - $tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID'=>$this->transaction->ID(),'LIN_type'=> EEM_Line_Item::type_tax_sub_total))); |
|
140 | - $questions_to_skip = array(EEM_Attendee::system_question_fname,EEM_Attendee::system_question_lname, EEM_Attendee::system_question_email); |
|
139 | + $tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID'=>$this->transaction->ID(), 'LIN_type'=> EEM_Line_Item::type_tax_sub_total))); |
|
140 | + $questions_to_skip = array(EEM_Attendee::system_question_fname, EEM_Attendee::system_question_lname, EEM_Attendee::system_question_email); |
|
141 | 141 | |
142 | 142 | |
143 | 143 | $template_args['events_for_txn'] = $events_for_txn; |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | $template_args['venues_for_events'] = $venues_for_events; |
147 | 147 | $template_args['tax_total_line_item'] = $tax_total_line_item; |
148 | 148 | $template_args['questions_to_skip'] = $questions_to_skip; |
149 | - $EE->load_helper( 'Venue_View' ); |
|
149 | + $EE->load_helper('Venue_View'); |
|
150 | 150 | // d($template_args); |
151 | 151 | $template_args['download_link'] = $this->registration->receipt_url('download'); |
152 | - }else{ |
|
152 | + } else { |
|
153 | 153 | //it's just an invoice we're accessing |
154 | 154 | $template_args['download_link'] = $this->registration->invoice_url('download'); |
155 | 155 | } |
@@ -157,51 +157,51 @@ discard block |
||
157 | 157 | |
158 | 158 | |
159 | 159 | //require helpers |
160 | - $EE->load_helper( 'Formatter' ); |
|
160 | + $EE->load_helper('Formatter'); |
|
161 | 161 | |
162 | 162 | //Get the HTML as an object |
163 | 163 | EE_Registry::instance()->load_helper('Template'); |
164 | 164 | $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
165 | - $template_header = EEH_Template::locate_template( $templates_relative_path . 'invoice_header.template.php', $template_args, TRUE, TRUE ); |
|
166 | - if(isset($_GET['receipt'])){ |
|
167 | - $template_body = EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', $template_args, TRUE, TRUE ); |
|
168 | - }else{ |
|
169 | - $template_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', $template_args, TRUE, TRUE ); |
|
165 | + $template_header = EEH_Template::locate_template($templates_relative_path.'invoice_header.template.php', $template_args, TRUE, TRUE); |
|
166 | + if (isset($_GET['receipt'])) { |
|
167 | + $template_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', $template_args, TRUE, TRUE); |
|
168 | + } else { |
|
169 | + $template_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', $template_args, TRUE, TRUE); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
173 | - $template_footer = EEH_Template::locate_template( $templates_relative_path . 'invoice_footer.template.php', $template_args, TRUE, TRUE ); |
|
173 | + $template_footer = EEH_Template::locate_template($templates_relative_path.'invoice_footer.template.php', $template_args, TRUE, TRUE); |
|
174 | 174 | |
175 | - $copies = ! empty( $_REQUEST['copies'] ) ? $_REQUEST['copies'] : 1; |
|
175 | + $copies = ! empty($_REQUEST['copies']) ? $_REQUEST['copies'] : 1; |
|
176 | 176 | |
177 | 177 | $content = $this->espresso_replace_invoice_shortcodes($template_header); |
178 | - for( $x = 1; $x <= $copies; $x++ ) { |
|
178 | + for ($x = 1; $x <= $copies; $x++) { |
|
179 | 179 | $content .= $this->espresso_replace_invoice_shortcodes($template_body); |
180 | 180 | } |
181 | 181 | $content .= $this->espresso_replace_invoice_shortcodes($template_footer); |
182 | 182 | |
183 | 183 | //Check if debugging or mobile is set |
184 | - if (!empty($_REQUEST['html'])) { |
|
184 | + if ( ! empty($_REQUEST['html'])) { |
|
185 | 185 | echo $content; |
186 | 186 | exit(0); |
187 | 187 | } |
188 | - $invoice_name = $template_args['organization'] . ' ' . __('Invoice #', 'event_espresso') . $template_args['registration_code'] . __(' for ', 'event_espresso') . $template_args['name']; |
|
189 | - $invoice_name = str_replace( ' ', '_', $invoice_name ); |
|
188 | + $invoice_name = $template_args['organization'].' '.__('Invoice #', 'event_espresso').$template_args['registration_code'].__(' for ', 'event_espresso').$template_args['name']; |
|
189 | + $invoice_name = str_replace(' ', '_', $invoice_name); |
|
190 | 190 | //Create the PDF |
191 | - if(array_key_exists('html',$_GET)){ |
|
191 | + if (array_key_exists('html', $_GET)) { |
|
192 | 192 | echo $content; |
193 | - }else{ |
|
193 | + } else { |
|
194 | 194 | //only load dompdf if nobody else has yet... |
195 | - if( ! defined('DOMPDF_DIR')){ |
|
195 | + if ( ! defined('DOMPDF_DIR')) { |
|
196 | 196 | define('DOMPDF_ENABLE_REMOTE', TRUE); |
197 | 197 | define('DOMPDF_ENABLE_JAVASCRIPT', FALSE); |
198 | 198 | define('DOMPDF_ENABLE_CSS_FLOAT', TRUE); |
199 | - require_once(EE_THIRD_PARTY . 'dompdf/dompdf_config.inc.php'); |
|
199 | + require_once(EE_THIRD_PARTY.'dompdf/dompdf_config.inc.php'); |
|
200 | 200 | } |
201 | 201 | $dompdf = new DOMPDF(); |
202 | 202 | $dompdf->load_html($content); |
203 | 203 | $dompdf->render(); |
204 | - $dompdf->stream($invoice_name . ".pdf", array( 'Attachment' => $download )); |
|
204 | + $dompdf->stream($invoice_name.".pdf", array('Attachment' => $download)); |
|
205 | 205 | } |
206 | 206 | exit(0); |
207 | 207 | } |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | * @param EE_Line_Item $line_item |
212 | 212 | * @return boolean |
213 | 213 | */ |
214 | - function check_if_any_line_items_have_a_description(EE_Line_Item $line_item){ |
|
215 | - if($line_item->desc()){ |
|
214 | + function check_if_any_line_items_have_a_description(EE_Line_Item $line_item) { |
|
215 | + if ($line_item->desc()) { |
|
216 | 216 | return true; |
217 | - }else{ |
|
218 | - foreach($line_item->children() as $child_line_item){ |
|
219 | - if($this->check_if_any_line_items_have_a_description($child_line_item)){ |
|
217 | + } else { |
|
218 | + foreach ($line_item->children() as $child_line_item) { |
|
219 | + if ($this->check_if_any_line_items_have_a_description($child_line_item)) { |
|
220 | 220 | return true; |
221 | 221 | } |
222 | 222 | } |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | //Perform the shortcode replacement |
229 | - function espresso_replace_invoice_shortcodes( $content ) { |
|
229 | + function espresso_replace_invoice_shortcodes($content) { |
|
230 | 230 | |
231 | 231 | $EE = EE_Registry::instance(); |
232 | 232 | //Create the logo |
233 | - $invoice_logo_url = $this->invoice_payment_method->get_extra_meta('pdf_logo_image', TRUE, $EE->CFG->organization->logo_url ); |
|
234 | - if (!empty($invoice_logo_url)) { |
|
233 | + $invoice_logo_url = $this->invoice_payment_method->get_extra_meta('pdf_logo_image', TRUE, $EE->CFG->organization->logo_url); |
|
234 | + if ( ! empty($invoice_logo_url)) { |
|
235 | 235 | $image_size = getimagesize($invoice_logo_url); |
236 | - $invoice_logo_image = '<img class="logo screen" src="' . $invoice_logo_url . '" ' . $image_size[3] . ' alt="logo" /> '; |
|
236 | + $invoice_logo_image = '<img class="logo screen" src="'.$invoice_logo_url.'" '.$image_size[3].' alt="logo" /> '; |
|
237 | 237 | } else { |
238 | 238 | $invoice_logo_image = ''; |
239 | 239 | } |
@@ -255,28 +255,28 @@ discard block |
||
255 | 255 | "[instructions]", |
256 | 256 | ); |
257 | 257 | $primary_attendee = $this->transaction->primary_registration()->attendee(); |
258 | - $org_state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID ); |
|
259 | - if($org_state){ |
|
258 | + $org_state = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID); |
|
259 | + if ($org_state) { |
|
260 | 260 | $org_state_name = $org_state->name(); |
261 | - }else{ |
|
261 | + } else { |
|
262 | 262 | $org_state_name = ''; |
263 | 263 | } |
264 | 264 | $ReplaceValues = array( |
265 | - $EE->CFG->organization->get_pretty( 'name' ), |
|
265 | + $EE->CFG->organization->get_pretty('name'), |
|
266 | 266 | $this->registration->reg_code(), |
267 | 267 | $this->transaction->ID(), |
268 | 268 | $primary_attendee->full_name(), |
269 | - (is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) ? EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/' : EE_GATEWAYS_URL . 'Invoice/lib/templates/', |
|
270 | - $this->registration->invoice_url(),//home_url() . '/?download_invoice=true&id=' . $this->registration->reg_url_link(), |
|
269 | + (is_dir(EVENT_ESPRESSO_GATEWAY_DIR.'/invoice')) ? EVENT_ESPRESSO_GATEWAY_URL.'Invoice/lib/templates/' : EE_GATEWAYS_URL.'Invoice/lib/templates/', |
|
270 | + $this->registration->invoice_url(), //home_url() . '/?download_invoice=true&id=' . $this->registration->reg_url_link(), |
|
271 | 271 | $invoice_logo_image, |
272 | - empty( $EE->CFG->organization->address_2 ) ? $EE->CFG->organization->get_pretty( 'address_1' ) : $EE->CFG->organization->get_pretty( 'address_1' ) . '<br>' . $EE->CFG->organization->get_pretty( 'address_2' ), |
|
273 | - $EE->CFG->organization->get_pretty( 'city' ), |
|
272 | + empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1').'<br>'.$EE->CFG->organization->get_pretty('address_2'), |
|
273 | + $EE->CFG->organization->get_pretty('city'), |
|
274 | 274 | $org_state_name, |
275 | - $EE->CFG->organization->get_pretty( 'zip' ), |
|
276 | - $EE->CFG->organization->get_pretty( 'email' ), |
|
275 | + $EE->CFG->organization->get_pretty('zip'), |
|
276 | + $EE->CFG->organization->get_pretty('email'), |
|
277 | 277 | $EE->CFG->organization->vat, |
278 | - $this->registration->get_i18n_datetime( 'REG_date', get_option( 'date_format' ) ), |
|
279 | - $this->invoice_payment_method->get_extra_meta( 'pdf_instructions', TRUE ), |
|
278 | + $this->registration->get_i18n_datetime('REG_date', get_option('date_format')), |
|
279 | + $this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE), |
|
280 | 280 | ); |
281 | 281 | |
282 | 282 | return str_replace($SearchValues, $ReplaceValues, $content); |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | if ($total_cost < 0) { |
300 | 300 | $total_cost = (-1) * $total_cost; |
301 | 301 | } |
302 | - $find = array( ' ' ); |
|
303 | - $replace = array( '-' ); |
|
304 | - $row_id = strtolower( str_replace( $find, $replace, $text )); |
|
302 | + $find = array(' '); |
|
303 | + $replace = array('-'); |
|
304 | + $row_id = strtolower(str_replace($find, $replace, $text)); |
|
305 | 305 | $html .= '<tr id="'.$row_id.'-tr"><td colspan="4"> </td>'; |
306 | - $html .= '<td class="item_r">' . $text . '</td>'; |
|
307 | - $html .= '<td class="item_r">' . $total_cost . '</td>'; |
|
306 | + $html .= '<td class="item_r">'.$text.'</td>'; |
|
307 | + $html .= '<td class="item_r">'.$total_cost.'</td>'; |
|
308 | 308 | $html .= '</tr>'; |
309 | 309 | return $html; |
310 | 310 | } |
@@ -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='http://eventespresso.com'>","</a>"); |
|
285 | + printf(__("Powered by %sEvent Espresso %s", "event_espresso"), "<a href='http://eventespresso.com'>", "</a>"); |
|
286 | 286 | ?></div> |
287 | 287 | <?php } ?> |
288 | 288 | </div> |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return EED_Ical |
33 | 33 | */ |
34 | 34 | public static function instance() { |
35 | - return parent::get_instance( __CLASS__ ); |
|
35 | + return parent::get_instance(__CLASS__); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function set_hooks() { |
47 | 47 | // create download buttons |
48 | - add_filter( 'FHEE__espresso_list_of_event_dates__datetime_html', array( 'EED_Ical', 'generate_add_to_iCal_button' ), 10, 2 ); |
|
48 | + add_filter('FHEE__espresso_list_of_event_dates__datetime_html', array('EED_Ical', 'generate_add_to_iCal_button'), 10, 2); |
|
49 | 49 | // process ics download request |
50 | - EE_Config::register_route( 'download_ics_file', 'EED_Ical', 'download_ics_file' ); |
|
50 | + EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param WP $WP |
71 | 71 | * @return void |
72 | 72 | */ |
73 | - public function run( $WP ) {} |
|
73 | + public function run($WP) {} |
|
74 | 74 | |
75 | 75 | |
76 | 76 | |
@@ -82,30 +82,30 @@ discard block |
||
82 | 82 | * @param $datetime |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - public static function generate_add_to_iCal_button( $html, $datetime ) { |
|
85 | + public static function generate_add_to_iCal_button($html, $datetime) { |
|
86 | 86 | // first verify a proper datetime object has been received |
87 | - if ( $datetime instanceof EE_Datetime ) { |
|
87 | + if ($datetime instanceof EE_Datetime) { |
|
88 | 88 | // set whether a link or submit button is shown |
89 | - $iCal_type = apply_filters( 'FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit' ); |
|
89 | + $iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit'); |
|
90 | 90 | // generate a link to the route we registered in set_hooks() |
91 | - $URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $datetime->ID() ), site_url() ); |
|
91 | + $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url()); |
|
92 | 92 | // what type ? |
93 | - switch ( $iCal_type ) { |
|
93 | + switch ($iCal_type) { |
|
94 | 94 | // submit buttons appear as buttons and are very compatible with a theme's style |
95 | 95 | case 'submit' : |
96 | - $html .= '<form id="download-iCal-frm-' . $datetime->ID() . '" class="download-iCal-frm" action="' . $URL . '" method="post" >'; |
|
97 | - $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '"/>'; |
|
96 | + $html .= '<form id="download-iCal-frm-'.$datetime->ID().'" class="download-iCal-frm" action="'.$URL.'" method="post" >'; |
|
97 | + $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="'.__('Add to iCal Calendar', 'event_espresso').'"/>'; |
|
98 | 98 | $html .= '</form>'; |
99 | 99 | break; |
100 | 100 | // buttons are just links that have been styled to appear as buttons, but may not be blend with a theme as well as submit buttons |
101 | 101 | case 'button' : |
102 | - $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">'; |
|
102 | + $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">'; |
|
103 | 103 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
104 | 104 | $html .= '</a>'; |
105 | 105 | break; |
106 | 106 | // links are just links that use the calendar dashicon |
107 | 107 | case 'icon' : |
108 | - $html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">'; |
|
108 | + $html .= '<a class="ee-ical-lnk" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">'; |
|
109 | 109 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
110 | 110 | $html .= '</a>'; |
111 | 111 | break; |
@@ -123,73 +123,73 @@ discard block |
||
123 | 123 | * @return void |
124 | 124 | */ |
125 | 125 | public static function download_ics_file() { |
126 | - if ( EE_Registry::instance()->REQ->is_set( 'ics_id' )) { |
|
127 | - $DTT_ID = absint( EE_Registry::instance()->REQ->get( 'ics_id' )); |
|
128 | - $datetime = EE_Registry::instance()->load_model( 'Datetime' )->get_one_by_ID( $DTT_ID ); |
|
129 | - if ( $datetime instanceof EE_Datetime ) { |
|
126 | + if (EE_Registry::instance()->REQ->is_set('ics_id')) { |
|
127 | + $DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id')); |
|
128 | + $datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID); |
|
129 | + if ($datetime instanceof EE_Datetime) { |
|
130 | 130 | // get related event, venues, and event categories |
131 | 131 | $event = $datetime->event(); |
132 | 132 | // get related category Term object and it's name |
133 | 133 | $category = $event->first_event_category(); |
134 | - if ( $category instanceof EE_Term ) { |
|
134 | + if ($category instanceof EE_Term) { |
|
135 | 135 | $category = $category->name(); |
136 | 136 | } |
137 | 137 | $location = ''; |
138 | 138 | // get first related venue and convert to CSV string |
139 | - $venue = $event->venues(array( 'limit'=>1 )); |
|
140 | - if ( is_array( $venue ) && ! empty( $venue )) { |
|
141 | - $venue = array_shift( $venue ); |
|
142 | - if ( $venue instanceof EE_Venue ) { |
|
143 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
144 | - $location = espresso_venue_raw_address( 'inline', $venue->ID(), FALSE ); |
|
139 | + $venue = $event->venues(array('limit'=>1)); |
|
140 | + if (is_array($venue) && ! empty($venue)) { |
|
141 | + $venue = array_shift($venue); |
|
142 | + if ($venue instanceof EE_Venue) { |
|
143 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
144 | + $location = espresso_venue_raw_address('inline', $venue->ID(), FALSE); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | // set variables, escape strings, convert timestamps to ics format, etc |
148 | - $filename = $event->slug() . '-' . $datetime->start_date( 'Y-m-d' ) . '.ics'; |
|
149 | - $organizer = EED_Ical::_escape_ICal_data( EE_Registry::instance()->CFG->organization->name ); |
|
150 | - $UID = EED_Ical::_escape_ICal_data( md5( $event->name() . $event->ID() . $datetime->ID() )); |
|
151 | - $org_email = EED_Ical::_escape_ICal_data( $datetime->ID() ); |
|
152 | - $timestamp = date( EED_Ical::iCal_datetime_format ); |
|
153 | - $location = EED_Ical::_escape_ICal_data( $location ); |
|
154 | - $summary = EED_Ical::_escape_ICal_data( $event->name() ); |
|
155 | - $description = EED_Ical::_escape_ICal_description( wp_strip_all_tags( $event->description() )); |
|
148 | + $filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics'; |
|
149 | + $organizer = EED_Ical::_escape_ICal_data(EE_Registry::instance()->CFG->organization->name); |
|
150 | + $UID = EED_Ical::_escape_ICal_data(md5($event->name().$event->ID().$datetime->ID())); |
|
151 | + $org_email = EED_Ical::_escape_ICal_data($datetime->ID()); |
|
152 | + $timestamp = date(EED_Ical::iCal_datetime_format); |
|
153 | + $location = EED_Ical::_escape_ICal_data($location); |
|
154 | + $summary = EED_Ical::_escape_ICal_data($event->name()); |
|
155 | + $description = EED_Ical::_escape_ICal_description(wp_strip_all_tags($event->description())); |
|
156 | 156 | $status = $datetime->get_active_status(); |
157 | 157 | $status = $status == EE_Datetime::cancelled ? 'Cancelled' : 'Confirmed'; |
158 | - $status = EED_Ical::_escape_ICal_data( $status ); |
|
159 | - $categories = EED_Ical::_escape_ICal_data( $category ); |
|
160 | - $url = EED_Ical::_escape_ICal_data( get_permalink( $event->ID() )); |
|
161 | - $dtt_start = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->start() )); |
|
162 | - $dtt_end = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->end() )); |
|
158 | + $status = EED_Ical::_escape_ICal_data($status); |
|
159 | + $categories = EED_Ical::_escape_ICal_data($category); |
|
160 | + $url = EED_Ical::_escape_ICal_data(get_permalink($event->ID())); |
|
161 | + $dtt_start = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->start())); |
|
162 | + $dtt_end = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->end())); |
|
163 | 163 | // set headers |
164 | - header( 'Content-type: text/calendar; charset=utf-8' ); |
|
165 | - header( 'Content-Disposition: attachment; filename="' . $filename . '"' ); |
|
166 | - header( 'Cache-Control: private, max-age=0, must-revalidate' ); |
|
167 | - header( 'Pragma: public' ); |
|
168 | - header( 'Content-Type: application/octet-stream' ); |
|
169 | - header( 'Content-Type: application/force-download' ); |
|
170 | - header( 'Cache-Control: no-cache, must-revalidate' ); |
|
171 | - header( 'Content-Transfer-Encoding: binary' ); |
|
172 | - header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); // past date |
|
173 | - ini_set( 'zlib.output_compression', '0' ); |
|
164 | + header('Content-type: text/calendar; charset=utf-8'); |
|
165 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
166 | + header('Cache-Control: private, max-age=0, must-revalidate'); |
|
167 | + header('Pragma: public'); |
|
168 | + header('Content-Type: application/octet-stream'); |
|
169 | + header('Content-Type: application/force-download'); |
|
170 | + header('Cache-Control: no-cache, must-revalidate'); |
|
171 | + header('Content-Transfer-Encoding: binary'); |
|
172 | + header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date |
|
173 | + ini_set('zlib.output_compression', '0'); |
|
174 | 174 | // echo the output |
175 | - echo "BEGIN:VCALENDAR" . PHP_EOL; |
|
176 | - echo "VERSION:2.0" . PHP_EOL; |
|
177 | - echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN" . PHP_EOL; |
|
178 | - echo "CALSCALE:GREGORIAN" . PHP_EOL; |
|
179 | - echo "BEGIN:VEVENT" . PHP_EOL; |
|
180 | - echo "UID:{$UID}" . PHP_EOL; |
|
181 | - echo "ORGANIZER:MAILTO:{$org_email}" . PHP_EOL; |
|
182 | - echo "DTSTAMP:{$timestamp}" . PHP_EOL; |
|
183 | - echo "LOCATION:{$location}" . PHP_EOL; |
|
184 | - echo "SUMMARY:{$summary}" . PHP_EOL; |
|
185 | - echo "DESCRIPTION:{$description}" . PHP_EOL; |
|
186 | - echo "STATUS:{$status}" . PHP_EOL; |
|
187 | - echo "CATEGORIES:{$categories}" . PHP_EOL; |
|
188 | - echo "URL;VALUE=URI:{$url}" . PHP_EOL; |
|
189 | - echo "DTSTART:{$dtt_start}" . PHP_EOL; |
|
190 | - echo "DTEND:{$dtt_end}" . PHP_EOL; |
|
191 | - echo "END:VEVENT" . PHP_EOL; |
|
192 | - echo "END:VCALENDAR" . PHP_EOL; |
|
175 | + echo "BEGIN:VCALENDAR".PHP_EOL; |
|
176 | + echo "VERSION:2.0".PHP_EOL; |
|
177 | + echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN".PHP_EOL; |
|
178 | + echo "CALSCALE:GREGORIAN".PHP_EOL; |
|
179 | + echo "BEGIN:VEVENT".PHP_EOL; |
|
180 | + echo "UID:{$UID}".PHP_EOL; |
|
181 | + echo "ORGANIZER:MAILTO:{$org_email}".PHP_EOL; |
|
182 | + echo "DTSTAMP:{$timestamp}".PHP_EOL; |
|
183 | + echo "LOCATION:{$location}".PHP_EOL; |
|
184 | + echo "SUMMARY:{$summary}".PHP_EOL; |
|
185 | + echo "DESCRIPTION:{$description}".PHP_EOL; |
|
186 | + echo "STATUS:{$status}".PHP_EOL; |
|
187 | + echo "CATEGORIES:{$categories}".PHP_EOL; |
|
188 | + echo "URL;VALUE=URI:{$url}".PHP_EOL; |
|
189 | + echo "DTSTART:{$dtt_start}".PHP_EOL; |
|
190 | + echo "DTEND:{$dtt_end}".PHP_EOL; |
|
191 | + echo "END:VEVENT".PHP_EOL; |
|
192 | + echo "END:VCALENDAR".PHP_EOL; |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | die(); |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | * @param string $string |
205 | 205 | * @return string |
206 | 206 | */ |
207 | - private static function _escape_ICal_data( $string = '' ) { |
|
208 | - return preg_replace( '/([\,;])/', '\\\$1', $string ); |
|
207 | + private static function _escape_ICal_data($string = '') { |
|
208 | + return preg_replace('/([\,;])/', '\\\$1', $string); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -215,13 +215,13 @@ discard block |
||
215 | 215 | * @param string $description |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - private static function _escape_ICal_description( $description = '' ) { |
|
218 | + private static function _escape_ICal_description($description = '') { |
|
219 | 219 | |
220 | 220 | //Escape spcial chars within the decription |
221 | - $description = EED_Ical::_escape_ICal_data( $description ); |
|
221 | + $description = EED_Ical::_escape_ICal_data($description); |
|
222 | 222 | |
223 | 223 | //Remove line breaks and output in iCal format |
224 | - $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
224 | + $description = str_replace(array("\r\n", "\n"), '\n', $description); |
|
225 | 225 | |
226 | 226 | return $description; |
227 | 227 | } |
@@ -220,8 +220,8 @@ |
||
220 | 220 | //Escape spcial chars within the decription |
221 | 221 | $description = EED_Ical::_escape_ICal_data( $description ); |
222 | 222 | |
223 | - //Remove line breaks and output in iCal format |
|
224 | - $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
223 | + //Remove line breaks and output in iCal format |
|
224 | + $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
225 | 225 | |
226 | 226 | return $description; |
227 | 227 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param EE_Checkout $checkout |
21 | 21 | * @return \EE_SPCO_Reg_Step_Finalize_Registration |
22 | 22 | */ |
23 | - public function __construct( EE_Checkout $checkout ) { |
|
23 | + public function __construct(EE_Checkout $checkout) { |
|
24 | 24 | $this->_slug = 'finalize_registration'; |
25 | 25 | $this->_name = __('Finalize Registration', 'event_espresso'); |
26 | 26 | $this->_submit_button_text = $this->_name; |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | public function initialize_reg_step() { |
48 | 48 | |
49 | 49 | // there's actually no reg form to process if this is the final step |
50 | - if ( $this->is_current_step() ) { |
|
50 | + if ($this->is_current_step()) { |
|
51 | 51 | $this->checkout->step = $_REQUEST['step'] = $this->slug(); |
52 | - $this->checkout->action = $_REQUEST[ 'action' ] = 'process_reg_step'; |
|
52 | + $this->checkout->action = $_REQUEST['action'] = 'process_reg_step'; |
|
53 | 53 | $this->checkout->generate_reg_form = false; |
54 | 54 | } |
55 | 55 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function process_reg_step() { |
74 | 74 | // ensure all data gets refreshed from the db |
75 | - $this->checkout->refresh_all_entities( true ); |
|
75 | + $this->checkout->refresh_all_entities(true); |
|
76 | 76 | // ensures that all details and statuses for transaction, registration, and payments are updated |
77 | 77 | $txn_update_params = $this->_finalize_transaction(); |
78 | 78 | // DEBUG LOG |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | // ) |
87 | 87 | //); |
88 | 88 | // set a hook point |
89 | - do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params ); |
|
89 | + do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params); |
|
90 | 90 | // check if transaction has a primary registrant and that it has a related Attendee object |
91 | - if ( $this->checkout->transaction_has_primary_registrant() ) { |
|
91 | + if ($this->checkout->transaction_has_primary_registrant()) { |
|
92 | 92 | // setup URL for redirect |
93 | 93 | $this->checkout->redirect_url = add_query_arg( |
94 | - array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ), |
|
94 | + array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()), |
|
95 | 95 | $this->checkout->thank_you_page_url |
96 | 96 | ); |
97 | 97 | } else { |
98 | - EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
98 | + EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
99 | 99 | $this->checkout->redirect = false; |
100 | 100 | $this->checkout->continue_reg = false; |
101 | 101 | return false; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | // you don't have to go home but you can't stay here ! |
104 | 104 | $this->checkout->redirect = true; |
105 | 105 | $this->checkout->continue_reg = true; |
106 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
107 | - if ( ! ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) ) { |
|
106 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
107 | + if ( ! ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site())) { |
|
108 | 108 | // mark this reg step as completed |
109 | 109 | $this->checkout->current_step->set_completed(); |
110 | 110 | } |
@@ -121,43 +121,43 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function _finalize_transaction() { |
123 | 123 | /** @type EE_Transaction_Processor $transaction_processor */ |
124 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
124 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
125 | 125 | //set revisit flag in txn processor |
126 | - $transaction_processor->set_revisit( $this->checkout->revisit ); |
|
126 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
127 | 127 | // at this point we'll consider a TXN to not have been abandoned |
128 | - $transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction ); |
|
129 | - if ( $this->checkout->cart instanceof EE_Cart ) { |
|
128 | + $transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction); |
|
129 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
130 | 130 | // save TXN data to the cart |
131 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
131 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
132 | 132 | } |
133 | 133 | /** @type EE_Transaction_Payments $transaction_payments */ |
134 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
134 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
135 | 135 | // maybe update status, but don't save transaction just yet |
136 | - $transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false ); |
|
136 | + $transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false); |
|
137 | 137 | // If the selected method of payment used an off-site gateway... |
138 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
139 | - $is_revisit = filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN ); |
|
140 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) { |
|
141 | - $gateway= $this->checkout->payment_method->type_obj()->get_gateway(); |
|
142 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
138 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
139 | + $is_revisit = filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN); |
|
140 | + if ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site()) { |
|
141 | + $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
142 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
143 | 143 | // do NOT trigger notifications because it was already done during the IPN |
144 | - remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' ); |
|
145 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
146 | - } else if ( ! $is_revisit ) { |
|
147 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
144 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
145 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
146 | + } else if ( ! $is_revisit) { |
|
147 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
148 | 148 | } |
149 | 149 | } else if ( |
150 | 150 | // if SPCO revisit and TXN status has changed due to a payment |
151 | - $is_revisit && ( $this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated() ) |
|
151 | + $is_revisit && ($this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated()) |
|
152 | 152 | ) { |
153 | 153 | // send out notifications |
154 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
155 | - } else if ( ! $is_revisit ) { |
|
156 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
154 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
155 | + } else if ( ! $is_revisit) { |
|
156 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | // this will result in the base session properties getting saved to the TXN_Session_data field |
160 | - $this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true )); |
|
160 | + $this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true)); |
|
161 | 161 | |
162 | 162 | // update the TXN if payment conditions have changed |
163 | 163 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @return boolean |
175 | 175 | */ |
176 | 176 | public function update_reg_step() { |
177 | - EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
|
177 | + EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | /** |
28 | 28 | * Applies all teh individual item validation strategies on each item in the array |
29 | 29 | * @param array $normalized_value |
30 | - * @return boolean |
|
30 | + * @return boolean|null |
|
31 | 31 | */ |
32 | 32 | function validate($normalized_value) { |
33 | 33 | if( is_array($normalized_value)){ |
@@ -116,7 +116,7 @@ |
||
116 | 116 | * @access public |
117 | 117 | * @param EE_Template_Config $CFG |
118 | 118 | * @param array $REQ |
119 | - * @return EE_Event_Single_Config |
|
119 | + * @return EE_Template_Config |
|
120 | 120 | */ |
121 | 121 | public static function update_template_settings( $CFG, $REQ ) { |
122 | 122 | $display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Event_Single_Caff |
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 | |
@@ -50,34 +50,34 @@ discard block |
||
50 | 50 | * @return void |
51 | 51 | */ |
52 | 52 | public static function set_hooks_admin() { |
53 | - define( 'EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
54 | - define( 'EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
53 | + define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
54 | + define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
55 | 55 | add_action( |
56 | 56 | 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__template_settings', |
57 | - array( 'EED_Event_Single_Caff', 'load_scripts_styles' ), |
|
57 | + array('EED_Event_Single_Caff', 'load_scripts_styles'), |
|
58 | 58 | 10 |
59 | 59 | ); |
60 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Event_Single_Caff', 'template_settings_form' ), 10 ); |
|
61 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Event_Single_Caff', 'update_template_settings' ), 10, 2 ); |
|
60 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Event_Single_Caff', 'template_settings_form'), 10); |
|
61 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Event_Single_Caff', 'update_template_settings'), 10, 2); |
|
62 | 62 | // AJAX |
63 | - add_action( 'wp_ajax_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) ); |
|
64 | - add_action( 'wp_ajax_nopriv_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) ); |
|
63 | + add_action('wp_ajax_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order')); |
|
64 | + add_action('wp_ajax_nopriv_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order')); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | 70 | public static function load_scripts_styles() { |
71 | - add_action( 'admin_enqueue_scripts', array( 'EED_Event_Single_Caff', 'enqueue_scripts_styles' ), 10 ); |
|
71 | + add_action('admin_enqueue_scripts', array('EED_Event_Single_Caff', 'enqueue_scripts_styles'), 10); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | |
76 | 76 | public static function enqueue_scripts_styles() { |
77 | - wp_register_style( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION ); |
|
78 | - wp_enqueue_style( 'eed-event-single-sortable' ); |
|
79 | - wp_register_script( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', array( 'jquery-ui-sortable' ), EVENT_ESPRESSO_VERSION, true ); |
|
80 | - wp_enqueue_script( 'eed-event-single-sortable' ); |
|
77 | + wp_register_style('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION); |
|
78 | + wp_enqueue_style('eed-event-single-sortable'); |
|
79 | + wp_register_script('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
80 | + wp_enqueue_script('eed-event-single-sortable'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -91,21 +91,21 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function template_settings_form() { |
93 | 93 | $config = EE_Registry::instance()->CFG->template_settings; |
94 | - $config = isset( $config->EED_Event_Single ) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
95 | - $config->use_sortable_display_order = isset( $config->use_sortable_display_order ) ? $config->use_sortable_display_order : false; |
|
96 | - $config = apply_filters( 'FHEE__EED_Event_Single__template_settings_form__event_list_config', $config ); |
|
94 | + $config = isset($config->EED_Event_Single) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
95 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false; |
|
96 | + $config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config); |
|
97 | 97 | |
98 | 98 | $event_single_order_array = array(); |
99 | - $event_single_order_array[ $config->display_order_tickets ] = 'tickets'; |
|
100 | - $event_single_order_array[ $config->display_order_datetimes ] = 'datetimes'; |
|
101 | - $event_single_order_array[ $config->display_order_event ] = 'event'; |
|
102 | - $event_single_order_array[ $config->display_order_venue ] = 'venue'; |
|
99 | + $event_single_order_array[$config->display_order_tickets] = 'tickets'; |
|
100 | + $event_single_order_array[$config->display_order_datetimes] = 'datetimes'; |
|
101 | + $event_single_order_array[$config->display_order_event] = 'event'; |
|
102 | + $event_single_order_array[$config->display_order_venue] = 'venue'; |
|
103 | 103 | // get template parts |
104 | - $template_parts = EED_Event_Single::instance()->initialize_template_parts( $config ); |
|
104 | + $template_parts = EED_Event_Single::instance()->initialize_template_parts($config); |
|
105 | 105 | // convert to array so that we can add more properties |
106 | - $config = get_object_vars( $config ); |
|
107 | - $config[ 'event_single_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-single-sortable-js', '', 'single-sortable-li single-sortable-js' ); |
|
108 | - EEH_Template::display_template( EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', $config ); |
|
106 | + $config = get_object_vars($config); |
|
107 | + $config['event_single_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-single-sortable-js', '', 'single-sortable-li single-sortable-js'); |
|
108 | + EEH_Template::display_template(EVENT_SINGLE_CAFF_TEMPLATES_PATH.'admin-event-single-settings.template.php', $config); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | * @param array $REQ |
119 | 119 | * @return EE_Event_Single_Config |
120 | 120 | */ |
121 | - public static function update_template_settings( $CFG, $REQ ) { |
|
122 | - $display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100; |
|
123 | - $display_order_datetimes = isset( $CFG->EED_Event_Single->display_order_datetimes ) ? $CFG->EED_Event_Single->display_order_datetimes : 110; |
|
124 | - $display_order_event = isset( $CFG->EED_Event_Single->display_order_event ) ? $CFG->EED_Event_Single->display_order_event : 120; |
|
125 | - $display_order_venue = isset( $CFG->EED_Event_Single->display_order_venue ) ? $CFG->EED_Event_Single->display_order_venue : 130; |
|
121 | + public static function update_template_settings($CFG, $REQ) { |
|
122 | + $display_order_tickets = isset($CFG->EED_Event_Single->display_order_tickets) ? $CFG->EED_Event_Single->display_order_tickets : 100; |
|
123 | + $display_order_datetimes = isset($CFG->EED_Event_Single->display_order_datetimes) ? $CFG->EED_Event_Single->display_order_datetimes : 110; |
|
124 | + $display_order_event = isset($CFG->EED_Event_Single->display_order_event) ? $CFG->EED_Event_Single->display_order_event : 120; |
|
125 | + $display_order_venue = isset($CFG->EED_Event_Single->display_order_venue) ? $CFG->EED_Event_Single->display_order_venue : 130; |
|
126 | 126 | $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
127 | - $CFG->EED_Event_Single->display_status_banner_single = !empty( $REQ['display_status_banner_single'] ) && $REQ['display_status_banner_single'] ? TRUE : FALSE; |
|
128 | - $CFG->EED_Event_Single->display_venue = ! empty( $REQ['display_venue'] ) && $REQ['display_venue'] ? TRUE : FALSE; |
|
129 | - $CFG->EED_Event_Single->use_sortable_display_order = ! empty( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) : 0; |
|
127 | + $CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single']) && $REQ['display_status_banner_single'] ? TRUE : FALSE; |
|
128 | + $CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue'] ? TRUE : FALSE; |
|
129 | + $CFG->EED_Event_Single->use_sortable_display_order = ! empty($REQ['EED_Events_Single_use_sortable_display_order']) ? absint($REQ['EED_Events_Single_use_sortable_display_order']) : 0; |
|
130 | 130 | $CFG->EED_Event_Single->display_order_tickets = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_tickets : 100; |
131 | 131 | $CFG->EED_Event_Single->display_order_datetimes = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_datetimes : 110; |
132 | 132 | $CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_event : 120; |
133 | 133 | $CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_venue : 130; |
134 | - do_action( 'AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ ); |
|
134 | + do_action('AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ); |
|
135 | 135 | return $CFG; |
136 | 136 | } |
137 | 137 | |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public static function update_event_single_order() { |
147 | 147 | $config_saved = false; |
148 | - $template_parts = sanitize_text_field( $_POST[ 'elements' ] ); |
|
149 | - if ( ! empty( $template_parts ) ) { |
|
150 | - $template_parts = explode( ',', trim( $template_parts, ',' ) ); |
|
151 | - foreach ( $template_parts as $key => $template_part ) { |
|
148 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
149 | + if ( ! empty($template_parts)) { |
|
150 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
151 | + foreach ($template_parts as $key => $template_part) { |
|
152 | 152 | $template_part = "display_order_$template_part"; |
153 | - $priority = ( $key * 10 ) + 100; |
|
153 | + $priority = ($key * 10) + 100; |
|
154 | 154 | EE_Registry::instance()->CFG->template_settings->EED_Event_Single->$template_part = $priority; |
155 | - do_action( "AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority ); |
|
155 | + do_action("AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority); |
|
156 | 156 | } |
157 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false ); |
|
157 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
158 | 158 | } |
159 | - if ( $config_saved ) { |
|
160 | - EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) ); |
|
159 | + if ($config_saved) { |
|
160 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
161 | 161 | } else { |
162 | - EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
162 | + EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
163 | 163 | } |
164 | - echo wp_json_encode( EE_Error::get_notices( false )); |
|
164 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
165 | 165 | exit(); |
166 | 166 | } |
167 | 167 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param WP $WP |
175 | 175 | * @return void |
176 | 176 | */ |
177 | - public function run( $WP ) { |
|
177 | + public function run($WP) { |
|
178 | 178 | } |
179 | 179 | |
180 | 180 |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * EED_Event_Single_Caff |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /modules/event_single_caff/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * EED_Event_Single_Caff |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /modules/event_single_caff/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class EED_Event_Single_Caff extends EED_Event_Single { |
25 | 25 | |
26 | 26 |
@@ -123,7 +123,7 @@ |
||
123 | 123 | * @access public |
124 | 124 | * @param EE_Template_Config $CFG |
125 | 125 | * @param array $REQ |
126 | - * @return EE_Events_Archive_Config |
|
126 | + * @return EE_Template_Config |
|
127 | 127 | */ |
128 | 128 | public static function update_template_settings( $CFG, $REQ ) { |
129 | 129 | $config = new EE_Events_Archive_Config(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return EED_Events_Archive_Caff |
29 | 29 | */ |
30 | 30 | public static function instance() { |
31 | - return parent::get_instance( __CLASS__ ); |
|
31 | + return parent::get_instance(__CLASS__); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_hooks_admin() { |
52 | - define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
53 | - define( 'EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
54 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 ); |
|
55 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 ); |
|
52 | + define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
53 | + define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
54 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10); |
|
55 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2); |
|
56 | 56 | // AJAX |
57 | - add_action( 'wp_ajax_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
58 | - add_action( 'wp_ajax_nopriv_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
57 | + add_action('wp_ajax_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
58 | + add_action('wp_ajax_nopriv_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param WP $WP |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function run( $WP ) { |
|
71 | + public function run($WP) { |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -83,33 +83,33 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function template_settings_form() { |
85 | 85 | // grab general settings admin page and remove the existing hook callback |
86 | - $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' ); |
|
87 | - if ( $gen_set_admin instanceof General_Settings_Admin_Page ) { |
|
88 | - remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 ); |
|
86 | + $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings'); |
|
87 | + if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
88 | + remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100); |
|
89 | 89 | } |
90 | 90 | // first just grab the template settings |
91 | 91 | $config = EE_Registry::instance()->CFG->template_settings; |
92 | 92 | // then if the Event Archive config is valid, use that, else create a new one |
93 | - $config = isset( $config->EED_Events_Archive ) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
94 | - $config = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config ); |
|
95 | - $config->display_status_banner = isset( $config->display_status_banner ) ? $config->display_status_banner : 0; |
|
96 | - $config->display_description = isset( $config->display_description ) ? $config->display_description : 1; |
|
97 | - $config->display_ticket_selector = isset( $config->display_ticket_selector ) ? $config->display_ticket_selector : 0; |
|
98 | - $config->display_datetimes = isset( $config->display_datetimes ) ? $config->display_datetimes : 1; |
|
99 | - $config->display_venue = isset( $config->display_venue ) ? $config->display_venue : 0; |
|
100 | - $config->display_expired_events = isset( $config->display_expired_events ) ? $config->display_expired_events : 0; |
|
93 | + $config = isset($config->EED_Events_Archive) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
94 | + $config = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config); |
|
95 | + $config->display_status_banner = isset($config->display_status_banner) ? $config->display_status_banner : 0; |
|
96 | + $config->display_description = isset($config->display_description) ? $config->display_description : 1; |
|
97 | + $config->display_ticket_selector = isset($config->display_ticket_selector) ? $config->display_ticket_selector : 0; |
|
98 | + $config->display_datetimes = isset($config->display_datetimes) ? $config->display_datetimes : 1; |
|
99 | + $config->display_venue = isset($config->display_venue) ? $config->display_venue : 0; |
|
100 | + $config->display_expired_events = isset($config->display_expired_events) ? $config->display_expired_events : 0; |
|
101 | 101 | // display order options |
102 | - $config->use_sortable_display_order = isset( $config->use_sortable_display_order )? $config->use_sortable_display_order : false; |
|
103 | - $config->display_order_tickets = isset( $config->display_order_tickets )? $config->display_order_tickets : 100; |
|
104 | - $config->display_order_datetimes = isset( $config->display_order_datetimes )? $config->display_order_datetimes : 110; |
|
105 | - $config->display_order_event = isset( $config->display_order_event )? $config->display_order_event : 120; |
|
106 | - $config->display_order_venue = isset( $config->display_order_venue )? $config->display_order_venue : 130; |
|
102 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false; |
|
103 | + $config->display_order_tickets = isset($config->display_order_tickets) ? $config->display_order_tickets : 100; |
|
104 | + $config->display_order_datetimes = isset($config->display_order_datetimes) ? $config->display_order_datetimes : 110; |
|
105 | + $config->display_order_event = isset($config->display_order_event) ? $config->display_order_event : 120; |
|
106 | + $config->display_order_venue = isset($config->display_order_venue) ? $config->display_order_venue : 130; |
|
107 | 107 | // get template parts |
108 | - $template_parts = EED_Events_Archive::instance()->initialize_template_parts( $config ); |
|
108 | + $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config); |
|
109 | 109 | // convert to array so that we can add more properties |
110 | - $config = get_object_vars( $config ); |
|
111 | - $config[ 'event_archive_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js' ); |
|
112 | - EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $config ); |
|
110 | + $config = get_object_vars($config); |
|
111 | + $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js'); |
|
112 | + EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $config); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -125,24 +125,24 @@ discard block |
||
125 | 125 | * @param array $REQ |
126 | 126 | * @return EE_Events_Archive_Config |
127 | 127 | */ |
128 | - public static function update_template_settings( $CFG, $REQ ) { |
|
128 | + public static function update_template_settings($CFG, $REQ) { |
|
129 | 129 | $config = new EE_Events_Archive_Config(); |
130 | 130 | // unless we are resetting the config... |
131 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
132 | - $config->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
133 | - $config->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
134 | - $config->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
135 | - $config->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
136 | - $config->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
137 | - $config->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; |
|
138 | - $config->use_sortable_display_order = isset( $REQ['EED_Events_Archive_use_sortable_display_order'] ) ? absint( $REQ['EED_Events_Archive_use_sortable_display_order'] ) : 0; |
|
139 | - $config->display_order_tickets = isset( $CFG->EED_Events_Archive->display_order_tickets ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100; |
|
140 | - $config->display_order_datetimes = isset( $CFG->EED_Events_Archive->display_order_datetimes ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110; |
|
141 | - $config->display_order_event = isset( $CFG->EED_Events_Archive->display_order_event ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120; |
|
142 | - $config->display_order_venue = isset( $CFG->EED_Events_Archive->display_order_venue ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130; |
|
131 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
132 | + $config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
133 | + $config->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
134 | + $config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
135 | + $config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
136 | + $config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
137 | + $config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; |
|
138 | + $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) : 0; |
|
139 | + $config->display_order_tickets = isset($CFG->EED_Events_Archive->display_order_tickets) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100; |
|
140 | + $config->display_order_datetimes = isset($CFG->EED_Events_Archive->display_order_datetimes) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110; |
|
141 | + $config->display_order_event = isset($CFG->EED_Events_Archive->display_order_event) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120; |
|
142 | + $config->display_order_venue = isset($CFG->EED_Events_Archive->display_order_venue) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130; |
|
143 | 143 | } |
144 | 144 | $CFG->EED_Events_Archive = $config; |
145 | - do_action( 'AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ ); |
|
145 | + do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ); |
|
146 | 146 | return $CFG; |
147 | 147 | } |
148 | 148 | |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function update_event_archive_order() { |
158 | 158 | $config_saved = false; |
159 | - $template_parts = sanitize_text_field( $_POST[ 'elements' ] ); |
|
160 | - if ( ! empty( $template_parts ) ) { |
|
161 | - $template_parts = explode( ',', trim( $template_parts, ',' ) ); |
|
162 | - foreach ( $template_parts as $key => $template_part ) { |
|
159 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
160 | + if ( ! empty($template_parts)) { |
|
161 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
162 | + foreach ($template_parts as $key => $template_part) { |
|
163 | 163 | $template_part = "display_order_$template_part"; |
164 | - $priority = ( $key * 10 ) + 100; |
|
164 | + $priority = ($key * 10) + 100; |
|
165 | 165 | if ( |
166 | 166 | property_exists( |
167 | 167 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive, |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | ) { |
171 | 171 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->$template_part = $priority; |
172 | 172 | } |
173 | - do_action( "AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority ); |
|
173 | + do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority); |
|
174 | 174 | } |
175 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false ); |
|
175 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
176 | 176 | } |
177 | - if ( $config_saved ) { |
|
178 | - EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) ); |
|
177 | + if ($config_saved) { |
|
178 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
179 | 179 | } else { |
180 | - EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
180 | + EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
181 | 181 | } |
182 | - echo wp_json_encode( EE_Error::get_notices( false ) ); |
|
182 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
183 | 183 | exit(); |
184 | 184 | } |
185 | 185 |
@@ -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,14 +356,14 @@ 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() ) { |
|
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 | 362 | // advance to the next step |
363 | - $this->set_current_step( $this->next_step->slug() ); |
|
364 | - $step_to_skip->set_is_current_step( false ); |
|
363 | + $this->set_current_step($this->next_step->slug()); |
|
364 | + $step_to_skip->set_is_current_step(false); |
|
365 | 365 | $step_to_skip->set_completed(); |
366 | - $this->set_reg_step_initiated( $this->current_step ); |
|
366 | + $this->set_reg_step_initiated($this->current_step); |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
@@ -377,16 +377,16 @@ discard block |
||
377 | 377 | * @param bool $reset whether to reset reg steps after removal |
378 | 378 | * @throws EE_Error |
379 | 379 | */ |
380 | - public function remove_reg_step( $reg_step_slug = '', $reset = true ) { |
|
381 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
382 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
380 | + public function remove_reg_step($reg_step_slug = '', $reset = true) { |
|
381 | + unset($this->reg_steps[$reg_step_slug]); |
|
382 | + if ($this->transaction instanceof EE_Transaction) { |
|
383 | 383 | /** @type EE_Transaction_Processor $transaction_processor */ |
384 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
384 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
385 | 385 | // now remove reg step from TXN and save |
386 | - $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
|
386 | + $transaction_processor->remove_reg_step($this->transaction, $reg_step_slug); |
|
387 | 387 | $this->transaction->save(); |
388 | 388 | } |
389 | - if ( $reset ) { |
|
389 | + if ($reset) { |
|
390 | 390 | $this->reset_reg_steps(); |
391 | 391 | } |
392 | 392 | } |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | * @param int $order |
402 | 402 | * @return void |
403 | 403 | */ |
404 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
405 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
406 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
404 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
405 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
406 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | |
@@ -416,25 +416,25 @@ discard block |
||
416 | 416 | * @param string $current_step |
417 | 417 | * @return void |
418 | 418 | */ |
419 | - public function set_current_step( $current_step ) { |
|
419 | + public function set_current_step($current_step) { |
|
420 | 420 | // grab what step we're on |
421 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
421 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
422 | 422 | // verify instance |
423 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
423 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
424 | 424 | // we don't want to repeat completed steps if this is the first time through SPCO |
425 | - if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) { |
|
425 | + if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) { |
|
426 | 426 | // so advance to the next step |
427 | 427 | $this->set_next_step(); |
428 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
428 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
429 | 429 | // and attempt to set it as the current step |
430 | - $this->set_current_step( $this->next_step->slug() ); |
|
430 | + $this->set_current_step($this->next_step->slug()); |
|
431 | 431 | } |
432 | 432 | return; |
433 | 433 | } |
434 | - $this->current_step->set_is_current_step( TRUE ); |
|
434 | + $this->current_step->set_is_current_step(TRUE); |
|
435 | 435 | } else { |
436 | 436 | EE_Error::add_error( |
437 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
437 | + __('The current step could not be set.', 'event_espresso'), |
|
438 | 438 | __FILE__, __FUNCTION__, __LINE__ |
439 | 439 | ); |
440 | 440 | } |
@@ -451,20 +451,20 @@ discard block |
||
451 | 451 | */ |
452 | 452 | public function set_next_step() { |
453 | 453 | // set pointer to start of array |
454 | - reset( $this->reg_steps ); |
|
454 | + reset($this->reg_steps); |
|
455 | 455 | // if there is more than one step |
456 | - if ( count( $this->reg_steps ) > 1 ) { |
|
456 | + if (count($this->reg_steps) > 1) { |
|
457 | 457 | // advance to the current step and set pointer |
458 | - while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) { |
|
459 | - next( $this->reg_steps ); |
|
458 | + while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') { |
|
459 | + next($this->reg_steps); |
|
460 | 460 | } |
461 | 461 | } |
462 | 462 | // advance one more spot ( if it exists ) |
463 | - $this->next_step = next( $this->reg_steps ); |
|
463 | + $this->next_step = next($this->reg_steps); |
|
464 | 464 | // verify instance |
465 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
465 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
466 | 466 | // then back to current step to reset |
467 | - prev( $this->reg_steps ); |
|
467 | + prev($this->reg_steps); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | * @return EE_SPCO_Reg_Step | null |
479 | 479 | */ |
480 | 480 | public function get_next_reg_step() { |
481 | - $next = next( $this->reg_steps ); |
|
482 | - prev( $this->reg_steps ); |
|
481 | + $next = next($this->reg_steps); |
|
482 | + prev($this->reg_steps); |
|
483 | 483 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
484 | 484 | } |
485 | 485 | |
@@ -494,8 +494,8 @@ discard block |
||
494 | 494 | * @return EE_SPCO_Reg_Step | null |
495 | 495 | */ |
496 | 496 | public function get_prev_reg_step() { |
497 | - $prev = prev( $this->reg_steps ); |
|
498 | - next( $this->reg_steps ); |
|
497 | + $prev = prev($this->reg_steps); |
|
498 | + next($this->reg_steps); |
|
499 | 499 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
500 | 500 | } |
501 | 501 | |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | * @return void |
509 | 509 | */ |
510 | 510 | public function sort_reg_steps() { |
511 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
512 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
511 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
512 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | |
@@ -522,19 +522,19 @@ discard block |
||
522 | 522 | * @param string $reg_step_slug |
523 | 523 | * @return EE_SPCO_Reg_Step|null |
524 | 524 | */ |
525 | - public function find_reg_step( $reg_step_slug = '' ) { |
|
526 | - if ( ! empty( $reg_step_slug ) ) { |
|
525 | + public function find_reg_step($reg_step_slug = '') { |
|
526 | + if ( ! empty($reg_step_slug)) { |
|
527 | 527 | // copy reg step array |
528 | 528 | $reg_steps = $this->reg_steps; |
529 | 529 | // set pointer to start of array |
530 | - reset( $reg_steps ); |
|
530 | + reset($reg_steps); |
|
531 | 531 | // if there is more than one step |
532 | - if ( count( $reg_steps ) > 1 ) { |
|
532 | + if (count($reg_steps) > 1) { |
|
533 | 533 | // advance to the current step and set pointer |
534 | - while ( key( $reg_steps ) != $reg_step_slug && key( $reg_steps ) != '' ) { |
|
535 | - next( $reg_steps ); |
|
534 | + while (key($reg_steps) != $reg_step_slug && key($reg_steps) != '') { |
|
535 | + next($reg_steps); |
|
536 | 536 | } |
537 | - return current( $reg_steps ); |
|
537 | + return current($reg_steps); |
|
538 | 538 | } |
539 | 539 | } |
540 | 540 | return null; |
@@ -550,17 +550,17 @@ discard block |
||
550 | 550 | * @param EE_SPCO_Reg_Step $reg_step_B |
551 | 551 | * @return array() |
552 | 552 | */ |
553 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
553 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
554 | 554 | // send finalize_registration step to the end of the array |
555 | - if ( $reg_step_A->slug() == 'finalize_registration' ) { |
|
555 | + if ($reg_step_A->slug() == 'finalize_registration') { |
|
556 | 556 | return 1; |
557 | - } else if ( $reg_step_B->slug() == 'finalize_registration' ) { |
|
557 | + } else if ($reg_step_B->slug() == 'finalize_registration') { |
|
558 | 558 | return -1; |
559 | 559 | } |
560 | - if ( $reg_step_A->order() == $reg_step_B->order() ) { |
|
560 | + if ($reg_step_A->order() == $reg_step_B->order()) { |
|
561 | 561 | return 0; |
562 | 562 | } |
563 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
563 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | * @access public |
572 | 572 | * @param EE_SPCO_Reg_Step $reg_step |
573 | 573 | */ |
574 | - public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) { |
|
574 | + public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) { |
|
575 | 575 | // call set_reg_step_initiated ??? |
576 | 576 | if ( |
577 | 577 | // first time visiting SPCO ? |
@@ -580,13 +580,13 @@ discard block |
||
580 | 580 | && $this->action === 'display_spco_reg_step' |
581 | 581 | ) { |
582 | 582 | /** @type EE_Transaction_Processor $transaction_processor */ |
583 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
583 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
584 | 584 | // set the start time for this reg step |
585 | - if ( ! $transaction_processor->set_reg_step_initiated( $this->transaction, $reg_step->slug() ) ) { |
|
586 | - if ( WP_DEBUG ) { |
|
585 | + if ( ! $transaction_processor->set_reg_step_initiated($this->transaction, $reg_step->slug())) { |
|
586 | + if (WP_DEBUG) { |
|
587 | 587 | EE_Error::add_error( |
588 | 588 | sprintf( |
589 | - __( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), |
|
589 | + __('The "%1$s" registration step was not initialized properly.', 'event_espresso'), |
|
590 | 590 | $reg_step->name() |
591 | 591 | ), |
592 | 592 | __FILE__, __FUNCTION__, __LINE__ |
@@ -605,10 +605,10 @@ discard block |
||
605 | 605 | * @return void |
606 | 606 | */ |
607 | 607 | public function set_reg_step_JSON_info() { |
608 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
608 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
609 | 609 | // pass basic reg step data to JS |
610 | - foreach ( $this->reg_steps as $reg_step ) { |
|
611 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
610 | + foreach ($this->reg_steps as $reg_step) { |
|
611 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
612 | 612 | } |
613 | 613 | // reset reg step html |
614 | 614 | // $this->json_response->set_reg_step_html( '' ); |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | */ |
625 | 625 | public function reset_reg_steps() { |
626 | 626 | $this->sort_reg_steps(); |
627 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
627 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
628 | 628 | $this->set_next_step(); |
629 | 629 | // the text that appears on the reg step form submit button |
630 | 630 | $this->current_step->set_submit_button_text(); |
@@ -641,9 +641,9 @@ discard block |
||
641 | 641 | */ |
642 | 642 | public function get_registration_time_limit() { |
643 | 643 | |
644 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
644 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
645 | 645 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
646 | - $registration_time_limit = gmdate( $time_limit_format, $registration_time_limit ); |
|
646 | + $registration_time_limit = gmdate($time_limit_format, $registration_time_limit); |
|
647 | 647 | return apply_filters( |
648 | 648 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
649 | 649 | $registration_time_limit |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | // overpaid TXN |
664 | 664 | // free TXN ( total = 0.00 ) |
665 | 665 | // then payment required is TRUE |
666 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
666 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | |
@@ -676,8 +676,8 @@ discard block |
||
676 | 676 | */ |
677 | 677 | public function initialize_txn_reg_steps_array() { |
678 | 678 | $txn_reg_steps_array = array(); |
679 | - foreach ( $this->reg_steps as $reg_step ) { |
|
680 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
679 | + foreach ($this->reg_steps as $reg_step) { |
|
680 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
681 | 681 | } |
682 | 682 | return $txn_reg_steps_array; |
683 | 683 | } |
@@ -693,13 +693,13 @@ discard block |
||
693 | 693 | public function update_txn_reg_steps_array() { |
694 | 694 | $updated = FALSE; |
695 | 695 | /** @type EE_Transaction_Processor $transaction_processor */ |
696 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
697 | - foreach ( $this->reg_steps as $reg_step ) { |
|
698 | - if ( $reg_step->completed() ) { |
|
699 | - $updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated; |
|
696 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
697 | + foreach ($this->reg_steps as $reg_step) { |
|
698 | + if ($reg_step->completed()) { |
|
699 | + $updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated; |
|
700 | 700 | } |
701 | 701 | } |
702 | - if ( $updated ) { |
|
702 | + if ($updated) { |
|
703 | 703 | $this->transaction->save(); |
704 | 704 | } |
705 | 705 | return $updated; |
@@ -714,14 +714,14 @@ discard block |
||
714 | 714 | * @return void |
715 | 715 | */ |
716 | 716 | public function stash_transaction_and_checkout() { |
717 | - if ( ! $this->revisit ) { |
|
717 | + if ( ! $this->revisit) { |
|
718 | 718 | $this->update_txn_reg_steps_array(); |
719 | 719 | } |
720 | 720 | $this->track_transaction_and_registration_status_updates(); |
721 | 721 | // save all data to the db, but suppress errors |
722 | 722 | //$this->save_all_data( FALSE ); |
723 | 723 | // cache the checkout in the session |
724 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
724 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | |
@@ -737,21 +737,21 @@ discard block |
||
737 | 737 | */ |
738 | 738 | public function track_transaction_and_registration_status_updates() { |
739 | 739 | // verify the transaction |
740 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
740 | + if ($this->transaction instanceof EE_Transaction) { |
|
741 | 741 | /** @type EE_Transaction_Payments $transaction_payments */ |
742 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
742 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
743 | 743 | /** @type EE_Transaction_Processor $transaction_processor */ |
744 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
744 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
745 | 745 | // has there been a TXN status change during this checkout? |
746 | - if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) { |
|
746 | + if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) { |
|
747 | 747 | $this->txn_status_updated = true; |
748 | 748 | } |
749 | 749 | /** @type EE_Registration_Processor $registration_processor */ |
750 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
750 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
751 | 751 | // grab the saved registrations from the transaction |
752 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
753 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
754 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
752 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
753 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
754 | + $this->set_reg_status_updated($registration->ID(), true); |
|
755 | 755 | } |
756 | 756 | } |
757 | 757 | } |
@@ -773,8 +773,8 @@ discard block |
||
773 | 773 | * @param EE_Registration $registration |
774 | 774 | * @return bool |
775 | 775 | */ |
776 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
777 | - return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE; |
|
776 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
777 | + return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE; |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | |
@@ -799,18 +799,18 @@ discard block |
||
799 | 799 | * @param bool $show_errors |
800 | 800 | * @return bool |
801 | 801 | */ |
802 | - public function save_all_data( $show_errors = TRUE ) { |
|
802 | + public function save_all_data($show_errors = TRUE) { |
|
803 | 803 | // verify the transaction |
804 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
804 | + if ($this->transaction instanceof EE_Transaction) { |
|
805 | 805 | // save to ensure that TXN has ID |
806 | 806 | $this->transaction->save(); |
807 | 807 | // grab the saved registrations from the transaction |
808 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
809 | - $this->_save_registration( $registration, $show_errors ); |
|
808 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
809 | + $this->_save_registration($registration, $show_errors); |
|
810 | 810 | } |
811 | 811 | } else { |
812 | - if ( $show_errors ) { |
|
813 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
812 | + if ($show_errors) { |
|
813 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
814 | 814 | } |
815 | 815 | return FALSE; |
816 | 816 | } |
@@ -825,32 +825,32 @@ discard block |
||
825 | 825 | * @param bool $show_errors |
826 | 826 | * @return void |
827 | 827 | */ |
828 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
828 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
829 | 829 | // verify object |
830 | - if ( $registration instanceof EE_Registration ) { |
|
830 | + if ($registration instanceof EE_Registration) { |
|
831 | 831 | // should this registration be processed during this visit ? |
832 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
832 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
833 | 833 | //set TXN ID |
834 | - if ( ! $registration->transaction_ID() ) { |
|
835 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
834 | + if ( ! $registration->transaction_ID()) { |
|
835 | + $registration->set_transaction_id($this->transaction->ID()); |
|
836 | 836 | } |
837 | 837 | // verify and save the attendee |
838 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
838 | + $this->_save_registration_attendee($registration, $show_errors); |
|
839 | 839 | // save answers to reg form questions |
840 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
840 | + $this->_save_registration_answers($registration, $show_errors); |
|
841 | 841 | // save changes |
842 | 842 | $registration->save(); |
843 | 843 | // update txn cache |
844 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
845 | - if ( $show_errors ) { |
|
846 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
844 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
845 | + if ($show_errors) { |
|
846 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
847 | 847 | } |
848 | 848 | } |
849 | 849 | } |
850 | 850 | } else { |
851 | - if ( $show_errors ) { |
|
851 | + if ($show_errors) { |
|
852 | 852 | EE_Error::add_error( |
853 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
853 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
854 | 854 | __FILE__, __FUNCTION__, __LINE__ |
855 | 855 | ); |
856 | 856 | } |
@@ -866,26 +866,26 @@ discard block |
||
866 | 866 | * @param bool $show_errors |
867 | 867 | * @return void |
868 | 868 | */ |
869 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
870 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
869 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
870 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
871 | 871 | // save so that ATT has ID |
872 | 872 | $registration->attendee()->save(); |
873 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) { |
|
874 | - if ( $show_errors ) { |
|
873 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
874 | + if ($show_errors) { |
|
875 | 875 | EE_Error::add_error( |
876 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
876 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
877 | 877 | __FILE__, __FUNCTION__, __LINE__ |
878 | 878 | ); |
879 | 879 | } |
880 | 880 | } |
881 | 881 | } else { |
882 | - if ( $show_errors ) { |
|
882 | + if ($show_errors) { |
|
883 | 883 | ob_start(); |
884 | - var_dump( $registration->attendee() ); |
|
884 | + var_dump($registration->attendee()); |
|
885 | 885 | EE_Error::add_error( |
886 | 886 | sprintf( |
887 | 887 | '%1$s||%1$s $attendee = %2$s', |
888 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
888 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
889 | 889 | ob_get_clean() |
890 | 890 | ), |
891 | 891 | __FILE__, __FUNCTION__, __LINE__ |
@@ -903,25 +903,25 @@ discard block |
||
903 | 903 | * @param bool $show_errors |
904 | 904 | * @return void |
905 | 905 | */ |
906 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
906 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
907 | 907 | // now save the answers |
908 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
908 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
909 | 909 | // verify object |
910 | - if ( $answer instanceof EE_Answer ) { |
|
911 | - $answer->set_registration( $registration->ID() ); |
|
910 | + if ($answer instanceof EE_Answer) { |
|
911 | + $answer->set_registration($registration->ID()); |
|
912 | 912 | $answer->save(); |
913 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
914 | - if ( $show_errors ) { |
|
913 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
914 | + if ($show_errors) { |
|
915 | 915 | EE_Error::add_error( |
916 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
916 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
917 | 917 | __FILE__, __FUNCTION__, __LINE__ |
918 | 918 | ); |
919 | 919 | } |
920 | 920 | } |
921 | 921 | } else { |
922 | - if ( $show_errors ) { |
|
922 | + if ($show_errors) { |
|
923 | 923 | EE_Error::add_error( |
924 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
924 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
925 | 925 | __FILE__, __FUNCTION__, __LINE__ |
926 | 926 | ); |
927 | 927 | } |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | * @param bool $from_db |
940 | 940 | * @return bool |
941 | 941 | */ |
942 | - public function refresh_all_entities( $from_db = false ) { |
|
942 | + public function refresh_all_entities($from_db = false) { |
|
943 | 943 | $from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db; |
944 | 944 | //$this->log( |
945 | 945 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -960,11 +960,11 @@ discard block |
||
960 | 960 | */ |
961 | 961 | protected function refresh_from_db() { |
962 | 962 | // verify the transaction |
963 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
963 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
964 | 964 | // pull fresh TXN data from the db |
965 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
965 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
966 | 966 | // update EE_Checkout's cached primary_attendee object |
967 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
967 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
968 | 968 | // update EE_Checkout's cached payment object |
969 | 969 | $payment = $this->transaction->last_payment(); |
970 | 970 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -972,15 +972,15 @@ discard block |
||
972 | 972 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
973 | 973 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
974 | 974 | //now refresh the cart, based on the TXN |
975 | - $this->cart = EE_Cart::get_cart_from_txn( $this->transaction ); |
|
975 | + $this->cart = EE_Cart::get_cart_from_txn($this->transaction); |
|
976 | 976 | // verify and update the cart because inaccurate totals are not so much fun |
977 | - if ( $this->cart instanceof EE_Cart ) { |
|
977 | + if ($this->cart instanceof EE_Cart) { |
|
978 | 978 | $this->cart->get_grand_total()->recalculate_total_including_taxes(); |
979 | 979 | } else { |
980 | - $this->cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
980 | + $this->cart = EE_Registry::instance()->load_core('Cart'); |
|
981 | 981 | } |
982 | 982 | } else { |
983 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
983 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
984 | 984 | return FALSE; |
985 | 985 | } |
986 | 986 | return TRUE; |
@@ -994,24 +994,24 @@ discard block |
||
994 | 994 | * @param EE_Transaction $transaction |
995 | 995 | * @return EE_Attendee | null |
996 | 996 | */ |
997 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
997 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
998 | 998 | |
999 | 999 | $primary_attendee_obj = null; |
1000 | 1000 | // grab the saved registrations from the transaction |
1001 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
1001 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
1002 | 1002 | // verify object |
1003 | - if ( $registration instanceof EE_Registration ) { |
|
1003 | + if ($registration instanceof EE_Registration) { |
|
1004 | 1004 | $attendee = $registration->attendee(); |
1005 | 1005 | // verify object |
1006 | - if ( $attendee instanceof EE_Attendee ) { |
|
1006 | + if ($attendee instanceof EE_Attendee) { |
|
1007 | 1007 | // maybe cache primary_attendee_obj ? |
1008 | - if ( $registration->is_primary_registrant() ) { |
|
1008 | + if ($registration->is_primary_registrant()) { |
|
1009 | 1009 | $primary_attendee_obj = $attendee; |
1010 | 1010 | } |
1011 | 1011 | } |
1012 | 1012 | } else { |
1013 | 1013 | EE_Error::add_error( |
1014 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1014 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1015 | 1015 | __FILE__, __FUNCTION__, __LINE__ |
1016 | 1016 | ); |
1017 | 1017 | } |
@@ -1031,43 +1031,43 @@ discard block |
||
1031 | 1031 | */ |
1032 | 1032 | protected function refresh_entity_map() { |
1033 | 1033 | // verify the transaction |
1034 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1034 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1035 | 1035 | // never cache payment info |
1036 | - $this->transaction->clear_cache( 'Payment' ); |
|
1036 | + $this->transaction->clear_cache('Payment'); |
|
1037 | 1037 | /** @type EE_Transaction_Processor $transaction_processor */ |
1038 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1038 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1039 | 1039 | // is the Payment Options Reg Step completed ? |
1040 | - if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) { |
|
1040 | + if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) { |
|
1041 | 1041 | // then check for payments and update TXN accordingly |
1042 | 1042 | /** @type EE_Transaction_Payments $transaction_payments */ |
1043 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1044 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
1043 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1044 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
1045 | 1045 | } |
1046 | 1046 | // grab the saved registrations from the transaction |
1047 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) { |
|
1048 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
1047 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) { |
|
1048 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
1049 | 1049 | } |
1050 | 1050 | // make sure our cached TXN is added to the model entity mapper |
1051 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
1051 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
1052 | 1052 | |
1053 | 1053 | } else { |
1054 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1054 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1055 | 1055 | return FALSE; |
1056 | 1056 | } |
1057 | 1057 | // verify and update the cart because inaccurate totals are not so much fun |
1058 | - if ( $this->cart instanceof EE_Cart ) { |
|
1058 | + if ($this->cart instanceof EE_Cart) { |
|
1059 | 1059 | $grand_total = $this->cart->get_grand_total(); |
1060 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
1060 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
1061 | 1061 | $grand_total->recalculate_total_including_taxes(); |
1062 | 1062 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
1063 | 1063 | $this->cart->get_grand_total()->ID(), |
1064 | 1064 | $this->cart->get_grand_total() |
1065 | 1065 | ); |
1066 | 1066 | } |
1067 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
1068 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
1067 | + if ($grand_total instanceof EE_Line_Item) { |
|
1068 | + $this->cart = EE_Cart::instance($grand_total); |
|
1069 | 1069 | } else { |
1070 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1070 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1071 | 1071 | return false; |
1072 | 1072 | } |
1073 | 1073 | } |
@@ -1083,19 +1083,19 @@ discard block |
||
1083 | 1083 | * @param EE_Registration $registration |
1084 | 1084 | * @return void |
1085 | 1085 | */ |
1086 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
1086 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
1087 | 1087 | |
1088 | 1088 | // verify object |
1089 | - if ( $registration instanceof EE_Registration ) { |
|
1089 | + if ($registration instanceof EE_Registration) { |
|
1090 | 1090 | // update the entity mapper attendee |
1091 | - $this->_refresh_registration_attendee( $registration ); |
|
1091 | + $this->_refresh_registration_attendee($registration); |
|
1092 | 1092 | // update the entity mapper answers for reg form questions |
1093 | - $this->_refresh_registration_answers( $registration ); |
|
1093 | + $this->_refresh_registration_answers($registration); |
|
1094 | 1094 | // make sure the cached registration is added to the model entity mapper |
1095 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1095 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1096 | 1096 | } else { |
1097 | 1097 | EE_Error::add_error( |
1098 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1098 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1099 | 1099 | __FILE__, __FUNCTION__, __LINE__ |
1100 | 1100 | ); |
1101 | 1101 | } |
@@ -1109,15 +1109,15 @@ discard block |
||
1109 | 1109 | * @param EE_Registration $registration |
1110 | 1110 | * @return void |
1111 | 1111 | */ |
1112 | - protected function _refresh_registration_attendee( $registration ) { |
|
1112 | + protected function _refresh_registration_attendee($registration) { |
|
1113 | 1113 | |
1114 | 1114 | $attendee = $registration->attendee(); |
1115 | 1115 | // verify object |
1116 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1116 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1117 | 1117 | // make sure the cached attendee is added to the model entity mapper |
1118 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1118 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1119 | 1119 | // maybe cache primary_attendee_obj ? |
1120 | - if ( $registration->is_primary_registrant() ) { |
|
1120 | + if ($registration->is_primary_registrant()) { |
|
1121 | 1121 | $this->primary_attendee_obj = $attendee; |
1122 | 1122 | } |
1123 | 1123 | } |
@@ -1131,19 +1131,19 @@ discard block |
||
1131 | 1131 | * @param EE_Registration $registration |
1132 | 1132 | * @return void |
1133 | 1133 | */ |
1134 | - protected function _refresh_registration_answers( $registration ) { |
|
1134 | + protected function _refresh_registration_answers($registration) { |
|
1135 | 1135 | |
1136 | 1136 | // now update the answers |
1137 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1137 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1138 | 1138 | // verify object |
1139 | - if ( $answer instanceof EE_Answer ) { |
|
1140 | - if ( $answer->ID() ) { |
|
1139 | + if ($answer instanceof EE_Answer) { |
|
1140 | + if ($answer->ID()) { |
|
1141 | 1141 | // make sure the cached answer is added to the model entity mapper |
1142 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1142 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1143 | 1143 | } |
1144 | 1144 | } else { |
1145 | 1145 | EE_Error::add_error( |
1146 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1146 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1147 | 1147 | __FILE__, __FUNCTION__, __LINE__ |
1148 | 1148 | ); |
1149 | 1149 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1159 | 1159 | */ |
1160 | 1160 | function __wakeup() { |
1161 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1161 | + foreach ($this->reg_steps as $reg_step) { |
|
1162 | 1162 | $reg_step->checkout = $this; |
1163 | 1163 | } |
1164 | 1164 | } |
@@ -1174,11 +1174,11 @@ discard block |
||
1174 | 1174 | * @param array $info |
1175 | 1175 | * @param bool $display_request |
1176 | 1176 | */ |
1177 | - function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1178 | - if ( WP_DEBUG && false ) { |
|
1179 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1177 | + function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1178 | + if (WP_DEBUG && false) { |
|
1179 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1180 | 1180 | $default_data = array( |
1181 | - $class => $func . '() : ' . $line, |
|
1181 | + $class => $func.'() : '.$line, |
|
1182 | 1182 | 'request->step' => $this->step, |
1183 | 1183 | 'request->action' => $this->action, |
1184 | 1184 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1190,24 +1190,24 @@ discard block |
||
1190 | 1190 | 'reg_url_link' => $this->reg_url_link, |
1191 | 1191 | 'REQ' => $display_request ? $_REQUEST : '', |
1192 | 1192 | ); |
1193 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1194 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1195 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1196 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1197 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1193 | + if ($this->transaction instanceof EE_Transaction) { |
|
1194 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1195 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1196 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1197 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1198 | 1198 | } |
1199 | - if ( $this->transaction->ID() ) { |
|
1200 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1199 | + if ($this->transaction->ID()) { |
|
1200 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1201 | 1201 | // don't serialize objects |
1202 | - $info = $this->_strip_objects( $info ); |
|
1203 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1204 | - $debug_data[ $TXN_ID ] = array(); |
|
1202 | + $info = $this->_strip_objects($info); |
|
1203 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1204 | + $debug_data[$TXN_ID] = array(); |
|
1205 | 1205 | } |
1206 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1206 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1207 | 1207 | $default_data, |
1208 | 1208 | $info |
1209 | 1209 | ); |
1210 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1210 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1211 | 1211 | } |
1212 | 1212 | } |
1213 | 1213 | } |
@@ -1220,23 +1220,23 @@ discard block |
||
1220 | 1220 | * @param array $info |
1221 | 1221 | * @return array |
1222 | 1222 | */ |
1223 | - function _strip_objects( $info = array() ) { |
|
1224 | - foreach ( $info as $key => $value ) { |
|
1225 | - if ( is_array( $value )) { |
|
1226 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1227 | - } else if ( is_object( $value ) ) { |
|
1228 | - $object_class = get_class( $value ); |
|
1229 | - $info[ $object_class ] = array(); |
|
1230 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1231 | - if ( method_exists( $value, 'status' ) ) { |
|
1232 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1233 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1234 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1223 | + function _strip_objects($info = array()) { |
|
1224 | + foreach ($info as $key => $value) { |
|
1225 | + if (is_array($value)) { |
|
1226 | + $info[$key] = $this->_strip_objects($value); |
|
1227 | + } else if (is_object($value)) { |
|
1228 | + $object_class = get_class($value); |
|
1229 | + $info[$object_class] = array(); |
|
1230 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1231 | + if (method_exists($value, 'status')) { |
|
1232 | + $info[$object_class]['status'] = $value->status(); |
|
1233 | + } else if (method_exists($value, 'status_ID')) { |
|
1234 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1235 | 1235 | } |
1236 | - unset( $info[ $key ] ); |
|
1236 | + unset($info[$key]); |
|
1237 | 1237 | } |
1238 | 1238 | } |
1239 | - return (array)$info; |
|
1239 | + return (array) $info; |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 |
@@ -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,7 +463,7 @@ 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 | // d( $registration ); |
469 | 468 | // d( $question ); |
470 | 469 | // d( $answer ); |
@@ -487,29 +486,29 @@ discard block |
||
487 | 486 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
488 | 487 | |
489 | 488 | $input_constructor_args = array( |
490 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
491 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
492 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
489 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
490 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
491 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
493 | 492 | 'required' => $question->required() ? TRUE : FALSE, |
494 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
493 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
495 | 494 | 'html_label_class' => 'ee-reg-qstn', |
496 | 495 | 'html_label_text' => $question->display_text(), |
497 | 496 | 'required_validation_error_message' => $question->required_text() |
498 | 497 | ); |
499 | 498 | // has this question been answered ? |
500 | - if ( $answer instanceof EE_Answer ) { |
|
501 | - if ( $answer->ID() ) { |
|
502 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
503 | - $input_constructor_args['html_id'] .= '-' . $answer->ID(); |
|
504 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); |
|
499 | + if ($answer instanceof EE_Answer) { |
|
500 | + if ($answer->ID()) { |
|
501 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
502 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
503 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
505 | 504 | } |
506 | 505 | $input_constructor_args['default'] = $answer->value(); |
507 | 506 | } |
508 | 507 | //add "-lbl" to the end of the label id |
509 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
510 | - $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() ); |
|
511 | - if( EEM_Question::instance()->question_type_is_in_category( $question->type(), 'text' ) ) { |
|
512 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Max_Length_Validation_Strategy( |
|
508 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
509 | + $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID()); |
|
510 | + if (EEM_Question::instance()->question_type_is_in_category($question->type(), 'text')) { |
|
511 | + $input_constructor_args['validation_strategies'][] = new EE_Max_Length_Validation_Strategy( |
|
513 | 512 | null, |
514 | 513 | min( |
515 | 514 | $max_max_for_question, |
@@ -517,83 +516,83 @@ discard block |
||
517 | 516 | ) |
518 | 517 | ); |
519 | 518 | } |
520 | - $input_constructor_args = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
519 | + $input_constructor_args = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
521 | 520 | $input_constructor_args, |
522 | 521 | $registration, |
523 | 522 | $question, |
524 | 523 | $answer |
525 | 524 | ); |
526 | 525 | |
527 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
526 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
528 | 527 | |
529 | - switch ( $question->type() ) { |
|
528 | + switch ($question->type()) { |
|
530 | 529 | // Text |
531 | 530 | case EEM_Question::QST_type_text : |
532 | - if( $identifier == 'email' ){ |
|
533 | - return new EE_Email_Input( $input_constructor_args ); |
|
534 | - }else{ |
|
535 | - return new EE_Text_Input( $input_constructor_args ); |
|
531 | + if ($identifier == 'email') { |
|
532 | + return new EE_Email_Input($input_constructor_args); |
|
533 | + } else { |
|
534 | + return new EE_Text_Input($input_constructor_args); |
|
536 | 535 | } |
537 | 536 | break; |
538 | 537 | // Textarea |
539 | 538 | case EEM_Question::QST_type_textarea : |
540 | - return new EE_Text_Area_Input( $input_constructor_args ); |
|
539 | + return new EE_Text_Area_Input($input_constructor_args); |
|
541 | 540 | break; |
542 | 541 | // Radio Buttons |
543 | 542 | case EEM_Question::QST_type_radio : |
544 | - return new EE_Radio_Button_Input( $question->options(), $input_constructor_args ); |
|
543 | + return new EE_Radio_Button_Input($question->options(), $input_constructor_args); |
|
545 | 544 | break; |
546 | 545 | // Dropdown |
547 | 546 | case EEM_Question::QST_type_dropdown : |
548 | - return new EE_Select_Input( $question->options(), $input_constructor_args ); |
|
547 | + return new EE_Select_Input($question->options(), $input_constructor_args); |
|
549 | 548 | break; |
550 | 549 | // State Dropdown |
551 | 550 | case EEM_Question::QST_type_state : |
552 | - $state_options = array( '' => array( '' => '')); |
|
551 | + $state_options = array('' => array('' => '')); |
|
553 | 552 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
554 | - if ( ! empty( $states )) { |
|
555 | - foreach( $states as $state ){ |
|
556 | - if ( $state instanceof EE_State ) { |
|
557 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
553 | + if ( ! empty($states)) { |
|
554 | + foreach ($states as $state) { |
|
555 | + if ($state instanceof EE_State) { |
|
556 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
558 | 557 | } |
559 | 558 | } |
560 | 559 | } |
561 | - $state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer ); |
|
562 | - return new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
560 | + $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer); |
|
561 | + return new EE_State_Select_Input($state_options, $input_constructor_args); |
|
563 | 562 | break; |
564 | 563 | // Country Dropdown |
565 | 564 | case EEM_Question::QST_type_country : |
566 | - $country_options = array( '' => '' ); |
|
565 | + $country_options = array('' => ''); |
|
567 | 566 | // get possibly cached list of countries |
568 | 567 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
569 | - if ( ! empty( $countries )) { |
|
570 | - foreach( $countries as $country ){ |
|
571 | - if ( $country instanceof EE_Country ) { |
|
572 | - $country_options[ $country->ID() ] = $country->name(); |
|
568 | + if ( ! empty($countries)) { |
|
569 | + foreach ($countries as $country) { |
|
570 | + if ($country instanceof EE_Country) { |
|
571 | + $country_options[$country->ID()] = $country->name(); |
|
573 | 572 | } |
574 | 573 | } |
575 | 574 | } |
576 | - $country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer ); |
|
577 | - return new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
575 | + $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer); |
|
576 | + return new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
578 | 577 | break; |
579 | 578 | // Checkboxes |
580 | 579 | case EEM_Question::QST_type_checkbox : |
581 | - return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args ); |
|
580 | + return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args); |
|
582 | 581 | break; |
583 | 582 | // Date |
584 | 583 | case EEM_Question::QST_type_date : |
585 | - return new EE_Datepicker_Input( $input_constructor_args ); |
|
584 | + return new EE_Datepicker_Input($input_constructor_args); |
|
586 | 585 | break; |
587 | 586 | case EEM_Question::QST_type_html_textarea : |
588 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy(); |
|
589 | - $input = new EE_Text_Area_Input( $input_constructor_args ); |
|
590 | - $input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' ); |
|
587 | + $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy(); |
|
588 | + $input = new EE_Text_Area_Input($input_constructor_args); |
|
589 | + $input->remove_validation_strategy('EE_Plaintext_Validation_Strategy'); |
|
591 | 590 | return $input; |
592 | 591 | // fallback |
593 | 592 | default : |
594 | - $default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args ); |
|
595 | - if( ! $default_input ){ |
|
596 | - $default_input = new EE_Text_Input( $input_constructor_args ); |
|
593 | + $default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args); |
|
594 | + if ( ! $default_input) { |
|
595 | + $default_input = new EE_Text_Input($input_constructor_args); |
|
597 | 596 | } |
598 | 597 | return $default_input; |
599 | 598 | } |
@@ -618,65 +617,65 @@ discard block |
||
618 | 617 | */ |
619 | 618 | public function process_reg_step() { |
620 | 619 | |
621 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
620 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
622 | 621 | // grab validated data from form |
623 | 622 | $valid_data = $this->checkout->current_step->valid_data(); |
624 | 623 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
625 | 624 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
626 | 625 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
627 | - if ( empty( $valid_data )) { |
|
628 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
626 | + if (empty($valid_data)) { |
|
627 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
629 | 628 | return FALSE; |
630 | 629 | } |
631 | 630 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
632 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
633 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
631 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
632 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
634 | 633 | return FALSE; |
635 | 634 | } |
636 | 635 | // get cached registrations |
637 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
636 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
638 | 637 | // verify we got the goods |
639 | - if ( empty( $registrations )) { |
|
640 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
638 | + if (empty($registrations)) { |
|
639 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
641 | 640 | return FALSE; |
642 | 641 | } |
643 | 642 | // extract attendee info from form data and save to model objects |
644 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
643 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
645 | 644 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
646 | - if ( $registrations_processed === FALSE ) { |
|
645 | + if ($registrations_processed === FALSE) { |
|
647 | 646 | // but return immediately if the previous step exited early due to errors |
648 | 647 | return FALSE; |
649 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
648 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
650 | 649 | // generate a correctly translated string for all possible singular/plural combinations |
651 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
650 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
652 | 651 | $error_msg = sprintf( |
653 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
652 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
654 | 653 | $this->checkout->total_ticket_count, |
655 | 654 | $registrations_processed |
656 | 655 | ); |
657 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
656 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
658 | 657 | $error_msg = sprintf( |
659 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
658 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
660 | 659 | $this->checkout->total_ticket_count, |
661 | 660 | $registrations_processed |
662 | 661 | ); |
663 | 662 | } else { |
664 | 663 | $error_msg = sprintf( |
665 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
664 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
666 | 665 | $this->checkout->total_ticket_count, |
667 | 666 | $registrations_processed |
668 | 667 | ); |
669 | 668 | |
670 | 669 | } |
671 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
670 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
672 | 671 | return FALSE; |
673 | 672 | } |
674 | 673 | // mark this reg step as completed |
675 | 674 | $this->set_completed(); |
676 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
675 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
677 | 676 | //do action in case a plugin wants to do something with the data submitted in step 1. |
678 | 677 | //passes EE_Single_Page_Checkout, and it's posted data |
679 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
678 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
680 | 679 | return TRUE; |
681 | 680 | |
682 | 681 | } |
@@ -690,9 +689,9 @@ discard block |
||
690 | 689 | * @param array $valid_data |
691 | 690 | * @return boolean | int |
692 | 691 | */ |
693 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
692 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
694 | 693 | // load resources and set some defaults |
695 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
694 | + EE_Registry::instance()->load_model('Attendee'); |
|
696 | 695 | // holder for primary registrant attendee object |
697 | 696 | $this->checkout->primary_attendee_obj = NULL; |
698 | 697 | // array for tracking reg form data for the primary registrant |
@@ -709,19 +708,19 @@ discard block |
||
709 | 708 | // attendee counter |
710 | 709 | $att_nmbr = 0; |
711 | 710 | // grab the saved registrations from the transaction |
712 | - foreach ( $registrations as $registration ) { |
|
711 | + foreach ($registrations as $registration) { |
|
713 | 712 | // verify EE_Registration object |
714 | - if ( ! $registration instanceof EE_Registration ) { |
|
715 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
713 | + if ( ! $registration instanceof EE_Registration) { |
|
714 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
716 | 715 | return FALSE; |
717 | 716 | } |
718 | 717 | $reg_url_link = $registration->reg_url_link(); |
719 | 718 | // reg_url_link exists ? |
720 | - if ( $reg_url_link ) { |
|
719 | + if ($reg_url_link) { |
|
721 | 720 | // should this registration be processed during this visit ? |
722 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
721 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
723 | 722 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
724 | - if ( ! $this->checkout->revisit ) { |
|
723 | + if ( ! $this->checkout->revisit) { |
|
725 | 724 | $registration->save(); |
726 | 725 | } |
727 | 726 | |
@@ -732,41 +731,41 @@ discard block |
||
732 | 731 | * @var bool if TRUE is returned by the plugin then the |
733 | 732 | * registration processing is halted. |
734 | 733 | */ |
735 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
734 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
736 | 735 | return FALSE; |
737 | 736 | } |
738 | 737 | |
739 | 738 | // Houston, we have a registration! |
740 | 739 | $att_nmbr++; |
741 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
740 | + $this->_attendee_data[$reg_url_link] = array(); |
|
742 | 741 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
743 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
742 | + if (isset($valid_data[$reg_url_link])) { |
|
744 | 743 | // do we need to copy basic info from primary attendee ? |
745 | - $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; |
|
744 | + $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; |
|
746 | 745 | // filter form input data for this registration |
747 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
746 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
748 | 747 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
749 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
750 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
751 | - unset( $valid_data['primary_attendee'] ); |
|
748 | + if (isset($valid_data['primary_attendee'])) { |
|
749 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
750 | + unset($valid_data['primary_attendee']); |
|
752 | 751 | } |
753 | 752 | // now loop through our array of valid post data && process attendee reg forms |
754 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
755 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
756 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
753 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
754 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
755 | + foreach ($form_inputs as $form_input => $input_value) { |
|
757 | 756 | // check for critical inputs |
758 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
757 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
759 | 758 | return FALSE; |
760 | 759 | } |
761 | 760 | // store a bit of data about the primary attendee |
762 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
763 | - $primary_registrant[ $form_input ] = $input_value; |
|
764 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
765 | - $input_value = $primary_registrant[ $form_input ]; |
|
761 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
762 | + $primary_registrant[$form_input] = $input_value; |
|
763 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
764 | + $input_value = $primary_registrant[$form_input]; |
|
766 | 765 | } |
767 | 766 | // now attempt to save the input data |
768 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
769 | - 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__ ); |
|
767 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
768 | + 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__); |
|
770 | 769 | return FALSE; |
771 | 770 | } |
772 | 771 | } |
@@ -775,51 +774,51 @@ discard block |
||
775 | 774 | } |
776 | 775 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
777 | 776 | // this registration does not require additional attendee information ? |
778 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
777 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
779 | 778 | // just copy the primary registrant |
780 | 779 | $attendee = $this->checkout->primary_attendee_obj; |
781 | 780 | } else { |
782 | 781 | // have we met before? |
783 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
782 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
784 | 783 | // did we find an already existing record for this attendee ? |
785 | - if ( $attendee instanceof EE_Attendee ) { |
|
786 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
784 | + if ($attendee instanceof EE_Attendee) { |
|
785 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
787 | 786 | } else { |
788 | 787 | // ensure critical details are set for additional attendees |
789 | - $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 ]; |
|
790 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
788 | + $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]; |
|
789 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
791 | 790 | } |
792 | 791 | // who's #1 ? |
793 | - if ( $att_nmbr == 1 ) { |
|
792 | + if ($att_nmbr == 1) { |
|
794 | 793 | $this->checkout->primary_attendee_obj = $attendee; |
795 | 794 | } |
796 | 795 | } |
797 | 796 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
798 | 797 | // add relation to registration, set attendee ID, and cache attendee |
799 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
800 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
801 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
798 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
799 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
800 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
802 | 801 | return FALSE; |
803 | 802 | } |
804 | 803 | /** @type EE_Registration_Processor $registration_processor */ |
805 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
804 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
806 | 805 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
807 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
806 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
808 | 807 | /** @type EE_Transaction_Processor $transaction_processor */ |
809 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
808 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
810 | 809 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
811 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
810 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
812 | 811 | // if we've gotten this far, then let's save what we have |
813 | 812 | $registration->save(); |
814 | 813 | // add relation between TXN and registration |
815 | - $this->_associate_registration_with_transaction( $registration ); |
|
814 | + $this->_associate_registration_with_transaction($registration); |
|
816 | 815 | |
817 | 816 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
818 | 817 | |
819 | - } else { |
|
820 | - 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__ ); |
|
818 | + } else { |
|
819 | + 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__); |
|
821 | 820 | // remove malformed data |
822 | - unset( $valid_data[ $reg_url_link ] ); |
|
821 | + unset($valid_data[$reg_url_link]); |
|
823 | 822 | return FALSE; |
824 | 823 | } |
825 | 824 | |
@@ -837,22 +836,22 @@ discard block |
||
837 | 836 | * @param string $input_value |
838 | 837 | * @return boolean |
839 | 838 | */ |
840 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
839 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
841 | 840 | //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>'; |
842 | 841 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
843 | 842 | // allow for plugins to hook in and do their own processing of the form input. |
844 | 843 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
845 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
844 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
846 | 845 | return TRUE; |
847 | 846 | } |
848 | 847 | |
849 | 848 | // grab related answer objects |
850 | 849 | $answers = $registration->answers(); |
851 | 850 | // $answer_cache_id is the key used to find the EE_Answer we want |
852 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
853 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
851 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
852 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
854 | 853 | //rename form_inputs if they are EE_Attendee properties |
855 | - switch( (string)$form_input ) { |
|
854 | + switch ((string) $form_input) { |
|
856 | 855 | |
857 | 856 | case 'state' : |
858 | 857 | case 'STA_ID' : |
@@ -867,33 +866,33 @@ discard block |
||
867 | 866 | break; |
868 | 867 | |
869 | 868 | default : |
870 | - $ATT_input = 'ATT_' . $form_input; |
|
869 | + $ATT_input = 'ATT_'.$form_input; |
|
871 | 870 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
872 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
873 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
871 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
872 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
874 | 873 | } |
875 | 874 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
876 | 875 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
877 | 876 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
878 | 877 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
879 | 878 | // if this form input has a corresponding attendee property |
880 | - if ( $attendee_property ) { |
|
881 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
882 | - if ( $answer_is_obj ) { |
|
879 | + if ($attendee_property) { |
|
880 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
881 | + if ($answer_is_obj) { |
|
883 | 882 | // and delete the corresponding answer since we won't be storing this data in that object |
884 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
885 | - $answers[ $answer_cache_id ]->delete_permanently(); |
|
883 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
884 | + $answers[$answer_cache_id]->delete_permanently(); |
|
886 | 885 | } |
887 | 886 | return TRUE; |
888 | - } elseif ( $answer_is_obj ) { |
|
887 | + } elseif ($answer_is_obj) { |
|
889 | 888 | // save this data to the answer object |
890 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
891 | - $result = $answers[ $answer_cache_id ]->save(); |
|
889 | + $answers[$answer_cache_id]->set_value($input_value); |
|
890 | + $result = $answers[$answer_cache_id]->save(); |
|
892 | 891 | return $result !== false ? true : false; |
893 | 892 | } else { |
894 | - foreach ( $answers as $answer ) { |
|
895 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
896 | - $answer->set_value( $input_value ); |
|
893 | + foreach ($answers as $answer) { |
|
894 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
895 | + $answer->set_value($input_value); |
|
897 | 896 | $result = $answer->save(); |
898 | 897 | return $result !== false ? true : false; |
899 | 898 | } |
@@ -911,33 +910,33 @@ discard block |
||
911 | 910 | * @param string $input_value |
912 | 911 | * @return boolean |
913 | 912 | */ |
914 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
915 | - if ( empty( $input_value )) { |
|
913 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
914 | + if (empty($input_value)) { |
|
916 | 915 | // if the form input isn't marked as being required, then just return |
917 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
916 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
918 | 917 | return true; |
919 | 918 | } |
920 | - switch( $form_input ) { |
|
919 | + switch ($form_input) { |
|
921 | 920 | case 'fname' : |
922 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
921 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
923 | 922 | return FALSE; |
924 | 923 | break; |
925 | 924 | case 'lname' : |
926 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
925 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
927 | 926 | return FALSE; |
928 | 927 | break; |
929 | 928 | case 'email' : |
930 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
929 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
931 | 930 | return FALSE; |
932 | 931 | break; |
933 | 932 | } |
934 | - } else if ( $form_input === 'email' ) { |
|
933 | + } else if ($form_input === 'email') { |
|
935 | 934 | // clean the email address |
936 | - $valid_email = sanitize_email( $input_value ); |
|
935 | + $valid_email = sanitize_email($input_value); |
|
937 | 936 | // check if it matches |
938 | - if ( $input_value != $valid_email ) { |
|
937 | + if ($input_value != $valid_email) { |
|
939 | 938 | // whoops!!! |
940 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
939 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
941 | 940 | return FALSE; |
942 | 941 | } |
943 | 942 | } |
@@ -965,14 +964,14 @@ discard block |
||
965 | 964 | * @param array $attendee_data |
966 | 965 | * @return boolean |
967 | 966 | */ |
968 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
967 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
969 | 968 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
970 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
971 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
972 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
969 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
970 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
971 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
973 | 972 | // but only if those have values |
974 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
975 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
973 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
974 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
976 | 975 | 'ATT_fname' => $ATT_fname, |
977 | 976 | 'ATT_lname' => $ATT_lname, |
978 | 977 | 'ATT_email' => $ATT_email |
@@ -980,7 +979,7 @@ discard block |
||
980 | 979 | } else { |
981 | 980 | $existing_attendee = NULL; |
982 | 981 | } |
983 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
982 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
984 | 983 | } |
985 | 984 | |
986 | 985 | |
@@ -992,13 +991,13 @@ discard block |
||
992 | 991 | * @param array $attendee_data |
993 | 992 | * @return \EE_Attendee |
994 | 993 | */ |
995 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
994 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
996 | 995 | // first remove fname, lname, and email from attendee data |
997 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
996 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
998 | 997 | // now loop thru what's left and add to attendee CPT |
999 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
1000 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
1001 | - $existing_attendee->set( $property_name, $property_value ); |
|
998 | + foreach ($attendee_data as $property_name => $property_value) { |
|
999 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
1000 | + $existing_attendee->set($property_name, $property_value); |
|
1002 | 1001 | } |
1003 | 1002 | } |
1004 | 1003 | // better save that now |
@@ -1015,11 +1014,11 @@ discard block |
||
1015 | 1014 | * @param EE_Attendee $attendee |
1016 | 1015 | * @return void |
1017 | 1016 | */ |
1018 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
1017 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
1019 | 1018 | // add relation to attendee |
1020 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1021 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1022 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1019 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1020 | + $registration->set_attendee_id($attendee->ID()); |
|
1021 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1023 | 1022 | } |
1024 | 1023 | |
1025 | 1024 | |
@@ -1030,10 +1029,10 @@ discard block |
||
1030 | 1029 | * @param EE_Registration $registration |
1031 | 1030 | * @return void |
1032 | 1031 | */ |
1033 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1032 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1034 | 1033 | // add relation to attendee |
1035 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1036 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1034 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1035 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1037 | 1036 | } |
1038 | 1037 | |
1039 | 1038 | |
@@ -1045,17 +1044,17 @@ discard block |
||
1045 | 1044 | * @param array $attendee_data |
1046 | 1045 | * @return array |
1047 | 1046 | */ |
1048 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1047 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1049 | 1048 | // bare minimum critical details include first name, last name, email address |
1050 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1049 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1051 | 1050 | // add address info to critical details? |
1052 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1053 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1054 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1051 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1052 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1053 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1055 | 1054 | } |
1056 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1057 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1058 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1055 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1056 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1057 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1059 | 1058 | } |
1060 | 1059 | } |
1061 | 1060 | return $attendee_data; |
@@ -1070,11 +1069,11 @@ discard block |
||
1070 | 1069 | * @param array $attendee_data |
1071 | 1070 | * @return \EE_Attendee |
1072 | 1071 | */ |
1073 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1072 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1074 | 1073 | // create new attendee object |
1075 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1074 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1076 | 1075 | // set author to event creator |
1077 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1076 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1078 | 1077 | $new_attendee->save(); |
1079 | 1078 | return $new_attendee; |
1080 | 1079 | } |
@@ -1090,7 +1089,7 @@ discard block |
||
1090 | 1089 | */ |
1091 | 1090 | public function update_reg_step() { |
1092 | 1091 | // save everything |
1093 | - if ( $this->process_reg_step() ) { |
|
1092 | + if ($this->process_reg_step()) { |
|
1094 | 1093 | $this->checkout->redirect = TRUE; |
1095 | 1094 | $this->checkout->redirect_url = add_query_arg( |
1096 | 1095 | array( |
@@ -1099,7 +1098,7 @@ discard block |
||
1099 | 1098 | ), |
1100 | 1099 | $this->checkout->thank_you_page_url |
1101 | 1100 | ); |
1102 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1101 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1103 | 1102 | return TRUE; |
1104 | 1103 | } |
1105 | 1104 | return FALSE; |
@@ -1,37 +1,37 @@ |
||
1 | 1 | <div id="admin-side-mbox-billing-info-dv" class="admin-side-mbox-dv"> |
2 | -<?php if ( empty($billing_form) ) : ?> |
|
2 | +<?php if (empty($billing_form)) : ?> |
|
3 | 3 | <div class="clearfix"> |
4 | - <?php _e( 'There is no billing info for this transaction.', 'event_espresso' );?><br/> |
|
4 | + <?php _e('There is no billing info for this transaction.', 'event_espresso'); ?><br/> |
|
5 | 5 | </div> |
6 | 6 | <?php else : |
7 | - function ee_show_billing_info_cleaned( EE_Form_Section_Proper $form_section, $found_cc_data = false ) { |
|
8 | - foreach( $form_section->subsections() as $subsection ) { |
|
9 | - if( $subsection instanceof EE_Form_Input_Base ) { |
|
10 | - if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal || |
|
11 | - $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal ){ |
|
7 | + function ee_show_billing_info_cleaned(EE_Form_Section_Proper $form_section, $found_cc_data = false) { |
|
8 | + foreach ($form_section->subsections() as $subsection) { |
|
9 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
10 | + if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal || |
|
11 | + $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal) { |
|
12 | 12 | continue; |
13 | 13 | } |
14 | - if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal ) { |
|
14 | + if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal) { |
|
15 | 15 | $found_cc_data = true; |
16 | 16 | } |
17 | 17 | ?> |
18 | 18 | <div class="clearfix"> |
19 | - <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label();?></span><?php echo $subsection->pretty_value();?> |
|
19 | + <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label(); ?></span><?php echo $subsection->pretty_value(); ?> |
|
20 | 20 | </div><?php |
21 | - } elseif( $subsection instanceof EE_Form_Section_Proper ) { |
|
22 | - $found_cc_data = ee_show_billing_info_cleaned( $subsection, $found_cc_data); |
|
21 | + } elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
22 | + $found_cc_data = ee_show_billing_info_cleaned($subsection, $found_cc_data); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | return $found_cc_data; |
26 | 26 | } |
27 | - $found_cc_data = ee_show_billing_info_cleaned( $billing_form ); |
|
28 | - if( apply_filters( |
|
27 | + $found_cc_data = ee_show_billing_info_cleaned($billing_form); |
|
28 | + if (apply_filters( |
|
29 | 29 | 'FHEE__txn_admin_details_side_meta_box_billing_info__show_default_note', |
30 | 30 | $found_cc_data, |
31 | - $billing_form ) ) {?> |
|
32 | - <p class="help"><?php _e( 'Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso' );?></p> |
|
31 | + $billing_form )) {?> |
|
32 | + <p class="help"><?php _e('Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso'); ?></p> |
|
33 | 33 | <?php } |
34 | - do_action( 'AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form ); |
|
34 | + do_action('AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form); |
|
35 | 35 | endif; ?> |
36 | 36 | |
37 | 37 | </div> |