@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @access private |
22 | 22 | * @since 1.0 |
23 | 23 | */ |
24 | -add_action( 'give_paypal_cc_form', '__return_false' ); |
|
24 | +add_action('give_paypal_cc_form', '__return_false'); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Process PayPal Purchase. |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return void |
34 | 34 | */ |
35 | -function give_process_paypal_purchase( $purchase_data ) { |
|
35 | +function give_process_paypal_purchase($purchase_data) { |
|
36 | 36 | |
37 | - if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) { |
|
38 | - wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
37 | + if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) { |
|
38 | + wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
39 | 39 | } |
40 | 40 | |
41 | - $form_id = intval( $purchase_data['post_data']['give-form-id'] ); |
|
42 | - $price_id = isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : ''; |
|
41 | + $form_id = intval($purchase_data['post_data']['give-form-id']); |
|
42 | + $price_id = isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : ''; |
|
43 | 43 | |
44 | 44 | // Collect payment data. |
45 | 45 | $payment_data = array( |
@@ -57,69 +57,69 @@ discard block |
||
57 | 57 | ); |
58 | 58 | |
59 | 59 | // Record the pending payment. |
60 | - $payment = give_insert_payment( $payment_data ); |
|
60 | + $payment = give_insert_payment($payment_data); |
|
61 | 61 | |
62 | 62 | // Check payment. |
63 | - if ( ! $payment ) { |
|
63 | + if ( ! $payment) { |
|
64 | 64 | // Record the error. |
65 | 65 | give_record_gateway_error( |
66 | - esc_html__( 'Payment Error', 'give' ), |
|
66 | + esc_html__('Payment Error', 'give'), |
|
67 | 67 | sprintf( |
68 | 68 | /* translators: %s: payment data */ |
69 | - esc_html__( 'Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give' ), |
|
70 | - json_encode( $payment_data ) |
|
69 | + esc_html__('Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give'), |
|
70 | + json_encode($payment_data) |
|
71 | 71 | ), |
72 | 72 | $payment |
73 | 73 | ); |
74 | 74 | // Problems? Send back. |
75 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
75 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
76 | 76 | |
77 | 77 | } else { |
78 | 78 | |
79 | 79 | // Only send to PayPal if the pending payment is created successfully. |
80 | - $listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) ); |
|
80 | + $listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php')); |
|
81 | 81 | |
82 | 82 | // Get the success url |
83 | - $return_url = add_query_arg( array( |
|
83 | + $return_url = add_query_arg(array( |
|
84 | 84 | 'payment-confirmation' => 'paypal', |
85 | 85 | 'payment-id' => $payment |
86 | 86 | |
87 | - ), get_permalink( give_get_option( 'success_page' ) ) ); |
|
87 | + ), get_permalink(give_get_option('success_page'))); |
|
88 | 88 | |
89 | 89 | // Get the PayPal redirect uri |
90 | - $paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?'; |
|
90 | + $paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?'; |
|
91 | 91 | |
92 | 92 | //Item name - pass level name if variable priced |
93 | 93 | $item_name = $purchase_data['post_data']['give-form-title']; |
94 | 94 | |
95 | 95 | //Verify has variable prices |
96 | - if ( give_has_variable_prices( $form_id ) && isset( $purchase_data['post_data']['give-price-id'] ) ) { |
|
96 | + if (give_has_variable_prices($form_id) && isset($purchase_data['post_data']['give-price-id'])) { |
|
97 | 97 | |
98 | - $item_price_level_text = give_get_price_option_name( $form_id, $purchase_data['post_data']['give-price-id'] ); |
|
98 | + $item_price_level_text = give_get_price_option_name($form_id, $purchase_data['post_data']['give-price-id']); |
|
99 | 99 | |
100 | - $price_level_amount = give_get_price_option_amount( $form_id, $purchase_data['post_data']['give-price-id'] ); |
|
100 | + $price_level_amount = give_get_price_option_amount($form_id, $purchase_data['post_data']['give-price-id']); |
|
101 | 101 | |
102 | 102 | //Donation given doesn't match selected level (must be a custom amount) |
103 | - if ( $price_level_amount != give_sanitize_amount( $purchase_data['price'] ) ) { |
|
104 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
103 | + if ($price_level_amount != give_sanitize_amount($purchase_data['price'])) { |
|
104 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
105 | 105 | //user custom amount text if any, fallback to default if not |
106 | - $item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) ); |
|
106 | + $item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give')); |
|
107 | 107 | |
108 | 108 | } //Is there any donation level text? |
109 | - elseif ( ! empty( $item_price_level_text ) ) { |
|
110 | - $item_name .= ' - ' . $item_price_level_text; |
|
109 | + elseif ( ! empty($item_price_level_text)) { |
|
110 | + $item_name .= ' - '.$item_price_level_text; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | } //Single donation: Custom Amount |
114 | - elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $purchase_data['price'] ) ) { |
|
115 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
114 | + elseif (give_get_form_price($form_id) !== give_sanitize_amount($purchase_data['price'])) { |
|
115 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
116 | 116 | //user custom amount text if any, fallback to default if not |
117 | - $item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) ); |
|
117 | + $item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give')); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // Setup PayPal arguments |
121 | 121 | $paypal_args = array( |
122 | - 'business' => give_get_option( 'paypal_email', false ), |
|
122 | + 'business' => give_get_option('paypal_email', false), |
|
123 | 123 | 'first_name' => $purchase_data['user_info']['first_name'], |
124 | 124 | 'last_name' => $purchase_data['user_info']['last_name'], |
125 | 125 | 'email' => $purchase_data['user_email'], |
@@ -132,28 +132,28 @@ discard block |
||
132 | 132 | 'shipping' => '0', |
133 | 133 | 'no_note' => '1', |
134 | 134 | 'currency_code' => give_get_currency(), |
135 | - 'charset' => get_bloginfo( 'charset' ), |
|
135 | + 'charset' => get_bloginfo('charset'), |
|
136 | 136 | 'custom' => $payment, |
137 | 137 | 'rm' => '2', |
138 | 138 | 'return' => $return_url, |
139 | - 'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment ), |
|
139 | + 'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment), |
|
140 | 140 | 'notify_url' => $listener_url, |
141 | 141 | 'page_style' => give_get_paypal_page_style(), |
142 | - 'cbt' => get_bloginfo( 'name' ), |
|
142 | + 'cbt' => get_bloginfo('name'), |
|
143 | 143 | 'bn' => 'givewp_SP' |
144 | 144 | ); |
145 | 145 | |
146 | 146 | //Add user address if present. |
147 | - if ( ! empty( $purchase_data['user_info']['address'] ) ) { |
|
148 | - $paypal_args['address1'] = isset( $purchase_data['user_info']['address']['line1'] ) ? $purchase_data['user_info']['address']['line1'] : ''; |
|
149 | - $paypal_args['address2'] = isset( $purchase_data['user_info']['address']['line2'] ) ? $purchase_data['user_info']['address']['line2'] : ''; |
|
150 | - $paypal_args['city'] = isset( $purchase_data['user_info']['address']['city'] ) ? $purchase_data['user_info']['address']['city'] : ''; |
|
151 | - $paypal_args['state'] = isset( $purchase_data['user_info']['address']['state'] ) ? $purchase_data['user_info']['address']['state'] : ''; |
|
152 | - $paypal_args['country'] = isset( $purchase_data['user_info']['address']['country'] ) ? $purchase_data['user_info']['address']['country'] : ''; |
|
147 | + if ( ! empty($purchase_data['user_info']['address'])) { |
|
148 | + $paypal_args['address1'] = isset($purchase_data['user_info']['address']['line1']) ? $purchase_data['user_info']['address']['line1'] : ''; |
|
149 | + $paypal_args['address2'] = isset($purchase_data['user_info']['address']['line2']) ? $purchase_data['user_info']['address']['line2'] : ''; |
|
150 | + $paypal_args['city'] = isset($purchase_data['user_info']['address']['city']) ? $purchase_data['user_info']['address']['city'] : ''; |
|
151 | + $paypal_args['state'] = isset($purchase_data['user_info']['address']['state']) ? $purchase_data['user_info']['address']['state'] : ''; |
|
152 | + $paypal_args['country'] = isset($purchase_data['user_info']['address']['country']) ? $purchase_data['user_info']['address']['country'] : ''; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | //Donations or regular transactions? |
156 | - if ( give_get_option( 'paypal_button_type' ) === 'standard' ) { |
|
156 | + if (give_get_option('paypal_button_type') === 'standard') { |
|
157 | 157 | $paypal_extra_args = array( |
158 | 158 | 'cmd' => '_xclick', |
159 | 159 | ); |
@@ -163,23 +163,23 @@ discard block |
||
163 | 163 | ); |
164 | 164 | } |
165 | 165 | |
166 | - $paypal_args = array_merge( $paypal_extra_args, $paypal_args ); |
|
167 | - $paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $purchase_data ); |
|
166 | + $paypal_args = array_merge($paypal_extra_args, $paypal_args); |
|
167 | + $paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $purchase_data); |
|
168 | 168 | |
169 | 169 | // Build query |
170 | - $paypal_redirect .= http_build_query( $paypal_args ); |
|
170 | + $paypal_redirect .= http_build_query($paypal_args); |
|
171 | 171 | |
172 | 172 | // Fix for some sites that encode the entities |
173 | - $paypal_redirect = str_replace( '&', '&', $paypal_redirect ); |
|
173 | + $paypal_redirect = str_replace('&', '&', $paypal_redirect); |
|
174 | 174 | |
175 | 175 | // Redirect to PayPal |
176 | - wp_redirect( $paypal_redirect ); |
|
176 | + wp_redirect($paypal_redirect); |
|
177 | 177 | exit; |
178 | 178 | } |
179 | 179 | |
180 | 180 | } |
181 | 181 | |
182 | -add_action( 'give_gateway_paypal', 'give_process_paypal_purchase' ); |
|
182 | +add_action('give_gateway_paypal', 'give_process_paypal_purchase'); |
|
183 | 183 | |
184 | 184 | /** |
185 | 185 | * Listens for a PayPal IPN requests and then sends to the processing function |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | */ |
190 | 190 | function give_listen_for_paypal_ipn() { |
191 | 191 | // Regular PayPal IPN |
192 | - if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) { |
|
193 | - do_action( 'give_verify_paypal_ipn' ); |
|
192 | + if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') { |
|
193 | + do_action('give_verify_paypal_ipn'); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
197 | -add_action( 'init', 'give_listen_for_paypal_ipn' ); |
|
197 | +add_action('init', 'give_listen_for_paypal_ipn'); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Process PayPal IPN |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | function give_process_paypal_ipn() { |
206 | 206 | |
207 | 207 | // Check the request method is POST |
208 | - if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) { |
|
208 | + if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') { |
|
209 | 209 | return; |
210 | 210 | } |
211 | 211 | |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | $post_data = ''; |
214 | 214 | |
215 | 215 | // Fallback just in case post_max_size is lower than needed |
216 | - if ( ini_get( 'allow_url_fopen' ) ) { |
|
217 | - $post_data = file_get_contents( 'php://input' ); |
|
216 | + if (ini_get('allow_url_fopen')) { |
|
217 | + $post_data = file_get_contents('php://input'); |
|
218 | 218 | } else { |
219 | 219 | // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough |
220 | - ini_set( 'post_max_size', '12M' ); |
|
220 | + ini_set('post_max_size', '12M'); |
|
221 | 221 | } |
222 | 222 | // Start the encoded data collection with notification command |
223 | 223 | $encoded_data = 'cmd=_notify-validate'; |
@@ -226,40 +226,40 @@ discard block |
||
226 | 226 | $arg_separator = give_get_php_arg_separator_output(); |
227 | 227 | |
228 | 228 | // Verify there is a post_data |
229 | - if ( $post_data || strlen( $post_data ) > 0 ) { |
|
229 | + if ($post_data || strlen($post_data) > 0) { |
|
230 | 230 | // Append the data |
231 | - $encoded_data .= $arg_separator . $post_data; |
|
231 | + $encoded_data .= $arg_separator.$post_data; |
|
232 | 232 | } else { |
233 | 233 | // Check if POST is empty |
234 | - if ( empty( $_POST ) ) { |
|
234 | + if (empty($_POST)) { |
|
235 | 235 | // Nothing to do |
236 | 236 | return; |
237 | 237 | } else { |
238 | 238 | // Loop through each POST |
239 | - foreach ( $_POST as $key => $value ) { |
|
239 | + foreach ($_POST as $key => $value) { |
|
240 | 240 | // Encode the value and append the data |
241 | - $encoded_data .= $arg_separator . "$key=" . urlencode( $value ); |
|
241 | + $encoded_data .= $arg_separator."$key=".urlencode($value); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | 246 | // Convert collected post data to an array |
247 | - parse_str( $encoded_data, $encoded_data_array ); |
|
247 | + parse_str($encoded_data, $encoded_data_array); |
|
248 | 248 | |
249 | - foreach ( $encoded_data_array as $key => $value ) { |
|
249 | + foreach ($encoded_data_array as $key => $value) { |
|
250 | 250 | |
251 | - if ( false !== strpos( $key, 'amp;' ) ) { |
|
252 | - $new_key = str_replace( '&', '&', $key ); |
|
253 | - $new_key = str_replace( 'amp;', '&', $new_key ); |
|
251 | + if (false !== strpos($key, 'amp;')) { |
|
252 | + $new_key = str_replace('&', '&', $key); |
|
253 | + $new_key = str_replace('amp;', '&', $new_key); |
|
254 | 254 | |
255 | - unset( $encoded_data_array[ $key ] ); |
|
256 | - $encoded_data_array[ $new_key ] = $value; |
|
255 | + unset($encoded_data_array[$key]); |
|
256 | + $encoded_data_array[$new_key] = $value; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | } |
260 | 260 | |
261 | 261 | //Validate IPN request w/ PayPal if user hasn't disabled this security measure |
262 | - if ( ! give_get_option( 'disable_paypal_verification' ) ) { |
|
262 | + if ( ! give_get_option('disable_paypal_verification')) { |
|
263 | 263 | |
264 | 264 | $remote_post_vars = array( |
265 | 265 | 'method' => 'POST', |
@@ -279,28 +279,28 @@ discard block |
||
279 | 279 | ); |
280 | 280 | |
281 | 281 | // Validate the IPN |
282 | - $api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars ); |
|
282 | + $api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars); |
|
283 | 283 | |
284 | - if ( is_wp_error( $api_response ) ) { |
|
284 | + if (is_wp_error($api_response)) { |
|
285 | 285 | give_record_gateway_error( |
286 | - esc_html__( 'IPN Error', 'give' ), |
|
286 | + esc_html__('IPN Error', 'give'), |
|
287 | 287 | sprintf( |
288 | 288 | /* translators: %s: Paypal IPN response */ |
289 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
290 | - json_encode( $api_response ) |
|
289 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
290 | + json_encode($api_response) |
|
291 | 291 | ) |
292 | 292 | ); |
293 | 293 | |
294 | 294 | return; // Something went wrong |
295 | 295 | } |
296 | 296 | |
297 | - if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) { |
|
297 | + if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) { |
|
298 | 298 | give_record_gateway_error( |
299 | - esc_html__( 'IPN Error', 'give' ), |
|
299 | + esc_html__('IPN Error', 'give'), |
|
300 | 300 | sprintf( |
301 | 301 | /* translators: %s: Paypal IPN response */ |
302 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
303 | - json_encode( $api_response ) |
|
302 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
303 | + json_encode($api_response) |
|
304 | 304 | ) |
305 | 305 | ); |
306 | 306 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | } |
311 | 311 | |
312 | 312 | // Check if $post_data_array has been populated |
313 | - if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) { |
|
313 | + if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) { |
|
314 | 314 | return; |
315 | 315 | } |
316 | 316 | |
@@ -319,21 +319,21 @@ discard block |
||
319 | 319 | 'payment_status' => '' |
320 | 320 | ); |
321 | 321 | |
322 | - $encoded_data_array = wp_parse_args( $encoded_data_array, $defaults ); |
|
322 | + $encoded_data_array = wp_parse_args($encoded_data_array, $defaults); |
|
323 | 323 | |
324 | - $payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0; |
|
324 | + $payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0; |
|
325 | 325 | |
326 | - if ( has_action( 'give_paypal_' . $encoded_data_array['txn_type'] ) ) { |
|
326 | + if (has_action('give_paypal_'.$encoded_data_array['txn_type'])) { |
|
327 | 327 | // Allow PayPal IPN types to be processed separately |
328 | - do_action( 'give_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $payment_id ); |
|
328 | + do_action('give_paypal_'.$encoded_data_array['txn_type'], $encoded_data_array, $payment_id); |
|
329 | 329 | } else { |
330 | 330 | // Fallback to web accept just in case the txn_type isn't present |
331 | - do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id ); |
|
331 | + do_action('give_paypal_web_accept', $encoded_data_array, $payment_id); |
|
332 | 332 | } |
333 | 333 | exit; |
334 | 334 | } |
335 | 335 | |
336 | -add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' ); |
|
336 | +add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn'); |
|
337 | 337 | |
338 | 338 | /** |
339 | 339 | * Process web accept (one time) payment IPNs. |
@@ -344,224 +344,224 @@ discard block |
||
344 | 344 | * |
345 | 345 | * @return void |
346 | 346 | */ |
347 | -function give_process_paypal_web_accept_and_cart( $data, $payment_id ) { |
|
347 | +function give_process_paypal_web_accept_and_cart($data, $payment_id) { |
|
348 | 348 | |
349 | - if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded' ) { |
|
349 | + if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') { |
|
350 | 350 | return; |
351 | 351 | } |
352 | 352 | |
353 | - if ( empty( $payment_id ) ) { |
|
353 | + if (empty($payment_id)) { |
|
354 | 354 | return; |
355 | 355 | } |
356 | 356 | |
357 | 357 | // Collect payment details |
358 | - $purchase_key = isset( $data['invoice'] ) ? $data['invoice'] : $data['item_number']; |
|
358 | + $purchase_key = isset($data['invoice']) ? $data['invoice'] : $data['item_number']; |
|
359 | 359 | $paypal_amount = $data['mc_gross']; |
360 | - $payment_status = strtolower( $data['payment_status'] ); |
|
361 | - $currency_code = strtolower( $data['mc_currency'] ); |
|
362 | - $business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] ); |
|
363 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
360 | + $payment_status = strtolower($data['payment_status']); |
|
361 | + $currency_code = strtolower($data['mc_currency']); |
|
362 | + $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']); |
|
363 | + $payment_meta = give_get_payment_meta($payment_id); |
|
364 | 364 | |
365 | 365 | |
366 | - if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) { |
|
366 | + if (give_get_payment_gateway($payment_id) != 'paypal') { |
|
367 | 367 | return; // this isn't a PayPal standard IPN |
368 | 368 | } |
369 | 369 | |
370 | 370 | // Verify payment recipient |
371 | - if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) { |
|
371 | + if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) { |
|
372 | 372 | |
373 | 373 | give_record_gateway_error( |
374 | - esc_html__( 'IPN Error', 'give' ), |
|
374 | + esc_html__('IPN Error', 'give'), |
|
375 | 375 | sprintf( |
376 | 376 | /* translators: %s: Paypal IPN response */ |
377 | - esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ), |
|
378 | - json_encode( $data ) |
|
377 | + esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'), |
|
378 | + json_encode($data) |
|
379 | 379 | ), |
380 | 380 | $payment_id |
381 | 381 | ); |
382 | - give_update_payment_status( $payment_id, 'failed' ); |
|
383 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) ); |
|
382 | + give_update_payment_status($payment_id, 'failed'); |
|
383 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give')); |
|
384 | 384 | |
385 | 385 | return; |
386 | 386 | } |
387 | 387 | |
388 | 388 | // Verify payment currency. |
389 | - if ( $currency_code != strtolower( $payment_meta['currency'] ) ) { |
|
389 | + if ($currency_code != strtolower($payment_meta['currency'])) { |
|
390 | 390 | |
391 | 391 | give_record_gateway_error( |
392 | - esc_html__( 'IPN Error', 'give' ), |
|
392 | + esc_html__('IPN Error', 'give'), |
|
393 | 393 | sprintf( |
394 | 394 | /* translators: %s: Paypal IPN response */ |
395 | - esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ), |
|
396 | - json_encode( $data ) |
|
395 | + esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'), |
|
396 | + json_encode($data) |
|
397 | 397 | ), |
398 | 398 | $payment_id |
399 | 399 | ); |
400 | - give_update_payment_status( $payment_id, 'failed' ); |
|
401 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) ); |
|
400 | + give_update_payment_status($payment_id, 'failed'); |
|
401 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give')); |
|
402 | 402 | |
403 | 403 | return; |
404 | 404 | } |
405 | 405 | |
406 | - if ( ! give_get_payment_user_email( $payment_id ) ) { |
|
406 | + if ( ! give_get_payment_user_email($payment_id)) { |
|
407 | 407 | |
408 | 408 | // No email associated with donation, so store email from PayPal. |
409 | - give_update_payment_meta( $payment_id, '_give_payment_user_email', $data['payer_email'] ); |
|
409 | + give_update_payment_meta($payment_id, '_give_payment_user_email', $data['payer_email']); |
|
410 | 410 | |
411 | 411 | // Setup and store the donors's details. |
412 | 412 | $address = array(); |
413 | - $address['line1'] = ! empty( $data['address_street'] ) ? sanitize_text_field( $data['address_street'] ) : false; |
|
414 | - $address['city'] = ! empty( $data['address_city'] ) ? sanitize_text_field( $data['address_city'] ) : false; |
|
415 | - $address['state'] = ! empty( $data['address_state'] ) ? sanitize_text_field( $data['address_state'] ) : false; |
|
416 | - $address['country'] = ! empty( $data['address_country_code'] ) ? sanitize_text_field( $data['address_country_code'] ) : false; |
|
417 | - $address['zip'] = ! empty( $data['address_zip'] ) ? sanitize_text_field( $data['address_zip'] ) : false; |
|
413 | + $address['line1'] = ! empty($data['address_street']) ? sanitize_text_field($data['address_street']) : false; |
|
414 | + $address['city'] = ! empty($data['address_city']) ? sanitize_text_field($data['address_city']) : false; |
|
415 | + $address['state'] = ! empty($data['address_state']) ? sanitize_text_field($data['address_state']) : false; |
|
416 | + $address['country'] = ! empty($data['address_country_code']) ? sanitize_text_field($data['address_country_code']) : false; |
|
417 | + $address['zip'] = ! empty($data['address_zip']) ? sanitize_text_field($data['address_zip']) : false; |
|
418 | 418 | |
419 | 419 | $user_info = array( |
420 | 420 | 'id' => '-1', |
421 | - 'email' => sanitize_text_field( $data['payer_email'] ), |
|
422 | - 'first_name' => sanitize_text_field( $data['first_name'] ), |
|
423 | - 'last_name' => sanitize_text_field( $data['last_name'] ), |
|
421 | + 'email' => sanitize_text_field($data['payer_email']), |
|
422 | + 'first_name' => sanitize_text_field($data['first_name']), |
|
423 | + 'last_name' => sanitize_text_field($data['last_name']), |
|
424 | 424 | 'discount' => '', |
425 | 425 | 'address' => $address |
426 | 426 | ); |
427 | 427 | |
428 | 428 | $payment_meta['user_info'] = $user_info; |
429 | - give_update_payment_meta( $payment_id, '_give_payment_meta', $payment_meta ); |
|
429 | + give_update_payment_meta($payment_id, '_give_payment_meta', $payment_meta); |
|
430 | 430 | } |
431 | 431 | |
432 | - if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) { |
|
432 | + if ($payment_status == 'refunded' || $payment_status == 'reversed') { |
|
433 | 433 | |
434 | 434 | // Process a refund |
435 | - give_process_paypal_refund( $data, $payment_id ); |
|
435 | + give_process_paypal_refund($data, $payment_id); |
|
436 | 436 | |
437 | 437 | } else { |
438 | 438 | |
439 | - if ( get_post_status( $payment_id ) == 'publish' ) { |
|
439 | + if (get_post_status($payment_id) == 'publish') { |
|
440 | 440 | return; // Only complete payments once |
441 | 441 | } |
442 | 442 | |
443 | 443 | // Retrieve the total purchase amount (before PayPal) |
444 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
444 | + $payment_amount = give_get_payment_amount($payment_id); |
|
445 | 445 | |
446 | - if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
446 | + if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
447 | 447 | // The prices don't match |
448 | 448 | give_record_gateway_error( |
449 | - esc_html__( 'IPN Error', 'give' ), |
|
449 | + esc_html__('IPN Error', 'give'), |
|
450 | 450 | sprintf( |
451 | 451 | /* translators: %s: Paypal IPN response */ |
452 | - esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), |
|
453 | - json_encode( $data ) |
|
452 | + esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'), |
|
453 | + json_encode($data) |
|
454 | 454 | ), |
455 | 455 | $payment_id |
456 | 456 | ); |
457 | - give_update_payment_status( $payment_id, 'failed' ); |
|
458 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) ); |
|
457 | + give_update_payment_status($payment_id, 'failed'); |
|
458 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give')); |
|
459 | 459 | |
460 | 460 | return; |
461 | 461 | } |
462 | - if ( $purchase_key != give_get_payment_key( $payment_id ) ) { |
|
462 | + if ($purchase_key != give_get_payment_key($payment_id)) { |
|
463 | 463 | // Purchase keys don't match |
464 | 464 | give_record_gateway_error( |
465 | - esc_html__( 'IPN Error', 'give' ), |
|
465 | + esc_html__('IPN Error', 'give'), |
|
466 | 466 | sprintf( |
467 | 467 | /* translators: %s: Paypal IPN response */ |
468 | - esc_html__( 'Invalid purchase key in IPN response. IPN data: %s', 'give' ), |
|
469 | - json_encode( $data ) |
|
468 | + esc_html__('Invalid purchase key in IPN response. IPN data: %s', 'give'), |
|
469 | + json_encode($data) |
|
470 | 470 | ), |
471 | 471 | $payment_id |
472 | 472 | ); |
473 | - give_update_payment_status( $payment_id, 'failed' ); |
|
474 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid purchase key in PayPal IPN.', 'give' ) ); |
|
473 | + give_update_payment_status($payment_id, 'failed'); |
|
474 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid purchase key in PayPal IPN.', 'give')); |
|
475 | 475 | |
476 | 476 | return; |
477 | 477 | } |
478 | 478 | |
479 | - if ( $payment_status == 'completed' || give_is_test_mode() ) { |
|
479 | + if ($payment_status == 'completed' || give_is_test_mode()) { |
|
480 | 480 | give_insert_payment_note( |
481 | 481 | $payment_id, |
482 | 482 | sprintf( |
483 | 483 | /* translators: %s: Paypal transaction ID */ |
484 | - esc_html__( 'PayPal Transaction ID: %s', 'give' ), |
|
484 | + esc_html__('PayPal Transaction ID: %s', 'give'), |
|
485 | 485 | $data['txn_id'] |
486 | 486 | ) |
487 | 487 | ); |
488 | - give_set_payment_transaction_id( $payment_id, $data['txn_id'] ); |
|
489 | - give_update_payment_status( $payment_id, 'publish' ); |
|
490 | - } else if ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) { |
|
488 | + give_set_payment_transaction_id($payment_id, $data['txn_id']); |
|
489 | + give_update_payment_status($payment_id, 'publish'); |
|
490 | + } else if ('pending' == $payment_status && isset($data['pending_reason'])) { |
|
491 | 491 | |
492 | 492 | // Look for possible pending reasons, such as an echeck |
493 | 493 | |
494 | 494 | $note = ''; |
495 | 495 | |
496 | - switch ( strtolower( $data['pending_reason'] ) ) { |
|
496 | + switch (strtolower($data['pending_reason'])) { |
|
497 | 497 | |
498 | 498 | case 'echeck' : |
499 | 499 | |
500 | - $note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' ); |
|
500 | + $note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give'); |
|
501 | 501 | |
502 | 502 | break; |
503 | 503 | |
504 | 504 | case 'address' : |
505 | 505 | |
506 | - $note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' ); |
|
506 | + $note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give'); |
|
507 | 507 | |
508 | 508 | break; |
509 | 509 | |
510 | 510 | case 'intl' : |
511 | 511 | |
512 | - $note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' ); |
|
512 | + $note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give'); |
|
513 | 513 | |
514 | 514 | break; |
515 | 515 | |
516 | 516 | case 'multi-currency' : |
517 | 517 | |
518 | - $note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' ); |
|
518 | + $note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give'); |
|
519 | 519 | |
520 | 520 | break; |
521 | 521 | |
522 | 522 | case 'paymentreview' : |
523 | 523 | case 'regulatory_review' : |
524 | 524 | |
525 | - $note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' ); |
|
525 | + $note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give'); |
|
526 | 526 | |
527 | 527 | break; |
528 | 528 | |
529 | 529 | case 'unilateral' : |
530 | 530 | |
531 | - $note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' ); |
|
531 | + $note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give'); |
|
532 | 532 | |
533 | 533 | break; |
534 | 534 | |
535 | 535 | case 'upgrade' : |
536 | 536 | |
537 | - $note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' ); |
|
537 | + $note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give'); |
|
538 | 538 | |
539 | 539 | break; |
540 | 540 | |
541 | 541 | case 'verify' : |
542 | 542 | |
543 | - $note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this payment.', 'give' ); |
|
543 | + $note = esc_html__('PayPal account is not verified. Verify account in order to accept this payment.', 'give'); |
|
544 | 544 | |
545 | 545 | break; |
546 | 546 | |
547 | 547 | case 'other' : |
548 | 548 | |
549 | - $note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' ); |
|
549 | + $note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give'); |
|
550 | 550 | |
551 | 551 | break; |
552 | 552 | |
553 | 553 | } |
554 | 554 | |
555 | - if ( ! empty( $note ) ) { |
|
555 | + if ( ! empty($note)) { |
|
556 | 556 | |
557 | - give_insert_payment_note( $payment_id, $note ); |
|
557 | + give_insert_payment_note($payment_id, $note); |
|
558 | 558 | |
559 | 559 | } |
560 | 560 | } |
561 | 561 | } |
562 | 562 | } |
563 | 563 | |
564 | -add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 ); |
|
564 | +add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2); |
|
565 | 565 | |
566 | 566 | /** |
567 | 567 | * Process PayPal IPN Refunds |
@@ -572,28 +572,28 @@ discard block |
||
572 | 572 | * |
573 | 573 | * @return void |
574 | 574 | */ |
575 | -function give_process_paypal_refund( $data, $payment_id = 0 ) { |
|
575 | +function give_process_paypal_refund($data, $payment_id = 0) { |
|
576 | 576 | |
577 | 577 | // Collect payment details |
578 | 578 | |
579 | - if ( empty( $payment_id ) ) { |
|
579 | + if (empty($payment_id)) { |
|
580 | 580 | return; |
581 | 581 | } |
582 | 582 | |
583 | - if ( get_post_status( $payment_id ) == 'refunded' ) { |
|
583 | + if (get_post_status($payment_id) == 'refunded') { |
|
584 | 584 | return; // Only refund payments once |
585 | 585 | } |
586 | 586 | |
587 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
587 | + $payment_amount = give_get_payment_amount($payment_id); |
|
588 | 588 | $refund_amount = $data['payment_gross'] * - 1; |
589 | 589 | |
590 | - if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
590 | + if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
591 | 591 | |
592 | 592 | give_insert_payment_note( |
593 | 593 | $payment_id, |
594 | 594 | sprintf( |
595 | 595 | /* translators: %s: Paypal parent transaction ID */ |
596 | - esc_html__( 'Partial PayPal refund processed: %s', 'give' ), |
|
596 | + esc_html__('Partial PayPal refund processed: %s', 'give'), |
|
597 | 597 | $data['parent_txn_id'] |
598 | 598 | ) |
599 | 599 | ); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | $payment_id, |
607 | 607 | sprintf( |
608 | 608 | /* translators: %s: Paypal parent transaction ID */ |
609 | - esc_html__( 'PayPal Payment #%s Refunded for reason: %s', 'give' ), |
|
609 | + esc_html__('PayPal Payment #%s Refunded for reason: %s', 'give'), |
|
610 | 610 | $data['parent_txn_id'], $data['reason_code'] |
611 | 611 | ) |
612 | 612 | ); |
@@ -614,11 +614,11 @@ discard block |
||
614 | 614 | $payment_id, |
615 | 615 | sprintf( |
616 | 616 | /* translators: %s: Paypal transaction ID */ |
617 | - esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ), |
|
617 | + esc_html__('PayPal Refund Transaction ID: %s', 'give'), |
|
618 | 618 | $data['txn_id'] |
619 | 619 | ) |
620 | 620 | ); |
621 | - give_update_payment_status( $payment_id, 'refunded' ); |
|
621 | + give_update_payment_status($payment_id, 'refunded'); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | /** |
@@ -630,24 +630,24 @@ discard block |
||
630 | 630 | * |
631 | 631 | * @return string |
632 | 632 | */ |
633 | -function give_get_paypal_redirect( $ssl_check = false ) { |
|
633 | +function give_get_paypal_redirect($ssl_check = false) { |
|
634 | 634 | |
635 | - if ( is_ssl() || ! $ssl_check ) { |
|
635 | + if (is_ssl() || ! $ssl_check) { |
|
636 | 636 | $protocal = 'https://'; |
637 | 637 | } else { |
638 | 638 | $protocal = 'http://'; |
639 | 639 | } |
640 | 640 | |
641 | 641 | // Check the current payment mode |
642 | - if ( give_is_test_mode() ) { |
|
642 | + if (give_is_test_mode()) { |
|
643 | 643 | // Test mode |
644 | - $paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
644 | + $paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
645 | 645 | } else { |
646 | 646 | // Live mode |
647 | - $paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr'; |
|
647 | + $paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr'; |
|
648 | 648 | } |
649 | 649 | |
650 | - return apply_filters( 'give_paypal_uri', $paypal_uri ); |
|
650 | + return apply_filters('give_paypal_uri', $paypal_uri); |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | /** |
@@ -657,9 +657,9 @@ discard block |
||
657 | 657 | * @return string |
658 | 658 | */ |
659 | 659 | function give_get_paypal_page_style() { |
660 | - $page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) ); |
|
660 | + $page_style = trim(give_get_option('paypal_page_style', 'PayPal')); |
|
661 | 661 | |
662 | - return apply_filters( 'give_paypal_page_style', $page_style ); |
|
662 | + return apply_filters('give_paypal_page_style', $page_style); |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | /** |
@@ -674,27 +674,27 @@ discard block |
||
674 | 674 | * @return string |
675 | 675 | * |
676 | 676 | */ |
677 | -function give_paypal_success_page_content( $content ) { |
|
677 | +function give_paypal_success_page_content($content) { |
|
678 | 678 | |
679 | - if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) { |
|
679 | + if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) { |
|
680 | 680 | return $content; |
681 | 681 | } |
682 | 682 | |
683 | - $payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false; |
|
683 | + $payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false; |
|
684 | 684 | |
685 | - if ( ! $payment_id ) { |
|
685 | + if ( ! $payment_id) { |
|
686 | 686 | $session = give_get_purchase_session(); |
687 | - $payment_id = give_get_purchase_id_by_key( $session['purchase_key'] ); |
|
687 | + $payment_id = give_get_purchase_id_by_key($session['purchase_key']); |
|
688 | 688 | } |
689 | 689 | |
690 | - $payment = get_post( $payment_id ); |
|
690 | + $payment = get_post($payment_id); |
|
691 | 691 | |
692 | - if ( $payment && 'pending' == $payment->post_status ) { |
|
692 | + if ($payment && 'pending' == $payment->post_status) { |
|
693 | 693 | |
694 | 694 | // Payment is still pending so show processing indicator to fix the Race Condition |
695 | 695 | ob_start(); |
696 | 696 | |
697 | - give_get_template_part( 'payment', 'processing' ); |
|
697 | + give_get_template_part('payment', 'processing'); |
|
698 | 698 | |
699 | 699 | $content = ob_get_clean(); |
700 | 700 | |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | |
705 | 705 | } |
706 | 706 | |
707 | -add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' ); |
|
707 | +add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content'); |
|
708 | 708 | |
709 | 709 | /** |
710 | 710 | * Given a Payment ID, extract the transaction ID |
@@ -715,22 +715,22 @@ discard block |
||
715 | 715 | * |
716 | 716 | * @return string Transaction ID |
717 | 717 | */ |
718 | -function give_paypal_get_payment_transaction_id( $payment_id ) { |
|
718 | +function give_paypal_get_payment_transaction_id($payment_id) { |
|
719 | 719 | |
720 | 720 | $transaction_id = ''; |
721 | - $notes = give_get_payment_notes( $payment_id ); |
|
721 | + $notes = give_get_payment_notes($payment_id); |
|
722 | 722 | |
723 | - foreach ( $notes as $note ) { |
|
724 | - if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) { |
|
723 | + foreach ($notes as $note) { |
|
724 | + if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) { |
|
725 | 725 | $transaction_id = $match[1]; |
726 | 726 | continue; |
727 | 727 | } |
728 | 728 | } |
729 | 729 | |
730 | - return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id ); |
|
730 | + return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id); |
|
731 | 731 | } |
732 | 732 | |
733 | -add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 ); |
|
733 | +add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1); |
|
734 | 734 | |
735 | 735 | /** |
736 | 736 | * Given a transaction ID, generate a link to the PayPal transaction ID details |
@@ -742,13 +742,13 @@ discard block |
||
742 | 742 | * |
743 | 743 | * @return string A link to the PayPal transaction details |
744 | 744 | */ |
745 | -function give_paypal_link_transaction_id( $transaction_id, $payment_id ) { |
|
745 | +function give_paypal_link_transaction_id($transaction_id, $payment_id) { |
|
746 | 746 | |
747 | 747 | $paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='; |
748 | - $transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>'; |
|
748 | + $transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>'; |
|
749 | 749 | |
750 | - return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url ); |
|
750 | + return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url); |
|
751 | 751 | |
752 | 752 | } |
753 | 753 | |
754 | -add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 ); |
|
754 | +add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2); |