@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -49,8 +50,9 @@ discard block |
||
49 | 50 | ); |
50 | 51 | $this->_MSGR->set_validator_config( $new_config ); |
51 | 52 | |
52 | - if ( $this->_context != 'admin' ) |
|
53 | - $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
53 | + if ( $this->_context != 'admin' ) { |
|
54 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
55 | + } |
|
54 | 56 | |
55 | 57 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
56 | 58 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | class EE_Messages_Email_Cancelled_Registration_Validator extends EE_Messages_Validator { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $fields, $context ) { |
|
33 | + public function __construct($fields, $context) { |
|
34 | 34 | $this->_m_name = 'email'; |
35 | 35 | $this->_mt_name = 'cancelled_registration'; |
36 | 36 | |
37 | - parent::__construct( $fields, $context ); |
|
37 | + parent::__construct($fields, $context); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
47 | 47 | 'required' => array('[EVENT_LIST]') |
48 | 48 | ); |
49 | - $this->_messenger->set_validator_config( $new_config ); |
|
49 | + $this->_messenger->set_validator_config($new_config); |
|
50 | 50 | |
51 | - if ( $this->_context != 'admin' ) |
|
51 | + if ($this->_context != 'admin') |
|
52 | 52 | $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
53 | 53 | |
54 | 54 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | 11 | |
12 | 12 | /** |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | */ |
25 | 25 | class EE_Messages_Html_Receipt_Validator extends EE_Messages_Validator { |
26 | 26 | |
27 | - public function __construct( $fields, $context ) { |
|
27 | + public function __construct($fields, $context) { |
|
28 | 28 | $this->_m_name = 'html'; |
29 | 29 | $this->_mt_name = 'receipt'; |
30 | 30 | |
31 | - parent::__construct( $fields, $context ); |
|
31 | + parent::__construct($fields, $context); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -282,7 +282,7 @@ |
||
282 | 282 | /** |
283 | 283 | * Gets the first event for this payment (it's possible that it could be for multiple) |
284 | 284 | * @param EEI_Payment $payment |
285 | - * @return EEI_Event|null |
|
285 | + * @return EE_Event|null |
|
286 | 286 | */ |
287 | 287 | protected function _get_first_event_for_payment( EEI_Payment $payment ) { |
288 | 288 | $transaction = $payment->transaction(); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @subpackage core/libraries/payment_methods |
16 | 16 | * @author Mike Nelson |
17 | 17 | */ |
18 | -abstract class EE_Gateway{ |
|
18 | +abstract class EE_Gateway { |
|
19 | 19 | /** |
20 | 20 | * a constant used as a possible value for $_currencies_supported to indicate |
21 | 21 | * that ALL currencies are supported by this gateway |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * @return EE_Gateway |
95 | 95 | */ |
96 | - public function __construct(){ |
|
96 | + public function __construct() { |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | * beginning again) |
106 | 106 | * @return array |
107 | 107 | */ |
108 | - public function __sleep(){ |
|
108 | + public function __sleep() { |
|
109 | 109 | $properties = get_object_vars($this); |
110 | - unset( $properties[ '_pay_model' ], $properties[ '_pay_log' ] ); |
|
110 | + unset($properties['_pay_model'], $properties['_pay_log']); |
|
111 | 111 | return array_keys($properties); |
112 | 112 | } |
113 | 113 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * see $_supports_sending_refunds |
116 | 116 | * @return boolean |
117 | 117 | */ |
118 | - public function supports_sending_refunds(){ |
|
118 | + public function supports_sending_refunds() { |
|
119 | 119 | return $this->_supports_sending_refunds; |
120 | 120 | } |
121 | 121 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * see $_supports_receiving_refunds |
124 | 124 | * @return boolean |
125 | 125 | */ |
126 | - public function supports_receiving_refunds(){ |
|
126 | + public function supports_receiving_refunds() { |
|
127 | 127 | return $this->_supports_receiving_refunds; |
128 | 128 | } |
129 | 129 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return EE_Payment for the refund |
139 | 139 | * @throws EE_Error |
140 | 140 | */ |
141 | - public function do_direct_refund( EE_Payment $payment, $refund_info = null ) { |
|
141 | + public function do_direct_refund(EE_Payment $payment, $refund_info = null) { |
|
142 | 142 | return NULL; |
143 | 143 | } |
144 | 144 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | * etc |
150 | 150 | * @param array $settings_array |
151 | 151 | */ |
152 | - public function set_settings($settings_array){ |
|
153 | - foreach($settings_array as $name => $value){ |
|
152 | + public function set_settings($settings_array) { |
|
153 | + foreach ($settings_array as $name => $value) { |
|
154 | 154 | $property_name = "_".$name; |
155 | 155 | $this->{$property_name} = $value; |
156 | 156 | } |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | * See this class description |
160 | 160 | * @param EEMI_Payment $payment_model |
161 | 161 | */ |
162 | - public function set_payment_model($payment_model){ |
|
162 | + public function set_payment_model($payment_model) { |
|
163 | 163 | $this->_pay_model = $payment_model; |
164 | 164 | } |
165 | 165 | /** |
166 | 166 | * See this class description |
167 | 167 | * @param EEMI_Payment_Log $payment_log_model |
168 | 168 | */ |
169 | - public function set_payment_log($payment_log_model){ |
|
169 | + public function set_payment_log($payment_log_model) { |
|
170 | 170 | $this->_pay_log = $payment_log_model; |
171 | 171 | } |
172 | 172 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * See this class description |
175 | 175 | * @param EEHI_Template $template_helper |
176 | 176 | */ |
177 | - public function set_template_helper($template_helper){ |
|
177 | + public function set_template_helper($template_helper) { |
|
178 | 178 | $this->_template = $template_helper; |
179 | 179 | } |
180 | 180 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * See this class description |
183 | 183 | * @param EEHI_Line_Item $line_item_helper |
184 | 184 | */ |
185 | - public function set_line_item_helper( $line_item_helper ){ |
|
185 | + public function set_line_item_helper($line_item_helper) { |
|
186 | 186 | $this->_line_item = $line_item_helper; |
187 | 187 | } |
188 | 188 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * See this class description |
191 | 191 | * @param EEHI_Money $money_helper |
192 | 192 | */ |
193 | - public function set_money_helper( $money_helper ){ |
|
193 | + public function set_money_helper($money_helper) { |
|
194 | 194 | $this->_money = $money_helper; |
195 | 195 | } |
196 | 196 | |
@@ -199,23 +199,23 @@ discard block |
||
199 | 199 | * @param $message |
200 | 200 | * @param $payment |
201 | 201 | */ |
202 | - public function log($message,$payment){ |
|
203 | - if($payment instanceof EEI_Payment){ |
|
204 | - $type='Payment'; |
|
202 | + public function log($message, $payment) { |
|
203 | + if ($payment instanceof EEI_Payment) { |
|
204 | + $type = 'Payment'; |
|
205 | 205 | $id = $payment->ID(); |
206 | - }else{ |
|
206 | + } else { |
|
207 | 207 | $type = 'Payment_Method'; |
208 | 208 | $id = $this->_ID; |
209 | 209 | } |
210 | - $this->_pay_log->gateway_log($message,$id,$type); |
|
210 | + $this->_pay_log->gateway_log($message, $id, $type); |
|
211 | 211 | } |
212 | 212 | /** |
213 | 213 | * Formats the amount so it can generally be sent to gateways |
214 | 214 | * @param float $amount |
215 | 215 | * @return string |
216 | 216 | */ |
217 | - public function format_currency($amount){ |
|
218 | - return number_format( $amount, 2, '.', '' ); |
|
217 | + public function format_currency($amount) { |
|
218 | + return number_format($amount, 2, '.', ''); |
|
219 | 219 | // return $this->_template->format_currency($amount, true); |
220 | 220 | } |
221 | 221 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * or a string indicating they're all supported (EE_gateway::all_currencies_supported) |
225 | 225 | * @return mixed array or string |
226 | 226 | */ |
227 | - public function currencies_supported(){ |
|
227 | + public function currencies_supported() { |
|
228 | 228 | return $this->_currencies_supported; |
229 | 229 | } |
230 | 230 | |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | * @param EE_Transaction $transaction |
237 | 237 | * @return float |
238 | 238 | */ |
239 | - protected function _sum_items_and_taxes( EE_Transaction $transaction){ |
|
239 | + protected function _sum_items_and_taxes(EE_Transaction $transaction) { |
|
240 | 240 | $total_line_item = $transaction->total_line_item(); |
241 | 241 | $total = 0; |
242 | - foreach($total_line_item->get_items() as $item_line_item ){ |
|
243 | - $total += max( $item_line_item->total(), 0 ); |
|
242 | + foreach ($total_line_item->get_items() as $item_line_item) { |
|
243 | + $total += max($item_line_item->total(), 0); |
|
244 | 244 | } |
245 | - foreach($total_line_item->tax_descendants() as $tax_line_item ){ |
|
246 | - $total += max( $tax_line_item->total(), 0 ); |
|
245 | + foreach ($total_line_item->tax_descendants() as $tax_line_item) { |
|
246 | + $total += max($tax_line_item->total(), 0); |
|
247 | 247 | } |
248 | 248 | return $total; |
249 | 249 | } |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | * @param EEI_Payment $payment |
255 | 255 | * @return boolean |
256 | 256 | */ |
257 | - protected function _can_easily_itemize_transaction_for( EEI_Payment $payment ){ |
|
257 | + protected function _can_easily_itemize_transaction_for(EEI_Payment $payment) { |
|
258 | 258 | return $this->_money->compare_floats( |
259 | - $this->_sum_items_and_taxes( $payment->transaction() ), |
|
259 | + $this->_sum_items_and_taxes($payment->transaction()), |
|
260 | 260 | $payment->transaction()->total() ) && |
261 | 261 | $this->_money->compare_floats( |
262 | 262 | $payment->amount(), |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * @param EE_Payment $payment |
275 | 275 | * @return void |
276 | 276 | */ |
277 | - public function update_txn_based_on_payment( $payment ){ |
|
277 | + public function update_txn_based_on_payment($payment) { |
|
278 | 278 | //maybe update the transaction or line items or registrations |
279 | 279 | //but most gateways don't need to do this, because they only update the payment |
280 | 280 | } |
@@ -284,11 +284,11 @@ discard block |
||
284 | 284 | * @param EEI_Payment $payment |
285 | 285 | * @return EEI_Event|null |
286 | 286 | */ |
287 | - protected function _get_first_event_for_payment( EEI_Payment $payment ) { |
|
287 | + protected function _get_first_event_for_payment(EEI_Payment $payment) { |
|
288 | 288 | $transaction = $payment->transaction(); |
289 | - if( $transaction instanceof EEI_Transaction ) { |
|
289 | + if ($transaction instanceof EEI_Transaction) { |
|
290 | 290 | $primary_registrant = $transaction->primary_registration(); |
291 | - if( $primary_registrant instanceof EE_Registration ) { |
|
291 | + if ($primary_registrant instanceof EE_Registration) { |
|
292 | 292 | return $primary_registrant->event_obj(); |
293 | 293 | } |
294 | 294 | } |
@@ -300,19 +300,19 @@ discard block |
||
300 | 300 | * @param EEI_Payment $payment |
301 | 301 | * @return string |
302 | 302 | */ |
303 | - protected function _get_first_event_name_for_payment( EEI_Payment $payment ) { |
|
304 | - $event = $this->_get_first_event_for_payment( $payment ); |
|
305 | - return $event instanceof EEI_Event ? $event->name() : __( 'Event', 'event_espresso' ); |
|
303 | + protected function _get_first_event_name_for_payment(EEI_Payment $payment) { |
|
304 | + $event = $this->_get_first_event_for_payment($payment); |
|
305 | + return $event instanceof EEI_Event ? $event->name() : __('Event', 'event_espresso'); |
|
306 | 306 | } |
307 | 307 | /** |
308 | 308 | * Gets the text to use for a gateway's line item name when this is a partial payment |
309 | 309 | * @param EE_Payment $payment |
310 | 310 | * @return string |
311 | 311 | */ |
312 | - protected function _format_partial_payment_line_item_name( EEI_Payment $payment ){ |
|
312 | + protected function _format_partial_payment_line_item_name(EEI_Payment $payment) { |
|
313 | 313 | return apply_filters( |
314 | 314 | 'EEG_Paypal_Pro__do_direct_payment__partial_amount_line_item_name', |
315 | - $this->_get_first_event_name_for_payment( $payment ), |
|
315 | + $this->_get_first_event_name_for_payment($payment), |
|
316 | 316 | $this, |
317 | 317 | $payment |
318 | 318 | ); |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | * @param EEI_Payment $payment |
323 | 323 | * @return string |
324 | 324 | */ |
325 | - protected function _format_partial_payment_line_item_desc( EEI_Payment $payment ) { |
|
325 | + protected function _format_partial_payment_line_item_desc(EEI_Payment $payment) { |
|
326 | 326 | return apply_filters( |
327 | 327 | 'FHEE__EE_Gateway___partial_payment_desc', |
328 | 328 | sprintf( |
329 | 329 | __("Payment of %s for %s", "event_espresso"), |
330 | - $payment->get_pretty( 'PAY_amount', 'no_currency_code' ), |
|
331 | - $this->_get_first_event_name_for_payment( $payment ) ), |
|
330 | + $payment->get_pretty('PAY_amount', 'no_currency_code'), |
|
331 | + $this->_get_first_event_name_for_payment($payment) ), |
|
332 | 332 | $this, |
333 | 333 | $payment |
334 | 334 | ); |
@@ -340,10 +340,10 @@ discard block |
||
340 | 340 | * @param EEI_Payment $payment |
341 | 341 | * @return string |
342 | 342 | */ |
343 | - protected function _format_line_item_name( EEI_Line_Item $line_item, EEI_Payment $payment ) { |
|
343 | + protected function _format_line_item_name(EEI_Line_Item $line_item, EEI_Payment $payment) { |
|
344 | 344 | return apply_filters( |
345 | 345 | 'FHEE__EE_gateway___line_item_name', |
346 | - sprintf( _x( '%1$s for %2$s', 'Ticket for Event', 'event_espresso' ), $line_item->name(), $line_item->ticket_event_name() ), |
|
346 | + sprintf(_x('%1$s for %2$s', 'Ticket for Event', 'event_espresso'), $line_item->name(), $line_item->ticket_event_name()), |
|
347 | 347 | $this, |
348 | 348 | $line_item, |
349 | 349 | $payment |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @param EEI_Payment $payment |
357 | 357 | * @return string |
358 | 358 | */ |
359 | - protected function _format_line_item_desc( EEI_Line_Item $line_item, EEI_Payment $payment ) { |
|
359 | + protected function _format_line_item_desc(EEI_Line_Item $line_item, EEI_Payment $payment) { |
|
360 | 360 | return apply_filters( |
361 | 361 | 'FHEE__EE_Gateway___line_item_desc', |
362 | 362 | $line_item->desc(), |
@@ -371,13 +371,13 @@ discard block |
||
371 | 371 | * @param EEI_Payment $payment |
372 | 372 | * @return type |
373 | 373 | */ |
374 | - protected function _format_order_description( EEI_Payment $payment ) { |
|
374 | + protected function _format_order_description(EEI_Payment $payment) { |
|
375 | 375 | return apply_filters( |
376 | 376 | 'FHEE__EE_Gateway___order_description', |
377 | 377 | sprintf( |
378 | 378 | __('Event Registrations from %1$s for %2$s', "event_espresso"), |
379 | 379 | get_bloginfo('name'), |
380 | - $this->_get_first_event_name_for_payment( $payment ) ), |
|
380 | + $this->_get_first_event_name_for_payment($payment) ), |
|
381 | 381 | $this, |
382 | 382 | $payment |
383 | 383 | ); |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | /** |
43 | 43 | * EE_Attendee_Shortcodes constructor. |
44 | - */ |
|
44 | + */ |
|
45 | 45 | public function __construct() { |
46 | 46 | parent::__construct(); |
47 | 47 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -49,26 +49,26 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _init_props() { |
52 | - $this->label = esc_html__( 'Attendee Shortcodes', 'event_espresso' ); |
|
53 | - $this->description = esc_html__( 'All shortcodes specific to attendee related data', 'event_espresso' ); |
|
52 | + $this->label = esc_html__('Attendee Shortcodes', 'event_espresso'); |
|
53 | + $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso'); |
|
54 | 54 | $this->_shortcodes = array( |
55 | - '[FNAME]' => esc_html__( 'First Name of an attendee.', 'event_espresso' ), |
|
56 | - '[LNAME]' => esc_html__( 'Last Name of an attendee.', 'event_espresso' ), |
|
57 | - '[ATTENDEE_EMAIL]' => esc_html__( 'Email address for the attendee.', 'event_espresso' ), |
|
58 | - '[EDIT_ATTENDEE_LINK]' => esc_html__( 'Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso' ), |
|
59 | - '[REGISTRATION_ID]' => esc_html__( 'Unique Registration ID for the registration', 'event_espresso' ), |
|
60 | - '[REGISTRATION_CODE]' => esc_html__( 'Unique Registration Code for the registration', 'event_espresso' ), |
|
61 | - '[REGISTRATION_STATUS_ID]' => esc_html__( 'Parses to the registration status for the attendee', 'event_espresso' ), |
|
62 | - '[REGISTRATION_STATUS_LABEL]' => esc_html__( 'Parses to the status label for the registrant', 'event_espresso' ), |
|
63 | - '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__( 'Parses to the total amount paid for this registration.', 'event_espresso' ), |
|
64 | - '[FRONTEND_EDIT_REG_LINK]' => esc_html__( 'Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso' ), |
|
65 | - '[PHONE_NUMBER]' => esc_html__( 'The Phone Number for the Registration.', 'event_espresso' ), |
|
66 | - '[ADDRESS]' => esc_html__( 'The Address for the Registration', 'event_espresso' ), |
|
67 | - '[ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the registration.', 'event_espresso' ), |
|
68 | - '[CITY]' => esc_html__( 'The city for the registration.', 'event_espresso' ), |
|
69 | - '[ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the Registration.', 'event_espresso' ), |
|
70 | - '[ADDRESS_STATE]' => esc_html__( 'The state/province for the registration.', 'event_espresso' ), |
|
71 | - '[COUNTRY]' => esc_html__( 'The country for the registration.', 'event_espresso' ) |
|
55 | + '[FNAME]' => esc_html__('First Name of an attendee.', 'event_espresso'), |
|
56 | + '[LNAME]' => esc_html__('Last Name of an attendee.', 'event_espresso'), |
|
57 | + '[ATTENDEE_EMAIL]' => esc_html__('Email address for the attendee.', 'event_espresso'), |
|
58 | + '[EDIT_ATTENDEE_LINK]' => esc_html__('Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso'), |
|
59 | + '[REGISTRATION_ID]' => esc_html__('Unique Registration ID for the registration', 'event_espresso'), |
|
60 | + '[REGISTRATION_CODE]' => esc_html__('Unique Registration Code for the registration', 'event_espresso'), |
|
61 | + '[REGISTRATION_STATUS_ID]' => esc_html__('Parses to the registration status for the attendee', 'event_espresso'), |
|
62 | + '[REGISTRATION_STATUS_LABEL]' => esc_html__('Parses to the status label for the registrant', 'event_espresso'), |
|
63 | + '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__('Parses to the total amount paid for this registration.', 'event_espresso'), |
|
64 | + '[FRONTEND_EDIT_REG_LINK]' => esc_html__('Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso'), |
|
65 | + '[PHONE_NUMBER]' => esc_html__('The Phone Number for the Registration.', 'event_espresso'), |
|
66 | + '[ADDRESS]' => esc_html__('The Address for the Registration', 'event_espresso'), |
|
67 | + '[ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the registration.', 'event_espresso'), |
|
68 | + '[CITY]' => esc_html__('The city for the registration.', 'event_espresso'), |
|
69 | + '[ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the Registration.', 'event_espresso'), |
|
70 | + '[ADDRESS_STATE]' => esc_html__('The state/province for the registration.', 'event_espresso'), |
|
71 | + '[COUNTRY]' => esc_html__('The country for the registration.', 'event_espresso') |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | * @return string |
83 | 83 | * @throws \EE_Error |
84 | 84 | */ |
85 | - protected function _parser( $shortcode ) { |
|
85 | + protected function _parser($shortcode) { |
|
86 | 86 | |
87 | 87 | |
88 | - $this->_xtra = ! empty( $this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
88 | + $this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
89 | 89 | ? $this->_extra_data['data'] |
90 | 90 | : null; |
91 | 91 | |
@@ -94,34 +94,34 @@ discard block |
||
94 | 94 | ? null |
95 | 95 | : $this->_data; |
96 | 96 | |
97 | - if ( ! $registration instanceof EE_Registration ) { |
|
97 | + if ( ! $registration instanceof EE_Registration) { |
|
98 | 98 | //let's attempt to get the txn_id for the error message. |
99 | - $txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction |
|
99 | + $txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction |
|
100 | 100 | ? $this->_xtra->txn->ID() |
101 | - : esc_html__( 'Unknown', 'event_espresso' ); |
|
102 | - $msg = esc_html__( 'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso' ); |
|
101 | + : esc_html__('Unknown', 'event_espresso'); |
|
102 | + $msg = esc_html__('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso'); |
|
103 | 103 | $dev_msg = sprintf( |
104 | - esc_html__( 'The transaction ID for this request is: %s', 'event_espresso' ), |
|
104 | + esc_html__('The transaction ID for this request is: %s', 'event_espresso'), |
|
105 | 105 | $txn_id |
106 | 106 | ); |
107 | - throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
|
107 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | //attendee obj for this registration |
111 | - $attendee = isset( $this->_xtra->registrations[ $registration->ID() ]['att_obj'] ) |
|
112 | - ? $this->_xtra->registrations[ $registration->ID() ]['att_obj'] |
|
113 | - : null ; |
|
111 | + $attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj']) |
|
112 | + ? $this->_xtra->registrations[$registration->ID()]['att_obj'] |
|
113 | + : null; |
|
114 | 114 | |
115 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
116 | - $msg = esc_html__( 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso' ); |
|
115 | + if ( ! $attendee instanceof EE_Attendee) { |
|
116 | + $msg = esc_html__('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso'); |
|
117 | 117 | $dev_msg = sprintf( |
118 | - esc_html__( 'The registration ID for this request is: %s', 'event_espresso' ), |
|
118 | + esc_html__('The registration ID for this request is: %s', 'event_espresso'), |
|
119 | 119 | $registration->ID() |
120 | 120 | ); |
121 | - throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
|
121 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
122 | 122 | } |
123 | 123 | |
124 | - switch ( $shortcode ) { |
|
124 | + switch ($shortcode) { |
|
125 | 125 | |
126 | 126 | case '[FNAME]' : |
127 | 127 | return $attendee->fname(); |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | * @param string $shortcode |
62 | 62 | * @return string |
63 | 63 | */ |
64 | - protected function _parser( $shortcode ) { |
|
64 | + protected function _parser($shortcode) { |
|
65 | 65 | |
66 | - if ( ! $this->_data instanceof EE_Datetime ) { |
|
66 | + if ( ! $this->_data instanceof EE_Datetime) { |
|
67 | 67 | return ''; //get out cause we can only parse with the datetime object. |
68 | 68 | } |
69 | 69 | |
70 | - switch ( $shortcode ) { |
|
70 | + switch ($shortcode) { |
|
71 | 71 | |
72 | 72 | case '[DATETIME_START]' : |
73 | 73 | return $this->_data->get_i18n_datetime('DTT_EVT_start'); |
@@ -81,27 +81,27 @@ discard block |
||
81 | 81 | return $this->_data->get_timezone(); |
82 | 82 | break; |
83 | 83 | case '[DATE_START]' : |
84 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_start', get_option( 'date_format' ) ); |
|
84 | + return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('date_format')); |
|
85 | 85 | break; |
86 | 86 | case '[DATE_END]' : |
87 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_end', get_option( 'date_format' ) ); |
|
87 | + return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('date_format')); |
|
88 | 88 | break; |
89 | 89 | case '[TIME_START]' : |
90 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_start', get_option( 'time_format' ) ); |
|
90 | + return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('time_format')); |
|
91 | 91 | break; |
92 | 92 | case '[TIME_END]' : |
93 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_end', get_option( 'time_format' ) ); |
|
93 | + return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('time_format')); |
|
94 | 94 | break; |
95 | 95 | } |
96 | 96 | |
97 | - if ( strpos( $shortcode, '[ICAL_LINK_*') !== FALSE ) { |
|
98 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
97 | + if (strpos($shortcode, '[ICAL_LINK_*') !== FALSE) { |
|
98 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
99 | 99 | |
100 | - $link_text = empty( $attrs['link_text'] ) ? __( 'Add to iCal Calendar', 'event_espresso' ) : $attrs['link_text']; |
|
100 | + $link_text = empty($attrs['link_text']) ? __('Add to iCal Calendar', 'event_espresso') : $attrs['link_text']; |
|
101 | 101 | |
102 | - $URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $this->_data->ID() ), site_url() ); |
|
102 | + $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $this->_data->ID()), site_url()); |
|
103 | 103 | |
104 | - return '<a class="ee-ical" href="' . $URL . '">' . $link_text . '</a>'; |
|
104 | + return '<a class="ee-ical" href="'.$URL.'">'.$link_text.'</a>'; |
|
105 | 105 | |
106 | 106 | } |
107 | 107 |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -58,96 +58,96 @@ discard block |
||
58 | 58 | '[CO_GOOGLE_URL]' => esc_html__('Link to organization Google page', 'event_espresso'), |
59 | 59 | '[CO_LINKEDIN_URL]' => esc_html__('Link to organization LinkedIn page', 'event_espresso'), |
60 | 60 | '[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'), |
61 | - '[CO_TAX_NUMBER_*]' => sprintf( esc_html__('This is the shortcode used for displaying any tax number for the company. %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56. Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso' ),'<strong>','</strong>') |
|
61 | + '[CO_TAX_NUMBER_*]' => sprintf(esc_html__('This is the shortcode used for displaying any tax number for the company. %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56. Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso'), '<strong>', '</strong>') |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | - protected function _parser( $shortcode ) { |
|
66 | + protected function _parser($shortcode) { |
|
67 | 67 | |
68 | - switch ( $shortcode ) { |
|
68 | + switch ($shortcode) { |
|
69 | 69 | |
70 | 70 | case '[COMPANY]' : |
71 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
71 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
72 | 72 | break; |
73 | 73 | |
74 | 74 | case '[CO_ADD1]' : |
75 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ); |
|
75 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_1'); |
|
76 | 76 | break; |
77 | 77 | |
78 | 78 | case '[CO_ADD2]' : |
79 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ); |
|
79 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_2'); |
|
80 | 80 | break; |
81 | 81 | |
82 | 82 | case '[CO_CITY]' : |
83 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'city' ); |
|
83 | + return EE_Registry::instance()->CFG->organization->get_pretty('city'); |
|
84 | 84 | break; |
85 | 85 | |
86 | 86 | case '[CO_STATE]' : |
87 | - $state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( EE_Registry::instance()->CFG->organization->STA_ID ); |
|
87 | + $state = EE_Registry::instance()->load_model('State')->get_one_by_ID(EE_Registry::instance()->CFG->organization->STA_ID); |
|
88 | 88 | return $state->name(); |
89 | 89 | break; |
90 | 90 | |
91 | 91 | case '[CO_ZIP]' : |
92 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ); |
|
92 | + return EE_Registry::instance()->CFG->organization->get_pretty('zip'); |
|
93 | 93 | break; |
94 | 94 | |
95 | 95 | case '[CO_EMAIL]' : |
96 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
96 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
97 | 97 | break; |
98 | 98 | |
99 | 99 | case '[CO_PHONE]' : |
100 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ); |
|
100 | + return EE_Registry::instance()->CFG->organization->get_pretty('phone'); |
|
101 | 101 | break; |
102 | 102 | |
103 | 103 | case '[CO_LOGO]' : |
104 | - return '<img src="' . EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) . '" id="headerImage" />'; |
|
104 | + return '<img src="'.EE_Registry::instance()->CFG->organization->get_pretty('logo_url').'" id="headerImage" />'; |
|
105 | 105 | break; |
106 | 106 | |
107 | 107 | case '[CO_LOGO_URL]' : |
108 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
108 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
109 | 109 | break; |
110 | 110 | |
111 | 111 | case '[CO_FACEBOOK_URL]' : |
112 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
112 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
113 | 113 | break; |
114 | 114 | |
115 | 115 | case '[CO_TWITTER_URL]' : |
116 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
116 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
117 | 117 | break; |
118 | 118 | |
119 | 119 | case '[CO_PINTEREST_URL]' : |
120 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
120 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
121 | 121 | break; |
122 | 122 | |
123 | 123 | case '[CO_LINKEDIN_URL]' : |
124 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
124 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
125 | 125 | break; |
126 | 126 | |
127 | 127 | case '[CO_GOOGLE_URL]' : |
128 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
128 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
129 | 129 | break; |
130 | 130 | |
131 | 131 | case '[CO_INSTAGRAM_URL]' : |
132 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
132 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
133 | 133 | break; |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | 137 | //also allow for parameter shortcode |
138 | - if ( strpos( $shortcode, '[CO_TAX_NUMBER_*' ) !== FALSE ) { |
|
138 | + if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== FALSE) { |
|
139 | 139 | //first see if there is any company tax number set and bail early if not |
140 | 140 | $tax_number = EE_Registry::instance()->CFG->organization->vat; |
141 | - if ( empty( $tax_number ) ) { |
|
141 | + if (empty($tax_number)) { |
|
142 | 142 | return ''; |
143 | 143 | } |
144 | 144 | |
145 | 145 | //see if there are any attributes. |
146 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
146 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
147 | 147 | |
148 | 148 | //set custom attrs if present (or default) |
149 | - $prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
150 | - return $prefix . $tax_number; |
|
149 | + $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
150 | + return $prefix.$tax_number; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return ''; |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return EED_Event_Single |
41 | 41 | */ |
42 | 42 | public static function instance() { |
43 | - return parent::get_instance( __CLASS__ ); |
|
43 | + return parent::get_instance(__CLASS__); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @return void |
53 | 53 | */ |
54 | 54 | public static function set_hooks() { |
55 | - add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
|
56 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
57 | - EE_Config::register_route( __( 'event', 'event_espresso' ), 'Event_Single', 'run' ); |
|
55 | + add_filter('FHEE_run_EE_wp', '__return_true'); |
|
56 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
57 | + EE_Config::register_route(__('event', 'event_espresso'), 'Event_Single', 'run'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return void |
65 | 65 | */ |
66 | 66 | public static function set_hooks_admin() { |
67 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
67 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @return void |
79 | 79 | */ |
80 | 80 | public static function set_definitions() { |
81 | - define( 'EVENT_SINGLE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
82 | - define( 'EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
81 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
82 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @void |
91 | 91 | */ |
92 | - protected function set_config(){ |
|
93 | - $this->set_config_section( 'template_settings' ); |
|
94 | - $this->set_config_class( 'EE_Event_Single_Config' ); |
|
95 | - $this->set_config_name( 'EED_Event_Single' ); |
|
92 | + protected function set_config() { |
|
93 | + $this->set_config_section('template_settings'); |
|
94 | + $this->set_config_class('EE_Event_Single_Config'); |
|
95 | + $this->set_config_name('EED_Event_Single'); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -105,35 +105,35 @@ discard block |
||
105 | 105 | * @param \EE_Event_Single_Config $config |
106 | 106 | * @return \EE_Template_Part_Manager |
107 | 107 | */ |
108 | - public function initialize_template_parts( EE_Event_Single_Config $config = null ) { |
|
108 | + public function initialize_template_parts(EE_Event_Single_Config $config = null) { |
|
109 | 109 | $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
110 | 110 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
111 | 111 | $template_parts = new EE_Template_Part_Manager(); |
112 | 112 | $template_parts->add_template_part( |
113 | 113 | 'tickets', |
114 | - __( 'Ticket Selector', 'event_espresso' ), |
|
114 | + __('Ticket Selector', 'event_espresso'), |
|
115 | 115 | 'content-espresso_events-tickets.php', |
116 | 116 | $config->display_order_tickets |
117 | 117 | ); |
118 | 118 | $template_parts->add_template_part( |
119 | 119 | 'datetimes', |
120 | - __( 'Dates and Times', 'event_espresso' ), |
|
120 | + __('Dates and Times', 'event_espresso'), |
|
121 | 121 | 'content-espresso_events-datetimes.php', |
122 | 122 | $config->display_order_datetimes |
123 | 123 | ); |
124 | 124 | $template_parts->add_template_part( |
125 | 125 | 'event', |
126 | - __( 'Event Description', 'event_espresso' ), |
|
126 | + __('Event Description', 'event_espresso'), |
|
127 | 127 | 'content-espresso_events-details.php', |
128 | 128 | $config->display_order_event |
129 | 129 | ); |
130 | 130 | $template_parts->add_template_part( |
131 | 131 | 'venue', |
132 | - __( 'Venue Information', 'event_espresso' ), |
|
132 | + __('Venue Information', 'event_espresso'), |
|
133 | 133 | 'content-espresso_events-venues.php', |
134 | 134 | $config->display_order_venue |
135 | 135 | ); |
136 | - do_action( 'AHEE__EED_Event_Single__initialize_template_parts', $template_parts ); |
|
136 | + do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
137 | 137 | return $template_parts; |
138 | 138 | } |
139 | 139 | |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
150 | + public function run($WP) { |
|
151 | 151 | // ensure valid EE_Events_Single_Config() object exists |
152 | 152 | $this->set_config(); |
153 | 153 | // check what template is loaded |
154 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
155 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
154 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
155 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
156 | 156 | // load css |
157 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
157 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -166,27 +166,27 @@ discard block |
||
166 | 166 | * @param string $template |
167 | 167 | * @return string |
168 | 168 | */ |
169 | - public function template_include( $template ) { |
|
169 | + public function template_include($template) { |
|
170 | 170 | global $post; |
171 | 171 | /** @type EE_Event_Single_Config $config */ |
172 | 172 | $config = $this->config(); |
173 | - if ( $config->display_status_banner_single ) { |
|
174 | - add_filter( 'the_title', array( 'EED_Event_Single', 'the_title' ), 100, 2 ); |
|
173 | + if ($config->display_status_banner_single) { |
|
174 | + add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
175 | 175 | } |
176 | 176 | // not a custom template? |
177 | 177 | if ( |
178 | - EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_events.php' |
|
179 | - || apply_filters( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE ) |
|
180 | - && ! post_password_required( $post ) |
|
178 | + EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_events.php' |
|
179 | + || apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE) |
|
180 | + && ! post_password_required($post) |
|
181 | 181 | ) { |
182 | 182 | EEH_Template::load_espresso_theme_functions(); |
183 | 183 | // then add extra event data via hooks |
184 | - add_action( 'loop_start', array( 'EED_Event_Single', 'loop_start' )); |
|
185 | - add_filter( 'get_the_excerpt', array( 'EED_Event_Single', 'get_the_excerpt' ), 1, 1 ); |
|
186 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
187 | - add_action( 'loop_end', array( 'EED_Event_Single', 'loop_end' )); |
|
184 | + add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
185 | + add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
186 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
187 | + add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
188 | 188 | // don't display entry meta because the existing theme will take car of that |
189 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
189 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
190 | 190 | } |
191 | 191 | return $template; |
192 | 192 | } |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * @param array $wp_query_array an array containing the WP_Query object |
201 | 201 | * @return void |
202 | 202 | */ |
203 | - public static function loop_start( $wp_query_array ) { |
|
203 | + public static function loop_start($wp_query_array) { |
|
204 | 204 | global $post; |
205 | - do_action( 'AHEE_event_details_before_post', $post, $wp_query_array ); |
|
205 | + do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | * @param int $id |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public static function the_title( $title = '', $id = 0 ) { |
|
218 | + public static function the_title($title = '', $id = 0) { |
|
219 | 219 | global $post; |
220 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
220 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | * @param string $excerpt |
230 | 230 | * @return string |
231 | 231 | */ |
232 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
232 | + public static function get_the_excerpt($excerpt = '') { |
|
233 | 233 | EED_Event_Single::$using_get_the_excerpt = true; |
234 | - add_filter( 'wp_trim_excerpt', array( 'EED_Event_Single', 'end_get_the_excerpt' ), 999, 1 ); |
|
234 | + add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
235 | 235 | return $excerpt; |
236 | 236 | } |
237 | 237 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param string $text |
245 | 245 | * @return string |
246 | 246 | */ |
247 | - public static function end_get_the_excerpt( $text = '' ) { |
|
247 | + public static function end_get_the_excerpt($text = '') { |
|
248 | 248 | EED_Event_Single::$using_get_the_excerpt = false; |
249 | 249 | return $text; |
250 | 250 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @param string $content |
259 | 259 | * @return string |
260 | 260 | */ |
261 | - public static function event_details( $content ) { |
|
261 | + public static function event_details($content) { |
|
262 | 262 | global $post; |
263 | 263 | static $current_post_ID = 0; |
264 | 264 | if ( |
@@ -273,15 +273,15 @@ discard block |
||
273 | 273 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
274 | 274 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
275 | 275 | // so the following allows this filter to be applied multiple times, but only once for real |
276 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
277 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order ) { |
|
276 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
277 | + if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
278 | 278 | // we need to first remove this callback from being applied to the_content() |
279 | 279 | // (otherwise it will recurse and blow up the interweb) |
280 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
280 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
281 | 281 | EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
282 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
283 | - $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters( $content ); |
|
284 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
282 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
283 | + $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
284 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
285 | 285 | } else { |
286 | 286 | $content = EED_Event_Single::use_filterable_display_order(); |
287 | 287 | } |
@@ -302,19 +302,19 @@ discard block |
||
302 | 302 | // it uses the_content() for displaying the $post->post_content |
303 | 303 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
304 | 304 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
305 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
305 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
306 | 306 | //now add additional content |
307 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110, 1 ); |
|
308 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120, 1 ); |
|
309 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130, 1 ); |
|
310 | - do_action( 'AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters' ); |
|
307 | + add_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110, 1); |
|
308 | + add_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120, 1); |
|
309 | + add_filter('the_content', array('EED_Event_Single', 'event_venues'), 130, 1); |
|
310 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
311 | 311 | // now load our template |
312 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
312 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
313 | 313 | //now add our filter back in, plus some others |
314 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
315 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 ); |
|
316 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 ); |
|
317 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130 ); |
|
314 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
315 | + remove_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110); |
|
316 | + remove_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120); |
|
317 | + remove_filter('the_content', array('EED_Event_Single', 'event_venues'), 130); |
|
318 | 318 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
319 | 319 | return $content; |
320 | 320 | } |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | * @param string $content |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - public static function event_datetimes( $content ) { |
|
332 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
331 | + public static function event_datetimes($content) { |
|
332 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | * @param string $content |
342 | 342 | * @return string |
343 | 343 | */ |
344 | - public static function event_tickets( $content ) { |
|
345 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
344 | + public static function event_tickets($content) { |
|
345 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | * @param string $content |
355 | 355 | * @return string |
356 | 356 | */ |
357 | - public static function event_venue( $content ) { |
|
358 | - return EED_Event_Single::event_venues( $content ); |
|
357 | + public static function event_venue($content) { |
|
358 | + return EED_Event_Single::event_venues($content); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | * @param string $content |
368 | 368 | * @return string |
369 | 369 | */ |
370 | - public static function event_venues( $content ) { |
|
371 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
370 | + public static function event_venues($content) { |
|
371 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -380,9 +380,9 @@ discard block |
||
380 | 380 | * @param array $wp_query_array an array containing the WP_Query object |
381 | 381 | * @return void |
382 | 382 | */ |
383 | - public static function loop_end( $wp_query_array ) { |
|
383 | + public static function loop_end($wp_query_array) { |
|
384 | 384 | global $post; |
385 | - do_action( 'AHEE_event_details_after_post', $post, $wp_query_array ); |
|
385 | + do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -395,16 +395,16 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public function wp_enqueue_scripts() { |
397 | 397 | // get some style |
398 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && apply_filters( 'FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE )) { |
|
398 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)) { |
|
399 | 399 | // first check uploads folder |
400 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
401 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
400 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
401 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
402 | 402 | } else { |
403 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
403 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
404 | 404 | } |
405 | - wp_enqueue_script( $this->theme ); |
|
406 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
407 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
405 | + wp_enqueue_script($this->theme); |
|
406 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
407 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | } |
@@ -425,9 +425,9 @@ discard block |
||
425 | 425 | public static function display_venue() { |
426 | 426 | /** @type EE_Event_Single_Config $config */ |
427 | 427 | $config = EED_Event_Single::instance()->config(); |
428 | - $display_venue= isset( $config->display_venue ) ? $config->display_venue : TRUE; |
|
428 | + $display_venue = isset($config->display_venue) ? $config->display_venue : TRUE; |
|
429 | 429 | $venue_name = EEH_Venue_View::venue_name(); |
430 | - return $display_venue && ! empty( $venue_name ) ? TRUE : FALSE; |
|
430 | + return $display_venue && ! empty($venue_name) ? TRUE : FALSE; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -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 | } |
@@ -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,72 +123,72 @@ 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 | - $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 | + $location = espresso_venue_raw_address('inline', $venue->ID(), FALSE); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | // set variables, escape strings, convert timestamps to ics format, etc |
147 | - $filename = $event->slug() . '-' . $datetime->start_date( 'Y-m-d' ) . '.ics'; |
|
148 | - $organizer = EED_Ical::_escape_ICal_data( EE_Registry::instance()->CFG->organization->name ); |
|
149 | - $UID = EED_Ical::_escape_ICal_data( md5( $event->name() . $event->ID() . $datetime->ID() )); |
|
150 | - $org_email = EED_Ical::_escape_ICal_data( $datetime->ID() ); |
|
151 | - $timestamp = date( EED_Ical::iCal_datetime_format ); |
|
152 | - $location = EED_Ical::_escape_ICal_data( $location ); |
|
153 | - $summary = EED_Ical::_escape_ICal_data( $event->name() ); |
|
154 | - $description = EED_Ical::_escape_ICal_description( wp_strip_all_tags( $event->description() )); |
|
147 | + $filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics'; |
|
148 | + $organizer = EED_Ical::_escape_ICal_data(EE_Registry::instance()->CFG->organization->name); |
|
149 | + $UID = EED_Ical::_escape_ICal_data(md5($event->name().$event->ID().$datetime->ID())); |
|
150 | + $org_email = EED_Ical::_escape_ICal_data($datetime->ID()); |
|
151 | + $timestamp = date(EED_Ical::iCal_datetime_format); |
|
152 | + $location = EED_Ical::_escape_ICal_data($location); |
|
153 | + $summary = EED_Ical::_escape_ICal_data($event->name()); |
|
154 | + $description = EED_Ical::_escape_ICal_description(wp_strip_all_tags($event->description())); |
|
155 | 155 | $status = $datetime->get_active_status(); |
156 | 156 | $status = $status == EE_Datetime::cancelled ? 'Cancelled' : 'Confirmed'; |
157 | - $status = EED_Ical::_escape_ICal_data( $status ); |
|
158 | - $categories = EED_Ical::_escape_ICal_data( $category ); |
|
159 | - $url = EED_Ical::_escape_ICal_data( get_permalink( $event->ID() )); |
|
160 | - $dtt_start = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->start() )); |
|
161 | - $dtt_end = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->end() )); |
|
157 | + $status = EED_Ical::_escape_ICal_data($status); |
|
158 | + $categories = EED_Ical::_escape_ICal_data($category); |
|
159 | + $url = EED_Ical::_escape_ICal_data(get_permalink($event->ID())); |
|
160 | + $dtt_start = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->start())); |
|
161 | + $dtt_end = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->end())); |
|
162 | 162 | // set headers |
163 | - header( 'Content-type: text/calendar; charset=utf-8' ); |
|
164 | - header( 'Content-Disposition: attachment; filename="' . $filename . '"' ); |
|
165 | - header( 'Cache-Control: private, max-age=0, must-revalidate' ); |
|
166 | - header( 'Pragma: public' ); |
|
167 | - header( 'Content-Type: application/octet-stream' ); |
|
168 | - header( 'Content-Type: application/force-download' ); |
|
169 | - header( 'Cache-Control: no-cache, must-revalidate' ); |
|
170 | - header( 'Content-Transfer-Encoding: binary' ); |
|
171 | - header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); // past date |
|
172 | - ini_set( 'zlib.output_compression', '0' ); |
|
163 | + header('Content-type: text/calendar; charset=utf-8'); |
|
164 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
165 | + header('Cache-Control: private, max-age=0, must-revalidate'); |
|
166 | + header('Pragma: public'); |
|
167 | + header('Content-Type: application/octet-stream'); |
|
168 | + header('Content-Type: application/force-download'); |
|
169 | + header('Cache-Control: no-cache, must-revalidate'); |
|
170 | + header('Content-Transfer-Encoding: binary'); |
|
171 | + header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date |
|
172 | + ini_set('zlib.output_compression', '0'); |
|
173 | 173 | // echo the output |
174 | - echo "BEGIN:VCALENDAR" . PHP_EOL; |
|
175 | - echo "VERSION:2.0" . PHP_EOL; |
|
176 | - echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN" . PHP_EOL; |
|
177 | - echo "CALSCALE:GREGORIAN" . PHP_EOL; |
|
178 | - echo "BEGIN:VEVENT" . PHP_EOL; |
|
179 | - echo "UID:{$UID}" . PHP_EOL; |
|
180 | - echo "ORGANIZER:MAILTO:{$org_email}" . PHP_EOL; |
|
181 | - echo "DTSTAMP:{$timestamp}" . PHP_EOL; |
|
182 | - echo "LOCATION:{$location}" . PHP_EOL; |
|
183 | - echo "SUMMARY:{$summary}" . PHP_EOL; |
|
184 | - echo "DESCRIPTION:{$description}" . PHP_EOL; |
|
185 | - echo "STATUS:{$status}" . PHP_EOL; |
|
186 | - echo "CATEGORIES:{$categories}" . PHP_EOL; |
|
187 | - echo "URL;VALUE=URI:{$url}" . PHP_EOL; |
|
188 | - echo "DTSTART:{$dtt_start}" . PHP_EOL; |
|
189 | - echo "DTEND:{$dtt_end}" . PHP_EOL; |
|
190 | - echo "END:VEVENT" . PHP_EOL; |
|
191 | - echo "END:VCALENDAR" . PHP_EOL; |
|
174 | + echo "BEGIN:VCALENDAR".PHP_EOL; |
|
175 | + echo "VERSION:2.0".PHP_EOL; |
|
176 | + echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN".PHP_EOL; |
|
177 | + echo "CALSCALE:GREGORIAN".PHP_EOL; |
|
178 | + echo "BEGIN:VEVENT".PHP_EOL; |
|
179 | + echo "UID:{$UID}".PHP_EOL; |
|
180 | + echo "ORGANIZER:MAILTO:{$org_email}".PHP_EOL; |
|
181 | + echo "DTSTAMP:{$timestamp}".PHP_EOL; |
|
182 | + echo "LOCATION:{$location}".PHP_EOL; |
|
183 | + echo "SUMMARY:{$summary}".PHP_EOL; |
|
184 | + echo "DESCRIPTION:{$description}".PHP_EOL; |
|
185 | + echo "STATUS:{$status}".PHP_EOL; |
|
186 | + echo "CATEGORIES:{$categories}".PHP_EOL; |
|
187 | + echo "URL;VALUE=URI:{$url}".PHP_EOL; |
|
188 | + echo "DTSTART:{$dtt_start}".PHP_EOL; |
|
189 | + echo "DTEND:{$dtt_end}".PHP_EOL; |
|
190 | + echo "END:VEVENT".PHP_EOL; |
|
191 | + echo "END:VCALENDAR".PHP_EOL; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | die(); |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | * @param string $string |
204 | 204 | * @return string |
205 | 205 | */ |
206 | - private static function _escape_ICal_data( $string = '' ) { |
|
207 | - return preg_replace( '/([\,;])/', '\\\$1', $string ); |
|
206 | + private static function _escape_ICal_data($string = '') { |
|
207 | + return preg_replace('/([\,;])/', '\\\$1', $string); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -214,13 +214,13 @@ discard block |
||
214 | 214 | * @param string $description |
215 | 215 | * @return string |
216 | 216 | */ |
217 | - private static function _escape_ICal_description( $description = '' ) { |
|
217 | + private static function _escape_ICal_description($description = '') { |
|
218 | 218 | |
219 | 219 | //Escape spcial chars within the decription |
220 | - $description = EED_Ical::_escape_ICal_data( $description ); |
|
220 | + $description = EED_Ical::_escape_ICal_data($description); |
|
221 | 221 | |
222 | 222 | //Remove line breaks and output in iCal format |
223 | - $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
223 | + $description = str_replace(array("\r\n", "\n"), '\n', $description); |
|
224 | 224 | |
225 | 225 | return $description; |
226 | 226 | } |
@@ -808,7 +808,7 @@ |
||
808 | 808 | |
809 | 809 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
810 | 810 | |
811 | - } else { |
|
811 | + } else { |
|
812 | 812 | EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
813 | 813 | // remove malformed data |
814 | 814 | unset( $valid_data[ $reg_url_link ] ); |
@@ -588,6 +588,7 @@ discard block |
||
588 | 588 | * @param EE_Registration $registration |
589 | 589 | * @param EE_Question $question |
590 | 590 | * @param mixed EE_Answer|NULL $answer |
591 | + * @param EE_Answer $answer |
|
591 | 592 | * @return EE_Form_Input_Base |
592 | 593 | * @throws \EE_Error |
593 | 594 | */ |
@@ -1190,7 +1191,7 @@ discard block |
||
1190 | 1191 | * |
1191 | 1192 | * @param EE_Registration $registration |
1192 | 1193 | * @param array $attendee_data |
1193 | - * @return boolean|EE_Attendee |
|
1194 | + * @return EE_Attendee |
|
1194 | 1195 | * @throws \EE_Error |
1195 | 1196 | */ |
1196 | 1197 | private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -135,33 +135,33 @@ discard block |
||
135 | 135 | $registration instanceof EE_Registration |
136 | 136 | && $this->checkout->visit_allows_processing_of_this_registration( $registration ) |
137 | 137 | ) { |
138 | - $attendee_reg_form = $this->_registrations_reg_form($registration); |
|
139 | - if ($attendee_reg_form instanceof EE_Form_Section_Proper) { |
|
140 | - $subsections[$registration->reg_url_link()] = $attendee_reg_form; |
|
141 | - if ( ! $this->checkout->admin_request) { |
|
142 | - $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
143 | - $template_args['ticket_count'][$registration->ticket()->ID()] = isset( |
|
144 | - $template_args['ticket_count'][$registration->ticket()->ID()] |
|
145 | - ) |
|
146 | - ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 |
|
147 | - : 1; |
|
148 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( |
|
149 | - $this->checkout->cart->get_grand_total(), |
|
150 | - 'Ticket', |
|
151 | - array($registration->ticket()->ID()) |
|
152 | - ); |
|
153 | - $ticket_line_item = is_array($ticket_line_item) |
|
154 | - ? reset($ticket_line_item) |
|
155 | - : $ticket_line_item; |
|
156 | - $template_args['ticket_line_item'][$registration->ticket() |
|
157 | - ->ID()] = $Line_Item_Display->display_line_item( |
|
158 | - $ticket_line_item |
|
159 | - ); |
|
160 | - } |
|
161 | - } |
|
162 | - if ($registration->is_primary_registrant()) { |
|
163 | - $primary_registrant = $registration->reg_url_link(); |
|
164 | - } |
|
138 | + $attendee_reg_form = $this->_registrations_reg_form($registration); |
|
139 | + if ($attendee_reg_form instanceof EE_Form_Section_Proper) { |
|
140 | + $subsections[$registration->reg_url_link()] = $attendee_reg_form; |
|
141 | + if ( ! $this->checkout->admin_request) { |
|
142 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
143 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset( |
|
144 | + $template_args['ticket_count'][$registration->ticket()->ID()] |
|
145 | + ) |
|
146 | + ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 |
|
147 | + : 1; |
|
148 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( |
|
149 | + $this->checkout->cart->get_grand_total(), |
|
150 | + 'Ticket', |
|
151 | + array($registration->ticket()->ID()) |
|
152 | + ); |
|
153 | + $ticket_line_item = is_array($ticket_line_item) |
|
154 | + ? reset($ticket_line_item) |
|
155 | + : $ticket_line_item; |
|
156 | + $template_args['ticket_line_item'][$registration->ticket() |
|
157 | + ->ID()] = $Line_Item_Display->display_line_item( |
|
158 | + $ticket_line_item |
|
159 | + ); |
|
160 | + } |
|
161 | + } |
|
162 | + if ($registration->is_primary_registrant()) { |
|
163 | + $primary_registrant = $registration->reg_url_link(); |
|
164 | + } |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | // print_copy_info ? |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | // generate hidden input |
174 | 174 | if ( |
175 | 175 | isset( $subsections[ $primary_registrant ] ) |
176 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
176 | + && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
177 | 177 | ) { |
178 | 178 | $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
179 | 179 | } |
@@ -208,35 +208,35 @@ discard block |
||
208 | 208 | */ |
209 | 209 | private function _registrations_reg_form( EE_Registration $registration ) { |
210 | 210 | static $attendee_nmbr = 1; |
211 | - $form_args = array(); |
|
211 | + $form_args = array(); |
|
212 | 212 | // verify that registration has valid event |
213 | 213 | if ( $registration->event() instanceof EE_Event ) { |
214 | 214 | $question_groups = $registration->event()->question_groups( |
215 | - array( |
|
216 | - array( |
|
217 | - 'Event.EVT_ID' => $registration->event()->ID(), |
|
218 | - 'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false |
|
219 | - ), |
|
220 | - 'order_by' => array('QSG_order' => 'ASC') |
|
221 | - ) |
|
222 | - ); |
|
215 | + array( |
|
216 | + array( |
|
217 | + 'Event.EVT_ID' => $registration->event()->ID(), |
|
218 | + 'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false |
|
219 | + ), |
|
220 | + 'order_by' => array('QSG_order' => 'ASC') |
|
221 | + ) |
|
222 | + ); |
|
223 | 223 | if ( $question_groups ) { |
224 | - // array of params to pass to parent constructor |
|
225 | - $form_args = array( |
|
226 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
227 | - 'html_class' => 'ee-reg-form-attendee-dv', |
|
228 | - 'html_style' => $this->checkout->admin_request |
|
229 | - ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
|
230 | - : '', |
|
231 | - 'subsections' => array(), |
|
232 | - 'layout_strategy' => new EE_Fieldset_Section_Layout( |
|
233 | - array( |
|
234 | - 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
|
235 | - 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
236 | - ) |
|
237 | - ) |
|
238 | - ); |
|
239 | - foreach ( $question_groups as $question_group ) { |
|
224 | + // array of params to pass to parent constructor |
|
225 | + $form_args = array( |
|
226 | + 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
227 | + 'html_class' => 'ee-reg-form-attendee-dv', |
|
228 | + 'html_style' => $this->checkout->admin_request |
|
229 | + ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
|
230 | + : '', |
|
231 | + 'subsections' => array(), |
|
232 | + 'layout_strategy' => new EE_Fieldset_Section_Layout( |
|
233 | + array( |
|
234 | + 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
|
235 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
236 | + ) |
|
237 | + ) |
|
238 | + ); |
|
239 | + foreach ( $question_groups as $question_group ) { |
|
240 | 240 | if ( $question_group instanceof EE_Question_Group ) { |
241 | 241 | $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( |
242 | 242 | $registration, |
@@ -244,19 +244,19 @@ discard block |
||
244 | 244 | ); |
245 | 245 | } |
246 | 246 | } |
247 | - // add hidden input |
|
248 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( |
|
249 | - $registration |
|
250 | - ); |
|
251 | - // if we have question groups for additional attendees, then display the copy options |
|
247 | + // add hidden input |
|
248 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( |
|
249 | + $registration |
|
250 | + ); |
|
251 | + // if we have question groups for additional attendees, then display the copy options |
|
252 | 252 | $this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info; |
253 | - if ($registration->is_primary_registrant()) { |
|
254 | - // generate hidden input |
|
255 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
256 | - } |
|
257 | - } |
|
253 | + if ($registration->is_primary_registrant()) { |
|
254 | + // generate hidden input |
|
255 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
256 | + } |
|
257 | + } |
|
258 | 258 | } |
259 | - $attendee_nmbr++; |
|
259 | + $attendee_nmbr++; |
|
260 | 260 | return ! empty($form_args) ? new EE_Form_Section_Proper( $form_args ) : null; |
261 | 261 | } |
262 | 262 | |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | if ( isset( $valid_data[ $reg_url_link ] ) ) { |
890 | 890 | // do we need to copy basic info from primary attendee ? |
891 | 891 | $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) |
892 | - && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
892 | + && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
893 | 893 | ? true |
894 | 894 | : false; |
895 | 895 | // filter form input data for this registration |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | ? $form_input |
1065 | 1065 | : $form_input . '-' . $registration->reg_url_link(); |
1066 | 1066 | $answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] ) |
1067 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1067 | + && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1068 | 1068 | ? true |
1069 | 1069 | : false; |
1070 | 1070 | //rename form_inputs if they are EE_Attendee properties |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | // then attempt to copy them from the primary attendee |
1185 | 1185 | if ( |
1186 | 1186 | $this->checkout->primary_attendee_obj instanceof EE_Attendee |
1187 | - && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1187 | + && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1188 | 1188 | ) { |
1189 | 1189 | return $this->checkout->primary_attendee_obj; |
1190 | 1190 | } |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | } |
1303 | 1303 | foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
1304 | 1304 | if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) |
1305 | - || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1305 | + || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1306 | 1306 | ) { |
1307 | 1307 | $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( |
1308 | 1308 | $critical_attendee_detail |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | * @access public |
42 | 42 | * @param EE_Checkout $checkout |
43 | 43 | */ |
44 | - public function __construct( EE_Checkout $checkout ) { |
|
44 | + public function __construct(EE_Checkout $checkout) { |
|
45 | 45 | $this->_slug = 'attendee_information'; |
46 | 46 | $this->_name = __('Attendee Information', 'event_espresso'); |
47 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
47 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
48 | 48 | $this->checkout = $checkout; |
49 | 49 | $this->_reset_success_message(); |
50 | 50 | $this->set_instructions( |
51 | - __( 'Please answer the following registration questions before proceeding.', 'event_espresso' ) |
|
51 | + __('Please answer the following registration questions before proceeding.', 'event_espresso') |
|
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | 56 | |
57 | 57 | public function translate_js_strings() { |
58 | - EE_Registry::$i18n_js_strings['required_field'] = __( ' is a required question.', 'event_espresso' ); |
|
58 | + EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
|
59 | 59 | EE_Registry::$i18n_js_strings['required_multi_field'] = __( |
60 | 60 | ' is a required question. Please enter a value for at least one of the options.', |
61 | 61 | 'event_espresso' |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | // calculate taxes |
116 | 116 | $Line_Item_Display->display_line_item( |
117 | 117 | $this->checkout->cart->get_grand_total(), |
118 | - array( 'set_tax_rate' => true ) |
|
118 | + array('set_tax_rate' => true) |
|
119 | 119 | ); |
120 | 120 | /** @var $subsections EE_Form_Section_Proper[] */ |
121 | 121 | $subsections = array( |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | 'ticket_count' => array() |
128 | 128 | ); |
129 | 129 | // grab the saved registrations from the transaction |
130 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
131 | - if ( $registrations ) { |
|
132 | - foreach ( $registrations as $registration ) { |
|
130 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
131 | + if ($registrations) { |
|
132 | + foreach ($registrations as $registration) { |
|
133 | 133 | // can this registration be processed during this visit ? |
134 | 134 | if ( |
135 | 135 | $registration instanceof EE_Registration |
136 | - && $this->checkout->visit_allows_processing_of_this_registration( $registration ) |
|
136 | + && $this->checkout->visit_allows_processing_of_this_registration($registration) |
|
137 | 137 | ) { |
138 | 138 | $attendee_reg_form = $this->_registrations_reg_form($registration); |
139 | 139 | if ($attendee_reg_form instanceof EE_Form_Section_Proper) { |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | } |
166 | 166 | } |
167 | 167 | // print_copy_info ? |
168 | - if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) { |
|
168 | + if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) { |
|
169 | 169 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
170 | 170 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info |
171 | 171 | ? $this->_copy_attendee_info_form() |
172 | 172 | : $this->_auto_copy_attendee_info(); |
173 | 173 | // generate hidden input |
174 | 174 | if ( |
175 | - isset( $subsections[ $primary_registrant ] ) |
|
176 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
175 | + isset($subsections[$primary_registrant]) |
|
176 | + && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper |
|
177 | 177 | ) { |
178 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
178 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
@@ -187,8 +187,7 @@ discard block |
||
187 | 187 | 'html_id' => $this->reg_form_name(), |
188 | 188 | 'subsections' => $subsections, |
189 | 189 | 'layout_strategy' => $this->checkout->admin_request ? |
190 | - new EE_Div_Per_Section_Layout() : |
|
191 | - new EE_Template_Layout( |
|
190 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
192 | 191 | array( |
193 | 192 | 'layout_template_file' => $this->_template, // layout_template |
194 | 193 | 'template_args' => $template_args |
@@ -206,11 +205,11 @@ discard block |
||
206 | 205 | * @return EE_Form_Section_Proper |
207 | 206 | * @throws \EE_Error |
208 | 207 | */ |
209 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
208 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
210 | 209 | static $attendee_nmbr = 1; |
211 | 210 | $form_args = array(); |
212 | 211 | // verify that registration has valid event |
213 | - if ( $registration->event() instanceof EE_Event ) { |
|
212 | + if ($registration->event() instanceof EE_Event) { |
|
214 | 213 | $question_groups = $registration->event()->question_groups( |
215 | 214 | array( |
216 | 215 | array( |
@@ -220,10 +219,10 @@ discard block |
||
220 | 219 | 'order_by' => array('QSG_order' => 'ASC') |
221 | 220 | ) |
222 | 221 | ); |
223 | - if ( $question_groups ) { |
|
222 | + if ($question_groups) { |
|
224 | 223 | // array of params to pass to parent constructor |
225 | 224 | $form_args = array( |
226 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
225 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
227 | 226 | 'html_class' => 'ee-reg-form-attendee-dv', |
228 | 227 | 'html_style' => $this->checkout->admin_request |
229 | 228 | ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
@@ -236,9 +235,9 @@ discard block |
||
236 | 235 | ) |
237 | 236 | ) |
238 | 237 | ); |
239 | - foreach ( $question_groups as $question_group ) { |
|
240 | - if ( $question_group instanceof EE_Question_Group ) { |
|
241 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( |
|
238 | + foreach ($question_groups as $question_group) { |
|
239 | + if ($question_group instanceof EE_Question_Group) { |
|
240 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form( |
|
242 | 241 | $registration, |
243 | 242 | $question_group |
244 | 243 | ); |
@@ -257,7 +256,7 @@ discard block |
||
257 | 256 | } |
258 | 257 | } |
259 | 258 | $attendee_nmbr++; |
260 | - return ! empty($form_args) ? new EE_Form_Section_Proper( $form_args ) : null; |
|
259 | + return ! empty($form_args) ? new EE_Form_Section_Proper($form_args) : null; |
|
261 | 260 | } |
262 | 261 | |
263 | 262 | |
@@ -278,7 +277,7 @@ discard block |
||
278 | 277 | // generate hidden input |
279 | 278 | return new EE_Hidden_Input( |
280 | 279 | array( |
281 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
280 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
282 | 281 | 'default' => $additional_attendee_reg_info |
283 | 282 | ) |
284 | 283 | ); |
@@ -292,26 +291,26 @@ discard block |
||
292 | 291 | * @return EE_Form_Section_Proper |
293 | 292 | * @throws \EE_Error |
294 | 293 | */ |
295 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
294 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
296 | 295 | // array of params to pass to parent constructor |
297 | 296 | $form_args = array( |
298 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
297 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
299 | 298 | 'html_class' => $this->checkout->admin_request |
300 | 299 | ? 'form-table ee-reg-form-qstn-grp-dv' |
301 | 300 | : 'ee-reg-form-qstn-grp-dv', |
302 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
301 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
303 | 302 | 'subsections' => array( |
304 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
303 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
305 | 304 | ), |
306 | 305 | 'layout_strategy' => $this->checkout->admin_request |
307 | 306 | ? new EE_Admin_Two_Column_Layout() |
308 | 307 | : new EE_Div_Per_Section_Layout() |
309 | 308 | ); |
310 | 309 | // where params |
311 | - $query_params = array( 'QST_deleted' => 0 ); |
|
310 | + $query_params = array('QST_deleted' => 0); |
|
312 | 311 | // don't load admin only questions on the frontend |
313 | - if ( ! $this->checkout->admin_request ) { |
|
314 | - $query_params['QST_admin_only'] = array( '!=', true ); |
|
312 | + if ( ! $this->checkout->admin_request) { |
|
313 | + $query_params['QST_admin_only'] = array('!=', true); |
|
315 | 314 | } |
316 | 315 | $questions = $question_group->get_many_related( |
317 | 316 | 'Question', |
@@ -333,10 +332,10 @@ discard block |
||
333 | 332 | ) |
334 | 333 | ); |
335 | 334 | // loop thru questions |
336 | - foreach ( $questions as $question ) { |
|
337 | - if( $question instanceof EE_Question ){ |
|
335 | + foreach ($questions as $question) { |
|
336 | + if ($question instanceof EE_Question) { |
|
338 | 337 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
339 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
338 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
340 | 339 | } |
341 | 340 | } |
342 | 341 | $form_args['subsections'] = apply_filters( |
@@ -357,7 +356,7 @@ discard block |
||
357 | 356 | ) |
358 | 357 | ); |
359 | 358 | // d( $form_args ); |
360 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
359 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
361 | 360 | return apply_filters( |
362 | 361 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
363 | 362 | $question_group_reg_form, |
@@ -374,11 +373,11 @@ discard block |
||
374 | 373 | * @param EE_Question_Group $question_group |
375 | 374 | * @return EE_Form_Section_HTML |
376 | 375 | */ |
377 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
376 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
378 | 377 | $html = ''; |
379 | 378 | // group_name |
380 | - if ( $question_group->show_group_name() && $question_group->name() !== '' ) { |
|
381 | - if ( $this->checkout->admin_request ) { |
|
379 | + if ($question_group->show_group_name() && $question_group->name() !== '') { |
|
380 | + if ($this->checkout->admin_request) { |
|
382 | 381 | $html .= EEH_HTML::br(); |
383 | 382 | $html .= EEH_HTML::h3( |
384 | 383 | $question_group->name(), |
@@ -392,7 +391,7 @@ discard block |
||
392 | 391 | } |
393 | 392 | } |
394 | 393 | // group_desc |
395 | - if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) { |
|
394 | + if ($question_group->show_group_desc() && $question_group->desc() !== '') { |
|
396 | 395 | $html .= EEH_HTML::p( |
397 | 396 | $question_group->desc(), |
398 | 397 | '', |
@@ -402,7 +401,7 @@ discard block |
||
402 | 401 | ); |
403 | 402 | |
404 | 403 | } |
405 | - return new EE_Form_Section_HTML( $html ); |
|
404 | + return new EE_Form_Section_HTML($html); |
|
406 | 405 | } |
407 | 406 | |
408 | 407 | |
@@ -412,7 +411,7 @@ discard block |
||
412 | 411 | * @return EE_Form_Section_Proper |
413 | 412 | * @throws \EE_Error |
414 | 413 | */ |
415 | - private function _copy_attendee_info_form(){ |
|
414 | + private function _copy_attendee_info_form() { |
|
416 | 415 | // array of params to pass to parent constructor |
417 | 416 | return new EE_Form_Section_Proper( |
418 | 417 | array( |
@@ -441,7 +440,7 @@ discard block |
||
441 | 440 | private function _auto_copy_attendee_info() { |
442 | 441 | return new EE_Form_Section_HTML( |
443 | 442 | EEH_Template::locate_template( |
444 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
443 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
445 | 444 | apply_filters( |
446 | 445 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', |
447 | 446 | array() |
@@ -465,32 +464,32 @@ discard block |
||
465 | 464 | $copy_attendee_info_inputs = array(); |
466 | 465 | $prev_ticket = NULL; |
467 | 466 | // grab the saved registrations from the transaction |
468 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
469 | - foreach ( $registrations as $registration ) { |
|
467 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
468 | + foreach ($registrations as $registration) { |
|
470 | 469 | // for all attendees other than the primary attendee |
471 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
470 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
472 | 471 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
473 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
472 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
474 | 473 | $item_name = $registration->ticket()->name(); |
475 | 474 | $item_name .= $registration->ticket()->description() !== '' |
476 | - ? ' - ' . $registration->ticket()->description() |
|
475 | + ? ' - '.$registration->ticket()->description() |
|
477 | 476 | : ''; |
478 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
479 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
477 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
478 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
480 | 479 | ); |
481 | 480 | $prev_ticket = $registration->ticket()->ID(); |
482 | 481 | } |
483 | 482 | |
484 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
483 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
485 | 484 | EE_Checkbox_Multi_Input( |
486 | 485 | array( |
487 | 486 | $registration->ID() => sprintf( |
488 | - __( 'Attendee #%s', 'event_espresso' ), |
|
487 | + __('Attendee #%s', 'event_espresso'), |
|
489 | 488 | $registration->count() |
490 | 489 | ) |
491 | 490 | ), |
492 | 491 | array( |
493 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
492 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
494 | 493 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
495 | 494 | 'display_html_label_text' => false |
496 | 495 | ) |
@@ -510,7 +509,7 @@ discard block |
||
510 | 509 | * @return EE_Form_Input_Base |
511 | 510 | * @throws \EE_Error |
512 | 511 | */ |
513 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
512 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
514 | 513 | // generate hidden input |
515 | 514 | return new EE_Hidden_Input( |
516 | 515 | array( |
@@ -529,7 +528,7 @@ discard block |
||
529 | 528 | * @return EE_Form_Input_Base |
530 | 529 | * @throws \EE_Error |
531 | 530 | */ |
532 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
531 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
533 | 532 | |
534 | 533 | // if this question was for an attendee detail, then check for that answer |
535 | 534 | $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( |
@@ -538,32 +537,32 @@ discard block |
||
538 | 537 | ); |
539 | 538 | $answer = $answer_value === null |
540 | 539 | ? EEM_Answer::instance()->get_one( |
541 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
540 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
542 | 541 | ) |
543 | 542 | : null; |
544 | 543 | // if NOT returning to edit an existing registration |
545 | 544 | // OR if this question is for an attendee property |
546 | 545 | // OR we still don't have an EE_Answer object |
547 | - if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) { |
|
546 | + if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) { |
|
548 | 547 | // create an EE_Answer object for storing everything in |
549 | - $answer = EE_Answer::new_instance ( array( |
|
548 | + $answer = EE_Answer::new_instance(array( |
|
550 | 549 | 'QST_ID'=> $question->ID(), |
551 | 550 | 'REG_ID'=> $registration->ID() |
552 | 551 | )); |
553 | 552 | } |
554 | 553 | // verify instance |
555 | - if( $answer instanceof EE_Answer ){ |
|
556 | - if ( ! empty( $answer_value )) { |
|
557 | - $answer->set( 'ANS_value', $answer_value ); |
|
554 | + if ($answer instanceof EE_Answer) { |
|
555 | + if ( ! empty($answer_value)) { |
|
556 | + $answer->set('ANS_value', $answer_value); |
|
558 | 557 | } |
559 | - $answer->cache( 'Question', $question ); |
|
558 | + $answer->cache('Question', $question); |
|
560 | 559 | //remember system ID had a bug where sometimes it could be null |
561 | - $answer_cache_id =$question->is_system_question() |
|
562 | - ? $question->system_ID() . '-' . $registration->reg_url_link() |
|
563 | - : $question->ID() . '-' . $registration->reg_url_link(); |
|
564 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
560 | + $answer_cache_id = $question->is_system_question() |
|
561 | + ? $question->system_ID().'-'.$registration->reg_url_link() |
|
562 | + : $question->ID().'-'.$registration->reg_url_link(); |
|
563 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
565 | 564 | } |
566 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
565 | + return $this->_generate_question_input($registration, $question, $answer); |
|
567 | 566 | |
568 | 567 | } |
569 | 568 | |
@@ -576,46 +575,46 @@ discard block |
||
576 | 575 | * @return EE_Form_Input_Base |
577 | 576 | * @throws \EE_Error |
578 | 577 | */ |
579 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
578 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
580 | 579 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
581 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
580 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
582 | 581 | add_filter( |
583 | 582 | 'FHEE__EE_Question__generate_form_input__country_options', |
584 | - array( $this, 'use_cached_countries_for_form_input' ), |
|
583 | + array($this, 'use_cached_countries_for_form_input'), |
|
585 | 584 | 10, |
586 | 585 | 4 |
587 | 586 | ); |
588 | 587 | add_filter( |
589 | 588 | 'FHEE__EE_Question__generate_form_input__state_options', |
590 | - array( $this, 'use_cached_states_for_form_input' ), |
|
589 | + array($this, 'use_cached_states_for_form_input'), |
|
591 | 590 | 10, |
592 | 591 | 4 |
593 | 592 | ); |
594 | 593 | $input_constructor_args = array( |
595 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
596 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
597 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
598 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
594 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
595 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
596 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
597 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
599 | 598 | 'html_label_class' => 'ee-reg-qstn', |
600 | 599 | ); |
601 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
602 | - if ( $answer instanceof EE_Answer && $answer->ID() ) { |
|
603 | - $input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']'; |
|
604 | - $input_constructor_args[ 'html_id' ] .= '-' . $answer->ID(); |
|
605 | - $input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID(); |
|
600 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
601 | + if ($answer instanceof EE_Answer && $answer->ID()) { |
|
602 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
603 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
604 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
606 | 605 | } |
607 | - $form_input = $question->generate_form_input( |
|
606 | + $form_input = $question->generate_form_input( |
|
608 | 607 | $registration, |
609 | 608 | $answer, |
610 | 609 | $input_constructor_args |
611 | 610 | ); |
612 | 611 | remove_filter( |
613 | 612 | 'FHEE__EE_Question__generate_form_input__country_options', |
614 | - array( $this, 'use_cached_countries_for_form_input' ) |
|
613 | + array($this, 'use_cached_countries_for_form_input') |
|
615 | 614 | ); |
616 | 615 | remove_filter( |
617 | 616 | 'FHEE__EE_Question__generate_form_input__state_options', |
618 | - array( $this, 'use_cached_states_for_form_input' ) |
|
617 | + array($this, 'use_cached_states_for_form_input') |
|
619 | 618 | ); |
620 | 619 | return $form_input; |
621 | 620 | } |
@@ -637,22 +636,22 @@ discard block |
||
637 | 636 | \EE_Registration $registration = null, |
638 | 637 | \EE_Answer $answer = null |
639 | 638 | ) { |
640 | - $country_options = array( '' => '' ); |
|
639 | + $country_options = array('' => ''); |
|
641 | 640 | // get possibly cached list of countries |
642 | 641 | $countries = $this->checkout->action === 'process_reg_step' |
643 | 642 | ? EEM_Country::instance()->get_all_countries() |
644 | 643 | : EEM_Country::instance()->get_all_active_countries(); |
645 | - if ( ! empty( $countries )) { |
|
646 | - foreach( $countries as $country ){ |
|
647 | - if ( $country instanceof EE_Country ) { |
|
648 | - $country_options[ $country->ID() ] = $country->name(); |
|
644 | + if ( ! empty($countries)) { |
|
645 | + foreach ($countries as $country) { |
|
646 | + if ($country instanceof EE_Country) { |
|
647 | + $country_options[$country->ID()] = $country->name(); |
|
649 | 648 | } |
650 | 649 | } |
651 | 650 | } |
652 | - if( $question instanceof EE_Question |
|
653 | - && $registration instanceof EE_Registration ) { |
|
651 | + if ($question instanceof EE_Question |
|
652 | + && $registration instanceof EE_Registration) { |
|
654 | 653 | $answer = EEM_Answer::instance()->get_one( |
655 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
654 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
656 | 655 | ); |
657 | 656 | } else { |
658 | 657 | $answer = EE_Answer::new_instance(); |
@@ -685,14 +684,14 @@ discard block |
||
685 | 684 | \EE_Registration $registration = null, |
686 | 685 | \EE_Answer $answer = null |
687 | 686 | ) { |
688 | - $state_options = array( '' => array( '' => '')); |
|
687 | + $state_options = array('' => array('' => '')); |
|
689 | 688 | $states = $this->checkout->action === 'process_reg_step' |
690 | 689 | ? EEM_State::instance()->get_all_states() |
691 | 690 | : EEM_State::instance()->get_all_active_states(); |
692 | - if ( ! empty( $states )) { |
|
693 | - foreach( $states as $state ){ |
|
694 | - if ( $state instanceof EE_State ) { |
|
695 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
691 | + if ( ! empty($states)) { |
|
692 | + foreach ($states as $state) { |
|
693 | + if ($state instanceof EE_State) { |
|
694 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
696 | 695 | } |
697 | 696 | } |
698 | 697 | } |
@@ -720,24 +719,24 @@ discard block |
||
720 | 719 | * @throws \EE_Error |
721 | 720 | */ |
722 | 721 | public function process_reg_step() { |
723 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
722 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
724 | 723 | // grab validated data from form |
725 | 724 | $valid_data = $this->checkout->current_step->valid_data(); |
726 | 725 | // EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
727 | 726 | // EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
728 | 727 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
729 | - if ( empty( $valid_data )) { |
|
728 | + if (empty($valid_data)) { |
|
730 | 729 | EE_Error::add_error( |
731 | - __( 'No valid question responses were received.', 'event_espresso' ), |
|
730 | + __('No valid question responses were received.', 'event_espresso'), |
|
732 | 731 | __FILE__, |
733 | 732 | __FUNCTION__, |
734 | 733 | __LINE__ |
735 | 734 | ); |
736 | 735 | return false; |
737 | 736 | } |
738 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
737 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
739 | 738 | EE_Error::add_error( |
740 | - __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), |
|
739 | + __('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), |
|
741 | 740 | __FILE__, |
742 | 741 | __FUNCTION__, |
743 | 742 | __LINE__ |
@@ -745,11 +744,11 @@ discard block |
||
745 | 744 | return false; |
746 | 745 | } |
747 | 746 | // get cached registrations |
748 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
747 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
749 | 748 | // verify we got the goods |
750 | - if ( empty( $registrations )) { |
|
749 | + if (empty($registrations)) { |
|
751 | 750 | EE_Error::add_error( |
752 | - __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), |
|
751 | + __('Your form data could not be applied to any valid registrations.', 'event_espresso'), |
|
753 | 752 | __FILE__, |
754 | 753 | __FUNCTION__, |
755 | 754 | __LINE__ |
@@ -757,15 +756,15 @@ discard block |
||
757 | 756 | return false; |
758 | 757 | } |
759 | 758 | // extract attendee info from form data and save to model objects |
760 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
759 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
761 | 760 | // if first pass thru SPCO, |
762 | 761 | // then let's check processed registrations against the total number of tickets in the cart |
763 | - if ( $registrations_processed === false ) { |
|
762 | + if ($registrations_processed === false) { |
|
764 | 763 | // but return immediately if the previous step exited early due to errors |
765 | 764 | return false; |
766 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
765 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
767 | 766 | // generate a correctly translated string for all possible singular/plural combinations |
768 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
767 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
769 | 768 | $error_msg = sprintf( |
770 | 769 | __( |
771 | 770 | 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', |
@@ -774,7 +773,7 @@ discard block |
||
774 | 773 | $this->checkout->total_ticket_count, |
775 | 774 | $registrations_processed |
776 | 775 | ); |
777 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
776 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
778 | 777 | $error_msg = sprintf( |
779 | 778 | __( |
780 | 779 | 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', |
@@ -793,17 +792,17 @@ discard block |
||
793 | 792 | $registrations_processed |
794 | 793 | ); |
795 | 794 | } |
796 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
795 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
797 | 796 | return false; |
798 | 797 | } |
799 | 798 | // mark this reg step as completed |
800 | 799 | $this->set_completed(); |
801 | 800 | $this->_set_success_message( |
802 | - __( 'The Attendee Information Step has been successfully completed.', 'event_espresso' ) |
|
801 | + __('The Attendee Information Step has been successfully completed.', 'event_espresso') |
|
803 | 802 | ); |
804 | 803 | //do action in case a plugin wants to do something with the data submitted in step 1. |
805 | 804 | //passes EE_Single_Page_Checkout, and it's posted data |
806 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
805 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
807 | 806 | return true; |
808 | 807 | } |
809 | 808 | |
@@ -817,9 +816,9 @@ discard block |
||
817 | 816 | * @return boolean | int |
818 | 817 | * @throws \EE_Error |
819 | 818 | */ |
820 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
819 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
821 | 820 | // load resources and set some defaults |
822 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
821 | + EE_Registry::instance()->load_model('Attendee'); |
|
823 | 822 | // holder for primary registrant attendee object |
824 | 823 | $this->checkout->primary_attendee_obj = NULL; |
825 | 824 | // array for tracking reg form data for the primary registrant |
@@ -836,9 +835,9 @@ discard block |
||
836 | 835 | // attendee counter |
837 | 836 | $att_nmbr = 0; |
838 | 837 | // grab the saved registrations from the transaction |
839 | - foreach ( $registrations as $registration ) { |
|
838 | + foreach ($registrations as $registration) { |
|
840 | 839 | // verify EE_Registration object |
841 | - if ( ! $registration instanceof EE_Registration ) { |
|
840 | + if ( ! $registration instanceof EE_Registration) { |
|
842 | 841 | EE_Error::add_error( |
843 | 842 | __( |
844 | 843 | 'An invalid Registration object was discovered when attempting to process your registration information.', |
@@ -853,12 +852,12 @@ discard block |
||
853 | 852 | /** @var string $reg_url_link */ |
854 | 853 | $reg_url_link = $registration->reg_url_link(); |
855 | 854 | // reg_url_link exists ? |
856 | - if ( ! empty( $reg_url_link ) ) { |
|
855 | + if ( ! empty($reg_url_link)) { |
|
857 | 856 | // should this registration be processed during this visit ? |
858 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
857 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
859 | 858 | // if NOT revisiting, then let's save the registration now, |
860 | 859 | // so that we have a REG_ID to use when generating other objects |
861 | - if ( ! $this->checkout->revisit ) { |
|
860 | + if ( ! $this->checkout->revisit) { |
|
862 | 861 | $registration->save(); |
863 | 862 | } |
864 | 863 | /** |
@@ -868,7 +867,7 @@ discard block |
||
868 | 867 | * @var bool if true is returned by the plugin then the |
869 | 868 | * registration processing is halted. |
870 | 869 | */ |
871 | - if ( apply_filters( |
|
870 | + if (apply_filters( |
|
872 | 871 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', |
873 | 872 | false, |
874 | 873 | $att_nmbr, |
@@ -876,38 +875,38 @@ discard block |
||
876 | 875 | $registrations, |
877 | 876 | $valid_data, |
878 | 877 | $this |
879 | - ) ) { |
|
878 | + )) { |
|
880 | 879 | return false; |
881 | 880 | } |
882 | 881 | |
883 | 882 | // Houston, we have a registration! |
884 | 883 | $att_nmbr++; |
885 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
884 | + $this->_attendee_data[$reg_url_link] = array(); |
|
886 | 885 | // grab any existing related answer objects |
887 | 886 | $this->_registration_answers = $registration->answers(); |
888 | 887 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
889 | - if ( isset( $valid_data[ $reg_url_link ] ) ) { |
|
888 | + if (isset($valid_data[$reg_url_link])) { |
|
890 | 889 | // do we need to copy basic info from primary attendee ? |
891 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) |
|
892 | - && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
890 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) |
|
891 | + && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 |
|
893 | 892 | ? true |
894 | 893 | : false; |
895 | 894 | // filter form input data for this registration |
896 | - $valid_data[ $reg_url_link ] = (array)apply_filters( |
|
895 | + $valid_data[$reg_url_link] = (array) apply_filters( |
|
897 | 896 | 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
898 | - $valid_data[ $reg_url_link ] |
|
897 | + $valid_data[$reg_url_link] |
|
899 | 898 | ); |
900 | 899 | // EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
901 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
902 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) |
|
900 | + if (isset($valid_data['primary_attendee'])) { |
|
901 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) |
|
903 | 902 | ? $valid_data['primary_attendee'] |
904 | 903 | : false; |
905 | - unset( $valid_data['primary_attendee'] ); |
|
904 | + unset($valid_data['primary_attendee']); |
|
906 | 905 | } |
907 | 906 | // now loop through our array of valid post data && process attendee reg forms |
908 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
909 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
910 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
907 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
908 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
909 | + foreach ($form_inputs as $form_input => $input_value) { |
|
911 | 910 | // \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ ); |
912 | 911 | // check for critical inputs |
913 | 912 | if ( |
@@ -921,16 +920,16 @@ discard block |
||
921 | 920 | // store a bit of data about the primary attendee |
922 | 921 | if ( |
923 | 922 | $att_nmbr === 1 |
924 | - && ! empty( $input_value ) |
|
923 | + && ! empty($input_value) |
|
925 | 924 | && $reg_url_link === $primary_registrant['line_item_id'] |
926 | 925 | ) { |
927 | - $primary_registrant[ $form_input ] = $input_value; |
|
926 | + $primary_registrant[$form_input] = $input_value; |
|
928 | 927 | } else if ( |
929 | 928 | $copy_primary |
930 | 929 | && $input_value === null |
931 | - && isset( $primary_registrant[ $form_input ] ) |
|
930 | + && isset($primary_registrant[$form_input]) |
|
932 | 931 | ) { |
933 | - $input_value = $primary_registrant[ $form_input ]; |
|
932 | + $input_value = $primary_registrant[$form_input]; |
|
934 | 933 | } |
935 | 934 | // now attempt to save the input data |
936 | 935 | if ( |
@@ -972,55 +971,55 @@ discard block |
||
972 | 971 | // have we met before? |
973 | 972 | $attendee = $this->_find_existing_attendee( |
974 | 973 | $registration, |
975 | - $this->_attendee_data[ $reg_url_link ] |
|
974 | + $this->_attendee_data[$reg_url_link] |
|
976 | 975 | ); |
977 | 976 | // did we find an already existing record for this attendee ? |
978 | - if ( $attendee instanceof EE_Attendee ) { |
|
977 | + if ($attendee instanceof EE_Attendee) { |
|
979 | 978 | $attendee = $this->_update_existing_attendee_data( |
980 | 979 | $attendee, |
981 | - $this->_attendee_data[ $reg_url_link ] |
|
980 | + $this->_attendee_data[$reg_url_link] |
|
982 | 981 | ); |
983 | 982 | } else { |
984 | 983 | // ensure critical details are set for additional attendees |
985 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 |
|
984 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 |
|
986 | 985 | ? $this->_copy_critical_attendee_details_from_primary_registrant( |
987 | - $this->_attendee_data[ $reg_url_link ] |
|
986 | + $this->_attendee_data[$reg_url_link] |
|
988 | 987 | ) |
989 | - : $this->_attendee_data[ $reg_url_link ]; |
|
988 | + : $this->_attendee_data[$reg_url_link]; |
|
990 | 989 | $attendee = $this->_create_new_attendee( |
991 | 990 | $registration, |
992 | - $this->_attendee_data[ $reg_url_link ] |
|
991 | + $this->_attendee_data[$reg_url_link] |
|
993 | 992 | ); |
994 | 993 | } |
995 | 994 | // who's #1 ? |
996 | - if ( $att_nmbr === 1 ) { |
|
995 | + if ($att_nmbr === 1) { |
|
997 | 996 | $this->checkout->primary_attendee_obj = $attendee; |
998 | 997 | } |
999 | 998 | } |
1000 | 999 | // EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
1001 | 1000 | // add relation to registration, set attendee ID, and cache attendee |
1002 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
1001 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
1003 | 1002 | // \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ ); |
1004 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
1005 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1003 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
1004 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
1006 | 1005 | return false; |
1007 | 1006 | } |
1008 | 1007 | /** @type EE_Registration_Processor $registration_processor */ |
1009 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1008 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1010 | 1009 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1011 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, false ); |
|
1010 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, false); |
|
1012 | 1011 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1013 | 1012 | $this->checkout->transaction->toggle_failed_transaction_status(); |
1014 | 1013 | // if we've gotten this far, then let's save what we have |
1015 | 1014 | $registration->save(); |
1016 | 1015 | // add relation between TXN and registration |
1017 | - $this->_associate_registration_with_transaction( $registration ); |
|
1016 | + $this->_associate_registration_with_transaction($registration); |
|
1018 | 1017 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
1019 | 1018 | |
1020 | - } else { |
|
1021 | - 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__ ); |
|
1019 | + } else { |
|
1020 | + 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__); |
|
1022 | 1021 | // remove malformed data |
1023 | - unset( $valid_data[ $reg_url_link ] ); |
|
1022 | + unset($valid_data[$reg_url_link]); |
|
1024 | 1023 | return false; |
1025 | 1024 | } |
1026 | 1025 | |
@@ -1049,26 +1048,26 @@ discard block |
||
1049 | 1048 | // \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
1050 | 1049 | // allow for plugins to hook in and do their own processing of the form input. |
1051 | 1050 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
1052 | - if ( apply_filters( |
|
1051 | + if (apply_filters( |
|
1053 | 1052 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', |
1054 | 1053 | false, |
1055 | 1054 | $registration, |
1056 | 1055 | $form_input, |
1057 | 1056 | $input_value, |
1058 | 1057 | $this |
1059 | - ) ) { |
|
1058 | + )) { |
|
1060 | 1059 | return true; |
1061 | 1060 | } |
1062 | 1061 | // $answer_cache_id is the key used to find the EE_Answer we want |
1063 | 1062 | $answer_cache_id = $this->checkout->reg_url_link |
1064 | 1063 | ? $form_input |
1065 | - : $form_input . '-' . $registration->reg_url_link(); |
|
1066 | - $answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] ) |
|
1067 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1064 | + : $form_input.'-'.$registration->reg_url_link(); |
|
1065 | + $answer_is_obj = isset($this->_registration_answers[$answer_cache_id]) |
|
1066 | + && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer |
|
1068 | 1067 | ? true |
1069 | 1068 | : false; |
1070 | 1069 | //rename form_inputs if they are EE_Attendee properties |
1071 | - switch( (string)$form_input ) { |
|
1070 | + switch ((string) $form_input) { |
|
1072 | 1071 | |
1073 | 1072 | case 'state' : |
1074 | 1073 | case 'STA_ID' : |
@@ -1083,32 +1082,32 @@ discard block |
||
1083 | 1082 | break; |
1084 | 1083 | |
1085 | 1084 | default : |
1086 | - $ATT_input = 'ATT_' . $form_input; |
|
1085 | + $ATT_input = 'ATT_'.$form_input; |
|
1087 | 1086 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
1088 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false; |
|
1089 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
1087 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false; |
|
1088 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
1090 | 1089 | } |
1091 | 1090 | // EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
1092 | 1091 | // EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
1093 | 1092 | // EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
1094 | 1093 | // if this form input has a corresponding attendee property |
1095 | - if ( $attendee_property ) { |
|
1096 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
1097 | - if ( $answer_is_obj ) { |
|
1094 | + if ($attendee_property) { |
|
1095 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
1096 | + if ($answer_is_obj) { |
|
1098 | 1097 | // and delete the corresponding answer since we won't be storing this data in that object |
1099 | - $registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' ); |
|
1100 | - $this->_registration_answers[ $answer_cache_id ]->delete_permanently(); |
|
1098 | + $registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer'); |
|
1099 | + $this->_registration_answers[$answer_cache_id]->delete_permanently(); |
|
1101 | 1100 | } |
1102 | 1101 | return true; |
1103 | - } elseif ( $answer_is_obj ) { |
|
1102 | + } elseif ($answer_is_obj) { |
|
1104 | 1103 | // save this data to the answer object |
1105 | - $this->_registration_answers[ $answer_cache_id ]->set_value( $input_value ); |
|
1106 | - $result = $this->_registration_answers[ $answer_cache_id ]->save(); |
|
1104 | + $this->_registration_answers[$answer_cache_id]->set_value($input_value); |
|
1105 | + $result = $this->_registration_answers[$answer_cache_id]->save(); |
|
1107 | 1106 | return $result !== false ? true : false; |
1108 | 1107 | } else { |
1109 | - foreach ( $this->_registration_answers as $answer ) { |
|
1110 | - if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) { |
|
1111 | - $answer->set_value( $input_value ); |
|
1108 | + foreach ($this->_registration_answers as $answer) { |
|
1109 | + if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) { |
|
1110 | + $answer->set_value($input_value); |
|
1112 | 1111 | $result = $answer->save(); |
1113 | 1112 | return $result !== false ? true : false; |
1114 | 1113 | } |
@@ -1130,15 +1129,15 @@ discard block |
||
1130 | 1129 | $form_input = '', |
1131 | 1130 | $input_value = '' |
1132 | 1131 | ) { |
1133 | - if ( empty( $input_value ) ) { |
|
1132 | + if (empty($input_value)) { |
|
1134 | 1133 | // if the form input isn't marked as being required, then just return |
1135 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
1134 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
1136 | 1135 | return true; |
1137 | 1136 | } |
1138 | - switch ( $form_input ) { |
|
1137 | + switch ($form_input) { |
|
1139 | 1138 | case 'fname' : |
1140 | 1139 | EE_Error::add_error( |
1141 | - __( 'First Name is a required value.', 'event_espresso' ), |
|
1140 | + __('First Name is a required value.', 'event_espresso'), |
|
1142 | 1141 | __FILE__, |
1143 | 1142 | __FUNCTION__, |
1144 | 1143 | __LINE__ |
@@ -1147,7 +1146,7 @@ discard block |
||
1147 | 1146 | break; |
1148 | 1147 | case 'lname' : |
1149 | 1148 | EE_Error::add_error( |
1150 | - __( 'Last Name is a required value.', 'event_espresso' ), |
|
1149 | + __('Last Name is a required value.', 'event_espresso'), |
|
1151 | 1150 | __FILE__, |
1152 | 1151 | __FUNCTION__, |
1153 | 1152 | __LINE__ |
@@ -1156,7 +1155,7 @@ discard block |
||
1156 | 1155 | break; |
1157 | 1156 | case 'email' : |
1158 | 1157 | EE_Error::add_error( |
1159 | - __( 'Please enter a valid email address.', 'event_espresso' ), |
|
1158 | + __('Please enter a valid email address.', 'event_espresso'), |
|
1160 | 1159 | __FILE__, |
1161 | 1160 | __FUNCTION__, |
1162 | 1161 | __LINE__ |
@@ -1178,30 +1177,30 @@ discard block |
||
1178 | 1177 | * @return boolean|EE_Attendee |
1179 | 1178 | * @throws \EE_Error |
1180 | 1179 | */ |
1181 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1180 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1182 | 1181 | $existing_attendee = null; |
1183 | 1182 | // if none of the critical properties are set in the incoming attendee data... |
1184 | 1183 | // then attempt to copy them from the primary attendee |
1185 | 1184 | if ( |
1186 | 1185 | $this->checkout->primary_attendee_obj instanceof EE_Attendee |
1187 | - && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1186 | + && ! isset($attendee_data['ATT_fname'], $attendee_data['ATT_email']) |
|
1188 | 1187 | ) { |
1189 | 1188 | return $this->checkout->primary_attendee_obj; |
1190 | 1189 | } |
1191 | 1190 | // does this attendee already exist in the db ? |
1192 | 1191 | // we're searching using a combination of first name, last name, AND email address |
1193 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) |
|
1192 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) |
|
1194 | 1193 | ? $attendee_data['ATT_fname'] |
1195 | 1194 | : ''; |
1196 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) |
|
1195 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) |
|
1197 | 1196 | ? $attendee_data['ATT_lname'] |
1198 | 1197 | : ''; |
1199 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) |
|
1198 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) |
|
1200 | 1199 | ? $attendee_data['ATT_email'] |
1201 | 1200 | : ''; |
1202 | 1201 | // but only if those have values |
1203 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
1204 | - $existing_attendee = EEM_Attendee::instance()->find_existing_attendee( array( |
|
1202 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
1203 | + $existing_attendee = EEM_Attendee::instance()->find_existing_attendee(array( |
|
1205 | 1204 | 'ATT_fname' => $ATT_fname, |
1206 | 1205 | 'ATT_lname' => $ATT_lname, |
1207 | 1206 | 'ATT_email' => $ATT_email |
@@ -1225,13 +1224,13 @@ discard block |
||
1225 | 1224 | * @return \EE_Attendee |
1226 | 1225 | * @throws \EE_Error |
1227 | 1226 | */ |
1228 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
1227 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
1229 | 1228 | // first remove fname, lname, and email from attendee data |
1230 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1229 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1231 | 1230 | // now loop thru what's left and add to attendee CPT |
1232 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
1233 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
1234 | - $existing_attendee->set( $property_name, $property_value ); |
|
1231 | + foreach ($attendee_data as $property_name => $property_value) { |
|
1232 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
1233 | + $existing_attendee->set($property_name, $property_value); |
|
1235 | 1234 | } |
1236 | 1235 | } |
1237 | 1236 | // better save that now |
@@ -1249,11 +1248,11 @@ discard block |
||
1249 | 1248 | * @return void |
1250 | 1249 | * @throws \EE_Error |
1251 | 1250 | */ |
1252 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
1251 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
1253 | 1252 | // add relation to attendee |
1254 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1255 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1256 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1253 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1254 | + $registration->set_attendee_id($attendee->ID()); |
|
1255 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1257 | 1256 | } |
1258 | 1257 | |
1259 | 1258 | |
@@ -1265,10 +1264,10 @@ discard block |
||
1265 | 1264 | * @return void |
1266 | 1265 | * @throws \EE_Error |
1267 | 1266 | */ |
1268 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1267 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1269 | 1268 | // add relation to attendee |
1270 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1271 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1269 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1270 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1272 | 1271 | } |
1273 | 1272 | |
1274 | 1273 | |
@@ -1281,14 +1280,14 @@ discard block |
||
1281 | 1280 | * @return array |
1282 | 1281 | * @throws \EE_Error |
1283 | 1282 | */ |
1284 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1283 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1285 | 1284 | // bare minimum critical details include first name, last name, email address |
1286 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1285 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1287 | 1286 | // add address info to critical details? |
1288 | - if ( apply_filters( |
|
1287 | + if (apply_filters( |
|
1289 | 1288 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', |
1290 | 1289 | false |
1291 | - ) ) { |
|
1290 | + )) { |
|
1292 | 1291 | $address_details = array( |
1293 | 1292 | 'ATT_address', |
1294 | 1293 | 'ATT_address2', |
@@ -1298,13 +1297,13 @@ discard block |
||
1298 | 1297 | 'ATT_zip', |
1299 | 1298 | 'ATT_phone' |
1300 | 1299 | ); |
1301 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1300 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1302 | 1301 | } |
1303 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1304 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) |
|
1305 | - || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1302 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1303 | + if ( ! isset($attendee_data[$critical_attendee_detail]) |
|
1304 | + || empty($attendee_data[$critical_attendee_detail]) |
|
1306 | 1305 | ) { |
1307 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( |
|
1306 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get( |
|
1308 | 1307 | $critical_attendee_detail |
1309 | 1308 | ); |
1310 | 1309 | } |
@@ -1322,11 +1321,11 @@ discard block |
||
1322 | 1321 | * @return \EE_Attendee |
1323 | 1322 | * @throws \EE_Error |
1324 | 1323 | */ |
1325 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1324 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1326 | 1325 | // create new attendee object |
1327 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1326 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1328 | 1327 | // set author to event creator |
1329 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1328 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1330 | 1329 | $new_attendee->save(); |
1331 | 1330 | return $new_attendee; |
1332 | 1331 | } |
@@ -1343,7 +1342,7 @@ discard block |
||
1343 | 1342 | */ |
1344 | 1343 | public function update_reg_step() { |
1345 | 1344 | // save everything |
1346 | - if ( $this->process_reg_step() ) { |
|
1345 | + if ($this->process_reg_step()) { |
|
1347 | 1346 | $this->checkout->redirect = true; |
1348 | 1347 | $this->checkout->redirect_url = add_query_arg( |
1349 | 1348 | array( |
@@ -1352,7 +1351,7 @@ discard block |
||
1352 | 1351 | ), |
1353 | 1352 | $this->checkout->thank_you_page_url |
1354 | 1353 | ); |
1355 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1354 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1356 | 1355 | return true; |
1357 | 1356 | } |
1358 | 1357 | return false; |