@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return EEG_Paypal_Standard |
69 | 69 | */ |
70 | 70 | public function __construct() { |
71 | - $this->set_uses_separate_IPN_request( true ) ; |
|
71 | + $this->set_uses_separate_IPN_request(true); |
|
72 | 72 | parent::__construct(); |
73 | 73 | } |
74 | 74 | |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | * Also sets the gateway url class variable based on whether debug mode is enabled or not |
79 | 79 | * @param array $settings_array |
80 | 80 | */ |
81 | - public function set_settings($settings_array){ |
|
81 | + public function set_settings($settings_array) { |
|
82 | 82 | parent::set_settings($settings_array); |
83 | - if($this->_debug_mode){ |
|
83 | + if ($this->_debug_mode) { |
|
84 | 84 | $this->_gateway_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; |
85 | - }else{ |
|
85 | + } else { |
|
86 | 86 | $this->_gateway_url = 'https://www.paypal.com/cgi-bin/webscr'; |
87 | 87 | } |
88 | 88 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param string $cancel_url URL to send the user to after a cancelled payment attempt on teh payment provider's website |
98 | 98 | * @return EEI_Payment |
99 | 99 | */ |
100 | - public function set_redirection_info( $payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL ){ |
|
100 | + public function set_redirection_info($payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL) { |
|
101 | 101 | $redirect_args = array(); |
102 | 102 | $transaction = $payment->transaction(); |
103 | 103 | $primary_registrant = $transaction->primary_registration(); |
@@ -107,42 +107,42 @@ discard block |
||
107 | 107 | |
108 | 108 | $total_discounts_to_cart_total = $transaction->paid(); |
109 | 109 | //only itemize the order if we're paying for the rest of the order's amount |
110 | - if( $payment->amount() == $transaction->total() ) { |
|
111 | - $payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true ); |
|
110 | + if ($payment->amount() == $transaction->total()) { |
|
111 | + $payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true); |
|
112 | 112 | //this payment is for the remaining transaction amount, |
113 | 113 | //keep track of exactly how much the itemized order amount equals |
114 | 114 | $itemized_sum = 0; |
115 | 115 | $shipping_previously_added = 0; |
116 | 116 | //so let's show all the line items |
117 | - foreach($total_line_item->get_items() as $line_item){ |
|
118 | - if ( $line_item instanceof EE_Line_Item ) { |
|
117 | + foreach ($total_line_item->get_items() as $line_item) { |
|
118 | + if ($line_item instanceof EE_Line_Item) { |
|
119 | 119 | //it's some kind of discount |
120 | - if( $line_item->total() < 0 ) { |
|
121 | - $total_discounts_to_cart_total += abs( $line_item->total() ); |
|
120 | + if ($line_item->total() < 0) { |
|
121 | + $total_discounts_to_cart_total += abs($line_item->total()); |
|
122 | 122 | $itemized_sum += $line_item->total(); |
123 | 123 | continue; |
124 | 124 | } |
125 | 125 | //dont include shipping again. |
126 | - if( strpos( $line_item->code(), 'paypal_shipping_') === 0 ) { |
|
126 | + if (strpos($line_item->code(), 'paypal_shipping_') === 0) { |
|
127 | 127 | $shipping_previously_added = $line_item->total(); |
128 | 128 | continue; |
129 | 129 | } |
130 | - $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
131 | - sprintf( _x( '%1$s for %2$s', 'Ticket for Event', 'event_espresso' ), $line_item->name(), $line_item->ticket_event_name() ), |
|
130 | + $redirect_args['item_name_'.$item_num] = substr( |
|
131 | + sprintf(_x('%1$s for %2$s', 'Ticket for Event', 'event_espresso'), $line_item->name(), $line_item->ticket_event_name()), |
|
132 | 132 | 0, 127 |
133 | 133 | ); |
134 | - $redirect_args[ 'amount_' . $item_num ] = $line_item->unit_price(); |
|
135 | - $redirect_args[ 'quantity_' . $item_num ] = $line_item->quantity(); |
|
134 | + $redirect_args['amount_'.$item_num] = $line_item->unit_price(); |
|
135 | + $redirect_args['quantity_'.$item_num] = $line_item->quantity(); |
|
136 | 136 | //if we're not letting PayPal calculate shipping, tell them its 0 |
137 | - if ( ! $this->_paypal_shipping ) { |
|
138 | - $redirect_args[ 'shipping_' . $item_num ] = '0'; |
|
139 | - $redirect_args[ 'shipping2_' . $item_num ] = '0'; |
|
137 | + if ( ! $this->_paypal_shipping) { |
|
138 | + $redirect_args['shipping_'.$item_num] = '0'; |
|
139 | + $redirect_args['shipping2_'.$item_num] = '0'; |
|
140 | 140 | } |
141 | 141 | $item_num++; |
142 | 142 | $itemized_sum += $line_item->total(); |
143 | 143 | } |
144 | 144 | } |
145 | - $taxes_li = $this->_line_item->get_taxes_subtotal( $total_line_item ); |
|
145 | + $taxes_li = $this->_line_item->get_taxes_subtotal($total_line_item); |
|
146 | 146 | //ideally itemized sum equals the transaction total. but if not (which is weird) |
147 | 147 | //and the itemized sum is LESS than the transaction total |
148 | 148 | //add another line item |
@@ -152,47 +152,47 @@ discard block |
||
152 | 152 | $transaction->total() - $itemized_sum - $taxes_li->total() - $shipping_previously_added, |
153 | 153 | 2 |
154 | 154 | ); |
155 | - if( $itemized_sum_diff_from_txn_total < 0 ) { |
|
155 | + if ($itemized_sum_diff_from_txn_total < 0) { |
|
156 | 156 | //itemized sum is too big |
157 | - $total_discounts_to_cart_total += abs( $itemized_sum_diff_from_txn_total ); |
|
158 | - } elseif( $itemized_sum_diff_from_txn_total > 0 ) { |
|
159 | - $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
160 | - __( 'Other charges', 'event_espresso' ), 0, 127 ); |
|
161 | - $redirect_args[ 'amount_' . $item_num ] = $this->format_currency( $itemized_sum_diff_from_txn_total ); |
|
162 | - $redirect_args[ 'quantity_' . $item_num ] = 1; |
|
157 | + $total_discounts_to_cart_total += abs($itemized_sum_diff_from_txn_total); |
|
158 | + } elseif ($itemized_sum_diff_from_txn_total > 0) { |
|
159 | + $redirect_args['item_name_'.$item_num] = substr( |
|
160 | + __('Other charges', 'event_espresso'), 0, 127 ); |
|
161 | + $redirect_args['amount_'.$item_num] = $this->format_currency($itemized_sum_diff_from_txn_total); |
|
162 | + $redirect_args['quantity_'.$item_num] = 1; |
|
163 | 163 | $item_num++; |
164 | 164 | } |
165 | - if( $total_discounts_to_cart_total > 0 ) { |
|
166 | - $redirect_args[ 'discount_amount_cart' ] = $this->format_currency( $total_discounts_to_cart_total ); |
|
165 | + if ($total_discounts_to_cart_total > 0) { |
|
166 | + $redirect_args['discount_amount_cart'] = $this->format_currency($total_discounts_to_cart_total); |
|
167 | 167 | } |
168 | 168 | //add our taxes to the order if we're NOT using PayPal's |
169 | - if( ! $this->_paypal_taxes ){ |
|
169 | + if ( ! $this->_paypal_taxes) { |
|
170 | 170 | $redirect_args['tax_cart'] = $total_line_item->get_total_tax(); |
171 | 171 | } |
172 | 172 | } else { |
173 | - $payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, false ); |
|
173 | + $payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, false); |
|
174 | 174 | //partial payment that's not for the remaining amount, so we can't send an itemized list |
175 | - $redirect_args['item_name_' . $item_num] = substr( |
|
176 | - sprintf( __('Payment of %1$s for %2$s', "event_espresso"), $payment->amount(), $primary_registrant->reg_code() ), |
|
175 | + $redirect_args['item_name_'.$item_num] = substr( |
|
176 | + sprintf(__('Payment of %1$s for %2$s', "event_espresso"), $payment->amount(), $primary_registrant->reg_code()), |
|
177 | 177 | 0, 127 |
178 | 178 | ); |
179 | - $redirect_args['amount_' . $item_num] = $payment->amount(); |
|
180 | - $redirect_args['shipping_' . $item_num ] = '0'; |
|
181 | - $redirect_args['shipping2_' . $item_num ] = '0'; |
|
179 | + $redirect_args['amount_'.$item_num] = $payment->amount(); |
|
180 | + $redirect_args['shipping_'.$item_num] = '0'; |
|
181 | + $redirect_args['shipping2_'.$item_num] = '0'; |
|
182 | 182 | $redirect_args['tax_cart'] = '0'; |
183 | 183 | $item_num++; |
184 | 184 | } |
185 | 185 | |
186 | - if($this->_debug_mode){ |
|
187 | - $redirect_args['item_name_' . $item_num] = 'DEBUG INFO (this item only added in sandbox mode'; |
|
188 | - $redirect_args['amount_' . $item_num] = 0; |
|
186 | + if ($this->_debug_mode) { |
|
187 | + $redirect_args['item_name_'.$item_num] = 'DEBUG INFO (this item only added in sandbox mode'; |
|
188 | + $redirect_args['amount_'.$item_num] = 0; |
|
189 | 189 | $redirect_args['on0_'.$item_num] = 'NOTIFY URL'; |
190 | - $redirect_args['os0_' . $item_num] = $notify_url; |
|
190 | + $redirect_args['os0_'.$item_num] = $notify_url; |
|
191 | 191 | $redirect_args['on1_'.$item_num] = 'RETURN URL'; |
192 | - $redirect_args['os1_' . $item_num] = $return_url; |
|
192 | + $redirect_args['os1_'.$item_num] = $return_url; |
|
193 | 193 | // $redirect_args['option_index_' . $item_num] = 1; // <-- dunno if this is needed ? |
194 | - $redirect_args['shipping_' . $item_num ] = '0'; |
|
195 | - $redirect_args['shipping2_' . $item_num ] = '0'; |
|
194 | + $redirect_args['shipping_'.$item_num] = '0'; |
|
195 | + $redirect_args['shipping2_'.$item_num] = '0'; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | $redirect_args['business'] = $this->_paypal_id; |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | $redirect_args['cmd'] = '_cart'; |
203 | 203 | $redirect_args['upload'] = 1; |
204 | 204 | $redirect_args['currency_code'] = $payment->currency_code(); |
205 | - $redirect_args['rm'] = 2;//makes the user return with method=POST |
|
206 | - if($this->_image_url){ |
|
205 | + $redirect_args['rm'] = 2; //makes the user return with method=POST |
|
206 | + if ($this->_image_url) { |
|
207 | 207 | $redirect_args['image_url'] = $this->_image_url; |
208 | 208 | } |
209 | 209 | $redirect_args['no_shipping'] = $this->_shipping_details; |
210 | - $redirect_args['bn'] = 'EventEspresso_SP';//EE will blow up if you change this |
|
210 | + $redirect_args['bn'] = 'EventEspresso_SP'; //EE will blow up if you change this |
|
211 | 211 | |
212 | - $redirect_args = apply_filters( "FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this ); |
|
212 | + $redirect_args = apply_filters("FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this); |
|
213 | 213 | |
214 | 214 | $payment->set_redirect_url($this->_gateway_url); |
215 | 215 | $payment->set_redirect_args($redirect_args); |
@@ -230,55 +230,55 @@ discard block |
||
230 | 230 | * @return \EEI_Payment updated |
231 | 231 | * @throws \EE_Error |
232 | 232 | */ |
233 | - public function handle_payment_update( $update_info, $transaction ){ |
|
233 | + public function handle_payment_update($update_info, $transaction) { |
|
234 | 234 | //verify there's payment data that's been sent |
235 | - if ( empty( $update_info[ 'payment_status' ] ) || empty( $update_info[ 'txn_id' ] ) ) { |
|
235 | + if (empty($update_info['payment_status']) || empty($update_info['txn_id'])) { |
|
236 | 236 | // waaaait... is this a PDT request? (see https://developer.paypal.com/docs/classic/products/payment-data-transfer/) |
237 | 237 | // indicated by the "tx" argument? If so, we don't need it. We'll just use the IPN data when it comes |
238 | - if ( isset( $update_info[ 'tx' ] ) ) { |
|
238 | + if (isset($update_info['tx'])) { |
|
239 | 239 | return $transaction->last_payment(); |
240 | 240 | } else { |
241 | 241 | return null; |
242 | 242 | } |
243 | 243 | } |
244 | - $payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr( $update_info[ 'txn_id' ] ); |
|
245 | - if ( ! $payment instanceof EEI_Payment ) { |
|
244 | + $payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['txn_id']); |
|
245 | + if ( ! $payment instanceof EEI_Payment) { |
|
246 | 246 | $payment = $transaction->last_payment(); |
247 | 247 | } |
248 | 248 | // ok, then validate the IPN. Even if we've already processed this payment, |
249 | 249 | // let PayPal know we don't want to hear from them anymore! |
250 | - if ( ! $this->validate_ipn( $update_info, $payment ) ) { |
|
250 | + if ( ! $this->validate_ipn($update_info, $payment)) { |
|
251 | 251 | return $payment; |
252 | 252 | } |
253 | 253 | //ok, well let's process this payment then! |
254 | - switch ( $update_info[ 'payment_status' ] ) { |
|
254 | + switch ($update_info['payment_status']) { |
|
255 | 255 | |
256 | 256 | case 'Completed' : |
257 | 257 | $status = $this->_pay_model->approved_status(); |
258 | - $gateway_response = __( 'The payment is approved.', 'event_espresso' ); |
|
258 | + $gateway_response = __('The payment is approved.', 'event_espresso'); |
|
259 | 259 | break; |
260 | 260 | |
261 | 261 | case 'Pending' : |
262 | 262 | $status = $this->_pay_model->pending_status(); |
263 | - $gateway_response = __( 'The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso' ); |
|
263 | + $gateway_response = __('The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso'); |
|
264 | 264 | break; |
265 | 265 | |
266 | 266 | case 'Denied' : |
267 | 267 | $status = $this->_pay_model->declined_status(); |
268 | - $gateway_response = __( 'The payment has been declined.', 'event_espresso' ); |
|
268 | + $gateway_response = __('The payment has been declined.', 'event_espresso'); |
|
269 | 269 | break; |
270 | 270 | |
271 | 271 | case 'Expired' : |
272 | 272 | case 'Failed' : |
273 | 273 | $status = $this->_pay_model->failed_status(); |
274 | - $gateway_response = __( 'The payment failed for technical reasons or expired.', 'event_espresso' ); |
|
274 | + $gateway_response = __('The payment failed for technical reasons or expired.', 'event_espresso'); |
|
275 | 275 | break; |
276 | 276 | |
277 | 277 | case 'Refunded' : |
278 | 278 | case 'Partially_Refunded' : |
279 | 279 | // even though it's a refund, we consider the payment as approved, it just has a negative value |
280 | 280 | $status = $this->_pay_model->approved_status(); |
281 | - $gateway_response = __( 'The payment has been refunded. Please update registrations accordingly.', 'event_espresso' ); |
|
281 | + $gateway_response = __('The payment has been refunded. Please update registrations accordingly.', 'event_espresso'); |
|
282 | 282 | break; |
283 | 283 | |
284 | 284 | case 'Voided' : |
@@ -286,25 +286,25 @@ discard block |
||
286 | 286 | case 'Canceled_Reversal' : |
287 | 287 | default : |
288 | 288 | $status = $this->_pay_model->cancelled_status(); |
289 | - $gateway_response = __( 'The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso' ); |
|
289 | + $gateway_response = __('The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso'); |
|
290 | 290 | break; |
291 | 291 | |
292 | 292 | } |
293 | 293 | |
294 | 294 | //check if we've already processed this payment |
295 | - if ( $payment instanceof EEI_Payment ) { |
|
295 | + if ($payment instanceof EEI_Payment) { |
|
296 | 296 | //payment exists. if this has the exact same status and amount, don't bother updating. just return |
297 | - if ( $payment->status() == $status && $payment->amount() == $update_info[ 'mc_gross' ] ) { |
|
297 | + if ($payment->status() == $status && $payment->amount() == $update_info['mc_gross']) { |
|
298 | 298 | // DUPLICATED IPN! dont bother updating transaction foo!; |
299 | - $message_log = sprintf( __( 'It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso' ), $payment->ID() ); |
|
299 | + $message_log = sprintf(__('It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso'), $payment->ID()); |
|
300 | 300 | } else { |
301 | 301 | // new payment yippee !!! |
302 | - $payment->set_status( $status ); |
|
303 | - $payment->set_amount( floatval( $update_info[ 'mc_gross' ] ) ); |
|
304 | - $payment->set_gateway_response( $gateway_response ); |
|
305 | - $payment->set_details( $update_info ); |
|
306 | - $payment->set_txn_id_chq_nmbr( $update_info[ 'txn_id' ] ); |
|
307 | - $message_log = sprintf( __( 'Updated payment either from IPN or as part of POST from PayPal', 'event_espresso' ) ); |
|
302 | + $payment->set_status($status); |
|
303 | + $payment->set_amount(floatval($update_info['mc_gross'])); |
|
304 | + $payment->set_gateway_response($gateway_response); |
|
305 | + $payment->set_details($update_info); |
|
306 | + $payment->set_txn_id_chq_nmbr($update_info['txn_id']); |
|
307 | + $message_log = sprintf(__('Updated payment either from IPN or as part of POST from PayPal', 'event_espresso')); |
|
308 | 308 | } |
309 | 309 | $this->log( |
310 | 310 | array( |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | $payment |
317 | 317 | ); |
318 | 318 | } |
319 | - do_action( 'FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this ); |
|
319 | + do_action('FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this); |
|
320 | 320 | // kill request here if this is a refund |
321 | - if ( $update_info[ 'payment_status' ] == 'Refunded' || $update_info[ 'payment_status' ] == 'Partially_Refunded' ) { |
|
322 | - if ( apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true ) ) { |
|
323 | - status_header( 200 ); |
|
321 | + if ($update_info['payment_status'] == 'Refunded' || $update_info['payment_status'] == 'Partially_Refunded') { |
|
322 | + if (apply_filters('FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true)) { |
|
323 | + status_header(200); |
|
324 | 324 | exit(); |
325 | 325 | } |
326 | 326 | } |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | * @param EE_Payment|EEI_Payment $payment |
337 | 337 | * @return boolean |
338 | 338 | */ |
339 | - public function validate_ipn( $update_info, $payment ) { |
|
339 | + public function validate_ipn($update_info, $payment) { |
|
340 | 340 | //allow us to skip validating IPNs with PayPal (useful for testing) |
341 | - if ( apply_filters( 'FHEE__EEG_Paypal_Standard__validate_ipn__skip', false ) ) { |
|
341 | + if (apply_filters('FHEE__EEG_Paypal_Standard__validate_ipn__skip', false)) { |
|
342 | 342 | return true; |
343 | 343 | } |
344 | 344 | //...otherwise, we actually don't care what the $update_info is, we need to look |
@@ -346,22 +346,22 @@ discard block |
||
346 | 346 | // Reading POSTed data directly from $_POST causes serialization issues with array data in the POST. |
347 | 347 | // Instead, read raw POST data from the input stream. |
348 | 348 | // @see https://gist.github.com/xcommerce-gists/3440401 |
349 | - $raw_post_data = file_get_contents( 'php://input' ); |
|
350 | - $raw_post_array = explode( '&', $raw_post_data ); |
|
349 | + $raw_post_data = file_get_contents('php://input'); |
|
350 | + $raw_post_array = explode('&', $raw_post_data); |
|
351 | 351 | $update_info = array(); |
352 | - foreach ( $raw_post_array as $keyval ) { |
|
353 | - $keyval = explode( '=', $keyval ); |
|
354 | - if ( count( $keyval ) == 2 ) |
|
355 | - $update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] ); |
|
352 | + foreach ($raw_post_array as $keyval) { |
|
353 | + $keyval = explode('=', $keyval); |
|
354 | + if (count($keyval) == 2) |
|
355 | + $update_info[$keyval[0]] = urldecode($keyval[1]); |
|
356 | 356 | } |
357 | 357 | // read the IPN message sent from PayPal and prepend 'cmd=_notify-validate' |
358 | 358 | $req = 'cmd=_notify-validate'; |
359 | - $get_magic_quotes_exists = function_exists( 'get_magic_quotes_gpc' ) ? true : false; |
|
360 | - foreach ( $update_info as $key => $value ) { |
|
361 | - if ( $get_magic_quotes_exists && get_magic_quotes_gpc() == 1 ) { |
|
362 | - $value = urlencode( stripslashes( $value ) ); |
|
359 | + $get_magic_quotes_exists = function_exists('get_magic_quotes_gpc') ? true : false; |
|
360 | + foreach ($update_info as $key => $value) { |
|
361 | + if ($get_magic_quotes_exists && get_magic_quotes_gpc() == 1) { |
|
362 | + $value = urlencode(stripslashes($value)); |
|
363 | 363 | } else { |
364 | - $value = urlencode( $value ); |
|
364 | + $value = urlencode($value); |
|
365 | 365 | } |
366 | 366 | $req .= "&$key=$value"; |
367 | 367 | } |
@@ -371,34 +371,34 @@ discard block |
||
371 | 371 | array( |
372 | 372 | 'body' => $req, |
373 | 373 | 'sslverify' => false, |
374 | - 'timeout' => 60 , |
|
374 | + 'timeout' => 60, |
|
375 | 375 | // make sure to set a site specific unique "user-agent" string since the WordPres default gets declined by PayPal |
376 | 376 | // plz see: https://github.com/websharks/s2member/issues/610 |
377 | - 'user-agent' => 'Event Espresso v' . EVENT_ESPRESSO_VERSION . '; ' . home_url(), |
|
377 | + 'user-agent' => 'Event Espresso v'.EVENT_ESPRESSO_VERSION.'; '.home_url(), |
|
378 | 378 | 'httpversion' => '1.1' |
379 | 379 | ) |
380 | 380 | ); |
381 | 381 | // then check the response |
382 | - if ( ! is_wp_error( $response ) && array_key_exists( 'body', $response ) && strcmp( $response[ 'body' ], "VERIFIED" ) == 0 ) { |
|
382 | + if ( ! is_wp_error($response) && array_key_exists('body', $response) && strcmp($response['body'], "VERIFIED") == 0) { |
|
383 | 383 | return true; |
384 | 384 | } else { |
385 | 385 | // huh, something's wack... the IPN didn't validate. We must have replied to the IPN incorrectly, |
386 | 386 | // or their API must have changed: http://www.paypalobjects.com/en_US/ebook/PP_OrderManagement_IntegrationGuide/ipn.html |
387 | - if( is_wp_error( $response ) ) { |
|
387 | + if (is_wp_error($response)) { |
|
388 | 388 | $error_msg = sprintf( |
389 | - __( 'WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso' ), |
|
389 | + __('WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso'), |
|
390 | 390 | $response->get_error_code(), |
391 | 391 | $response->get_error_message(), |
392 | - print_r( $response->get_error_data, true ) |
|
392 | + print_r($response->get_error_data, true) |
|
393 | 393 | ); |
394 | - } elseif( is_array( $response ) && isset( $response[ 'body' ] ) ) { |
|
395 | - $error_msg = $response[ 'body' ]; |
|
394 | + } elseif (is_array($response) && isset($response['body'])) { |
|
395 | + $error_msg = $response['body']; |
|
396 | 396 | } else { |
397 | - $error_msg = print_r( $response, true ); |
|
397 | + $error_msg = print_r($response, true); |
|
398 | 398 | } |
399 | - $payment->set_gateway_response( sprintf( __( "IPN Validation failed! Paypal responded with '%s'", "event_espresso" ), $error_msg ) ); |
|
400 | - $payment->set_details( array( 'REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response ) ); |
|
401 | - $payment->set_status( EEM_Payment::status_id_failed ); |
|
399 | + $payment->set_gateway_response(sprintf(__("IPN Validation failed! Paypal responded with '%s'", "event_espresso"), $error_msg)); |
|
400 | + $payment->set_details(array('REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response)); |
|
401 | + $payment->set_status(EEM_Payment::status_id_failed); |
|
402 | 402 | // log the results |
403 | 403 | $this->log( |
404 | 404 | array( |
@@ -420,9 +420,9 @@ discard block |
||
420 | 420 | */ |
421 | 421 | protected function _process_response_url() { |
422 | 422 | EE_Registry::instance()->load_helper('URL'); |
423 | - if ( isset( $_SERVER[ 'HTTP_HOST' ], $_SERVER[ 'REQUEST_URI' ] ) ) { |
|
423 | + if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) { |
|
424 | 424 | $url = is_ssl() ? 'https://' : 'http://'; |
425 | - $url .= EEH_URL::filter_input_server_url( 'HTTP_HOST' ); |
|
425 | + $url .= EEH_URL::filter_input_server_url('HTTP_HOST'); |
|
426 | 426 | $url .= EEH_URL::filter_input_server_url(); |
427 | 427 | } else { |
428 | 428 | $url = 'unknown'; |
@@ -438,30 +438,30 @@ discard block |
||
438 | 438 | * like the taxes or shipping |
439 | 439 | * @param EEI_Payment $payment |
440 | 440 | */ |
441 | - public function update_txn_based_on_payment( $payment ) { |
|
441 | + public function update_txn_based_on_payment($payment) { |
|
442 | 442 | $update_info = $payment->details(); |
443 | 443 | $transaction = $payment->transaction(); |
444 | - $payment_was_itemized = $payment->get_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true, false ); |
|
445 | - if( ! $transaction ){ |
|
446 | - $this->log( __( 'Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly', 'event_espresso' ), $payment ); |
|
444 | + $payment_was_itemized = $payment->get_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true, false); |
|
445 | + if ( ! $transaction) { |
|
446 | + $this->log(__('Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly', 'event_espresso'), $payment); |
|
447 | 447 | return; |
448 | 448 | } |
449 | - if( ! is_array( $update_info ) || ! isset( $update_info[ 'mc_shipping' ] ) || ! isset( $update_info[ 'tax' ] ) ) { |
|
449 | + if ( ! is_array($update_info) || ! isset($update_info['mc_shipping']) || ! isset($update_info['tax'])) { |
|
450 | 450 | $this->log( |
451 | 451 | array( |
452 | 452 | 'url' => $this->_process_response_url(), |
453 | - 'message' => __( 'Could not update transaction based on payment because the payment details have not yet been put on the payment. This normally happens during the IPN or returning from PayPal', 'event_espresso' ), |
|
453 | + 'message' => __('Could not update transaction based on payment because the payment details have not yet been put on the payment. This normally happens during the IPN or returning from PayPal', 'event_espresso'), |
|
454 | 454 | 'payment' => $payment->model_field_array() |
455 | 455 | ), |
456 | 456 | $payment |
457 | 457 | ); |
458 | 458 | return; |
459 | 459 | } |
460 | - if( $payment->status() !== $this->_pay_model->approved_status() ) { |
|
460 | + if ($payment->status() !== $this->_pay_model->approved_status()) { |
|
461 | 461 | $this->log( |
462 | 462 | array( |
463 | 463 | 'url' => $this->_process_response_url(), |
464 | - 'message' => __( 'We shouldn\'t update transactions taxes or shipping data from non-approved payments', 'event_espresso' ), |
|
464 | + 'message' => __('We shouldn\'t update transactions taxes or shipping data from non-approved payments', 'event_espresso'), |
|
465 | 465 | 'payment' => $payment->model_field_array() |
466 | 466 | ), |
467 | 467 | $payment |
@@ -471,43 +471,43 @@ discard block |
||
471 | 471 | $grand_total_needs_resaving = false; |
472 | 472 | |
473 | 473 | //might paypal have changed the taxes? |
474 | - if( $this->_paypal_taxes && $payment_was_itemized ){ |
|
474 | + if ($this->_paypal_taxes && $payment_was_itemized) { |
|
475 | 475 | //note that we're doing this BEFORE adding shipping; we actually want PayPal's shipping to remain non-taxable |
476 | - $this->_line_item->set_line_items_taxable( $transaction->total_line_item(), true, 'paypal_shipping' ); |
|
476 | + $this->_line_item->set_line_items_taxable($transaction->total_line_item(), true, 'paypal_shipping'); |
|
477 | 477 | $this->_line_item->set_total_tax_to( |
478 | 478 | $transaction->total_line_item(), |
479 | - floatval( $update_info['tax'] ), |
|
480 | - __( 'Taxes', 'event_espresso' ), |
|
481 | - __( 'Calculated by Paypal', 'event_espresso' ), |
|
479 | + floatval($update_info['tax']), |
|
480 | + __('Taxes', 'event_espresso'), |
|
481 | + __('Calculated by Paypal', 'event_espresso'), |
|
482 | 482 | 'paypal_tax' |
483 | 483 | ); |
484 | 484 | $grand_total_needs_resaving = TRUE; |
485 | 485 | } |
486 | 486 | |
487 | - $shipping_amount = floatval( $update_info[ 'mc_shipping' ] ); |
|
487 | + $shipping_amount = floatval($update_info['mc_shipping']); |
|
488 | 488 | //might paypal have added shipping? |
489 | - if( $this->_paypal_shipping && $shipping_amount && $payment_was_itemized ){ |
|
489 | + if ($this->_paypal_shipping && $shipping_amount && $payment_was_itemized) { |
|
490 | 490 | $this->_line_item->add_unrelated_item( |
491 | 491 | $transaction->total_line_item(), |
492 | - sprintf( __('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID() ), |
|
492 | + sprintf(__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID()), |
|
493 | 493 | $shipping_amount, |
494 | 494 | __('Shipping charges calculated by Paypal', 'event_espresso'), |
495 | 495 | 1, |
496 | 496 | false, |
497 | - 'paypal_shipping_' . $transaction->ID() |
|
497 | + 'paypal_shipping_'.$transaction->ID() |
|
498 | 498 | ); |
499 | 499 | $grand_total_needs_resaving = true; |
500 | 500 | } |
501 | 501 | |
502 | - if( $grand_total_needs_resaving ){ |
|
503 | - $transaction->total_line_item()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
504 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
505 | - $registration_processor->update_registration_final_prices( $transaction ); |
|
502 | + if ($grand_total_needs_resaving) { |
|
503 | + $transaction->total_line_item()->save_this_and_descendants_to_txn($transaction->ID()); |
|
504 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
505 | + $registration_processor->update_registration_final_prices($transaction); |
|
506 | 506 | } |
507 | 507 | $this->log( |
508 | 508 | array( |
509 | 509 | 'url' => $this->_process_response_url(), |
510 | - 'message' => __( 'Updated transaction related to payment', 'event_espresso' ), |
|
510 | + 'message' => __('Updated transaction related to payment', 'event_espresso'), |
|
511 | 511 | 'transaction (updated)' => $transaction->model_field_array(), |
512 | 512 | 'payment (updated)' => $payment->model_field_array(), |
513 | 513 | 'use_paypal_shipping' => $this->_paypal_shipping, |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @param bool $preview indicate whether a preview is being generated or not. |
272 | 272 | * @return void |
273 | 273 | */ |
274 | - public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE ) { |
|
274 | + public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE) { |
|
275 | 275 | |
276 | 276 | $this->_active_messenger = $active_messenger; |
277 | 277 | |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | |
281 | 281 | //this is a special method that allows child message types to trigger an exit from generating messages early (in cases where there may be a delay on send). |
282 | 282 | $exit = $this->_trigger_exit(); |
283 | - if ( $exit && ! $this->_preview ) return FALSE; |
|
283 | + if ($exit && ! $this->_preview) return FALSE; |
|
284 | 284 | |
285 | 285 | //todo: need to move require into registration hook but for now we'll require here. |
286 | - EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ); |
|
286 | + EE_Registry::instance()->load_helper('Parse_Shortcodes'); |
|
287 | 287 | //get shortcode_replace instance- set when _get_messages is called in child... |
288 | 288 | $this->_shortcode_replace = new EEH_Parse_Shortcodes(); |
289 | 289 | |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | $this->_data_handler = ! $this->_preview ? $this->_data_handler : 'Preview'; |
295 | 295 | |
296 | 296 | //if there is an incoming context then this is a preview so let's ONLY show the given context! |
297 | - if ( !empty( $context ) ) { |
|
298 | - $cntxt = ! empty( $this->_contexts[$context] ) ? $this->_contexts[$context] : ''; |
|
299 | - if ( ! empty( $cntxt ) ) { |
|
297 | + if ( ! empty($context)) { |
|
298 | + $cntxt = ! empty($this->_contexts[$context]) ? $this->_contexts[$context] : ''; |
|
299 | + if ( ! empty($cntxt)) { |
|
300 | 300 | $this->_contexts = array(); |
301 | 301 | $this->_contexts[$context] = $cntxt; |
302 | 302 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $exit = $this->_init_data(); |
306 | 306 | |
307 | 307 | //final check for if we exit or not cause child objects may have run conditionals that cleared out data so no addresees generated. |
308 | - if ( $exit ) return FALSE; |
|
308 | + if ($exit) return FALSE; |
|
309 | 309 | |
310 | 310 | $this->_get_templates(); //get the templates that have been set with this type and for the given messenger that have been saved in the database. |
311 | 311 | $this->_assemble_messages(); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * @param int $id Optional. Integer corresponding to the value for the primary key of a EE_Base_Class_Object |
342 | 342 | * @return mixed ( EE_Base_Class||EE_Base_Class[] ) |
343 | 343 | */ |
344 | - abstract protected function _get_data_for_context( $context, EE_Registration $registration, $id ); |
|
344 | + abstract protected function _get_data_for_context($context, EE_Registration $registration, $id); |
|
345 | 345 | |
346 | 346 | |
347 | 347 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @return int |
375 | 375 | */ |
376 | - protected function _get_id_for_msg_url( $context, EE_Registration $registration ) { |
|
376 | + protected function _get_id_for_msg_url($context, EE_Registration $registration) { |
|
377 | 377 | return 0; |
378 | 378 | } |
379 | 379 | |
@@ -406,28 +406,28 @@ discard block |
||
406 | 406 | * |
407 | 407 | * @return string generated url |
408 | 408 | */ |
409 | - public function get_url_trigger( $context, $sending_messenger, EE_Registration $registration ) { |
|
409 | + public function get_url_trigger($context, $sending_messenger, EE_Registration $registration) { |
|
410 | 410 | |
411 | 411 | //validate context |
412 | 412 | //valid context? |
413 | - if ( !isset( $this->_contexts[$context] ) ) { |
|
414 | - throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) ); |
|
413 | + if ( ! isset($this->_contexts[$context])) { |
|
414 | + throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this))); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | //valid sending_messenger? |
418 | 418 | $not_valid_msgr = FALSE; |
419 | - foreach ( $this->_with_messengers as $generating => $sendings ) { |
|
420 | - if ( empty( $sendings ) || array_search( $sending_messenger, $sendings ) === FALSE ) { |
|
419 | + foreach ($this->_with_messengers as $generating => $sendings) { |
|
420 | + if (empty($sendings) || array_search($sending_messenger, $sendings) === FALSE) { |
|
421 | 421 | $not_valid_msgr = TRUE; |
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
425 | - if ( $not_valid_msgr ) { |
|
426 | - throw new EE_Error( sprintf( __('The given sending messenger string (%s) does not match a valid sending messenger with the %s. If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class( $this ) ) ); |
|
425 | + if ($not_valid_msgr) { |
|
426 | + throw new EE_Error(sprintf(__('The given sending messenger string (%s) does not match a valid sending messenger with the %s. If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class($this))); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | EE_Registry::instance()->load_helper('MSG_Template'); |
430 | - return EEH_MSG_Template::generate_url_trigger( $sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url( $context, $registration ) ); |
|
430 | + return EEH_MSG_Template::generate_url_trigger($sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url($context, $registration)); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -448,19 +448,19 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @return mixed (EE_Base_Class||EE_Base_Class[]) |
450 | 450 | */ |
451 | - public function get_data_for_context( $context, EE_Registration $registration, $id = 0 ) { |
|
451 | + public function get_data_for_context($context, EE_Registration $registration, $id = 0) { |
|
452 | 452 | //valid context? |
453 | - if ( !isset( $this->_contexts[$context] ) ) { |
|
454 | - throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) ); |
|
453 | + if ( ! isset($this->_contexts[$context])) { |
|
454 | + throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this))); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | //get data and apply global and class specific filters on it. |
458 | - $data = apply_filters( 'FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context( $context, $registration, $id ), $this ); |
|
459 | - $data = apply_filters( 'FHEE__' . get_class( $this ) . '__get_data_for_context__data', $data, $this ); |
|
458 | + $data = apply_filters('FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context($context, $registration, $id), $this); |
|
459 | + $data = apply_filters('FHEE__'.get_class($this).'__get_data_for_context__data', $data, $this); |
|
460 | 460 | |
461 | 461 | //if empty then something went wrong! |
462 | - if ( empty( $data ) ) { |
|
463 | - throw new EE_Error( sprintf( __('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name ) ); |
|
462 | + if (empty($data)) { |
|
463 | + throw new EE_Error(sprintf(__('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name)); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | return $data; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | */ |
496 | 496 | public function with_messengers() { |
497 | 497 | |
498 | - return apply_filters( 'FHEE__EE_message_type__get_with_messengers__with_messengers__' . get_class( $this ), $this->_with_messengers); |
|
498 | + return apply_filters('FHEE__EE_message_type__get_with_messengers__with_messengers__'.get_class($this), $this->_with_messengers); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | * @access public |
514 | 514 | * @return void |
515 | 515 | */ |
516 | - public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array() ) { |
|
516 | + public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array()) { |
|
517 | 517 | //we can also further refine the context by action (if present). |
518 | - return $this->_get_admin_page_content( $page, $action, $extra, $messengers ); |
|
518 | + return $this->_get_admin_page_content($page, $action, $extra, $messengers); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | */ |
560 | 560 | public function get_master_templates() { |
561 | 561 | //first class specific filter then filter that by the global filter. |
562 | - $master_templates = apply_filters( 'FHEE__' . get_class( $this ) . '__get_master_templates', $this->_master_templates ); |
|
563 | - return apply_filters( 'FHEE__EE_message_type__get_master_templates', $master_templates, $this ); |
|
562 | + $master_templates = apply_filters('FHEE__'.get_class($this).'__get_master_templates', $this->_master_templates); |
|
563 | + return apply_filters('FHEE__EE_message_type__get_master_templates', $master_templates, $this); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -579,31 +579,31 @@ discard block |
||
579 | 579 | /** |
580 | 580 | * first let's make sure that incoming data isn't empty! |
581 | 581 | */ |
582 | - if ( is_array($this->_data) && empty($this->_data) && !$this->_preview ) { |
|
583 | - $msg = sprintf( __( '"%s" message type incoming data is empty. There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular'] ); |
|
584 | - throw new EE_Error( $msg ); |
|
582 | + if (is_array($this->_data) && empty($this->_data) && ! $this->_preview) { |
|
583 | + $msg = sprintf(__('"%s" message type incoming data is empty. There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular']); |
|
584 | + throw new EE_Error($msg); |
|
585 | 585 | } |
586 | 586 | |
587 | - if ( empty( $this->_data_handler) ) { |
|
588 | - $msg = sprintf( __('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__ ); |
|
589 | - throw new EE_Error( $msg ); |
|
587 | + if (empty($this->_data_handler)) { |
|
588 | + $msg = sprintf(__('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__); |
|
589 | + throw new EE_Error($msg); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
593 | 593 | //setup class name for the data handler |
594 | - $classname = 'EE_Messages_' . $this->_data_handler . '_incoming_data'; |
|
594 | + $classname = 'EE_Messages_'.$this->_data_handler.'_incoming_data'; |
|
595 | 595 | |
596 | 596 | //check that the class exists |
597 | - if ( !class_exists( $classname ) ) { |
|
597 | + if ( ! class_exists($classname)) { |
|
598 | 598 | |
599 | 599 | $msg[] = __('uhoh, Something went wrong and no data handler is found', 'event_espresso'); |
600 | - $msg[] = sprintf( __('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class"). Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname ); |
|
601 | - throw new EE_error( implode('||', $msg) ); |
|
600 | + $msg[] = sprintf(__('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class"). Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname); |
|
601 | + throw new EE_error(implode('||', $msg)); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | //k lets get the prepared data object and replace existing data property with it. |
605 | - $a = new ReflectionClass( $classname ); |
|
606 | - $this->_data = $a->newInstance( $this->_data ); |
|
605 | + $a = new ReflectionClass($classname); |
|
606 | + $this->_data = $a->newInstance($this->_data); |
|
607 | 607 | |
608 | 608 | $this->_set_default_addressee_data(); |
609 | 609 | return $this->_process_data(); |
@@ -619,15 +619,15 @@ discard block |
||
619 | 619 | protected function _process_data() { |
620 | 620 | //at a minimum, we NEED EE_Attendee objects. |
621 | 621 | |
622 | - if ( empty( $this->_data->attendees ) ) |
|
623 | - return TRUE; //EXIT! |
|
622 | + if (empty($this->_data->attendees)) |
|
623 | + return TRUE; //EXIT! |
|
624 | 624 | |
625 | 625 | //process addressees for each context. Child classes will have to have methods for each context defined to handle the processing of the data object within them |
626 | - foreach ( $this->_contexts as $context => $details ) { |
|
627 | - $xpctd_method = '_' . $context . '_addressees'; |
|
628 | - if ( !method_exists( $this, $xpctd_method ) ) |
|
629 | - throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) ); |
|
630 | - $this->_addressees[$context] = call_user_func( array( $this, $xpctd_method ) ); |
|
626 | + foreach ($this->_contexts as $context => $details) { |
|
627 | + $xpctd_method = '_'.$context.'_addressees'; |
|
628 | + if ( ! method_exists($this, $xpctd_method)) |
|
629 | + throw new EE_Error(sprintf(__('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method)); |
|
630 | + $this->_addressees[$context] = call_user_func(array($this, $xpctd_method)); |
|
631 | 631 | } |
632 | 632 | return FALSE; //DON'T EXIT |
633 | 633 | } |
@@ -662,8 +662,8 @@ discard block |
||
662 | 662 | 'total_ticket_count' => $this->_data->total_ticket_count |
663 | 663 | ); |
664 | 664 | |
665 | - if ( is_array( $this->_data->primary_attendee_data ) ) { |
|
666 | - $this->_default_addressee_data = array_merge( $this->_default_addressee_data, $this->_data->primary_attendee_data ); |
|
665 | + if (is_array($this->_data->primary_attendee_data)) { |
|
666 | + $this->_default_addressee_data = array_merge($this->_default_addressee_data, $this->_data->primary_attendee_data); |
|
667 | 667 | $this->_default_addressee_data['primary_att_obj'] = $this->_data->primary_attendee_data['att_obj']; |
668 | 668 | $this->_default_addressee_data['primary_reg_obj'] = $this->_data->primary_attendee_data['reg_obj']; |
669 | 669 | } |
@@ -681,26 +681,26 @@ discard block |
||
681 | 681 | * see abstract declaration in parent class for details, children message types can override these valid shortcodes if desired (we include all for all contexts by default). |
682 | 682 | */ |
683 | 683 | protected function _set_valid_shortcodes() { |
684 | - $all_shortcodes = array( 'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger' ); |
|
684 | + $all_shortcodes = array('attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger'); |
|
685 | 685 | $contexts = $this->get_contexts(); |
686 | - foreach ( $contexts as $context => $details ) { |
|
686 | + foreach ($contexts as $context => $details) { |
|
687 | 687 | $this->_valid_shortcodes[$context] = $all_shortcodes; |
688 | 688 | |
689 | 689 | //make sure non admin context does not include the event_author shortcodes |
690 | - if ( $context != 'admin' ) { |
|
691 | - if( ($key = array_search('event_author', $this->_valid_shortcodes[$context] ) ) !== false) { |
|
690 | + if ($context != 'admin') { |
|
691 | + if (($key = array_search('event_author', $this->_valid_shortcodes[$context])) !== false) { |
|
692 | 692 | unset($this->_valid_shortcodes[$context][$key]); |
693 | 693 | } |
694 | 694 | } |
695 | 695 | } |
696 | 696 | |
697 | 697 | //make sure admin context does not include the recipient_details shortcodes IF we have admin context hooked in message types might not have that context. |
698 | - if ( !empty( $this->_valid_shortcodes['admin'] ) ) { |
|
699 | - if( ($key = array_search('recipient_details', $this->_valid_shortcodes['admin'] ) ) !== false) { |
|
698 | + if ( ! empty($this->_valid_shortcodes['admin'])) { |
|
699 | + if (($key = array_search('recipient_details', $this->_valid_shortcodes['admin'])) !== false) { |
|
700 | 700 | unset($this->_valid_shortcodes['admin'][$key]); |
701 | 701 | } |
702 | 702 | //make sure admin context does not include the recipient_details shortcodes |
703 | - if( ($key = array_search('recipient_list', $this->_valid_shortcodes['admin'] ) ) !== false) { |
|
703 | + if (($key = array_search('recipient_list', $this->_valid_shortcodes['admin'])) !== false) { |
|
704 | 704 | unset($this->_valid_shortcodes['admin'][$key]); |
705 | 705 | } |
706 | 706 | } |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | * @param array $new_config array of valid shortcodes (by context) |
714 | 714 | * @return void sets valid_shortcodes property |
715 | 715 | */ |
716 | - public function reset_valid_shortcodes_config( $new_config ) { |
|
717 | - foreach ( $new_config as $context => $shortcodes ) { |
|
716 | + public function reset_valid_shortcodes_config($new_config) { |
|
717 | + foreach ($new_config as $context => $shortcodes) { |
|
718 | 718 | $this->_valid_shortcodes[$context] = $shortcodes; |
719 | 719 | } |
720 | 720 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | $addressees = array(); |
735 | 735 | |
736 | 736 | //first we need to get the event admin user id for all the events and setup an addressee object for each unique admin user. |
737 | - foreach ( $this->_data->events as $line_ref => $event ) { |
|
737 | + foreach ($this->_data->events as $line_ref => $event) { |
|
738 | 738 | $admin_id = $this->_get_event_admin_id($event['ID']); |
739 | 739 | //get the user_id for the event |
740 | 740 | $admin_ids[] = $admin_id; |
@@ -746,14 +746,14 @@ discard block |
||
746 | 746 | $admin_ids = array_unique($admin_ids); |
747 | 747 | |
748 | 748 | //k now we can loop through the event_admins and setup the addressee data. |
749 | - foreach ( $admin_ids as $event_admin ) { |
|
749 | + foreach ($admin_ids as $event_admin) { |
|
750 | 750 | $aee = array( |
751 | 751 | 'user_id' => $event_admin, |
752 | 752 | 'events' => $admin_events[$event_admin], |
753 | 753 | 'attendees' => $this->_data->attendees |
754 | 754 | ); |
755 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
756 | - $addressees[] = new EE_Messages_Addressee( $aee ); |
|
755 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
756 | + $addressees[] = new EE_Messages_Addressee($aee); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | return $addressees; |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | $aee['attendees'] = $this->_data->attendees; |
774 | 774 | |
775 | 775 | //great now we can instantiate the $addressee object and return (as an array); |
776 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
776 | + $add[] = new EE_Messages_Addressee($aee); |
|
777 | 777 | return $add; |
778 | 778 | } |
779 | 779 | |
@@ -792,34 +792,34 @@ discard block |
||
792 | 792 | //use to verify unique attendee emails... we don't want to sent multiple copies to the same attendee do we? |
793 | 793 | $already_processed = array(); |
794 | 794 | |
795 | - foreach ( $this->_data->attendees as $att_id => $details ) { |
|
795 | + foreach ($this->_data->attendees as $att_id => $details) { |
|
796 | 796 | //set the attendee array to blank on each loop; |
797 | 797 | $aee = array(); |
798 | 798 | |
799 | - if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) continue; |
|
799 | + if (isset($this->_data->reg_obj) && ($this->_data->reg_obj->attendee_ID() != $att_id) && $this->_single_message) continue; |
|
800 | 800 | |
801 | 801 | //is $this->_regs_for_sending present? If so, let's make sure we ONLY generate addressee for registrations in that array. |
802 | - if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) { |
|
803 | - $regs_allowed = array_intersect_key( array_flip( $this->_regs_for_sending ), $details['reg_objs'] ); |
|
804 | - if ( empty( $regs_allowed ) ) { |
|
802 | + if ( ! empty($this->_regs_for_sending) && is_array($this->_regs_for_sending)) { |
|
803 | + $regs_allowed = array_intersect_key(array_flip($this->_regs_for_sending), $details['reg_objs']); |
|
804 | + if (empty($regs_allowed)) { |
|
805 | 805 | continue; |
806 | 806 | } |
807 | 807 | } |
808 | 808 | |
809 | - if ( in_array( $details['attendee_email'], $already_processed ) ) |
|
809 | + if (in_array($details['attendee_email'], $already_processed)) |
|
810 | 810 | continue; |
811 | 811 | |
812 | 812 | $already_processed[] = $details['attendee_email']; |
813 | 813 | |
814 | - foreach ( $details as $item => $value ) { |
|
814 | + foreach ($details as $item => $value) { |
|
815 | 815 | $aee[$item] = $value; |
816 | - if ( $item == 'line_ref' ) { |
|
817 | - foreach ( $value as $event_id ) { |
|
816 | + if ($item == 'line_ref') { |
|
817 | + foreach ($value as $event_id) { |
|
818 | 818 | $aee['events'][$event_id] = $this->_data->events[$event_id]; |
819 | 819 | } |
820 | 820 | } |
821 | 821 | |
822 | - if ( $item == 'attendee_email' ) { |
|
822 | + if ($item == 'attendee_email') { |
|
823 | 823 | $aee['attendee_email'] = $value; |
824 | 824 | } |
825 | 825 | |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | $aee['attendees'] = $this->_data->attendees; |
835 | 835 | |
836 | 836 | //merge in the primary attendee data |
837 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
838 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
837 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
838 | + $add[] = new EE_Messages_Addressee($aee); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | return $add; |
@@ -860,46 +860,46 @@ discard block |
||
860 | 860 | ); |
861 | 861 | |
862 | 862 | //in vanilla EE we're assuming there's only one event. However, if there are multiple events then we'll just use the default templates instead of different templates per event (which could create problems). |
863 | - if ( count($this->_data->events) === 1 ) { |
|
864 | - foreach ( $this->_data->events as $event ) { |
|
863 | + if (count($this->_data->events) === 1) { |
|
864 | + foreach ($this->_data->events as $event) { |
|
865 | 865 | $EVT_ID = $event['ID']; |
866 | 866 | } |
867 | 867 | } |
868 | 868 | // is there a Group ID in the incoming request? |
869 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
869 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
870 | 870 | // if not, set a default value of false |
871 | - $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID', false ); |
|
871 | + $GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID', false); |
|
872 | 872 | //if this is a preview then we just get whatever message group is for the preview and skip this part! |
873 | - if ( $this->_preview && $GRP_ID ) { |
|
874 | - $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
873 | + if ($this->_preview && $GRP_ID) { |
|
874 | + $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
875 | 875 | } else { |
876 | 876 | //not a preview or test send so lets continue on our way! |
877 | 877 | //is there an evt_id? If so let's get that. template. |
878 | - if ( !empty( $EVT_ID ) ) { |
|
878 | + if ( ! empty($EVT_ID)) { |
|
879 | 879 | $evt_qa = array( |
880 | 880 | 'Event.EVT_ID' => $EVT_ID |
881 | 881 | ); |
882 | - $qa = array_merge( $template_qa, $evt_qa ); |
|
883 | - $mtpg = EEM_Message_Template_Group::instance()->get_one( array( $qa ) ); |
|
882 | + $qa = array_merge($template_qa, $evt_qa); |
|
883 | + $mtpg = EEM_Message_Template_Group::instance()->get_one(array($qa)); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | //is there a 'GRP_ID' ? if so let's get that. |
887 | 887 | |
888 | 888 | //if global template is NOT an override, and there is a 'GRP_ID' in the request, then we'll assume a specific template has ben requested. |
889 | - if ( $GRP_ID ) { |
|
890 | - $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
889 | + if ($GRP_ID) { |
|
890 | + $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | |
894 | 894 | $template_qa['MTP_is_global'] = TRUE; |
895 | 895 | |
896 | 896 | //this gets the current global template (message template group) for the active messenger and message type. |
897 | - $global_mtpg = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) ); |
|
897 | + $global_mtpg = EEM_Message_Template_Group::instance()->get_one(array($template_qa)); |
|
898 | 898 | |
899 | - $mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get( 'MTP_is_override' ) ? $mtpg : $global_mtpg; |
|
899 | + $mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get('MTP_is_override') ? $mtpg : $global_mtpg; |
|
900 | 900 | } |
901 | 901 | |
902 | - if ( ! $mtpg instanceof EE_Message_Template_Group ) { |
|
902 | + if ( ! $mtpg instanceof EE_Message_Template_Group) { |
|
903 | 903 | //get out because we can't process anything, there are no message template groups |
904 | 904 | // and thus some sort of bad setup issues. |
905 | 905 | return false; |
@@ -915,8 +915,8 @@ discard block |
||
915 | 915 | |
916 | 916 | |
917 | 917 | |
918 | - foreach ( $templates as $context => $template_fields ) { |
|
919 | - foreach( $template_fields as $template_field=> $template_obj ) { |
|
918 | + foreach ($templates as $context => $template_fields) { |
|
919 | + foreach ($template_fields as $template_field=> $template_obj) { |
|
920 | 920 | $this->_templates[$template_field][$context] = $template_obj->get('MTP_content'); |
921 | 921 | } |
922 | 922 | } |
@@ -931,11 +931,11 @@ discard block |
||
931 | 931 | protected function _assemble_messages() { |
932 | 932 | //make sure any set messages object is cleared |
933 | 933 | $this->messages = array(); |
934 | - foreach ( $this->_addressees as $context => $addressees ) { |
|
935 | - foreach ( $addressees as $addressee ) { |
|
934 | + foreach ($this->_addressees as $context => $addressees) { |
|
935 | + foreach ($addressees as $addressee) { |
|
936 | 936 | $message = $this->_setup_message_object($context, $addressee); |
937 | 937 | //only assign message if everything went okay |
938 | - if ( $message ) { |
|
938 | + if ($message) { |
|
939 | 939 | $message->template_pack = $this->_template_pack; |
940 | 940 | $message->variation = $this->_variation; |
941 | 941 | $this->messages[] = $message; |
@@ -959,22 +959,22 @@ discard block |
||
959 | 959 | $m_shortcodes = $this->_active_messenger->get_valid_shortcodes(); |
960 | 960 | |
961 | 961 | //if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because this context is turned off) EXCEPT if we're previewing |
962 | - if ( ( isset( $this->_templates['to'][$context] ) && empty( $this->_templates['to'][$context] ) ) && !$this->_preview ) |
|
962 | + if ((isset($this->_templates['to'][$context]) && empty($this->_templates['to'][$context])) && ! $this->_preview) |
|
963 | 963 | return false; |
964 | 964 | |
965 | - if ( empty( $this->_templates ) ) { |
|
965 | + if (empty($this->_templates)) { |
|
966 | 966 | //unable to setup any messages because there are no templates. Some sort of catastrophic setup |
967 | 967 | //issue exists |
968 | 968 | return false; |
969 | 969 | } |
970 | 970 | |
971 | - foreach ( $this->_templates as $field => $ctxt ) { |
|
971 | + foreach ($this->_templates as $field => $ctxt) { |
|
972 | 972 | //let's setup the valid shortcodes for the incoming context. |
973 | 973 | $valid_shortcodes = $mt_shortcodes[$context]; |
974 | 974 | //merge in valid shortcodes for the field. |
975 | 975 | $shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes; |
976 | - if ( isset( $this->_templates[$field][$context] ) ) { |
|
977 | - $message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID ); |
|
976 | + if (isset($this->_templates[$field][$context])) { |
|
977 | + $message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID); |
|
978 | 978 | } |
979 | 979 | } |
980 | 980 | return $message; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <div id="admin-primary-mbox-dv" class="admin-primary-mbox-dv"> |
2 | 2 | |
3 | 3 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
4 | - <span class="dashicons dashicons-cart"></span><?php _e( 'Transaction Items', 'event_espresso' );?> |
|
4 | + <span class="dashicons dashicons-cart"></span><?php _e('Transaction Items', 'event_espresso'); ?> |
|
5 | 5 | </h3> |
6 | 6 | |
7 | 7 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -10,27 +10,27 @@ discard block |
||
10 | 10 | </div> |
11 | 11 | |
12 | 12 | <a id="display-additional-transaction-session-info" class="display-the-hidden smaller-text" rel="additional-transaction-session-info"> |
13 | - <span class="dashicons dashicons-plus-alt"></span><?php _e( 'view additional transaction session details', 'event_espresso' );?> |
|
13 | + <span class="dashicons dashicons-plus-alt"></span><?php _e('view additional transaction session details', 'event_espresso'); ?> |
|
14 | 14 | </a> |
15 | 15 | |
16 | 16 | <div id="additional-transaction-session-info-dv" class="hidden"> |
17 | 17 | |
18 | 18 | <a id="hide-additional-transaction-session-info" class="hide-the-displayed hidden smaller-text" rel="additional-transaction-session-info"> |
19 | - <span class="dashicons dashicons-dismiss"></span><?php _e( 'hide additional transaction session details', 'event_espresso' );?> |
|
19 | + <span class="dashicons dashicons-dismiss"></span><?php _e('hide additional transaction session details', 'event_espresso'); ?> |
|
20 | 20 | </a> |
21 | 21 | <br class="clear"/> |
22 | 22 | |
23 | - <h3 class="admin-primary-mbox-h4"><?php _e( 'Transaction Session Details', 'event_espresso' );?></h3> |
|
23 | + <h3 class="admin-primary-mbox-h4"><?php _e('Transaction Session Details', 'event_espresso'); ?></h3> |
|
24 | 24 | |
25 | 25 | <table id="admin-primary-mbox-txn-extra-session-info-tbl" class="form-table skinny-rows"> |
26 | 26 | <tbody> |
27 | - <?php foreach ( $txn_details as $key => $txn_detail ) : ?> |
|
27 | + <?php foreach ($txn_details as $key => $txn_detail) : ?> |
|
28 | 28 | <tr> |
29 | 29 | <th> |
30 | - <label for="<?php echo $key;?>"><?php echo $txn_detail['label'];?></label> |
|
30 | + <label for="<?php echo $key; ?>"><?php echo $txn_detail['label']; ?></label> |
|
31 | 31 | </th> |
32 | 32 | <td> |
33 | - <?php echo $txn_detail['value'];?> |
|
33 | + <?php echo $txn_detail['value']; ?> |
|
34 | 34 | </td> |
35 | 35 | </tr> |
36 | 36 | <?php endforeach; // $txn_details?> |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | <br class="clear"/> |
41 | 41 | |
42 | 42 | |
43 | - <?php if ( $attendee instanceof EE_Attendee && ( $grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty( $payments ) ) ) : ?> |
|
43 | + <?php if ($attendee instanceof EE_Attendee && ($grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty($payments))) : ?> |
|
44 | 44 | |
45 | 45 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
46 | - <span class="ee-icon ee-icon-cash"></span><?php _e( 'Payment Details', 'event_espresso' );?> |
|
46 | + <span class="ee-icon ee-icon-cash"></span><?php _e('Payment Details', 'event_espresso'); ?> |
|
47 | 47 | </h3> |
48 | 48 | |
49 | 49 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -52,75 +52,75 @@ discard block |
||
52 | 52 | <tr> |
53 | 53 | <th></th> |
54 | 54 | <th class="jst-cntr"></th> |
55 | - <th class="jst-cntr"><?php _e( 'ID', 'event_espresso' );?></th> |
|
56 | - <th class="jst-left"><?php _e( 'Date', 'event_espresso' );?></th> |
|
57 | - <th class="jst-cntr"><?php _e( 'Source', 'event_espresso' );?></th> |
|
58 | - <th class="jst-left"><?php _e( 'Method', 'event_espresso' );?></th> |
|
59 | - <th class="jst-left"><?php _e( 'Gateway Response', 'event_espresso' );?></th> |
|
60 | - <th class="jst-left"><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></th> |
|
61 | - <th class="jst-left"><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></th> |
|
62 | - <th class="jst-left"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></th> |
|
63 | - <!--<th class="jst-left"><?php _e( 'Details', 'event_espresso' );?></th>--> |
|
64 | - <th class="jst-cntr"><?php _e( 'Amount', 'event_espresso' );?></th> |
|
55 | + <th class="jst-cntr"><?php _e('ID', 'event_espresso'); ?></th> |
|
56 | + <th class="jst-left"><?php _e('Date', 'event_espresso'); ?></th> |
|
57 | + <th class="jst-cntr"><?php _e('Source', 'event_espresso'); ?></th> |
|
58 | + <th class="jst-left"><?php _e('Method', 'event_espresso'); ?></th> |
|
59 | + <th class="jst-left"><?php _e('Gateway Response', 'event_espresso'); ?></th> |
|
60 | + <th class="jst-left"><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></th> |
|
61 | + <th class="jst-left"><?php _e('P.O. / S.O. #', 'event_espresso'); ?></th> |
|
62 | + <th class="jst-left"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></th> |
|
63 | + <!--<th class="jst-left"><?php _e('Details', 'event_espresso'); ?></th>--> |
|
64 | + <th class="jst-cntr"><?php _e('Amount', 'event_espresso'); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if ( $payments ) : ?> |
|
68 | + <?php if ($payments) : ?> |
|
69 | 69 | <?php $payment_total = 0; ?> |
70 | - <?php foreach ( $payments as $PAY_ID => $payment ) : ?> |
|
71 | - <tr id="txn-admin-payment-tr-<?php echo $PAY_ID;?>"> |
|
70 | + <?php foreach ($payments as $PAY_ID => $payment) : ?> |
|
71 | + <tr id="txn-admin-payment-tr-<?php echo $PAY_ID; ?>"> |
|
72 | 72 | <td> |
73 | 73 | <span id="payment-status-<?php echo $PAY_ID; ?>" class="ee-status-strip-td ee-status-strip pymt-status-<?php echo $payment->STS_ID(); ?>"></span> |
74 | - <div id="payment-STS_ID-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->STS_ID();?></div> |
|
75 | - <div id="reg-payments-<?php echo $PAY_ID;?>" class="hidden"><?php echo json_encode( $existing_reg_payments[ $PAY_ID ] );?></div> |
|
74 | + <div id="payment-STS_ID-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->STS_ID(); ?></div> |
|
75 | + <div id="reg-payments-<?php echo $PAY_ID; ?>" class="hidden"><?php echo json_encode($existing_reg_payments[$PAY_ID]); ?></div> |
|
76 | 76 | </td> |
77 | 77 | <td class=" jst-cntr"> |
78 | 78 | <ul class="txn-overview-actions-ul"> |
79 | 79 | <li> |
80 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
80 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
81 | 81 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
82 | 82 | </a> |
83 | 83 | </li> |
84 | 84 | <li> |
85 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
85 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
86 | 86 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
87 | 87 | </a> |
88 | 88 | </li> |
89 | 89 | </ul> |
90 | 90 | </td> |
91 | 91 | <td class=" jst-rght"> |
92 | - <div id="payment-id-<?php echo $PAY_ID;?>"><?php echo $PAY_ID;?></div> |
|
92 | + <div id="payment-id-<?php echo $PAY_ID; ?>"><?php echo $PAY_ID; ?></div> |
|
93 | 93 | </td> |
94 | 94 | <td class=" jst-left"> |
95 | - <div id="payment-date-<?php echo $PAY_ID;?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'h:i a');?></div> |
|
95 | + <div id="payment-date-<?php echo $PAY_ID; ?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'h:i a'); ?></div> |
|
96 | 96 | </td> |
97 | 97 | <td class=" jst-cntr"> |
98 | - <div id="payment-method-<?php echo $PAY_ID;?>"> |
|
99 | - <?php echo $payment->source();?> |
|
98 | + <div id="payment-method-<?php echo $PAY_ID; ?>"> |
|
99 | + <?php echo $payment->source(); ?> |
|
100 | 100 | </div> |
101 | 101 | </td> |
102 | 102 | <td class=" jst-left"> |
103 | - <div id="payment-gateway-<?php echo $PAY_ID;?>"> |
|
104 | - <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso');?> |
|
103 | + <div id="payment-gateway-<?php echo $PAY_ID; ?>"> |
|
104 | + <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'); ?> |
|
105 | 105 | </div> |
106 | - <div id="payment-gateway-id-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0;?></div> |
|
106 | + <div id="payment-gateway-id-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0; ?></div> |
|
107 | 107 | </td> |
108 | 108 | <td class=" jst-left"> |
109 | - <div id="payment-response-<?php echo $PAY_ID;?>"><?php echo $payment->gateway_response();?></div> |
|
109 | + <div id="payment-response-<?php echo $PAY_ID; ?>"><?php echo $payment->gateway_response(); ?></div> |
|
110 | 110 | </td> |
111 | 111 | <td class=" jst-left"> |
112 | - <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->txn_id_chq_nmbr();?></div> |
|
112 | + <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->txn_id_chq_nmbr(); ?></div> |
|
113 | 113 | </td> |
114 | 114 | <td class=" jst-left"> |
115 | - <div id="payment-po-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->po_number();?></div> |
|
115 | + <div id="payment-po-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->po_number(); ?></div> |
|
116 | 116 | </td> |
117 | 117 | <td class=" jst-left"> |
118 | - <div id="payment-accntng-<?php echo $PAY_ID;?>"><?php echo $payment->extra_accntng();?></div> |
|
118 | + <div id="payment-accntng-<?php echo $PAY_ID; ?>"><?php echo $payment->extra_accntng(); ?></div> |
|
119 | 119 | </td> |
120 | 120 | <td class=" jst-rght"> |
121 | - <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-' . $payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
122 | - <span class="<?php echo $payment_class;?>"> |
|
123 | - <div id="payment-amount-<?php echo $PAY_ID;?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE ); ?></div> |
|
121 | + <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-'.$payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
122 | + <span class="<?php echo $payment_class; ?>"> |
|
123 | + <div id="payment-amount-<?php echo $PAY_ID; ?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE); ?></div> |
|
124 | 124 | </span> |
125 | 125 | </td> |
126 | 126 | </tr> |
@@ -130,25 +130,25 @@ discard block |
||
130 | 130 | <?php endforeach; // $payment?> |
131 | 131 | <?php |
132 | 132 | $pay_totals_class = $payment_total > $grand_raw_total ? ' important-notice' : ''; |
133 | - $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">' . __( 'This transaction has been overpaid ! ', 'event_espresso' ) . '</span>' : ''; |
|
133 | + $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">'.__('This transaction has been overpaid ! ', 'event_espresso').'</span>' : ''; |
|
134 | 134 | ?> |
135 | 135 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden"> |
136 | 136 | <td class=" jst-rght" colspan="11"> |
137 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
137 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
138 | 138 | </td> |
139 | 139 | </tr> |
140 | - <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class;?>"> |
|
141 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid . sprintf( __( 'Payments Total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );?></span></th> |
|
142 | - <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE);?></span></th> |
|
140 | + <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class; ?>"> |
|
141 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid.sprintf(__('Payments Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); ?></span></th> |
|
142 | + <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE); ?></span></th> |
|
143 | 143 | </tr> |
144 | 144 | <?php else : ?> |
145 | 145 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr"> |
146 | 146 | <td class=" jst-rght" colspan="11"> |
147 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
147 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
148 | 148 | </td> |
149 | 149 | </tr> |
150 | 150 | <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr hidden"> |
151 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __( 'Payments Total', 'event_espresso' );?></span></th> |
|
151 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __('Payments Total', 'event_espresso'); ?></span></th> |
|
152 | 152 | <th class=" jst-rght"><span id="txn-admin-payment-total"></span></th> |
153 | 153 | </tr> |
154 | 154 | <?php endif; // $payments?> |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | <td class=" jst-cntr"> |
162 | 162 | <ul class="txn-overview-actions-ul"> |
163 | 163 | <li> |
164 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
164 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
165 | 165 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
166 | 166 | </a> |
167 | 167 | </li> |
168 | 168 | <li> |
169 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
169 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
170 | 170 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
171 | 171 | </a> |
172 | 172 | </li> |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | <ul id="txn-admin-payment-options-ul"> |
214 | 214 | <li> |
215 | 215 | <a id="display-txn-admin-apply-payment" class="button-primary no-icon no-hide" rel="txn-admin-apply-payment" > <!--display-the-hidden --> |
216 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
216 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
217 | 217 | </a> |
218 | 218 | </li> |
219 | 219 | <li> |
220 | 220 | <a id="display-txn-admin-apply-refund" class="button-secondary no-icon no-hide" rel="txn-admin-apply-refund" > <!--display-the-hidden --> |
221 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
221 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
222 | 222 | </a> |
223 | 223 | </li> |
224 | 224 | </ul> |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | |
229 | 229 | <h2 id="admin-modal-dialog-apply-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
230 | 230 | <div class="ee-icon ee-icon-cash-add float-left"></div> |
231 | - <?php echo __( 'Apply a Payment to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
231 | + <?php echo __('Apply a Payment to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
232 | 232 | </h2> |
233 | 233 | |
234 | 234 | <h2 id="admin-modal-dialog-edit-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
235 | 235 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
236 | 236 | <?php |
237 | 237 | echo sprintf( |
238 | - __( 'Edit Payment #%s for Transaction #%s', 'event_espresso' ), |
|
238 | + __('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
239 | 239 | '<span></span>', |
240 | 240 | $txn_nmbr['value'] |
241 | 241 | ); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
247 | 247 | <?php |
248 | 248 | echo sprintf( |
249 | - __( 'Edit Refund #%s for Transaction #%s', 'event_espresso' ), |
|
249 | + __('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
250 | 250 | '<span></span>', |
251 | 251 | $txn_nmbr['value'] |
252 | 252 | ); |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | |
256 | 256 | <h2 id="admin-modal-dialog-apply-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
257 | 257 | <div class="ee-icon ee-icon-cash-remove float-left"></div> |
258 | - <?php echo __( 'Apply a Refund to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
258 | + <?php echo __('Apply a Refund to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
259 | 259 | </h2> |
260 | 260 | |
261 | 261 | <form name="txn-admin-apply-payment-frm" id="txn-admin-apply-payment-frm" action="<?php echo $apply_payment_form_url; ?>"> |
262 | 262 | <div class="admin-modal-dialog-wrap"> |
263 | 263 | <div class="admin-modal-dialog-inner"> |
264 | 264 | |
265 | - <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_apply_payment_nonce' );?>"/> |
|
265 | + <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce('espresso_apply_payment_nonce'); ?>"/> |
|
266 | 266 | <input type="hidden" name="espresso_ajax" id="espresso-ajax" value="0"/> |
267 | 267 | <input type="hidden" name="noheader" id="txn-admin-noheader-inp" value="0"/> |
268 | 268 | <input type="hidden" name="txn_admin_payment[PAY_ID]" id="txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
@@ -270,108 +270,108 @@ discard block |
||
270 | 270 | <input type="hidden" name="txn_admin_payment[type]" id="txn-admin-payment-type-inp" value="1"/> |
271 | 271 | <input type="hidden" name="txn_admin_payment[details]" id="txn-admin-payment-details-inp" value=""/> |
272 | 272 | <input type="hidden" name="txn_admin_delete_payment_form_url" id="txn-admin-delete-payment-form-url-inp" value="<?php echo $delete_payment_form_url; ?>"/> |
273 | - <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date( 'Y-m-d h:i a', current_time( 'timestamp' )); ?>"/> |
|
273 | + <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date('Y-m-d h:i a', current_time('timestamp')); ?>"/> |
|
274 | 274 | |
275 | 275 | <div class="txn-admin-apply-payment-date-dv admin-modal-dialog-row"> |
276 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
277 | - <label for="txn-admin-payment-date-inp" class=""><?php _e( 'Payment Date', 'event_espresso' );?></label> |
|
278 | - <input name="txn_admin_payment[date]" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date( 'Y-m-d h:i a', current_time( 'timestamp' )); ?>"/> |
|
279 | - <p class="description"><?php _e( 'The date the payment was actually made on', 'event_espresso' );?></p> |
|
276 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
277 | + <label for="txn-admin-payment-date-inp" class=""><?php _e('Payment Date', 'event_espresso'); ?></label> |
|
278 | + <input name="txn_admin_payment[date]" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date('Y-m-d h:i a', current_time('timestamp')); ?>"/> |
|
279 | + <p class="description"><?php _e('The date the payment was actually made on', 'event_espresso'); ?></p> |
|
280 | 280 | </div> |
281 | 281 | |
282 | 282 | <div class="txn-admin-apply-payment-amount-dv admin-modal-dialog-row"> |
283 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
284 | - <label for="txn-admin-payment-amount-inp" class=""><?php _e( 'Amount', 'event_espresso' );?></label> |
|
283 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
284 | + <label for="txn-admin-payment-amount-inp" class=""><?php _e('Amount', 'event_espresso'); ?></label> |
|
285 | 285 | <input name="txn_admin_payment[amount]" id="txn-admin-payment-amount-inp" class="txn-admin-apply-payment-inp required" type="text" value=""/> |
286 | - <p class="description"><?php _e( 'The amount of the payment', 'event_espresso' );?></p> |
|
286 | + <p class="description"><?php _e('The amount of the payment', 'event_espresso'); ?></p> |
|
287 | 287 | </div> |
288 | 288 | |
289 | 289 | <div class="txn-admin-apply-payment-method-dv admin-modal-dialog-row"> |
290 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
291 | - <label for="txn-admin-payment-method-inp" class=""><?php _e( 'Method of Payment', 'event_espresso' );?></label> |
|
290 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
291 | + <label for="txn-admin-payment-method-inp" class=""><?php _e('Method of Payment', 'event_espresso'); ?></label> |
|
292 | 292 | <select name="txn_admin_payment[PMD_ID]" id="txn-admin-payment-method-slct" class="txn-admin-apply-payment-slct required" type="text" > |
293 | - <?php foreach ( $payment_methods as $method ) : ?> |
|
293 | + <?php foreach ($payment_methods as $method) : ?> |
|
294 | 294 | <?php $selected = $method->slug() == 'cash' ? ' selected="selected"' : ''; ?> |
295 | - <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key( $method->admin_desc() ) ? substr( $method->admin_desc(), 0, 128) : $method->admin_name() ; ?> </option> |
|
295 | + <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key($method->admin_desc()) ? substr($method->admin_desc(), 0, 128) : $method->admin_name(); ?> </option> |
|
296 | 296 | <?php endforeach; ?> |
297 | 297 | </select> |
298 | - <p class="description"><?php _e( 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso' );?></p> |
|
298 | + <p class="description"><?php _e('Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso'); ?></p> |
|
299 | 299 | </div> |
300 | 300 | |
301 | 301 | <div class="mop-PP mop-CC mop-CHQ mop"> |
302 | 302 | <div class="txn-admin-apply-payment-gw-txn-id-dv admin-modal-dialog-row"> |
303 | - <label for="txn-admin-payment-txn-id-inp" class=""><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></label> |
|
303 | + <label for="txn-admin-payment-txn-id-inp" class=""><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></label> |
|
304 | 304 | <input name="txn_admin_payment[txn_id_chq_nmbr]" id="txn-admin-payment-txn-id-chq-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
305 | - <p class="description"><?php _e( 'The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso' );?></p> |
|
305 | + <p class="description"><?php _e('The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso'); ?></p> |
|
306 | 306 | </div> |
307 | 307 | </div> |
308 | 308 | |
309 | 309 | <div class="mop-CC mop" style="display:none"> |
310 | 310 | <div class="txn-admin-apply-payment-response-dv admin-modal-dialog-row"> |
311 | - <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e( 'Gateway Response', 'event_espresso' );?></label> |
|
311 | + <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e('Gateway Response', 'event_espresso'); ?></label> |
|
312 | 312 | <input name="txn_admin_payment[gateway_response]" id="txn-admin-payment-gateway-response-inp" class="txn-admin-apply-payment-inp" type="text"/> |
313 | - <p class="description"><?php _e( 'The gateway response string (optional)', 'event_espresso' );?></p> |
|
313 | + <p class="description"><?php _e('The gateway response string (optional)', 'event_espresso'); ?></p> |
|
314 | 314 | </div> |
315 | 315 | </div> |
316 | 316 | |
317 | 317 | <div class="mop-PP mop-CC mop"> |
318 | 318 | <div class="txn-admin-apply-payment-status-dv admin-modal-dialog-row"> |
319 | - <label for="txn-admin-payment-status-inp" class=""><?php _e( 'Payment Status', 'event_espresso' );?></label> |
|
319 | + <label for="txn-admin-payment-status-inp" class=""><?php _e('Payment Status', 'event_espresso'); ?></label> |
|
320 | 320 | <select name="txn_admin_payment[status]" id="txn-admin-payment-status-slct" class="txn-admin-apply-payment-slct" type="text" > |
321 | - <?php foreach ( $payment_status as $STS_ID => $STS_code ) : ?> |
|
321 | + <?php foreach ($payment_status as $STS_ID => $STS_code) : ?> |
|
322 | 322 | <?php $selected = $STS_ID == 'PAP' ? ' selected="selected"' : ''; ?> |
323 | 323 | <option id="payment-status-opt-<?php echo $STS_ID; ?>" value="<?php echo $STS_ID; ?>"<?php echo $selected; ?>><?php echo $STS_code; ?> </option> |
324 | 324 | <?php endforeach; ?> |
325 | 325 | </select> |
326 | - <p class="description"><?php _e( 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso' );?></p> |
|
326 | + <p class="description"><?php _e('Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso'); ?></p> |
|
327 | 327 | </div> |
328 | 328 | </div> |
329 | 329 | |
330 | 330 | <div class="txn-admin-apply-payment-po-nmbr-dv admin-modal-dialog-row"> |
331 | - <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></label> |
|
331 | + <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e('P.O. / S.O. #', 'event_espresso'); ?></label> |
|
332 | 332 | <input name="txn_admin_payment[po_number]" id="txn-admin-payment-po-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
333 | - <p class="description"><?php _e( 'The Purchase or Sales Order Number if any (optional)', 'event_espresso' );?></p> |
|
333 | + <p class="description"><?php _e('The Purchase or Sales Order Number if any (optional)', 'event_espresso'); ?></p> |
|
334 | 334 | </div> |
335 | 335 | |
336 | 336 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
337 | - <label for="txn-admin-payment-accounting-inp" class="last"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></label> |
|
337 | + <label for="txn-admin-payment-accounting-inp" class="last"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></label> |
|
338 | 338 | <input name="txn_admin_payment[accounting]" id="txn-admin-payment-accounting-inp" class="txn-admin-apply-payment-inp" type="text" value="<?php echo $REG_code; ?>" maxlength="100"/> <input type="hidden" id="txn-admin-reg-code-inp" value="<?php echo $REG_code; ?>"/> |
339 | - <p class="description"><?php _e( 'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso' );?></p> |
|
339 | + <p class="description"><?php _e('An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso'); ?></p> |
|
340 | 340 | </div> |
341 | 341 | |
342 | 342 | <div class="txn-admin-apply-payment-registrations-dv admin-modal-dialog-row"> |
343 | - <label for="txn-admin-payment-registrations-inp" class="last"><?php _e( 'Registrations to Apply Payment to:', 'event_espresso' ); ?></label> |
|
343 | + <label for="txn-admin-payment-registrations-inp" class="last"><?php _e('Registrations to Apply Payment to:', 'event_espresso'); ?></label> |
|
344 | 344 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
345 | 345 | <input type="radio" value="1" id="txn-admin-apply-payment-to-all-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" checked="checked"/> |
346 | - <?php _e( 'ALL Registrations', 'event_espresso' ); ?> |
|
346 | + <?php _e('ALL Registrations', 'event_espresso'); ?> |
|
347 | 347 | </label> |
348 | 348 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
349 | 349 | <input type="radio" value="0" id="txn-admin-apply-payment-to-some-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" /> |
350 | - <?php _e( 'Just the following Registrations', 'event_espresso' ); ?> |
|
350 | + <?php _e('Just the following Registrations', 'event_espresso'); ?> |
|
351 | 351 | </label> |
352 | 352 | <?php echo $registrations_to_apply_payment_to; ?> |
353 | 353 | </div> |
354 | 354 | |
355 | 355 | <div class="txn-admin-payment-reg-status-dv admin-modal-dialog-row"> |
356 | - <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
356 | + <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
357 | 357 | <?php echo $status_change_select; ?> |
358 | - <p class="description"><?php _e( 'If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso' ); ?></p> |
|
358 | + <p class="description"><?php _e('If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso'); ?></p> |
|
359 | 359 | <br/> |
360 | 360 | </div> |
361 | 361 | |
362 | 362 | <div class="txn-admin-apply-payment-send-notifications-dv admin-modal-dialog-row"> |
363 | 363 | |
364 | - <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
364 | + <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
365 | 365 | <label class="txn-admin-payment-send-notifications-lbl"> |
366 | 366 | <input type="checkbox" value="1" name="txn_payments[send_notifications]" checked="checked" aria-checked="true" style="vertical-align: middle;"> |
367 | - <?php _e( 'Payment Messages?', 'event_espresso' ); ?> |
|
367 | + <?php _e('Payment Messages?', 'event_espresso'); ?> |
|
368 | 368 | </label> |
369 | 369 | <label class="txn-admin-payment-send-notifications-lbl"> |
370 | 370 | <input type="checkbox" value="1" name="txn_reg_status_change[send_notifications]" style="vertical-align: middle;"> |
371 | - <?php _e( 'Registration Messages?', 'event_espresso' ); ?> |
|
371 | + <?php _e('Registration Messages?', 'event_espresso'); ?> |
|
372 | 372 | </label> |
373 | 373 | <br class="clear-float"/> |
374 | - <p class="description"><?php printf( __('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />' ); ?></p> |
|
374 | + <p class="description"><?php printf(__('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />'); ?></p> |
|
375 | 375 | <label></label> |
376 | 376 | </div> |
377 | 377 | <div class="clear"></div> |
@@ -382,27 +382,27 @@ discard block |
||
382 | 382 | <ul id="admin-modal-dialog-options-ul"> |
383 | 383 | <li> |
384 | 384 | <a id="txn-admin-modal-dialog-apply-payment-lnk" class="button-primary no-icon" style="display:none;" > |
385 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
385 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
386 | 386 | </a> |
387 | 387 | </li> |
388 | 388 | <li> |
389 | 389 | <a id="txn-admin-modal-dialog-edit-payment-lnk" class="button-primary no-icon" style="display:none;" > |
390 | - <?php _e( 'Save Payment Details', 'event_espresso' );?> |
|
390 | + <?php _e('Save Payment Details', 'event_espresso'); ?> |
|
391 | 391 | </a> |
392 | 392 | </li> |
393 | 393 | <li> |
394 | 394 | <a id="txn-admin-modal-dialog-edit-refund-lnk" class="button-primary no-icon" style="display:none;" > |
395 | - <?php _e( 'Save Refund Details', 'event_espresso' );?> |
|
395 | + <?php _e('Save Refund Details', 'event_espresso'); ?> |
|
396 | 396 | </a> |
397 | 397 | </li> |
398 | 398 | <li> |
399 | 399 | <a id="txn-admin-modal-dialog-apply-refund-lnk" class="button-primary no-icon" style="display:none;" > |
400 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
400 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
401 | 401 | </a> |
402 | 402 | </li> |
403 | 403 | <li> |
404 | 404 | <a id="txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
405 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
405 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
406 | 406 | </a> |
407 | 407 | </li> |
408 | 408 | <li> |
@@ -419,29 +419,29 @@ discard block |
||
419 | 419 | |
420 | 420 | <h2 id="admin-modal-dialog-delete-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
421 | 421 | <span class="ee-icon ee-icon-cash-add"></span> |
422 | - <?php echo __( 'Delete Payment/Refund for Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
422 | + <?php echo __('Delete Payment/Refund for Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
423 | 423 | </h2> |
424 | 424 | |
425 | 425 | <form name="txn-admin-delete-payment-frm" id="txn-admin-delete-payment-frm" action="<?php echo $delete_payment_url; ?>"> |
426 | 426 | <div class="admin-modal-dialog-wrap"> |
427 | 427 | <div class="admin-modal-dialog-inner"> |
428 | 428 | |
429 | - <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_delete_payment_nonce' );?>"/> |
|
429 | + <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce('espresso_delete_payment_nonce'); ?>"/> |
|
430 | 430 | <input type="hidden" name="delete_espresso_ajax" id="delete-espresso-ajax" value="0"/> |
431 | 431 | <input type="hidden" name="delete_noheader" id="delete-txn-admin-noheader-inp" value="0"/> |
432 | 432 | <input type="hidden" name="delete_txn_admin_payment[PAY_ID]" id="delete-txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
433 | 433 | <input type="hidden" name="delete_txn_admin_payment[TXN_ID]" id="delete-txn-admin-payment-txn-id-inp" value="<?php echo $txn_nmbr['value']; ?>"/> |
434 | 434 | |
435 | 435 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
436 | - <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
436 | + <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
437 | 437 | <?php echo $delete_status_change_select; ?> |
438 | - <p class="description"><?php printf( __('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>' ); ?></p> |
|
438 | + <p class="description"><?php printf(__('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
439 | 439 | </div> |
440 | 440 | |
441 | 441 | <div class="ee-attention txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
442 | - <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
442 | + <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
443 | 443 | <input type="checkbox" value="1" name="delete_txn_reg_status_change[send_notifications]"> |
444 | - <p class="description"><?php _e( 'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso' );?></p> |
|
444 | + <p class="description"><?php _e('If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso'); ?></p> |
|
445 | 445 | </div> |
446 | 446 | <div class="clear"></div> |
447 | 447 | |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | <ul id="del-admin-modal-dialog-options-ul"> |
452 | 452 | <li> |
453 | 453 | <a id="txn-admin-modal-dialog-delete-lnk" class="button-primary no-icon" style="display:none;" > |
454 | - <?php _e( 'Delete', 'event_espresso' );?> |
|
454 | + <?php _e('Delete', 'event_espresso'); ?> |
|
455 | 455 | </a> |
456 | 456 | </li> |
457 | 457 | <li> |
458 | 458 | <a id="del-txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
459 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
459 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
460 | 460 | </a> |
461 | 461 | </li> |
462 | 462 | <li> |
@@ -472,30 +472,30 @@ discard block |
||
472 | 472 | <?php endif; // $grand_raw_total > 0?> |
473 | 473 | |
474 | 474 | <?php |
475 | - if ( WP_DEBUG ) { |
|
476 | - $delivered_messages = get_option( 'EED_Messages__payment', array() ); |
|
477 | - if ( isset( $delivered_messages[ $TXN_ID ] )) { |
|
475 | + if (WP_DEBUG) { |
|
476 | + $delivered_messages = get_option('EED_Messages__payment', array()); |
|
477 | + if (isset($delivered_messages[$TXN_ID])) { |
|
478 | 478 | ?> |
479 | - <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e( 'Messages Sent to Primary Registrant', 'event_espresso' );?></h4> |
|
479 | + <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e('Messages Sent to Primary Registrant', 'event_espresso'); ?></h4> |
|
480 | 480 | |
481 | 481 | <div class="admin-primary-mbox-tbl-wrap"> |
482 | 482 | <table class="admin-primary-mbox-tbl"> |
483 | 483 | <thead> |
484 | 484 | <tr> |
485 | - <th class="jst-left"><?php _e( 'Date & Time', 'event_espresso' );?></th> |
|
486 | - <th class="jst-left"><?php _e( 'Message Type', 'event_espresso' );?></th> |
|
487 | - <th class="jst-left"><?php _e( 'Payment Status Upon Sending', 'event_espresso' );?></th> |
|
488 | - <th class="jst-left"><?php _e( 'TXN Status Upon Sending', 'event_espresso' );?></th> |
|
485 | + <th class="jst-left"><?php _e('Date & Time', 'event_espresso'); ?></th> |
|
486 | + <th class="jst-left"><?php _e('Message Type', 'event_espresso'); ?></th> |
|
487 | + <th class="jst-left"><?php _e('Payment Status Upon Sending', 'event_espresso'); ?></th> |
|
488 | + <th class="jst-left"><?php _e('TXN Status Upon Sending', 'event_espresso'); ?></th> |
|
489 | 489 | </tr> |
490 | 490 | </thead> |
491 | 491 | <tbody> |
492 | - <?php foreach ( $delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message ) : |
|
492 | + <?php foreach ($delivered_messages[$TXN_ID] as $timestamp => $delivered_message) : |
|
493 | 493 | ?> |
494 | 494 | <tr> |
495 | - <td class="jst-left"><?php echo gmdate( get_option('date_format') . ' ' . get_option('time_format'), ( $timestamp + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );?></td> |
|
496 | - <td class="jst-left"><?php echo isset( $delivered_message['message_type'] ) ? $delivered_message['message_type'] : '';?></td> |
|
497 | - <td class="jst-left"><?php echo isset( $delivered_message['pay_status'] ) ? $delivered_message['pay_status'] : '';?></td> |
|
498 | - <td class="jst-left"><?php echo isset( $delivered_message['txn_status'] ) ? $delivered_message['txn_status'] : '';?></td> |
|
495 | + <td class="jst-left"><?php echo gmdate(get_option('date_format').' '.get_option('time_format'), ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))); ?></td> |
|
496 | + <td class="jst-left"><?php echo isset($delivered_message['message_type']) ? $delivered_message['message_type'] : ''; ?></td> |
|
497 | + <td class="jst-left"><?php echo isset($delivered_message['pay_status']) ? $delivered_message['pay_status'] : ''; ?></td> |
|
498 | + <td class="jst-left"><?php echo isset($delivered_message['txn_status']) ? $delivered_message['txn_status'] : ''; ?></td> |
|
499 | 499 | </tr> |
500 | 500 | <?php endforeach; // $delivered_messages?> |
501 | 501 | </tbody> |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public static function instance() { |
63 | 63 | // check if class object is instantiated, and instantiated properly |
64 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Front_Controller )) { |
|
64 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Front_Controller)) { |
|
65 | 65 | self::$_instance = new self(); |
66 | 66 | } |
67 | 67 | return self::$_instance; |
@@ -79,37 +79,37 @@ discard block |
||
79 | 79 | */ |
80 | 80 | private function __construct() { |
81 | 81 | // make sure template tags are loaded immediately so that themes don't break |
82 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 ); |
|
82 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10); |
|
83 | 83 | // determine how to integrate WP_Query with the EE models |
84 | - add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' )); |
|
84 | + add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy')); |
|
85 | 85 | // load other resources and begin to actually run shortcodes and modules |
86 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 ); |
|
86 | + add_action('wp_loaded', array($this, 'wp_loaded'), 5); |
|
87 | 87 | // analyse the incoming WP request |
88 | - add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 ); |
|
88 | + add_action('parse_request', array($this, 'get_request'), 1, 1); |
|
89 | 89 | // process any content shortcodes |
90 | - add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 ); |
|
90 | + add_action('parse_request', array($this, '_initialize_shortcodes'), 5); |
|
91 | 91 | // process request with module factory |
92 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 ); |
|
92 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1); |
|
93 | 93 | // before headers sent |
94 | - add_action( 'wp', array( $this, 'wp' ), 5 ); |
|
94 | + add_action('wp', array($this, 'wp'), 5); |
|
95 | 95 | // load css and js |
96 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 ); |
|
96 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1); |
|
97 | 97 | // header |
98 | - add_action('wp_head', array( $this, 'header_meta_tag' ), 5 ); |
|
99 | - add_filter( 'template_include', array( $this, 'template_include' ), 1 ); |
|
98 | + add_action('wp_head', array($this, 'header_meta_tag'), 5); |
|
99 | + add_filter('template_include', array($this, 'template_include'), 1); |
|
100 | 100 | // display errors |
101 | - add_action('loop_start', array( $this, 'display_errors' ), 2 ); |
|
101 | + add_action('loop_start', array($this, 'display_errors'), 2); |
|
102 | 102 | // the content |
103 | - add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 ); |
|
103 | + add_filter('the_content', array($this, 'the_content'), 5, 1); |
|
104 | 104 | //exclude our private cpt comments |
105 | - add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 ); |
|
105 | + add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1); |
|
106 | 106 | //make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://) |
107 | - add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 ); |
|
107 | + add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1); |
|
108 | 108 | // action hook EE |
109 | - do_action( 'AHEE__EE_Front_Controller__construct__done',$this ); |
|
109 | + do_action('AHEE__EE_Front_Controller__construct__done', $this); |
|
110 | 110 | // for checking that browser cookies are enabled |
111 | - if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) { |
|
112 | - setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' ); |
|
111 | + if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) { |
|
112 | + setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/'); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | * @return void |
130 | 130 | */ |
131 | 131 | public function load_espresso_template_tags() { |
132 | - if ( is_readable( EE_PUBLIC . 'template_tags.php' )) { |
|
133 | - require_once( EE_PUBLIC . 'template_tags.php' ); |
|
132 | + if (is_readable(EE_PUBLIC.'template_tags.php')) { |
|
133 | + require_once(EE_PUBLIC.'template_tags.php'); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | * @param array $clauses array of comment clauses setup by WP_Comment_Query |
146 | 146 | * @return array array of comment clauses with modifications. |
147 | 147 | */ |
148 | - public function filter_wp_comments( $clauses ) { |
|
148 | + public function filter_wp_comments($clauses) { |
|
149 | 149 | global $wpdb; |
150 | - if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) { |
|
150 | + if (strpos($clauses['join'], $wpdb->posts) !== FALSE) { |
|
151 | 151 | $cpts = EE_Register_CPTs::get_private_CPTs(); |
152 | - foreach ( $cpts as $cpt => $details ) { |
|
153 | - $clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt ); |
|
152 | + foreach ($cpts as $cpt => $details) { |
|
153 | + $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | return $clauses; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @return void |
168 | 168 | */ |
169 | 169 | public function employ_CPT_Strategy() { |
170 | - if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){ |
|
171 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
170 | + if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) { |
|
171 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param string $url incoming url |
181 | 181 | * @return string final assembled url |
182 | 182 | */ |
183 | - public function maybe_force_admin_ajax_ssl( $url ) { |
|
184 | - if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) { |
|
185 | - $url = str_replace( 'http://', 'https://', $url ); |
|
183 | + public function maybe_force_admin_ajax_ssl($url) { |
|
184 | + if (is_ssl() && preg_match('/admin-ajax.php/', $url)) { |
|
185 | + $url = str_replace('http://', 'https://', $url); |
|
186 | 186 | } |
187 | 187 | return $url; |
188 | 188 | } |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | * @param WP $WP |
220 | 220 | * @return void |
221 | 221 | */ |
222 | - public function get_request( WP $WP ) { |
|
223 | - do_action( 'AHEE__EE_Front_Controller__get_request__start' ); |
|
224 | - EE_Registry::instance()->load_core( 'Request_Handler', $WP ); |
|
225 | - do_action( 'AHEE__EE_Front_Controller__get_request__complete' ); |
|
222 | + public function get_request(WP $WP) { |
|
223 | + do_action('AHEE__EE_Front_Controller__get_request__start'); |
|
224 | + EE_Registry::instance()->load_core('Request_Handler', $WP); |
|
225 | + do_action('AHEE__EE_Front_Controller__get_request__complete'); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -234,22 +234,22 @@ discard block |
||
234 | 234 | * @param WP $WP |
235 | 235 | * @return void |
236 | 236 | */ |
237 | - public function _initialize_shortcodes( WP $WP ) { |
|
238 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this ); |
|
237 | + public function _initialize_shortcodes(WP $WP) { |
|
238 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this); |
|
239 | 239 | // grab post_name from request |
240 | - $current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get( 'post_name' )); |
|
240 | + $current_post = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get('post_name')); |
|
241 | 241 | // if it's not set, then check if frontpage is blog |
242 | - if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'posts' ) { |
|
242 | + if (empty($current_post) && get_option('show_on_front') == 'posts') { |
|
243 | 243 | // yup.. this is the posts page, prepare to load all shortcode modules |
244 | 244 | $current_post = 'posts'; |
245 | - } else if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'page' ) { |
|
245 | + } else if (empty($current_post) && get_option('show_on_front') == 'page') { |
|
246 | 246 | // some other page is set as the homepage |
247 | - $page_on_front = get_option( 'page_on_front' ); |
|
248 | - if ( $page_on_front ) { |
|
247 | + $page_on_front = get_option('page_on_front'); |
|
248 | + if ($page_on_front) { |
|
249 | 249 | // k now we need to find the post_name for this page |
250 | 250 | global $wpdb; |
251 | 251 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='page' AND post_status='publish' AND ID=%d"; |
252 | - $page_on_front = $wpdb->get_var( $wpdb->prepare( $SQL, $page_on_front )); |
|
252 | + $page_on_front = $wpdb->get_var($wpdb->prepare($SQL, $page_on_front)); |
|
253 | 253 | // set the current post slug to what it actually is |
254 | 254 | $current_post = $page_on_front ? $page_on_front : $current_post; |
255 | 255 | } |
@@ -257,58 +257,58 @@ discard block |
||
257 | 257 | // where are posts being displayed ? |
258 | 258 | $page_for_posts = EE_Config::get_page_for_posts(); |
259 | 259 | // in case $current_post is hierarchical like: /parent-page/current-page |
260 | - $current_post = basename( $current_post ); |
|
260 | + $current_post = basename($current_post); |
|
261 | 261 | // are we on a category page? |
262 | - $term_exists = is_array( term_exists( $current_post, 'category' )) || array_key_exists( 'category_name', $WP->query_vars ); |
|
262 | + $term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name', $WP->query_vars); |
|
263 | 263 | // make sure shortcodes are set |
264 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes )) { |
|
264 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes)) { |
|
265 | 265 | // d( EE_Registry::instance()->CFG->core->post_shortcodes ); |
266 | 266 | // cycle thru all posts with shortcodes set |
267 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) { |
|
267 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes) { |
|
268 | 268 | // filter shortcodes so |
269 | - $post_shortcodes = apply_filters( 'FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes ); |
|
269 | + $post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes); |
|
270 | 270 | // now cycle thru shortcodes |
271 | - foreach ( $post_shortcodes as $shortcode_class => $post_id ) { |
|
271 | + foreach ($post_shortcodes as $shortcode_class => $post_id) { |
|
272 | 272 | // are we on this page, or on the blog page, or an EE CPT category page ? |
273 | - if ( $current_post == $post_name || $term_exists ) { |
|
273 | + if ($current_post == $post_name || $term_exists) { |
|
274 | 274 | // verify shortcode is in list of registered shortcodes |
275 | - if ( ! isset( EE_Registry::instance()->shortcodes->{$shortcode_class} )) { |
|
276 | - if ( $current_post != $page_for_posts && current_user_can( 'edit_post', $post_id )) { |
|
277 | - $msg = sprintf( __( 'The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso' ), $shortcode_class ); |
|
278 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
279 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
275 | + if ( ! isset(EE_Registry::instance()->shortcodes->{$shortcode_class} )) { |
|
276 | + if ($current_post != $page_for_posts && current_user_can('edit_post', $post_id)) { |
|
277 | + $msg = sprintf(__('The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso'), $shortcode_class); |
|
278 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
279 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
280 | 280 | } |
281 | - add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' )); |
|
281 | + add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor')); |
|
282 | 282 | continue; |
283 | 283 | } |
284 | 284 | // is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ? |
285 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $current_post ] ) || $term_exists || $current_post == $page_for_posts ) { |
|
285 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$current_post]) || $term_exists || $current_post == $page_for_posts) { |
|
286 | 286 | // let's pause to reflect on this... |
287 | - $sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class ); |
|
287 | + $sc_reflector = new ReflectionClass('EES_'.$shortcode_class); |
|
288 | 288 | // ensure that class is actually a shortcode |
289 | - if ( ! $sc_reflector->isSubclassOf( 'EES_Shortcode' ) && defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE ) { |
|
290 | - $msg = sprintf( __( 'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso' ), $shortcode_class ); |
|
291 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
292 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
289 | + if ( ! $sc_reflector->isSubclassOf('EES_Shortcode') && defined('WP_DEBUG') && WP_DEBUG === TRUE) { |
|
290 | + $msg = sprintf(__('The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso'), $shortcode_class); |
|
291 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
292 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
293 | 293 | continue; |
294 | 294 | } |
295 | 295 | // and pass the request object to the run method |
296 | 296 | EE_Registry::instance()->shortcodes->{$shortcode_class} = $sc_reflector->newInstance(); |
297 | 297 | // fire the shortcode class's run method, so that it can activate resources |
298 | - EE_Registry::instance()->shortcodes->{$shortcode_class}->run( $WP ); |
|
298 | + EE_Registry::instance()->shortcodes->{$shortcode_class}->run($WP); |
|
299 | 299 | } |
300 | 300 | // if this is NOT the "Posts page" and we have a valid entry for the "Posts page" in our tracked post_shortcodes array |
301 | - } else if ( $post_name != $page_for_posts && isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] )) { |
|
301 | + } else if ($post_name != $page_for_posts && isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
302 | 302 | // and the shortcode is not being tracked for this page |
303 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] )) { |
|
303 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])) { |
|
304 | 304 | // then remove the "fallback" shortcode processor |
305 | - remove_shortcode( $shortcode_class ); |
|
305 | + remove_shortcode($shortcode_class); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | } |
309 | 309 | } |
310 | 310 | } |
311 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this ); |
|
311 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | * @param WP_Query $WP_Query |
321 | 321 | * @return void |
322 | 322 | */ |
323 | - public function pre_get_posts( $WP_Query ) { |
|
323 | + public function pre_get_posts($WP_Query) { |
|
324 | 324 | // only load Module_Request_Router if this is the main query |
325 | - if ( $WP_Query->is_main_query() ) { |
|
325 | + if ($WP_Query->is_main_query()) { |
|
326 | 326 | // load module request router |
327 | - $Module_Request_Router = EE_Registry::instance()->load_core( 'Module_Request_Router' ); |
|
327 | + $Module_Request_Router = EE_Registry::instance()->load_core('Module_Request_Router'); |
|
328 | 328 | // verify object |
329 | - if ( $Module_Request_Router instanceof EE_Module_Request_Router ) { |
|
329 | + if ($Module_Request_Router instanceof EE_Module_Request_Router) { |
|
330 | 330 | // cycle thru module routes |
331 | - while ( $route = $Module_Request_Router->get_route( $WP_Query )) { |
|
331 | + while ($route = $Module_Request_Router->get_route($WP_Query)) { |
|
332 | 332 | // determine module and method for route |
333 | - $module = $Module_Request_Router->resolve_route( $route[0], $route[1] ); |
|
334 | - if( $module instanceof EED_Module ) { |
|
333 | + $module = $Module_Request_Router->resolve_route($route[0], $route[1]); |
|
334 | + if ($module instanceof EED_Module) { |
|
335 | 335 | // get registered view for route |
336 | - $this->_template_path = $Module_Request_Router->get_view( $route ); |
|
336 | + $this->_template_path = $Module_Request_Router->get_view($route); |
|
337 | 337 | // grab module name |
338 | 338 | $module_name = $module->module_name(); |
339 | 339 | // map the module to the module objects |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @return void |
361 | 361 | */ |
362 | 362 | public function wp() { |
363 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
363 | + EE_Registry::instance()->load_helper('Template'); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | |
@@ -378,30 +378,30 @@ discard block |
||
378 | 378 | public function wp_enqueue_scripts() { |
379 | 379 | |
380 | 380 | // css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_css', '__return_false' ); |
381 | - if ( apply_filters( 'FHEE_load_css', TRUE ) ) { |
|
381 | + if (apply_filters('FHEE_load_css', TRUE)) { |
|
382 | 382 | |
383 | 383 | EE_Registry::instance()->CFG->template_settings->enable_default_style = TRUE; |
384 | 384 | //Load the ThemeRoller styles if enabled |
385 | - if ( isset( EE_Registry::instance()->CFG->template_settings->enable_default_style ) && EE_Registry::instance()->CFG->template_settings->enable_default_style ) { |
|
385 | + if (isset(EE_Registry::instance()->CFG->template_settings->enable_default_style) && EE_Registry::instance()->CFG->template_settings->enable_default_style) { |
|
386 | 386 | |
387 | 387 | //Load custom style sheet if available |
388 | - if ( isset( EE_Registry::instance()->CFG->template_settings->custom_style_sheet )) { |
|
389 | - wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION ); |
|
388 | + if (isset(EE_Registry::instance()->CFG->template_settings->custom_style_sheet)) { |
|
389 | + wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION); |
|
390 | 390 | wp_enqueue_style('espresso_custom_css'); |
391 | 391 | } |
392 | 392 | |
393 | - EE_Registry::instance()->load_helper( 'File' ); |
|
394 | - if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) { |
|
395 | - wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
393 | + EE_Registry::instance()->load_helper('File'); |
|
394 | + if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) { |
|
395 | + wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
396 | 396 | } else { |
397 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
397 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
398 | 398 | } |
399 | 399 | wp_enqueue_style('espresso_default'); |
400 | 400 | |
401 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) { |
|
402 | - wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
401 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) { |
|
402 | + wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
403 | 403 | } else { |
404 | - wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
404 | + wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | } |
@@ -409,29 +409,29 @@ discard block |
||
409 | 409 | } |
410 | 410 | |
411 | 411 | // js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_js', '__return_false' ); |
412 | - if ( apply_filters( 'FHEE_load_js', TRUE ) ) { |
|
412 | + if (apply_filters('FHEE_load_js', TRUE)) { |
|
413 | 413 | |
414 | - wp_enqueue_script( 'jquery' ); |
|
414 | + wp_enqueue_script('jquery'); |
|
415 | 415 | //let's make sure that all required scripts have been setup |
416 | - if ( function_exists( 'wp_script_is' )) { |
|
417 | - if ( ! wp_script_is( 'jquery' )) { |
|
416 | + if (function_exists('wp_script_is')) { |
|
417 | + if ( ! wp_script_is('jquery')) { |
|
418 | 418 | $msg = sprintf( |
419 | - __( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ), |
|
419 | + __('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'), |
|
420 | 420 | '<em><br />', |
421 | 421 | '</em>' |
422 | 422 | ); |
423 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
423 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | // load core js |
427 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
428 | - wp_enqueue_script( 'espresso_core' ); |
|
429 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
427 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
428 | + wp_enqueue_script('espresso_core'); |
|
429 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
430 | 430 | |
431 | 431 | } |
432 | 432 | |
433 | 433 | //qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); |
434 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
434 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
435 | 435 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
436 | 436 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
437 | 437 | } |
@@ -439,11 +439,11 @@ discard block |
||
439 | 439 | |
440 | 440 | //accounting.js library |
441 | 441 | // @link http://josscrowcroft.github.io/accounting.js/ |
442 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
443 | - $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js'; |
|
444 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
445 | - wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE ); |
|
446 | - wp_enqueue_script( 'ee-accounting' ); |
|
442 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
443 | + $acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js'; |
|
444 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
445 | + wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE); |
|
446 | + wp_enqueue_script('ee-accounting'); |
|
447 | 447 | |
448 | 448 | $currency_config = array( |
449 | 449 | 'currency' => array( |
@@ -466,21 +466,21 @@ discard block |
||
466 | 466 | wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config); |
467 | 467 | } |
468 | 468 | |
469 | - if ( ! function_exists( 'wp_head' )) { |
|
469 | + if ( ! function_exists('wp_head')) { |
|
470 | 470 | $msg = sprintf( |
471 | - __( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
471 | + __('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
472 | 472 | '<em><br />', |
473 | 473 | '</em>' |
474 | 474 | ); |
475 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
475 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
476 | 476 | } |
477 | - if ( ! function_exists( 'wp_footer' )) { |
|
477 | + if ( ! function_exists('wp_footer')) { |
|
478 | 478 | $msg = sprintf( |
479 | - __( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
479 | + __('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
480 | 480 | '<em><br />', |
481 | 481 | '</em>' |
482 | 482 | ); |
483 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
483 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | * @return void |
495 | 495 | */ |
496 | 496 | public function header_meta_tag() { |
497 | - print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />")); |
|
497 | + print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />")); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -508,9 +508,9 @@ discard block |
||
508 | 508 | * @param $the_content |
509 | 509 | * @return string |
510 | 510 | */ |
511 | - public function the_content( $the_content ) { |
|
511 | + public function the_content($the_content) { |
|
512 | 512 | // nothing gets loaded at this point unless other systems turn this hookpoint on by using: add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
513 | - if ( apply_filters( 'FHEE_run_EE_the_content', FALSE ) ) { |
|
513 | + if (apply_filters('FHEE_run_EE_the_content', FALSE)) { |
|
514 | 514 | } |
515 | 515 | return $the_content; |
516 | 516 | } |
@@ -535,9 +535,9 @@ discard block |
||
535 | 535 | */ |
536 | 536 | public function display_errors() { |
537 | 537 | static $shown_already = FALSE; |
538 | - do_action( 'AHEE__EE_Front_Controller__display_errors__begin' ); |
|
538 | + do_action('AHEE__EE_Front_Controller__display_errors__begin'); |
|
539 | 539 | if ( |
540 | - apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE ) |
|
540 | + apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE) |
|
541 | 541 | && ! $shown_already |
542 | 542 | && is_main_query() |
543 | 543 | && ! is_feed() |
@@ -546,10 +546,10 @@ discard block |
||
546 | 546 | ) { |
547 | 547 | echo EE_Error::get_notices(); |
548 | 548 | $shown_already = TRUE; |
549 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
550 | - EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' ); |
|
549 | + EE_Registry::instance()->load_helper('Template'); |
|
550 | + EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php'); |
|
551 | 551 | } |
552 | - do_action( 'AHEE__EE_Front_Controller__display_errors__end' ); |
|
552 | + do_action('AHEE__EE_Front_Controller__display_errors__end'); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
@@ -564,12 +564,12 @@ discard block |
||
564 | 564 | * @param string $template_include_path |
565 | 565 | * @return string |
566 | 566 | */ |
567 | - public function template_include( $template_include_path = NULL ) { |
|
568 | - if ( EE_Registry::instance()->REQ->is_espresso_page() ) { |
|
569 | - $this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path ); |
|
570 | - $template_path = EEH_Template::locate_template( $this->_template_path, array(), false ); |
|
571 | - $this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path; |
|
572 | - $this->_template = basename( $this->_template_path ); |
|
567 | + public function template_include($template_include_path = NULL) { |
|
568 | + if (EE_Registry::instance()->REQ->is_espresso_page()) { |
|
569 | + $this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path); |
|
570 | + $template_path = EEH_Template::locate_template($this->_template_path, array(), false); |
|
571 | + $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path; |
|
572 | + $this->_template = basename($this->_template_path); |
|
573 | 573 | return $this->_template_path; |
574 | 574 | } |
575 | 575 | return $template_include_path; |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | * @param bool $with_path |
585 | 585 | * @return string |
586 | 586 | */ |
587 | - public function get_selected_template( $with_path = FALSE ) { |
|
587 | + public function get_selected_template($with_path = FALSE) { |
|
588 | 588 | return $with_path ? $this->_template_path : $this->_template; |
589 | 589 | } |
590 | 590 |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Ticket.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Ticket.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Ticket extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,36 +35,36 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Ticket','event_espresso'); |
|
40 | - $this->plural_item = __('Tickets','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Ticket', 'event_espresso'); |
|
40 | + $this->plural_item = __('Tickets', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Ticket'=>array( |
47 | - 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')), |
|
48 | - 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'), |
|
47 | + 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')), |
|
48 | + 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'), |
|
49 | 49 | 'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''), |
50 | - 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ), |
|
51 | - 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
52 | - 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
53 | - 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ), |
|
54 | - 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ), |
|
50 | + 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''), |
|
51 | + 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0), |
|
54 | + 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF), |
|
55 | 55 | 'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0), |
56 | 56 | 'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0), |
57 | - 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF), |
|
58 | - 'TKT_reserved'=>new EE_Integer_Field('TKT_reserved', __('Quantity of this ticket that is reserved, but not yet fully purchased','event_espresso'), false, 0 ), |
|
59 | - 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ), |
|
60 | - 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ), |
|
61 | - 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false), |
|
62 | - 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ), |
|
57 | + 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF), |
|
58 | + 'TKT_reserved'=>new EE_Integer_Field('TKT_reserved', __('Quantity of this ticket that is reserved, but not yet fully purchased', 'event_espresso'), false, 0), |
|
59 | + 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF), |
|
60 | + 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false), |
|
61 | + 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false), |
|
62 | + 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false), |
|
63 | 63 | 'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0), |
64 | - 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ), |
|
64 | + 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0), |
|
65 | 65 | 'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false), |
66 | - 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ), |
|
67 | - 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 ) |
|
66 | + 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE), |
|
67 | + 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0) |
|
68 | 68 | )); |
69 | 69 | $this->_model_relations = array( |
70 | 70 | 'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | ); |
77 | 77 | |
78 | 78 | //this model is generally available for reading |
79 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
79 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
80 | 80 | //account for default tickets in the caps |
81 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
82 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
83 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
84 | - parent::__construct( $timezone ); |
|
81 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
82 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
83 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
84 | + parent::__construct($timezone); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function get_all_default_tickets() { |
94 | 94 | /** @type EE_Ticket[] $tickets */ |
95 | - $tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')) ); |
|
95 | + $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC'))); |
|
96 | 96 | //we need to set the start date and end date to today's date and the start of the default dtt |
97 | - return $this->_set_default_dates( $tickets ); |
|
97 | + return $this->_set_default_dates($tickets); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | * @param EE_Ticket[] $tickets |
105 | 105 | * @return EE_Ticket[] |
106 | 106 | */ |
107 | - private function _set_default_dates( $tickets ) { |
|
108 | - foreach ( $tickets as $ticket ) { |
|
109 | - $ticket->set('TKT_start_date', (int)$this->current_time_for_query('TKT_start_date', true) ); |
|
110 | - $ticket->set('TKT_end_date', (int)$this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) ); |
|
111 | - $ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) ); |
|
107 | + private function _set_default_dates($tickets) { |
|
108 | + foreach ($tickets as $ticket) { |
|
109 | + $ticket->set('TKT_start_date', (int) $this->current_time_for_query('TKT_start_date', true)); |
|
110 | + $ticket->set('TKT_end_date', (int) $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30)); |
|
111 | + $ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone)); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return $tickets; |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @param array $query_params |
124 | 124 | * @return int |
125 | 125 | */ |
126 | - public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){ |
|
127 | - return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params ); |
|
126 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
127 | + return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | * @param EE_Ticket[] $tickets |
135 | 135 | * @return void |
136 | 136 | */ |
137 | - public function update_tickets_sold($tickets){ |
|
138 | - foreach($tickets as $ticket){ |
|
137 | + public function update_tickets_sold($tickets) { |
|
138 | + foreach ($tickets as $ticket) { |
|
139 | 139 | /* @var $ticket EE_Ticket */ |
140 | 140 | $ticket->update_tickets_sold(); |
141 | 141 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | //is for lower than 4.8.33 |
14 | 14 | add_filter( |
15 | 15 | 'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes', |
16 | - array( $this, 'remove_checkin_routes_earlier_than_4_8_33' ), |
|
16 | + array($this, 'remove_checkin_routes_earlier_than_4_8_33'), |
|
17 | 17 | 10, |
18 | 18 | 2 |
19 | 19 | ); |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * @param string $version |
27 | 27 | * @return array like $routes_on_this_version |
28 | 28 | */ |
29 | - public function remove_checkin_routes_earlier_than_4_8_33( $routes_on_this_version, $version ) { |
|
30 | - if( $this->applies_to_version( $version ) ) { |
|
31 | - unset( $routes_on_this_version[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] ); |
|
29 | + public function remove_checkin_routes_earlier_than_4_8_33($routes_on_this_version, $version) { |
|
30 | + if ($this->applies_to_version($version)) { |
|
31 | + unset($routes_on_this_version['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)']); |
|
32 | 32 | } |
33 | 33 | return $routes_on_this_version; |
34 | 34 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api\controllers; |
3 | 3 | |
4 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | protected $_requested_version; |
37 | 37 | |
38 | 38 | public function __construct() { |
39 | - $this->_debug_mode = defined( 'EE_REST_API_DEBUG_MODE' ) ? EE_REST_API_DEBUG_MODE : false; |
|
39 | + $this->_debug_mode = defined('EE_REST_API_DEBUG_MODE') ? EE_REST_API_DEBUG_MODE : false; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * Sets the version the user requested |
45 | 45 | * @param string $version eg '4.8' |
46 | 46 | */ |
47 | - public function set_requested_version( $version ) { |
|
47 | + public function set_requested_version($version) { |
|
48 | 48 | $this->_requested_version = $version; |
49 | 49 | } |
50 | 50 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @param string $key |
54 | 54 | * @param string|array $info |
55 | 55 | */ |
56 | - protected function _set_debug_info( $key, $info ){ |
|
57 | - $this->_debug_info[ $key ] = $info; |
|
56 | + protected function _set_debug_info($key, $info) { |
|
57 | + $this->_debug_info[$key] = $info; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | * @param \WP_Error $wp_error_response |
63 | 63 | * @return \WP_Error |
64 | 64 | */ |
65 | - protected function _add_ee_errors_to_response( \WP_Error $wp_error_response ) { |
|
65 | + protected function _add_ee_errors_to_response(\WP_Error $wp_error_response) { |
|
66 | 66 | $notices_during_checkin = \EE_Error::get_raw_notices(); |
67 | - if( ! empty( $notices_during_checkin[ 'errors' ] ) ) { |
|
68 | - foreach( $notices_during_checkin[ 'errors' ] as $error_code => $error_message ) { |
|
67 | + if ( ! empty($notices_during_checkin['errors'])) { |
|
68 | + foreach ($notices_during_checkin['errors'] as $error_code => $error_message) { |
|
69 | 69 | $wp_error_response->add( |
70 | - sanitize_key( $error_code ), |
|
71 | - strip_tags( $error_message ) ); |
|
70 | + sanitize_key($error_code), |
|
71 | + strip_tags($error_message) ); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | return $wp_error_response; |
@@ -86,26 +86,26 @@ discard block |
||
86 | 86 | * @param array|\WP_Error|\Exception $response |
87 | 87 | * @return \WP_REST_Response |
88 | 88 | */ |
89 | - public function send_response( $response ) { |
|
90 | - if( $response instanceof \Exception ) { |
|
91 | - $response = new \WP_Error( $response->getCode(), $response->getMessage() ); |
|
89 | + public function send_response($response) { |
|
90 | + if ($response instanceof \Exception) { |
|
91 | + $response = new \WP_Error($response->getCode(), $response->getMessage()); |
|
92 | 92 | } |
93 | - if( $response instanceof \WP_Error ) { |
|
94 | - $response = $this->_add_ee_errors_to_response( $response ); |
|
95 | - $rest_response = $this->_create_rest_response_from_wp_error( $response ); |
|
96 | - }else{ |
|
97 | - $rest_response = new \WP_REST_Response( $response, 200 ); |
|
93 | + if ($response instanceof \WP_Error) { |
|
94 | + $response = $this->_add_ee_errors_to_response($response); |
|
95 | + $rest_response = $this->_create_rest_response_from_wp_error($response); |
|
96 | + } else { |
|
97 | + $rest_response = new \WP_REST_Response($response, 200); |
|
98 | 98 | } |
99 | 99 | $headers = array(); |
100 | - if( $this->_debug_mode && is_array( $this->_debug_info ) ) { |
|
101 | - foreach( $this->_debug_info as $debug_key => $debug_info ) { |
|
102 | - if( is_array( $debug_info ) ) { |
|
103 | - $debug_info = json_encode( $debug_info ); |
|
100 | + if ($this->_debug_mode && is_array($this->_debug_info)) { |
|
101 | + foreach ($this->_debug_info as $debug_key => $debug_info) { |
|
102 | + if (is_array($debug_info)) { |
|
103 | + $debug_info = json_encode($debug_info); |
|
104 | 104 | } |
105 | - $headers[ 'X-EE4-Debug-' . ucwords( $debug_key ) ] = $debug_info; |
|
105 | + $headers['X-EE4-Debug-'.ucwords($debug_key)] = $debug_info; |
|
106 | 106 | } |
107 | 107 | } |
108 | - $rest_response->set_headers( $headers ); |
|
108 | + $rest_response->set_headers($headers); |
|
109 | 109 | return $rest_response; |
110 | 110 | } |
111 | 111 | |
@@ -116,31 +116,31 @@ discard block |
||
116 | 116 | * @param \WP_Error $wp_error |
117 | 117 | * @return \WP_REST_Response |
118 | 118 | */ |
119 | - protected function _create_rest_response_from_wp_error( \WP_Error $wp_error ) { |
|
119 | + protected function _create_rest_response_from_wp_error(\WP_Error $wp_error) { |
|
120 | 120 | $error_data = $wp_error->get_error_data(); |
121 | - if ( is_array( $error_data ) && isset( $error_data['status'] ) ) { |
|
121 | + if (is_array($error_data) && isset($error_data['status'])) { |
|
122 | 122 | $status = $error_data['status']; |
123 | 123 | } else { |
124 | 124 | $status = 500; |
125 | 125 | } |
126 | 126 | |
127 | 127 | $errors = array(); |
128 | - foreach ( (array) $wp_error->errors as $code => $messages ) { |
|
129 | - foreach ( (array) $messages as $message ) { |
|
128 | + foreach ((array) $wp_error->errors as $code => $messages) { |
|
129 | + foreach ((array) $messages as $message) { |
|
130 | 130 | $errors[] = array( |
131 | 131 | 'code' => $code, |
132 | 132 | 'message' => $message, |
133 | - 'data' => $wp_error->get_error_data( $code ) |
|
133 | + 'data' => $wp_error->get_error_data($code) |
|
134 | 134 | ); |
135 | 135 | } |
136 | 136 | } |
137 | - $data = isset( $errors[0] ) ? $errors[0] : array(); |
|
138 | - if ( count( $errors ) > 1 ) { |
|
137 | + $data = isset($errors[0]) ? $errors[0] : array(); |
|
138 | + if (count($errors) > 1) { |
|
139 | 139 | // Remove the primary error. |
140 | - array_shift( $errors ); |
|
140 | + array_shift($errors); |
|
141 | 141 | $data['additional_errors'] = $errors; |
142 | 142 | } |
143 | - return new \WP_REST_Response( $data, $status ); |
|
143 | + return new \WP_REST_Response($data, $status); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | * @param string $route |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - public function get_requested_version( $route ) { |
|
153 | + public function get_requested_version($route) { |
|
154 | 154 | $matches = $this->parse_route( |
155 | 155 | $route, |
156 | - '~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . '~', |
|
157 | - array( 'version' ) |
|
156 | + '~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'~', |
|
157 | + array('version') |
|
158 | 158 | ); |
159 | - if( isset( $matches[ 'version' ] ) ) { |
|
160 | - return $matches[ 'version' ]; |
|
159 | + if (isset($matches['version'])) { |
|
160 | + return $matches['version']; |
|
161 | 161 | } else { |
162 | 162 | return \EED_Core_Rest_Api::latest_rest_api_version(); |
163 | 163 | } |
@@ -182,23 +182,23 @@ discard block |
||
182 | 182 | * array( 'model' => 'foo', 'id' => 'bar' ) |
183 | 183 | * @throws \EE_Error if it couldn't be parsed |
184 | 184 | */ |
185 | - public function parse_route( $route, $regex, $match_keys ) { |
|
185 | + public function parse_route($route, $regex, $match_keys) { |
|
186 | 186 | $indexed_matches = array(); |
187 | - $success = preg_match( $regex, $route, $matches ); |
|
188 | - if( |
|
189 | - is_array( $matches ) ) { |
|
187 | + $success = preg_match($regex, $route, $matches); |
|
188 | + if ( |
|
189 | + is_array($matches) ) { |
|
190 | 190 | //skip the overall regex match. Who cares |
191 | - for( $i = 1; $i <= count( $match_keys ); $i++ ) { |
|
192 | - if( ! isset( $matches[ $i ] ) ) { |
|
191 | + for ($i = 1; $i <= count($match_keys); $i++) { |
|
192 | + if ( ! isset($matches[$i])) { |
|
193 | 193 | $success = false; |
194 | 194 | } else { |
195 | - $indexed_matches[ $match_keys[ $i - 1 ] ] = $matches[ $i ]; |
|
195 | + $indexed_matches[$match_keys[$i - 1]] = $matches[$i]; |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | } |
199 | - if( ! $success ) { |
|
199 | + if ( ! $success) { |
|
200 | 200 | throw new \EE_Error( |
201 | - __( 'We could not parse the URL. Please contact Event Espresso Support', 'event_espresso' ), |
|
201 | + __('We could not parse the URL. Please contact Event Espresso Support', 'event_espresso'), |
|
202 | 202 | 'endpoint_parsing_error' |
203 | 203 | ); |
204 | 204 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Core_Rest_Api |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | |
59 | 59 | public static function set_hooks_both() { |
60 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'register_routes' ), 10 ); |
|
61 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'set_hooks_rest_api' ), 5 ); |
|
62 | - add_filter( 'rest_route_data', array( 'EED_Core_Rest_Api', 'hide_old_endpoints' ), 10, 2 ); |
|
63 | - add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) ); |
|
60 | + add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10); |
|
61 | + add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5); |
|
62 | + add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2); |
|
63 | + add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index')); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | protected static function _set_hooks_for_changes() { |
76 | - $folder_contents = EEH_File::get_contents_of_folders( array( EE_LIBRARIES . 'rest_api' . DS . 'changes' ), false ); |
|
77 | - foreach( $folder_contents as $classname_in_namespace => $filepath ) { |
|
76 | + $folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false); |
|
77 | + foreach ($folder_contents as $classname_in_namespace => $filepath) { |
|
78 | 78 | //ignore the base parent class |
79 | - if( $classname_in_namespace === 'Changes_In_Base' ) { |
|
79 | + if ($classname_in_namespace === 'Changes_In_Base') { |
|
80 | 80 | continue; |
81 | 81 | } |
82 | - $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace; |
|
83 | - if ( class_exists( $full_classname )) { |
|
82 | + $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace; |
|
83 | + if (class_exists($full_classname)) { |
|
84 | 84 | $instance_of_class = new $full_classname; |
85 | - if ( $instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base ) { |
|
85 | + if ($instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base) { |
|
86 | 86 | $instance_of_class->set_hooks(); |
87 | 87 | } |
88 | 88 | } |
@@ -95,16 +95,16 @@ discard block |
||
95 | 95 | * so we actually prefer to only do it when an EE plugin is activated or upgraded |
96 | 96 | */ |
97 | 97 | public static function register_routes() { |
98 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
99 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
100 | - foreach( $routes as $route ) { |
|
98 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
99 | + foreach ($relative_urls as $endpoint => $routes) { |
|
100 | + foreach ($routes as $route) { |
|
101 | 101 | register_rest_route( |
102 | 102 | $namespace, |
103 | 103 | $endpoint, |
104 | 104 | array( |
105 | - 'callback' => $route[ 'callback' ], |
|
106 | - 'methods' => $route[ 'methods' ], |
|
107 | - 'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(), |
|
105 | + 'callback' => $route['callback'], |
|
106 | + 'methods' => $route['methods'], |
|
107 | + 'args' => isset($route['args']) ? $route['args'] : array(), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | * } |
122 | 122 | */ |
123 | 123 | public static function get_ee_route_data() { |
124 | - $ee_routes = get_option( self::saved_routes_option_names, null ); |
|
125 | - if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){ |
|
124 | + $ee_routes = get_option(self::saved_routes_option_names, null); |
|
125 | + if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) { |
|
126 | 126 | self::save_ee_routes(); |
127 | - $ee_routes = get_option( self::saved_routes_option_names, array() ); |
|
127 | + $ee_routes = get_option(self::saved_routes_option_names, array()); |
|
128 | 128 | } |
129 | 129 | return $ee_routes; |
130 | 130 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @return void |
136 | 136 | */ |
137 | 137 | public static function save_ee_routes() { |
138 | - if( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
138 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
139 | 139 | $instance = self::instance(); |
140 | 140 | $routes = apply_filters( |
141 | 141 | 'EED_Core_Rest_Api__save_ee_routes__routes', |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $instance->_register_rpc_routes() |
147 | 147 | ) |
148 | 148 | ); |
149 | - update_option( self::saved_routes_option_names, $routes, true ); |
|
149 | + update_option(self::saved_routes_option_names, $routes, true); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @return array @see get_ee_route_data |
156 | 156 | */ |
157 | 157 | protected function _register_model_routes() { |
158 | - EE_Registry::instance()->load_helper( 'Inflector' ); |
|
158 | + EE_Registry::instance()->load_helper('Inflector'); |
|
159 | 159 | $models_to_register = apply_filters( |
160 | 160 | 'FHEE__EED_Core_REST_API___register_model_routes', |
161 | 161 | EE_Registry::instance()->non_abstract_db_models |
@@ -164,23 +164,23 @@ discard block |
||
164 | 164 | unset($models_to_register['Extra_Meta']); |
165 | 165 | unset($models_to_register['Extra_Join']); |
166 | 166 | $model_routes = array( ); |
167 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
167 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
168 | 168 | |
169 | - foreach ( $models_to_register as $model_name => $model_classname ) { |
|
169 | + foreach ($models_to_register as $model_name => $model_classname) { |
|
170 | 170 | //yes we could just register one route for ALL models, but then they wouldn't show up in the index |
171 | - $ee_namespace = self::ee_api_namespace . $version; |
|
172 | - $plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name ); |
|
173 | - $singular_model_route = $plural_model_route . '/(?P<id>\d+)' ; |
|
174 | - $model_routes[ $ee_namespace ][ $plural_model_route ] = array( |
|
171 | + $ee_namespace = self::ee_api_namespace.$version; |
|
172 | + $plural_model_route = EEH_Inflector::pluralize_and_lower($model_name); |
|
173 | + $singular_model_route = $plural_model_route.'/(?P<id>\d+)'; |
|
174 | + $model_routes[$ee_namespace][$plural_model_route] = array( |
|
175 | 175 | array( |
176 | 176 | 'callback' => array( |
177 | 177 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
178 | 178 | 'handle_request_get_all' ), |
179 | 179 | 'methods' => WP_REST_Server::READABLE, |
180 | 180 | 'hidden_endpoint' => $hidden_endpoint, |
181 | - 'args' => $this->_get_read_query_params( $model_name ), |
|
181 | + 'args' => $this->_get_read_query_params($model_name), |
|
182 | 182 | '_links' => array( |
183 | - 'self' => rest_url( $ee_namespace . $singular_model_route ), |
|
183 | + 'self' => rest_url($ee_namespace.$singular_model_route), |
|
184 | 184 | ) |
185 | 185 | ), |
186 | 186 | // array( |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | // 'hidden_endpoint' => $hidden_endpoint |
192 | 192 | // ) |
193 | 193 | ); |
194 | - $model_routes[ $ee_namespace ][ $singular_model_route ] = array( |
|
194 | + $model_routes[$ee_namespace][$singular_model_route] = array( |
|
195 | 195 | array( |
196 | 196 | 'callback' => array( |
197 | 197 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'include' => array( |
203 | 203 | 'required' => false, |
204 | 204 | 'default' => '*', |
205 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ), |
|
205 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'), |
|
206 | 206 | ), |
207 | 207 | ) |
208 | 208 | ), |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | // ), |
216 | 216 | ); |
217 | 217 | //@todo: also handle DELETE for a single item |
218 | - $model = EE_Registry::instance()->load_model( $model_classname ); |
|
219 | - foreach ( $model->relation_settings() as $relation_name => $relation_obj ) { |
|
218 | + $model = EE_Registry::instance()->load_model($model_classname); |
|
219 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
220 | 220 | $related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name( |
221 | 221 | $relation_name, |
222 | 222 | $relation_obj |
223 | 223 | ); |
224 | - $model_routes[ $ee_namespace ][ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array( |
|
224 | + $model_routes[$ee_namespace][$singular_model_route.'/'.$related_model_name_endpoint_part] = array( |
|
225 | 225 | array( |
226 | 226 | 'callback' => array( |
227 | 227 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
228 | 228 | 'handle_request_get_related' ), |
229 | 229 | 'methods' => WP_REST_Server::READABLE, |
230 | 230 | 'hidden_endpoint' => $hidden_endpoint, |
231 | - 'args' => $this->_get_read_query_params( $relation_name ), |
|
231 | + 'args' => $this->_get_read_query_params($relation_name), |
|
232 | 232 | ), |
233 | 233 | // array( |
234 | 234 | // 'callback' => array( |
@@ -252,11 +252,11 @@ discard block |
||
252 | 252 | */ |
253 | 253 | protected function _register_rpc_routes() { |
254 | 254 | $routes = array(); |
255 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
256 | - $ee_namespace = self::ee_api_namespace . $version; |
|
255 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
256 | + $ee_namespace = self::ee_api_namespace.$version; |
|
257 | 257 | $this_versions_routes = array(); |
258 | 258 | //checkin endpoint |
259 | - $this_versions_routes[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] = array( |
|
259 | + $this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array( |
|
260 | 260 | array( |
261 | 261 | 'callback' => array( |
262 | 262 | 'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin', |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | 'force' => array( |
268 | 268 | 'required' => false, |
269 | 269 | 'default' => false, |
270 | - 'description' => __( 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso' ) |
|
270 | + 'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso') |
|
271 | 271 | ) |
272 | 272 | ) |
273 | 273 | ) |
274 | 274 | ); |
275 | - $routes[ $ee_namespace ] = apply_filters( |
|
275 | + $routes[$ee_namespace] = apply_filters( |
|
276 | 276 | 'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes', |
277 | 277 | $this_versions_routes, |
278 | 278 | $version, |
@@ -287,47 +287,47 @@ discard block |
||
287 | 287 | * @param string $model_name eg 'Event' or 'Venue' |
288 | 288 | * @return array describing the args acceptable when querying this model |
289 | 289 | */ |
290 | - protected function _get_read_query_params( $model_name ) { |
|
291 | - $model = EE_Registry::instance()->load_model( $model_name ); |
|
290 | + protected function _get_read_query_params($model_name) { |
|
291 | + $model = EE_Registry::instance()->load_model($model_name); |
|
292 | 292 | $default_orderby = array(); |
293 | - foreach( $model->get_combined_primary_key_fields() as $key_field ) { |
|
294 | - $default_orderby[ $key_field->get_name() ] = 'ASC'; |
|
293 | + foreach ($model->get_combined_primary_key_fields() as $key_field) { |
|
294 | + $default_orderby[$key_field->get_name()] = 'ASC'; |
|
295 | 295 | } |
296 | 296 | return array( |
297 | 297 | 'where' => array( |
298 | 298 | 'required' => false, |
299 | 299 | 'default' => array(), |
300 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso' ), |
|
300 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso'), |
|
301 | 301 | ), |
302 | 302 | 'limit' => array( |
303 | 303 | 'required' => false, |
304 | 304 | 'default' => 50, |
305 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso' ) |
|
305 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso') |
|
306 | 306 | ), |
307 | 307 | 'order_by' => array( |
308 | 308 | 'required' => false, |
309 | 309 | 'default' => $default_orderby, |
310 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso' ) |
|
310 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso') |
|
311 | 311 | ), |
312 | 312 | 'group_by' => array( |
313 | 313 | 'required' => false, |
314 | 314 | 'default' => null, |
315 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso' ) |
|
315 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso') |
|
316 | 316 | ), |
317 | 317 | 'having' => array( |
318 | 318 | 'required' => false, |
319 | 319 | 'default' => null, |
320 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso' ) |
|
320 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso') |
|
321 | 321 | ), |
322 | 322 | 'caps' => array( |
323 | 323 | 'required' => false, |
324 | 324 | 'default' => EEM_Base::caps_read, |
325 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso' ) |
|
325 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso') |
|
326 | 326 | ), |
327 | 327 | 'include' => array( |
328 | 328 | 'required' => false, |
329 | 329 | 'default' => '*', |
330 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ), |
|
330 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'), |
|
331 | 331 | ), |
332 | 332 | ); |
333 | 333 | } |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | */ |
339 | 339 | protected function _register_config_routes() { |
340 | 340 | $config_routes = array(); |
341 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
342 | - $config_routes[ self::ee_api_namespace . $version ][ 'config' ] = array( |
|
341 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
342 | + $config_routes[self::ee_api_namespace.$version]['config'] = array( |
|
343 | 343 | array( |
344 | 344 | 'callback' => array( |
345 | 345 | 'EventEspresso\core\libraries\rest_api\controllers\config\Read', |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | */ |
359 | 359 | protected function _register_meta_routes() { |
360 | 360 | $meta_routes = array(); |
361 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
362 | - $meta_routes[ self::ee_api_namespace . $version ][ '/resources' ] = array( |
|
361 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
362 | + $meta_routes[self::ee_api_namespace.$version]['/resources'] = array( |
|
363 | 363 | array( |
364 | 364 | 'callback' => array( |
365 | 365 | 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | * @param array $route_data |
381 | 381 | * @return array |
382 | 382 | */ |
383 | - public static function hide_old_endpoints( $route_data ) { |
|
384 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
385 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
386 | - foreach( $routes as $route ) { |
|
387 | - if( $route[ 'hidden_endpoint' ] ) { |
|
388 | - $full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' ); |
|
389 | - unset( $route_data[ $full_route ] ); |
|
383 | + public static function hide_old_endpoints($route_data) { |
|
384 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
385 | + foreach ($relative_urls as $endpoint => $routes) { |
|
386 | + foreach ($routes as $route) { |
|
387 | + if ($route['hidden_endpoint']) { |
|
388 | + $full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/'); |
|
389 | + unset($route_data[$full_route]); |
|
390 | 390 | } |
391 | 391 | } |
392 | 392 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | */ |
424 | 424 | public static function latest_rest_api_version() { |
425 | 425 | $versions_served = \EED_Core_Rest_Api::versions_served(); |
426 | - return end( array_keys( $versions_served ) ); |
|
426 | + return end(array_keys($versions_served)); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | /** |
@@ -437,17 +437,17 @@ discard block |
||
437 | 437 | public static function versions_served() { |
438 | 438 | $version_compatibilities = EED_Core_Rest_Api::version_compatibilities(); |
439 | 439 | $versions_served = array(); |
440 | - $lowest_compatible_version = $version_compatibilities[ EED_Core_Rest_Api::core_version() ]; |
|
440 | + $lowest_compatible_version = $version_compatibilities[EED_Core_Rest_Api::core_version()]; |
|
441 | 441 | //for each version of core we have ever served: |
442 | - foreach( array_keys( EED_Core_Rest_Api::version_compatibilities() ) as $possibly_served_version ) { |
|
442 | + foreach (array_keys(EED_Core_Rest_Api::version_compatibilities()) as $possibly_served_version) { |
|
443 | 443 | //if it's not above the current core version, and it's compatible with the current version of core |
444 | - if( |
|
444 | + if ( |
|
445 | 445 | $possibly_served_version < EED_Core_Rest_Api::core_version() |
446 | 446 | && $possibly_served_version >= $lowest_compatible_version |
447 | 447 | ) { |
448 | - $versions_served[ $possibly_served_version ] = true; |
|
449 | - }else { |
|
450 | - $versions_served[ $possibly_served_version ] = false; |
|
448 | + $versions_served[$possibly_served_version] = true; |
|
449 | + } else { |
|
450 | + $versions_served[$possibly_served_version] = false; |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | return $versions_served; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @return string |
461 | 461 | */ |
462 | 462 | public static function core_version() { |
463 | - return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) ); |
|
463 | + return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3))); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @param WP $WP |
473 | 473 | * @return void |
474 | 474 | */ |
475 | - public function run( $WP ) { |
|
475 | + public function run($WP) { |
|
476 | 476 | |
477 | 477 | } |
478 | 478 |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
42 | - return parent::get_instance( __CLASS__ ); |
|
41 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
42 | + return parent::get_instance(__CLASS__); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks_admin() { |
86 | 86 | EED_Single_Page_Checkout::set_definitions(); |
87 | - if ( defined( 'DOING_AJAX' )) { |
|
87 | + if (defined('DOING_AJAX')) { |
|
88 | 88 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
89 | 89 | ob_start(); |
90 | 90 | EED_Single_Page_Checkout::load_request_handler(); |
91 | 91 | EED_Single_Page_Checkout::load_reg_steps(); |
92 | 92 | } else { |
93 | 93 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
94 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
94 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
95 | 95 | } |
96 | 96 | // set ajax hooks |
97 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
98 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
99 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
100 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
101 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
102 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
97 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
98 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
99 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
100 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
101 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
102 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * process ajax request |
109 | 109 | * @param string $ajax_action |
110 | 110 | */ |
111 | - public static function process_ajax_request( $ajax_action ) { |
|
112 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
111 | + public static function process_ajax_request($ajax_action) { |
|
112 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
113 | 113 | EED_Single_Page_Checkout::instance()->_initialize(); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * ajax display registration step |
120 | 120 | */ |
121 | 121 | public static function display_reg_step() { |
122 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
122 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * ajax process registration step |
129 | 129 | */ |
130 | 130 | public static function process_reg_step() { |
131 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
131 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * ajax process registration step |
138 | 138 | */ |
139 | 139 | public static function update_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public static function update_checkout() { |
152 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
152 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public static function load_request_handler() { |
164 | 164 | // load core Request_Handler class |
165 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
166 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
165 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
166 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -176,21 +176,21 @@ discard block |
||
176 | 176 | * @return void |
177 | 177 | */ |
178 | 178 | public static function set_definitions() { |
179 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
180 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
181 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
182 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
183 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
184 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
185 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
187 | - EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ] = sprintf( |
|
188 | - __( '%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | + EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
|
188 | + __('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
189 | 189 | '<h4 class="important-notice">', |
190 | 190 | '</h4>', |
191 | 191 | '<br />', |
192 | 192 | '<p>', |
193 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
193 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
194 | 194 | '">', |
195 | 195 | '</a>', |
196 | 196 | '</p>' |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public static function load_reg_steps() { |
211 | 211 | static $reg_steps_loaded = FALSE; |
212 | - if ( $reg_steps_loaded ) { |
|
212 | + if ($reg_steps_loaded) { |
|
213 | 213 | return; |
214 | 214 | } |
215 | 215 | // filter list of reg_steps |
@@ -218,24 +218,24 @@ discard block |
||
218 | 218 | EED_Single_Page_Checkout::get_reg_steps() |
219 | 219 | ); |
220 | 220 | // sort by key (order) |
221 | - ksort( $reg_steps_to_load ); |
|
221 | + ksort($reg_steps_to_load); |
|
222 | 222 | // loop through folders |
223 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
223 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
224 | 224 | // we need a |
225 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
225 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
226 | 226 | // copy over to the reg_steps_array |
227 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
227 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
228 | 228 | // register custom key route for each reg step |
229 | 229 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
230 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
230 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
231 | 231 | // add AJAX or other hooks |
232 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
232 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
233 | 233 | // setup autoloaders if necessary |
234 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
235 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
234 | + if ( ! class_exists($reg_step['class_name'])) { |
|
235 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
236 | 236 | } |
237 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
238 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
237 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
238 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | } |
@@ -254,28 +254,28 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public static function get_reg_steps() { |
256 | 256 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
257 | - if ( empty( $reg_steps )) { |
|
257 | + if (empty($reg_steps)) { |
|
258 | 258 | $reg_steps = array( |
259 | 259 | 10 => array( |
260 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
260 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
261 | 261 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
262 | 262 | 'slug' => 'attendee_information', |
263 | 263 | 'has_hooks' => FALSE |
264 | 264 | ), |
265 | 265 | 20 => array( |
266 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
266 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
267 | 267 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
268 | 268 | 'slug' => 'registration_confirmation', |
269 | 269 | 'has_hooks' => FALSE |
270 | 270 | ), |
271 | 271 | 30 => array( |
272 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
272 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
273 | 273 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
274 | 274 | 'slug' => 'payment_options', |
275 | 275 | 'has_hooks' => TRUE |
276 | 276 | ), |
277 | 277 | 999 => array( |
278 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
278 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
279 | 279 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
280 | 280 | 'slug' => 'finalize_registration', |
281 | 281 | 'has_hooks' => FALSE |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public static function registration_checkout_for_admin() { |
297 | 297 | EED_Single_Page_Checkout::load_reg_steps(); |
298 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
299 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
300 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
298 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
299 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
300 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
301 | 301 | EED_Single_Page_Checkout::instance()->_initialize(); |
302 | 302 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
303 | 303 | return EE_Registry::instance()->REQ->get_output(); |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public static function process_registration_from_admin() { |
315 | 315 | EED_Single_Page_Checkout::load_reg_steps(); |
316 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
317 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
318 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
316 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
317 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
318 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
319 | 319 | EED_Single_Page_Checkout::instance()->_initialize(); |
320 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
321 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
322 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
323 | - if ( $final_reg_step->process_reg_step() ) { |
|
320 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
321 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
322 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
323 | + if ($final_reg_step->process_reg_step()) { |
|
324 | 324 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
325 | 325 | } |
326 | 326 | } |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | * @param WP_Query $WP_Query |
338 | 338 | * @return void |
339 | 339 | */ |
340 | - public function run( $WP_Query ) { |
|
340 | + public function run($WP_Query) { |
|
341 | 341 | if ( |
342 | 342 | $WP_Query instanceof WP_Query |
343 | 343 | && $WP_Query->is_main_query() |
344 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
344 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
345 | 345 | ) { |
346 | 346 | $this->_initialize(); |
347 | 347 | } |
@@ -357,8 +357,8 @@ discard block |
||
357 | 357 | * @param WP_Query $WP_Query |
358 | 358 | * @return void |
359 | 359 | */ |
360 | - public static function init( $WP_Query ) { |
|
361 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
360 | + public static function init($WP_Query) { |
|
361 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | |
@@ -372,29 +372,29 @@ discard block |
||
372 | 372 | */ |
373 | 373 | private function _initialize() { |
374 | 374 | // ensure SPCO doesn't run twice |
375 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
375 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
376 | 376 | return; |
377 | 377 | } |
378 | 378 | $this->_verify_session(); |
379 | 379 | // setup the EE_Checkout object |
380 | 380 | $this->checkout = $this->_initialize_checkout(); |
381 | 381 | // filter checkout |
382 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
382 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
383 | 383 | // get the $_GET |
384 | 384 | $this->_get_request_vars(); |
385 | 385 | // filter continue_reg |
386 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
386 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
387 | 387 | // load the reg steps array |
388 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
388 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
389 | 389 | EED_Single_Page_Checkout::$_initialized = true; |
390 | 390 | return; |
391 | 391 | } |
392 | 392 | // set the current step |
393 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
393 | + $this->checkout->set_current_step($this->checkout->step); |
|
394 | 394 | // and the next step |
395 | 395 | $this->checkout->set_next_step(); |
396 | 396 | // verify that everything has been setup correctly |
397 | - if ( ! ( $this->_verify_transaction_and_get_registrations() && $this->_final_verifications() ) ) { |
|
397 | + if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) { |
|
398 | 398 | EED_Single_Page_Checkout::$_initialized = true; |
399 | 399 | return; |
400 | 400 | } |
@@ -419,9 +419,9 @@ discard block |
||
419 | 419 | // set no cache headers and constants |
420 | 420 | EE_System::do_not_cache(); |
421 | 421 | // add anchor |
422 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
422 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
423 | 423 | // remove transaction lock |
424 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
424 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | |
@@ -434,16 +434,16 @@ discard block |
||
434 | 434 | * @throws EE_Error |
435 | 435 | */ |
436 | 436 | private function _verify_session() { |
437 | - if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
438 | - throw new EE_Error( __( 'The EE_Session class could not be loaded.', 'event_espresso' ) ); |
|
437 | + if ( ! EE_Registry::instance()->SSN instanceof EE_Session) { |
|
438 | + throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso')); |
|
439 | 439 | } |
440 | 440 | // is session still valid ? |
441 | - if ( EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) === '' ) { |
|
441 | + if (EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '') { |
|
442 | 442 | $this->checkout = new EE_Checkout(); |
443 | 443 | EE_Registry::instance()->SSN->reset_cart(); |
444 | 444 | EE_Registry::instance()->SSN->reset_checkout(); |
445 | 445 | EE_Registry::instance()->SSN->reset_transaction(); |
446 | - EE_Error::add_attention( EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ], __FILE__, __FUNCTION__, __LINE__ ); |
|
446 | + EE_Error::add_attention(EE_Registry::$i18n_js_strings['registration_expiration_notice'], __FILE__, __FUNCTION__, __LINE__); |
|
447 | 447 | EE_Registry::instance()->SSN->reset_expired(); |
448 | 448 | } |
449 | 449 | } |
@@ -463,20 +463,20 @@ discard block |
||
463 | 463 | /** @type EE_Checkout $checkout */ |
464 | 464 | $checkout = EE_Registry::instance()->SSN->checkout(); |
465 | 465 | // verify |
466 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
466 | + if ( ! $checkout instanceof EE_Checkout) { |
|
467 | 467 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
468 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
468 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
469 | 469 | // verify again |
470 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
471 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
470 | + if ( ! $checkout instanceof EE_Checkout) { |
|
471 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
472 | 472 | } |
473 | 473 | } else { |
474 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
475 | - wp_safe_redirect( $checkout->redirect_url ); |
|
474 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
475 | + wp_safe_redirect($checkout->redirect_url); |
|
476 | 476 | exit(); |
477 | 477 | } |
478 | 478 | } |
479 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
479 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
480 | 480 | // reset anything that needs a clean slate for each request |
481 | 481 | $checkout->reset_for_current_request(); |
482 | 482 | return $checkout; |
@@ -494,24 +494,24 @@ discard block |
||
494 | 494 | // load classes |
495 | 495 | EED_Single_Page_Checkout::load_request_handler(); |
496 | 496 | //make sure this request is marked as belonging to EE |
497 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
497 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
498 | 498 | // which step is being requested ? |
499 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
499 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
500 | 500 | // which step is being edited ? |
501 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
501 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
502 | 502 | // and what we're doing on the current step |
503 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
503 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
504 | 504 | // returning to edit ? |
505 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
505 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
506 | 506 | // or some other kind of revisit ? |
507 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
507 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
508 | 508 | // and whether or not to generate a reg form for this request |
509 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
509 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
510 | 510 | // and whether or not to process a reg form submission for this request |
511 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
511 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
512 | 512 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
513 | 513 | ? $this->checkout->process_form_submission |
514 | - : FALSE; // TRUE FALSE |
|
514 | + : FALSE; // TRUE FALSE |
|
515 | 515 | //$this->_display_request_vars(); |
516 | 516 | } |
517 | 517 | |
@@ -524,17 +524,17 @@ discard block |
||
524 | 524 | * @return void |
525 | 525 | */ |
526 | 526 | protected function _display_request_vars() { |
527 | - if ( ! WP_DEBUG ) { |
|
527 | + if ( ! WP_DEBUG) { |
|
528 | 528 | return; |
529 | 529 | } |
530 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
531 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
532 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
533 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
534 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
535 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
536 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
537 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
530 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
531 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
532 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
533 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
534 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
535 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
536 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
537 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * @return array |
549 | 549 | */ |
550 | 550 | private function _get_first_step() { |
551 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
552 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
551 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
552 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
@@ -565,27 +565,27 @@ discard block |
||
565 | 565 | private function _load_and_instantiate_reg_steps() { |
566 | 566 | // have reg_steps already been instantiated ? |
567 | 567 | if ( |
568 | - empty( $this->checkout->reg_steps ) || |
|
569 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
568 | + empty($this->checkout->reg_steps) || |
|
569 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
570 | 570 | ) { |
571 | 571 | // if not, then loop through raw reg steps array |
572 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
573 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
572 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
573 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
574 | 574 | return false; |
575 | 575 | } |
576 | 576 | } |
577 | 577 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
578 | 578 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
579 | 579 | // skip the registration_confirmation page ? |
580 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
580 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
581 | 581 | // just remove it from the reg steps array |
582 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
582 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
583 | 583 | } else if ( |
584 | 584 | EE_Registry::instance()->CFG->registration->reg_confirmation_last |
585 | - && isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
585 | + && isset($this->checkout->reg_steps['registration_confirmation']) |
|
586 | 586 | ) { |
587 | 587 | // set the order to something big like 100 |
588 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
588 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
589 | 589 | } |
590 | 590 | // filter the array for good luck |
591 | 591 | $this->checkout->reg_steps = apply_filters( |
@@ -595,13 +595,13 @@ discard block |
||
595 | 595 | // finally re-sort based on the reg step class order properties |
596 | 596 | $this->checkout->sort_reg_steps(); |
597 | 597 | } else { |
598 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
598 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
599 | 599 | // set all current step stati to FALSE |
600 | - $reg_step->set_is_current_step( FALSE ); |
|
600 | + $reg_step->set_is_current_step(FALSE); |
|
601 | 601 | } |
602 | 602 | } |
603 | - if ( empty( $this->checkout->reg_steps )) { |
|
604 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
603 | + if (empty($this->checkout->reg_steps)) { |
|
604 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
605 | 605 | return false; |
606 | 606 | } |
607 | 607 | // make reg step details available to JS |
@@ -619,10 +619,10 @@ discard block |
||
619 | 619 | * @param int $order |
620 | 620 | * @return bool |
621 | 621 | */ |
622 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
622 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
623 | 623 | |
624 | 624 | // we need a file_path, class_name, and slug to add a reg step |
625 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
625 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
626 | 626 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
627 | 627 | if ( |
628 | 628 | $this->checkout->reg_url_link |
@@ -640,26 +640,26 @@ discard block |
||
640 | 640 | FALSE |
641 | 641 | ); |
642 | 642 | // did we gets the goods ? |
643 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
643 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
644 | 644 | // set reg step order based on config |
645 | - $reg_step_obj->set_order( $order ); |
|
645 | + $reg_step_obj->set_order($order); |
|
646 | 646 | // add instantiated reg step object to the master reg steps array |
647 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
647 | + $this->checkout->add_reg_step($reg_step_obj); |
|
648 | 648 | } else { |
649 | 649 | EE_Error::add_error( |
650 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
650 | + __('The current step could not be set.', 'event_espresso'), |
|
651 | 651 | __FILE__, __FUNCTION__, __LINE__ |
652 | 652 | ); |
653 | 653 | return false; |
654 | 654 | } |
655 | 655 | } else { |
656 | - if ( WP_DEBUG ) { |
|
656 | + if (WP_DEBUG) { |
|
657 | 657 | EE_Error::add_error( |
658 | 658 | sprintf( |
659 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
660 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
661 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
662 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
659 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
660 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
661 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
662 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
663 | 663 | '<ul>', |
664 | 664 | '<li>', |
665 | 665 | '</li>', |
@@ -683,15 +683,15 @@ discard block |
||
683 | 683 | */ |
684 | 684 | private function _verify_transaction_and_get_registrations() { |
685 | 685 | // was there already a valid transaction in the checkout from the session ? |
686 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
686 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
687 | 687 | // get transaction from db or session |
688 | 688 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
689 | 689 | ? $this->_get_transaction_and_cart_for_previous_visit() |
690 | 690 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
691 | 691 | |
692 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
692 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
693 | 693 | EE_Error::add_error( |
694 | - __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), |
|
694 | + __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), |
|
695 | 695 | __FILE__, __FUNCTION__, __LINE__ |
696 | 696 | ); |
697 | 697 | $this->checkout->transaction = EE_Transaction::new_instance(); |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | return false; |
702 | 702 | } |
703 | 703 | // and the registrations for the transaction |
704 | - $this->_get_registrations( $this->checkout->transaction ); |
|
704 | + $this->_get_registrations($this->checkout->transaction); |
|
705 | 705 | } |
706 | 706 | return true; |
707 | 707 | } |
@@ -716,16 +716,16 @@ discard block |
||
716 | 716 | */ |
717 | 717 | private function _get_transaction_and_cart_for_previous_visit() { |
718 | 718 | /** @var $TXN_model EEM_Transaction */ |
719 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
719 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
720 | 720 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
721 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
721 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
722 | 722 | // verify transaction |
723 | - if ( $transaction instanceof EE_Transaction ) { |
|
723 | + if ($transaction instanceof EE_Transaction) { |
|
724 | 724 | // and get the cart that was used for that transaction |
725 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
725 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
726 | 726 | return $transaction; |
727 | 727 | } else { |
728 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
728 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
729 | 729 | return NULL; |
730 | 730 | } |
731 | 731 | } |
@@ -739,11 +739,11 @@ discard block |
||
739 | 739 | * @param EE_Transaction $transaction |
740 | 740 | * @return EE_Cart |
741 | 741 | */ |
742 | - private function _get_cart_for_transaction( $transaction ) { |
|
743 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
742 | + private function _get_cart_for_transaction($transaction) { |
|
743 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
744 | 744 | // verify cart |
745 | - if ( ! $cart instanceof EE_Cart ) { |
|
746 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
745 | + if ( ! $cart instanceof EE_Cart) { |
|
746 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
747 | 747 | } |
748 | 748 | return $cart; |
749 | 749 | } |
@@ -758,8 +758,8 @@ discard block |
||
758 | 758 | * @param EE_Transaction $transaction |
759 | 759 | * @return EE_Cart |
760 | 760 | */ |
761 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
762 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
761 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
762 | + return EE_Cart::get_cart_from_txn($transaction); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | |
@@ -774,15 +774,15 @@ discard block |
||
774 | 774 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
775 | 775 | // if there's no transaction, then this is the FIRST visit to SPCO |
776 | 776 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
777 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
777 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
778 | 778 | // and then create a new transaction |
779 | 779 | $transaction = $this->_initialize_transaction(); |
780 | 780 | // verify transaction |
781 | - if ( $transaction instanceof EE_Transaction ) { |
|
781 | + if ($transaction instanceof EE_Transaction) { |
|
782 | 782 | // and save TXN data to the cart |
783 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
783 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
784 | 784 | } else { |
785 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
785 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
786 | 786 | } |
787 | 787 | return $transaction; |
788 | 788 | } |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | // grab the cart grand total |
803 | 803 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
804 | 804 | // create new TXN |
805 | - $transaction = EE_Transaction::new_instance( array( |
|
805 | + $transaction = EE_Transaction::new_instance(array( |
|
806 | 806 | 'TXN_timestamp' => time(), |
807 | 807 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
808 | 808 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | $transaction->ID() |
818 | 818 | ); |
819 | 819 | return $transaction; |
820 | - } catch( Exception $e ) { |
|
821 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
820 | + } catch (Exception $e) { |
|
821 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
822 | 822 | } |
823 | 823 | return NULL; |
824 | 824 | } |
@@ -832,34 +832,34 @@ discard block |
||
832 | 832 | * @param EE_Transaction $transaction |
833 | 833 | * @return EE_Cart |
834 | 834 | */ |
835 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
835 | + private function _get_registrations(EE_Transaction $transaction) { |
|
836 | 836 | // first step: grab the registrants { : o |
837 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
837 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
838 | 838 | // verify registrations have been set |
839 | - if ( empty( $registrations )) { |
|
839 | + if (empty($registrations)) { |
|
840 | 840 | // if no cached registrations, then check the db |
841 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
841 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
842 | 842 | // still nothing ? well as long as this isn't a revisit |
843 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
843 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
844 | 844 | // generate new registrations from scratch |
845 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
845 | + $registrations = $this->_initialize_registrations($transaction); |
|
846 | 846 | } |
847 | 847 | } |
848 | 848 | // sort by their original registration order |
849 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
849 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
850 | 850 | // then loop thru the array |
851 | - foreach ( $registrations as $registration ) { |
|
851 | + foreach ($registrations as $registration) { |
|
852 | 852 | // verify each registration |
853 | - if ( $registration instanceof EE_Registration ) { |
|
853 | + if ($registration instanceof EE_Registration) { |
|
854 | 854 | // we display all attendee info for the primary registrant |
855 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
855 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
856 | 856 | $this->checkout->primary_revisit = TRUE; |
857 | 857 | break; |
858 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
858 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
859 | 859 | // but hide info if it doesn't belong to you |
860 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
860 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
861 | 861 | } |
862 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
862 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
863 | 863 | } |
864 | 864 | } |
865 | 865 | } |
@@ -873,17 +873,17 @@ discard block |
||
873 | 873 | * @param EE_Transaction $transaction |
874 | 874 | * @return array |
875 | 875 | */ |
876 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
876 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
877 | 877 | $att_nmbr = 0; |
878 | 878 | $registrations = array(); |
879 | - if ( $transaction instanceof EE_Transaction ) { |
|
879 | + if ($transaction instanceof EE_Transaction) { |
|
880 | 880 | /** @type EE_Registration_Processor $registration_processor */ |
881 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
881 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
882 | 882 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
883 | 883 | // now let's add the cart items to the $transaction |
884 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
884 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
885 | 885 | //do the following for each ticket of this type they selected |
886 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
886 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
887 | 887 | $att_nmbr++; |
888 | 888 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
889 | 889 | $line_item, |
@@ -891,12 +891,12 @@ discard block |
||
891 | 891 | $att_nmbr, |
892 | 892 | $this->checkout->total_ticket_count |
893 | 893 | ); |
894 | - if ( $registration instanceof EE_Registration ) { |
|
895 | - $registrations[ $registration->ID() ] = $registration; |
|
894 | + if ($registration instanceof EE_Registration) { |
|
895 | + $registrations[$registration->ID()] = $registration; |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 | } |
899 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
899 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
900 | 900 | } |
901 | 901 | return $registrations; |
902 | 902 | } |
@@ -911,12 +911,12 @@ discard block |
||
911 | 911 | * @param EE_Registration $reg_B |
912 | 912 | * @return array() |
913 | 913 | */ |
914 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
914 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
915 | 915 | // this shouldn't ever happen within the same TXN, but oh well |
916 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
916 | + if ($reg_A->count() == $reg_B->count()) { |
|
917 | 917 | return 0; |
918 | 918 | } |
919 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
919 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | |
@@ -931,35 +931,35 @@ discard block |
||
931 | 931 | */ |
932 | 932 | private function _final_verifications() { |
933 | 933 | // filter checkout |
934 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
934 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
935 | 935 | //verify that current step is still set correctly |
936 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
937 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
936 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
937 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
938 | 938 | return false; |
939 | 939 | } |
940 | 940 | // if returning to SPCO, then verify that primary registrant is set |
941 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
941 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
942 | 942 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
943 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
944 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
943 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
944 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
945 | 945 | return false; |
946 | 946 | } |
947 | 947 | $valid_registrant = null; |
948 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
949 | - if ( $registration instanceof EE_Registration ) { |
|
950 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
948 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
949 | + if ($registration instanceof EE_Registration) { |
|
950 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
951 | 951 | $valid_registrant = $registration; |
952 | 952 | } |
953 | 953 | } |
954 | 954 | } |
955 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
956 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
955 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
956 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
957 | 957 | return false; |
958 | 958 | } |
959 | 959 | } |
960 | 960 | // now that things have been kinda sufficiently verified, |
961 | 961 | // let's add the checkout to the session so that's available other systems |
962 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
962 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
963 | 963 | return true; |
964 | 964 | } |
965 | 965 | |
@@ -975,28 +975,28 @@ discard block |
||
975 | 975 | * @access private |
976 | 976 | * @param bool $reinitializing |
977 | 977 | */ |
978 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
979 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
978 | + private function _initialize_reg_steps($reinitializing = false) { |
|
979 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
980 | 980 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
981 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
982 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
981 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
982 | + if ( ! $reg_step->initialize_reg_step()) { |
|
983 | 983 | // if not initialized then maybe this step is being removed... |
984 | - if ( $reg_step->is_current_step() && ! $reinitializing ) { |
|
984 | + if ($reg_step->is_current_step() && ! $reinitializing) { |
|
985 | 985 | // if it was the current step, then we need to start over here |
986 | - $this->_initialize_reg_steps( true ); |
|
986 | + $this->_initialize_reg_steps(true); |
|
987 | 987 | return; |
988 | 988 | } |
989 | 989 | continue; |
990 | 990 | } |
991 | 991 | // i18n |
992 | 992 | $reg_step->translate_js_strings(); |
993 | - if ( $reg_step->is_current_step() ) { |
|
993 | + if ($reg_step->is_current_step()) { |
|
994 | 994 | // the text that appears on the reg step form submit button |
995 | 995 | $reg_step->set_submit_button_text(); |
996 | 996 | } |
997 | 997 | } |
998 | 998 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
999 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
999 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | |
@@ -1009,39 +1009,39 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | private function _check_form_submission() { |
1011 | 1011 | //does this request require the reg form to be generated ? |
1012 | - if ( $this->checkout->generate_reg_form ) { |
|
1012 | + if ($this->checkout->generate_reg_form) { |
|
1013 | 1013 | // ever heard that song by Blue Rodeo ? |
1014 | 1014 | try { |
1015 | 1015 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
1016 | 1016 | // if not displaying a form, then check for form submission |
1017 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
1017 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
1018 | 1018 | // clear out any old data in case this step is being run again |
1019 | - $this->checkout->current_step->set_valid_data( array() ); |
|
1019 | + $this->checkout->current_step->set_valid_data(array()); |
|
1020 | 1020 | // capture submitted form data |
1021 | 1021 | $this->checkout->current_step->reg_form->receive_form_submission( |
1022 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
1022 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
1023 | 1023 | ); |
1024 | 1024 | // validate submitted form data |
1025 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
1025 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
1026 | 1026 | // thou shall not pass !!! |
1027 | 1027 | $this->checkout->continue_reg = FALSE; |
1028 | 1028 | // any form validation errors? |
1029 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
1029 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
1030 | 1030 | $submission_error_messages = array(); |
1031 | 1031 | // bad, bad, bad registrant |
1032 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1033 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1034 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
1032 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1033 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1034 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
1035 | 1035 | } |
1036 | 1036 | } |
1037 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1037 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1038 | 1038 | } |
1039 | 1039 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1040 | 1040 | $this->go_to_next_step(); |
1041 | 1041 | return; |
1042 | 1042 | } |
1043 | 1043 | } |
1044 | - } catch( EE_Error $e ) { |
|
1044 | + } catch (EE_Error $e) { |
|
1045 | 1045 | $e->get_error(); |
1046 | 1046 | } |
1047 | 1047 | } |
@@ -1057,38 +1057,38 @@ discard block |
||
1057 | 1057 | */ |
1058 | 1058 | private function _process_form_action() { |
1059 | 1059 | // what cha wanna do? |
1060 | - switch( $this->checkout->action ) { |
|
1060 | + switch ($this->checkout->action) { |
|
1061 | 1061 | // AJAX next step reg form |
1062 | 1062 | case 'display_spco_reg_step' : |
1063 | 1063 | $this->checkout->redirect = FALSE; |
1064 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1065 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1064 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1065 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1066 | 1066 | } |
1067 | 1067 | break; |
1068 | 1068 | |
1069 | 1069 | default : |
1070 | 1070 | // meh... do one of those other steps first |
1071 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1071 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1072 | 1072 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1073 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1073 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1074 | 1074 | // call action on current step |
1075 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1075 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1076 | 1076 | // good registrant, you get to proceed |
1077 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
1078 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
1079 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
1077 | + if ($this->checkout->current_step->success_message() != '') { |
|
1078 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
1079 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
1080 | 1080 | } |
1081 | 1081 | } |
1082 | 1082 | // pack it up, pack it in... |
1083 | 1083 | $this->_setup_redirect(); |
1084 | 1084 | } |
1085 | 1085 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1086 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1086 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1087 | 1087 | |
1088 | 1088 | } else { |
1089 | 1089 | EE_Error::add_error( |
1090 | 1090 | sprintf( |
1091 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1091 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1092 | 1092 | $this->checkout->action, |
1093 | 1093 | $this->checkout->current_step->name() |
1094 | 1094 | ), |
@@ -1114,10 +1114,10 @@ discard block |
||
1114 | 1114 | public function add_styles_and_scripts() { |
1115 | 1115 | // i18n |
1116 | 1116 | $this->translate_js_strings(); |
1117 | - if ( $this->checkout->admin_request ) { |
|
1118 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1117 | + if ($this->checkout->admin_request) { |
|
1118 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1119 | 1119 | } else { |
1120 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1120 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1121 | 1121 | } |
1122 | 1122 | } |
1123 | 1123 | |
@@ -1133,50 +1133,50 @@ discard block |
||
1133 | 1133 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1134 | 1134 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1135 | 1135 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1136 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1137 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1138 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1136 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1137 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1138 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1139 | 1139 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1140 | 1140 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1141 | 1141 | EE_Registry::$i18n_js_strings['process_registration'] = sprintf( |
1142 | - __( 'Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso' ), |
|
1142 | + __('Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso'), |
|
1143 | 1143 | '<br/>' |
1144 | 1144 | ); |
1145 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1145 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1146 | 1146 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1147 | 1147 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1148 | 1148 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1149 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1150 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1151 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1152 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1153 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1154 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1155 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1156 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1157 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1158 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1159 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1160 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1161 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1162 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1149 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1150 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1151 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1152 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1153 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1154 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1155 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1156 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1157 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1158 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1159 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1160 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1161 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1162 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1163 | 1163 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1164 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1164 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1165 | 1165 | '<h4 class="important-notice">', |
1166 | 1166 | '</h4>', |
1167 | 1167 | '<br />', |
1168 | 1168 | '<p>', |
1169 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1169 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1170 | 1170 | '">', |
1171 | 1171 | '</a>', |
1172 | 1172 | '</p>' |
1173 | 1173 | ); |
1174 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1175 | - EE_Registry::$i18n_js_strings[ 'session_extension' ] = absint( |
|
1176 | - apply_filters( 'FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS ) |
|
1174 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1175 | + EE_Registry::$i18n_js_strings['session_extension'] = absint( |
|
1176 | + apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS) |
|
1177 | 1177 | ); |
1178 | - EE_Registry::$i18n_js_strings[ 'session_expiration' ] = gmdate( |
|
1179 | - 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) |
|
1178 | + EE_Registry::$i18n_js_strings['session_expiration'] = gmdate( |
|
1179 | + 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS) |
|
1180 | 1180 | ); |
1181 | 1181 | |
1182 | 1182 | |
@@ -1192,31 +1192,31 @@ discard block |
||
1192 | 1192 | */ |
1193 | 1193 | public function enqueue_styles_and_scripts() { |
1194 | 1194 | // load css |
1195 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1196 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1195 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1196 | + wp_enqueue_style('single_page_checkout'); |
|
1197 | 1197 | // load JS |
1198 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1199 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1198 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1199 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1200 | 1200 | wp_register_script( |
1201 | 1201 | 'single_page_checkout', |
1202 | - SPCO_JS_URL . 'single_page_checkout.js', |
|
1203 | - array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), |
|
1202 | + SPCO_JS_URL.'single_page_checkout.js', |
|
1203 | + array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), |
|
1204 | 1204 | EVENT_ESPRESSO_VERSION, |
1205 | 1205 | TRUE |
1206 | 1206 | ); |
1207 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1207 | + wp_enqueue_script('single_page_checkout'); |
|
1208 | 1208 | |
1209 | 1209 | /** |
1210 | 1210 | * global action hook for enqueueing styles and scripts with |
1211 | 1211 | * spco calls. |
1212 | 1212 | */ |
1213 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1213 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1214 | 1214 | |
1215 | 1215 | /** |
1216 | 1216 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1217 | 1217 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1218 | 1218 | */ |
1219 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1219 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1220 | 1220 | |
1221 | 1221 | // add css and JS for current step |
1222 | 1222 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1232,21 +1232,21 @@ discard block |
||
1232 | 1232 | */ |
1233 | 1233 | private function _display_spco_reg_form() { |
1234 | 1234 | // if registering via the admin, just display the reg form for the current step |
1235 | - if ( $this->checkout->admin_request ) { |
|
1236 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1235 | + if ($this->checkout->admin_request) { |
|
1236 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1237 | 1237 | } else { |
1238 | 1238 | // add powered by EE msg |
1239 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1239 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1240 | 1240 | |
1241 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1242 | - EE_Registry::$i18n_js_strings[ 'empty_cart' ] = $empty_cart; |
|
1241 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1242 | + EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart; |
|
1243 | 1243 | $cookies_not_set_msg = ''; |
1244 | - if ( $empty_cart ) { |
|
1245 | - if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1244 | + if ($empty_cart) { |
|
1245 | + if ( ! isset($_COOKIE['ee_cookie_test'])) { |
|
1246 | 1246 | $cookies_not_set_msg = apply_filters( |
1247 | 1247 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1248 | 1248 | sprintf( |
1249 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1249 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1250 | 1250 | '<div class="ee-attention">', |
1251 | 1251 | '</div>', |
1252 | 1252 | '<h6 class="important-notice">', |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | 'layout_strategy' => |
1268 | 1268 | new EE_Template_Layout( |
1269 | 1269 | array( |
1270 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1270 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1271 | 1271 | 'template_args' => array( |
1272 | 1272 | 'empty_cart' => $empty_cart, |
1273 | 1273 | 'revisit' => $this->checkout->revisit, |
@@ -1276,8 +1276,8 @@ discard block |
||
1276 | 1276 | 'empty_msg' => apply_filters( |
1277 | 1277 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1278 | 1278 | sprintf( |
1279 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1280 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1279 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1280 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1281 | 1281 | '">', |
1282 | 1282 | '</a>' |
1283 | 1283 | ) |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | ) |
1296 | 1296 | ); |
1297 | 1297 | // load template and add to output sent that gets filtered into the_content() |
1298 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1298 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1299 | 1299 | } |
1300 | 1300 | } |
1301 | 1301 | |
@@ -1309,8 +1309,8 @@ discard block |
||
1309 | 1309 | * @internal param string $label |
1310 | 1310 | * @return string |
1311 | 1311 | */ |
1312 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1313 | - if ( $next_step == 'finalize_registration' ) { |
|
1312 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1313 | + if ($next_step == 'finalize_registration') { |
|
1314 | 1314 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1315 | 1315 | } |
1316 | 1316 | } |
@@ -1324,18 +1324,18 @@ discard block |
||
1324 | 1324 | * @return string |
1325 | 1325 | */ |
1326 | 1326 | public static function display_registration_footer() { |
1327 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1328 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1329 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1330 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1327 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1328 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1329 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1330 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1331 | 1331 | echo apply_filters( |
1332 | 1332 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1333 | 1333 | sprintf( |
1334 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1335 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1334 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1335 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1336 | 1336 | '" target="_blank">', |
1337 | 1337 | '</a>', |
1338 | - '<a href="' . $url . '" title="', |
|
1338 | + '<a href="'.$url.'" title="', |
|
1339 | 1339 | '" target="_blank">', |
1340 | 1340 | '</a></div>' |
1341 | 1341 | ) |
@@ -1366,12 +1366,12 @@ discard block |
||
1366 | 1366 | * @return array |
1367 | 1367 | */ |
1368 | 1368 | private function _setup_redirect() { |
1369 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1369 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1370 | 1370 | $this->checkout->redirect = TRUE; |
1371 | - if ( empty( $this->checkout->redirect_url )) { |
|
1371 | + if (empty($this->checkout->redirect_url)) { |
|
1372 | 1372 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1373 | 1373 | } |
1374 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1374 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1375 | 1375 | } |
1376 | 1376 | } |
1377 | 1377 | |
@@ -1384,12 +1384,12 @@ discard block |
||
1384 | 1384 | * @return void |
1385 | 1385 | */ |
1386 | 1386 | public function go_to_next_step() { |
1387 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1387 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1388 | 1388 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1389 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1389 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1390 | 1390 | } |
1391 | 1391 | // just return for these conditions |
1392 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1392 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1393 | 1393 | return; |
1394 | 1394 | } |
1395 | 1395 | // AJAX response |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | */ |
1411 | 1411 | protected function _handle_json_response() { |
1412 | 1412 | // if this is an ajax request |
1413 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1413 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1414 | 1414 | // DEBUG LOG |
1415 | 1415 | //$this->checkout->log( |
1416 | 1416 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1420,10 +1420,10 @@ discard block |
||
1420 | 1420 | // 'continue_reg' => $this->checkout->continue_reg, |
1421 | 1421 | // ) |
1422 | 1422 | //); |
1423 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1424 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1423 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1424 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1425 | 1425 | // just send the ajax ( |
1426 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1426 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1427 | 1427 | $this->unlock_transaction(); |
1428 | 1428 | echo $json_response; |
1429 | 1429 | exit(); |
@@ -1440,9 +1440,9 @@ discard block |
||
1440 | 1440 | */ |
1441 | 1441 | protected function _handle_html_redirects() { |
1442 | 1442 | // going somewhere ? |
1443 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1443 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1444 | 1444 | // store notices in a transient |
1445 | - EE_Error::get_notices( false, true, true ); |
|
1445 | + EE_Error::get_notices(false, true, true); |
|
1446 | 1446 | $this->unlock_transaction(); |
1447 | 1447 | // DEBUG LOG |
1448 | 1448 | //$this->checkout->log( |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | // 'headers_list' => headers_list(), |
1454 | 1454 | // ) |
1455 | 1455 | //); |
1456 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1456 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1457 | 1457 | exit(); |
1458 | 1458 | } |
1459 | 1459 | } |