@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * Used to redirect a user back to the donation form if there are errors present. |
157 | 157 | * |
158 | - * @param array $args |
|
158 | + * @param string $args |
|
159 | 159 | * |
160 | 160 | * @access public |
161 | 161 | * @since 1.0 |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @param int $form_id Give Form ID |
439 | 439 | * |
440 | - * @return int $earnings Earnings for a certain form |
|
440 | + * @return double $earnings Earnings for a certain form |
|
441 | 441 | */ |
442 | 442 | function give_get_form_earnings_stats( $form_id = 0 ) { |
443 | 443 | $give_form = new Give_Donate_Form( $form_id ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | |
24 | 24 | global $typenow; |
25 | 25 | |
26 | - if ( $typenow != 'give_forms' ) { |
|
26 | + if ($typenow != 'give_forms') { |
|
27 | 27 | return true; |
28 | 28 | } |
29 | 29 | |
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | |
33 | -add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' ); |
|
33 | +add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition'); |
|
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return int|false |
42 | 42 | */ |
43 | -function get_form_id_from_args( $args ) { |
|
43 | +function get_form_id_from_args($args) { |
|
44 | 44 | |
45 | - if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) { |
|
45 | + if (isset($args['form_id']) && $args['form_id'] != 0) { |
|
46 | 46 | |
47 | - return intval( $args['form_id'] ); |
|
47 | + return intval($args['form_id']); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return false; |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool |
61 | 61 | */ |
62 | -function give_is_float_labels_enabled( $args ) { |
|
62 | +function give_is_float_labels_enabled($args) { |
|
63 | 63 | |
64 | 64 | $float_labels = ''; |
65 | 65 | |
66 | - if ( ! empty( $args['float_labels'] ) ) { |
|
66 | + if ( ! empty($args['float_labels'])) { |
|
67 | 67 | $float_labels = $args['float_labels']; |
68 | 68 | } |
69 | 69 | |
70 | - if ( empty( $float_labels ) ) { |
|
71 | - $float_labels = give_get_meta( $args['form_id'], '_give_form_floating_labels', true ); |
|
70 | + if (empty($float_labels)) { |
|
71 | + $float_labels = give_get_meta($args['form_id'], '_give_form_floating_labels', true); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) { |
|
75 | - $float_labels = give_get_option( 'floatlabels', 'disabled' ); |
|
74 | + if (empty($float_labels) || ('global' === $float_labels)) { |
|
75 | + $float_labels = give_get_option('floatlabels', 'disabled'); |
|
76 | 76 | } |
77 | 77 | |
78 | - return give_is_setting_enabled( $float_labels ); |
|
78 | + return give_is_setting_enabled($float_labels); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $can_checkout = true; |
93 | 93 | |
94 | - return (bool) apply_filters( 'give_can_checkout', $can_checkout ); |
|
94 | + return (bool) apply_filters('give_can_checkout', $can_checkout); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | function give_get_success_page_uri() { |
106 | 106 | $give_options = give_get_settings(); |
107 | 107 | |
108 | - $success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' ); |
|
108 | + $success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url'); |
|
109 | 109 | |
110 | - return apply_filters( 'give_get_success_page_uri', $success_page ); |
|
110 | + return apply_filters('give_get_success_page_uri', $success_page); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function give_is_success_page() { |
121 | 121 | $give_options = give_get_settings(); |
122 | - $is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false; |
|
122 | + $is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false; |
|
123 | 123 | |
124 | - return apply_filters( 'give_is_success_page', $is_success_page ); |
|
124 | + return apply_filters('give_is_success_page', $is_success_page); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | * @since 1.0 |
136 | 136 | * @return void |
137 | 137 | */ |
138 | -function give_send_to_success_page( $query_string = null ) { |
|
138 | +function give_send_to_success_page($query_string = null) { |
|
139 | 139 | |
140 | 140 | $redirect = give_get_success_page_uri(); |
141 | 141 | |
142 | - if ( $query_string ) { |
|
142 | + if ($query_string) { |
|
143 | 143 | $redirect .= $query_string; |
144 | 144 | } |
145 | 145 | |
146 | - $gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : ''; |
|
146 | + $gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : ''; |
|
147 | 147 | |
148 | - wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) ); |
|
148 | + wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string)); |
|
149 | 149 | give_die(); |
150 | 150 | } |
151 | 151 | |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | * @since 1.0 |
162 | 162 | * @return Void |
163 | 163 | */ |
164 | -function give_send_back_to_checkout( $args = array() ) { |
|
164 | +function give_send_back_to_checkout($args = array()) { |
|
165 | 165 | |
166 | - $url = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : ''; |
|
166 | + $url = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : ''; |
|
167 | 167 | $form_id = 0; |
168 | 168 | |
169 | 169 | // Set the form_id. |
170 | - if ( isset( $_POST['give-form-id'] ) ) { |
|
171 | - $form_id = sanitize_text_field( $_POST['give-form-id'] ); |
|
170 | + if (isset($_POST['give-form-id'])) { |
|
171 | + $form_id = sanitize_text_field($_POST['give-form-id']); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // Need a URL to continue. If none, redirect back to single form. |
175 | - if ( empty( $url ) ) { |
|
176 | - wp_safe_redirect( get_permalink( $form_id ) ); |
|
175 | + if (empty($url)) { |
|
176 | + wp_safe_redirect(get_permalink($form_id)); |
|
177 | 177 | give_die(); |
178 | 178 | } |
179 | 179 | |
@@ -182,41 +182,41 @@ discard block |
||
182 | 182 | ); |
183 | 183 | |
184 | 184 | // Set the $level_id. |
185 | - if ( isset( $_POST['give-price-id'] ) ) { |
|
186 | - $defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] ); |
|
185 | + if (isset($_POST['give-price-id'])) { |
|
186 | + $defaults['level-id'] = sanitize_text_field($_POST['give-price-id']); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | // Check for backward compatibility. |
190 | - if ( is_string( $args ) ) { |
|
191 | - $args = str_replace( '?', '', $args ); |
|
190 | + if (is_string($args)) { |
|
191 | + $args = str_replace('?', '', $args); |
|
192 | 192 | } |
193 | 193 | |
194 | - $args = wp_parse_args( $args, $defaults ); |
|
194 | + $args = wp_parse_args($args, $defaults); |
|
195 | 195 | |
196 | 196 | // Merge URL query with $args to maintain third-party URL parameters after redirect. |
197 | - $url_data = wp_parse_url( $url ); |
|
197 | + $url_data = wp_parse_url($url); |
|
198 | 198 | |
199 | 199 | // Check if an array to prevent notices before parsing. |
200 | - if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) { |
|
201 | - parse_str( $url_data['query'], $query ); |
|
200 | + if (isset($url_data['query']) && ! empty($url_data['query'])) { |
|
201 | + parse_str($url_data['query'], $query); |
|
202 | 202 | |
203 | 203 | // Precaution: don't allow any CC info. |
204 | - unset( $query['card_number'] ); |
|
205 | - unset( $query['card_cvc'] ); |
|
204 | + unset($query['card_number']); |
|
205 | + unset($query['card_cvc']); |
|
206 | 206 | |
207 | 207 | } else { |
208 | 208 | // No $url_data so pass empty array. |
209 | 209 | $query = array(); |
210 | 210 | } |
211 | 211 | |
212 | - $new_query = array_merge( $args, $query ); |
|
213 | - $new_query_string = http_build_query( $new_query ); |
|
212 | + $new_query = array_merge($args, $query); |
|
213 | + $new_query_string = http_build_query($new_query); |
|
214 | 214 | |
215 | 215 | // Assemble URL parts. |
216 | - $redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' ); |
|
216 | + $redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap'); |
|
217 | 217 | |
218 | 218 | // Redirect them. |
219 | - wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) ); |
|
219 | + wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args)); |
|
220 | 220 | give_die(); |
221 | 221 | |
222 | 222 | } |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | * @since 1.0 |
233 | 233 | * @return string |
234 | 234 | */ |
235 | -function give_get_success_page_url( $query_string = null ) { |
|
235 | +function give_get_success_page_url($query_string = null) { |
|
236 | 236 | |
237 | - $success_page = give_get_option( 'success_page', 0 ); |
|
238 | - $success_page = get_permalink( $success_page ); |
|
237 | + $success_page = give_get_option('success_page', 0); |
|
238 | + $success_page = get_permalink($success_page); |
|
239 | 239 | |
240 | - if ( $query_string ) { |
|
240 | + if ($query_string) { |
|
241 | 241 | $success_page .= $query_string; |
242 | 242 | } |
243 | 243 | |
244 | - return apply_filters( 'give_success_page_url', $success_page ); |
|
244 | + return apply_filters('give_success_page_url', $success_page); |
|
245 | 245 | |
246 | 246 | } |
247 | 247 | |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @return mixed|void Full URL to the Failed Donation Page, if present, home page if it doesn't exist |
256 | 256 | */ |
257 | -function give_get_failed_transaction_uri( $extras = false ) { |
|
257 | +function give_get_failed_transaction_uri($extras = false) { |
|
258 | 258 | $give_options = give_get_settings(); |
259 | 259 | |
260 | - $uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url(); |
|
261 | - if ( $extras ) { |
|
260 | + $uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url(); |
|
261 | + if ($extras) { |
|
262 | 262 | $uri .= $extras; |
263 | 263 | } |
264 | 264 | |
265 | - return apply_filters( 'give_get_failed_transaction_uri', $uri ); |
|
265 | + return apply_filters('give_get_failed_transaction_uri', $uri); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | */ |
274 | 274 | function give_is_failed_transaction_page() { |
275 | 275 | $give_options = give_get_settings(); |
276 | - $ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false; |
|
276 | + $ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false; |
|
277 | 277 | |
278 | - return apply_filters( 'give_is_failure_page', $ret ); |
|
278 | + return apply_filters('give_is_failure_page', $ret); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -287,18 +287,18 @@ discard block |
||
287 | 287 | */ |
288 | 288 | function give_listen_for_failed_payments() { |
289 | 289 | |
290 | - $failed_page = give_get_option( 'failure_page', 0 ); |
|
290 | + $failed_page = give_get_option('failure_page', 0); |
|
291 | 291 | |
292 | - if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) { |
|
292 | + if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) { |
|
293 | 293 | |
294 | - $payment_id = absint( $_GET['payment-id'] ); |
|
295 | - give_update_payment_status( $payment_id, 'failed' ); |
|
294 | + $payment_id = absint($_GET['payment-id']); |
|
295 | + give_update_payment_status($payment_id, 'failed'); |
|
296 | 296 | |
297 | 297 | } |
298 | 298 | |
299 | 299 | } |
300 | 300 | |
301 | -add_action( 'template_redirect', 'give_listen_for_failed_payments' ); |
|
301 | +add_action('template_redirect', 'give_listen_for_failed_payments'); |
|
302 | 302 | |
303 | 303 | /** |
304 | 304 | * Retrieve the Donation History page URI |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | function give_get_history_page_uri() { |
312 | 312 | $give_options = give_get_settings(); |
313 | 313 | |
314 | - $history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' ); |
|
314 | + $history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url'); |
|
315 | 315 | |
316 | - return apply_filters( 'give_get_history_page_uri', $history_page ); |
|
316 | + return apply_filters('give_get_history_page_uri', $history_page); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * @since 1.0 |
327 | 327 | * @return bool |
328 | 328 | */ |
329 | -function give_field_is_required( $field = '', $form_id ) { |
|
329 | +function give_field_is_required($field = '', $form_id) { |
|
330 | 330 | |
331 | - $required_fields = give_get_required_fields( $form_id ); |
|
331 | + $required_fields = give_get_required_fields($form_id); |
|
332 | 332 | |
333 | - return array_key_exists( $field, $required_fields ); |
|
333 | + return array_key_exists($field, $required_fields); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @return void |
350 | 350 | */ |
351 | -function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) { |
|
351 | +function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) { |
|
352 | 352 | global $give_logs; |
353 | 353 | |
354 | 354 | $log_data = array( |
355 | 355 | 'post_parent' => $give_form_id, |
356 | 356 | 'log_type' => 'sale', |
357 | - 'post_date' => isset( $sale_date ) ? $sale_date : null, |
|
358 | - 'post_date_gmt' => isset( $sale_date ) ? $sale_date : null, |
|
357 | + 'post_date' => isset($sale_date) ? $sale_date : null, |
|
358 | + 'post_date_gmt' => isset($sale_date) ? $sale_date : null, |
|
359 | 359 | ); |
360 | 360 | |
361 | 361 | $log_meta = array( |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | 'price_id' => (int) $price_id, |
364 | 364 | ); |
365 | 365 | |
366 | - $give_logs->insert_log( $log_data, $log_meta ); |
|
366 | + $give_logs->insert_log($log_data, $log_meta); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | * |
378 | 378 | * @return bool|int |
379 | 379 | */ |
380 | -function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) { |
|
380 | +function give_increase_purchase_count($form_id = 0, $quantity = 1) { |
|
381 | 381 | $quantity = (int) $quantity; |
382 | - $form = new Give_Donate_Form( $form_id ); |
|
382 | + $form = new Give_Donate_Form($form_id); |
|
383 | 383 | |
384 | - return $form->increase_sales( $quantity ); |
|
384 | + return $form->increase_sales($quantity); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | /** |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | * |
395 | 395 | * @return bool|int |
396 | 396 | */ |
397 | -function give_decrease_purchase_count( $form_id = 0, $quantity = 1 ) { |
|
397 | +function give_decrease_purchase_count($form_id = 0, $quantity = 1) { |
|
398 | 398 | $quantity = (int) $quantity; |
399 | - $form = new Give_Donate_Form( $form_id ); |
|
399 | + $form = new Give_Donate_Form($form_id); |
|
400 | 400 | |
401 | - return $form->decrease_sales( $quantity ); |
|
401 | + return $form->decrease_sales($quantity); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | /** |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | * |
412 | 412 | * @return bool|int |
413 | 413 | */ |
414 | -function give_increase_earnings( $give_form_id = 0, $amount ) { |
|
415 | - $form = new Give_Donate_Form( $give_form_id ); |
|
414 | +function give_increase_earnings($give_form_id = 0, $amount) { |
|
415 | + $form = new Give_Donate_Form($give_form_id); |
|
416 | 416 | |
417 | - return $form->increase_earnings( $amount ); |
|
417 | + return $form->increase_earnings($amount); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
@@ -427,10 +427,10 @@ discard block |
||
427 | 427 | * |
428 | 428 | * @return bool|int |
429 | 429 | */ |
430 | -function give_decrease_earnings( $form_id = 0, $amount ) { |
|
431 | - $form = new Give_Donate_Form( $form_id ); |
|
430 | +function give_decrease_earnings($form_id = 0, $amount) { |
|
431 | + $form = new Give_Donate_Form($form_id); |
|
432 | 432 | |
433 | - return $form->decrease_earnings( $amount ); |
|
433 | + return $form->decrease_earnings($amount); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | * |
444 | 444 | * @return int $earnings Earnings for a certain form |
445 | 445 | */ |
446 | -function give_get_form_earnings_stats( $form_id = 0 ) { |
|
447 | - $give_form = new Give_Donate_Form( $form_id ); |
|
446 | +function give_get_form_earnings_stats($form_id = 0) { |
|
447 | + $give_form = new Give_Donate_Form($form_id); |
|
448 | 448 | |
449 | 449 | return $give_form->earnings; |
450 | 450 | } |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | * |
460 | 460 | * @return int $sales Amount of sales for a certain form |
461 | 461 | */ |
462 | -function give_get_form_sales_stats( $give_form_id = 0 ) { |
|
463 | - $give_form = new Give_Donate_Form( $give_form_id ); |
|
462 | +function give_get_form_sales_stats($give_form_id = 0) { |
|
463 | + $give_form = new Give_Donate_Form($give_form_id); |
|
464 | 464 | |
465 | 465 | return $give_form->sales; |
466 | 466 | } |
@@ -475,16 +475,16 @@ discard block |
||
475 | 475 | * |
476 | 476 | * @return float $sales Average monthly sales |
477 | 477 | */ |
478 | -function give_get_average_monthly_form_sales( $form_id = 0 ) { |
|
479 | - $sales = give_get_form_sales_stats( $form_id ); |
|
480 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
478 | +function give_get_average_monthly_form_sales($form_id = 0) { |
|
479 | + $sales = give_get_form_sales_stats($form_id); |
|
480 | + $release_date = get_post_field('post_date', $form_id); |
|
481 | 481 | |
482 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
482 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
483 | 483 | |
484 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
484 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
485 | 485 | |
486 | - if ( $months > 0 ) { |
|
487 | - $sales = ( $sales / $months ); |
|
486 | + if ($months > 0) { |
|
487 | + $sales = ($sales / $months); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | return $sales; |
@@ -500,16 +500,16 @@ discard block |
||
500 | 500 | * |
501 | 501 | * @return float $earnings Average monthly earnings |
502 | 502 | */ |
503 | -function give_get_average_monthly_form_earnings( $form_id = 0 ) { |
|
504 | - $earnings = give_get_form_earnings_stats( $form_id ); |
|
505 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
503 | +function give_get_average_monthly_form_earnings($form_id = 0) { |
|
504 | + $earnings = give_get_form_earnings_stats($form_id); |
|
505 | + $release_date = get_post_field('post_date', $form_id); |
|
506 | 506 | |
507 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
507 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
508 | 508 | |
509 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
509 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
510 | 510 | |
511 | - if ( $months > 0 ) { |
|
512 | - $earnings = ( $earnings / $months ); |
|
511 | + if ($months > 0) { |
|
512 | + $earnings = ($earnings / $months); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | return $earnings < 0 ? 0 : $earnings; |
@@ -529,23 +529,23 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @return string $price_name Name of the price option |
531 | 531 | */ |
532 | -function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) { |
|
532 | +function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) { |
|
533 | 533 | |
534 | - $prices = give_get_variable_prices( $form_id ); |
|
534 | + $prices = give_get_variable_prices($form_id); |
|
535 | 535 | $price_name = ''; |
536 | 536 | |
537 | - foreach ( $prices as $price ) { |
|
537 | + foreach ($prices as $price) { |
|
538 | 538 | |
539 | - if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) { |
|
539 | + if (intval($price['_give_id']['level_id']) == intval($price_id)) { |
|
540 | 540 | |
541 | - $price_text = isset( $price['_give_text'] ) ? $price['_give_text'] : ''; |
|
542 | - $price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ) ); |
|
543 | - $price_name = ! empty( $price_text ) ? $price_text : $price_fallback; |
|
541 | + $price_text = isset($price['_give_text']) ? $price['_give_text'] : ''; |
|
542 | + $price_fallback = give_currency_filter(give_format_amount($price['_give_amount'])); |
|
543 | + $price_name = ! empty($price_text) ? $price_text : $price_fallback; |
|
544 | 544 | |
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
548 | - return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id ); |
|
548 | + return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -558,14 +558,14 @@ discard block |
||
558 | 558 | * |
559 | 559 | * @return string $range A fully formatted price range |
560 | 560 | */ |
561 | -function give_price_range( $form_id = 0 ) { |
|
562 | - $low = give_get_lowest_price_option( $form_id ); |
|
563 | - $high = give_get_highest_price_option( $form_id ); |
|
564 | - $range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>'; |
|
561 | +function give_price_range($form_id = 0) { |
|
562 | + $low = give_get_lowest_price_option($form_id); |
|
563 | + $high = give_get_highest_price_option($form_id); |
|
564 | + $range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>'; |
|
565 | 565 | $range .= '<span class="give_price_range_sep"> – </span>'; |
566 | - $range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>'; |
|
566 | + $range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>'; |
|
567 | 567 | |
568 | - return apply_filters( 'give_price_range', $range, $form_id, $low, $high ); |
|
568 | + return apply_filters('give_price_range', $range, $form_id, $low, $high); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | |
@@ -580,35 +580,35 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @return int ID of the lowest price |
582 | 582 | */ |
583 | -function give_get_lowest_price_id( $form_id = 0 ) { |
|
583 | +function give_get_lowest_price_id($form_id = 0) { |
|
584 | 584 | |
585 | - if ( empty( $form_id ) ) { |
|
585 | + if (empty($form_id)) { |
|
586 | 586 | $form_id = get_the_ID(); |
587 | 587 | } |
588 | 588 | |
589 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
590 | - return give_get_form_price( $form_id ); |
|
589 | + if ( ! give_has_variable_prices($form_id)) { |
|
590 | + return give_get_form_price($form_id); |
|
591 | 591 | } |
592 | 592 | |
593 | - $prices = give_get_variable_prices( $form_id ); |
|
593 | + $prices = give_get_variable_prices($form_id); |
|
594 | 594 | |
595 | 595 | $min = $min_id = 0; |
596 | 596 | |
597 | - if ( ! empty( $prices ) ) { |
|
597 | + if ( ! empty($prices)) { |
|
598 | 598 | |
599 | - foreach ( $prices as $key => $price ) { |
|
599 | + foreach ($prices as $key => $price) { |
|
600 | 600 | |
601 | - if ( empty( $price['_give_amount'] ) ) { |
|
601 | + if (empty($price['_give_amount'])) { |
|
602 | 602 | continue; |
603 | 603 | } |
604 | 604 | |
605 | - if ( ! isset( $min ) ) { |
|
605 | + if ( ! isset($min)) { |
|
606 | 606 | $min = $price['_give_amount']; |
607 | 607 | } else { |
608 | - $min = min( $min, $price['_give_amount'] ); |
|
608 | + $min = min($min, $price['_give_amount']); |
|
609 | 609 | } |
610 | 610 | |
611 | - if ( $price['_give_amount'] == $min ) { |
|
611 | + if ($price['_give_amount'] == $min) { |
|
612 | 612 | $min_id = $price['_give_id']['level_id']; |
613 | 613 | } |
614 | 614 | } |
@@ -626,45 +626,45 @@ discard block |
||
626 | 626 | * |
627 | 627 | * @return float Amount of the lowest price |
628 | 628 | */ |
629 | -function give_get_lowest_price_option( $form_id = 0 ) { |
|
630 | - if ( empty( $form_id ) ) { |
|
629 | +function give_get_lowest_price_option($form_id = 0) { |
|
630 | + if (empty($form_id)) { |
|
631 | 631 | $form_id = get_the_ID(); |
632 | 632 | } |
633 | 633 | |
634 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
635 | - return give_get_form_price( $form_id ); |
|
634 | + if ( ! give_has_variable_prices($form_id)) { |
|
635 | + return give_get_form_price($form_id); |
|
636 | 636 | } |
637 | 637 | |
638 | - $prices = give_get_variable_prices( $form_id ); |
|
638 | + $prices = give_get_variable_prices($form_id); |
|
639 | 639 | |
640 | 640 | $low = 0; |
641 | 641 | |
642 | - if ( ! empty( $prices ) ) { |
|
642 | + if ( ! empty($prices)) { |
|
643 | 643 | |
644 | 644 | $min = $min_id = 0; |
645 | 645 | |
646 | - foreach ( $prices as $key => $price ) { |
|
646 | + foreach ($prices as $key => $price) { |
|
647 | 647 | |
648 | - if ( empty( $price['_give_amount'] ) ) { |
|
648 | + if (empty($price['_give_amount'])) { |
|
649 | 649 | continue; |
650 | 650 | } |
651 | 651 | |
652 | - if ( ! isset( $min ) ) { |
|
652 | + if ( ! isset($min)) { |
|
653 | 653 | $min = $price['_give_amount']; |
654 | 654 | } else { |
655 | - $min = min( $min, give_sanitize_amount( $price['_give_amount'] ) ); |
|
655 | + $min = min($min, give_sanitize_amount($price['_give_amount'])); |
|
656 | 656 | } |
657 | 657 | |
658 | - if ( $price['_give_amount'] == $min ) { |
|
658 | + if ($price['_give_amount'] == $min) { |
|
659 | 659 | $min_id = $key; |
660 | 660 | } |
661 | 661 | } |
662 | 662 | |
663 | - $low = $prices[ $min_id ]['_give_amount']; |
|
663 | + $low = $prices[$min_id]['_give_amount']; |
|
664 | 664 | |
665 | 665 | } |
666 | 666 | |
667 | - return give_sanitize_amount( $low ); |
|
667 | + return give_sanitize_amount($low); |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | /** |
@@ -676,41 +676,41 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @return float Amount of the highest price |
678 | 678 | */ |
679 | -function give_get_highest_price_option( $form_id = 0 ) { |
|
679 | +function give_get_highest_price_option($form_id = 0) { |
|
680 | 680 | |
681 | - if ( empty( $form_id ) ) { |
|
681 | + if (empty($form_id)) { |
|
682 | 682 | $form_id = get_the_ID(); |
683 | 683 | } |
684 | 684 | |
685 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
686 | - return give_get_form_price( $form_id ); |
|
685 | + if ( ! give_has_variable_prices($form_id)) { |
|
686 | + return give_get_form_price($form_id); |
|
687 | 687 | } |
688 | 688 | |
689 | - $prices = give_get_variable_prices( $form_id ); |
|
689 | + $prices = give_get_variable_prices($form_id); |
|
690 | 690 | |
691 | 691 | $high = 0.00; |
692 | 692 | |
693 | - if ( ! empty( $prices ) ) { |
|
693 | + if ( ! empty($prices)) { |
|
694 | 694 | |
695 | 695 | $max_id = $max = 0; |
696 | 696 | |
697 | - foreach ( $prices as $key => $price ) { |
|
698 | - if ( empty( $price['_give_amount'] ) ) { |
|
697 | + foreach ($prices as $key => $price) { |
|
698 | + if (empty($price['_give_amount'])) { |
|
699 | 699 | continue; |
700 | 700 | } |
701 | - $give_amount = give_sanitize_amount( $price['_give_amount'] ); |
|
701 | + $give_amount = give_sanitize_amount($price['_give_amount']); |
|
702 | 702 | |
703 | - $max = max( $max, $give_amount ); |
|
703 | + $max = max($max, $give_amount); |
|
704 | 704 | |
705 | - if ( $give_amount == $max ) { |
|
705 | + if ($give_amount == $max) { |
|
706 | 706 | $max_id = $key; |
707 | 707 | } |
708 | 708 | } |
709 | 709 | |
710 | - $high = $prices[ $max_id ]['_give_amount']; |
|
710 | + $high = $prices[$max_id]['_give_amount']; |
|
711 | 711 | } |
712 | 712 | |
713 | - return give_sanitize_amount( $high ); |
|
713 | + return give_sanitize_amount($high); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | /** |
@@ -722,15 +722,15 @@ discard block |
||
722 | 722 | * |
723 | 723 | * @return mixed string|int Price of the form |
724 | 724 | */ |
725 | -function give_get_form_price( $form_id = 0 ) { |
|
725 | +function give_get_form_price($form_id = 0) { |
|
726 | 726 | |
727 | - if ( empty( $form_id ) ) { |
|
727 | + if (empty($form_id)) { |
|
728 | 728 | return false; |
729 | 729 | } |
730 | 730 | |
731 | - $form = new Give_Donate_Form( $form_id ); |
|
731 | + $form = new Give_Donate_Form($form_id); |
|
732 | 732 | |
733 | - return $form->__get( 'price' ); |
|
733 | + return $form->__get('price'); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | /** |
@@ -742,15 +742,15 @@ discard block |
||
742 | 742 | * |
743 | 743 | * @return mixed string|int Minimum price of the form |
744 | 744 | */ |
745 | -function give_get_form_minimum_price( $form_id = 0 ) { |
|
745 | +function give_get_form_minimum_price($form_id = 0) { |
|
746 | 746 | |
747 | - if ( empty( $form_id ) ) { |
|
747 | + if (empty($form_id)) { |
|
748 | 748 | return false; |
749 | 749 | } |
750 | 750 | |
751 | - $form = new Give_Donate_Form( $form_id ); |
|
751 | + $form = new Give_Donate_Form($form_id); |
|
752 | 752 | |
753 | - return $form->__get( 'minimum_price' ); |
|
753 | + return $form->__get('minimum_price'); |
|
754 | 754 | |
755 | 755 | } |
756 | 756 | |
@@ -765,51 +765,51 @@ discard block |
||
765 | 765 | * |
766 | 766 | * @return int $formatted_price |
767 | 767 | */ |
768 | -function give_price( $form_id = 0, $echo = true, $price_id = false ) { |
|
768 | +function give_price($form_id = 0, $echo = true, $price_id = false) { |
|
769 | 769 | |
770 | - if ( empty( $form_id ) ) { |
|
770 | + if (empty($form_id)) { |
|
771 | 771 | $form_id = get_the_ID(); |
772 | 772 | } |
773 | 773 | |
774 | - if ( give_has_variable_prices( $form_id ) ) { |
|
774 | + if (give_has_variable_prices($form_id)) { |
|
775 | 775 | |
776 | - $prices = give_get_variable_prices( $form_id ); |
|
776 | + $prices = give_get_variable_prices($form_id); |
|
777 | 777 | |
778 | - if ( false !== $price_id ) { |
|
778 | + if (false !== $price_id) { |
|
779 | 779 | |
780 | 780 | // loop through multi-prices to see which is default |
781 | - foreach ( $prices as $price ) { |
|
781 | + foreach ($prices as $price) { |
|
782 | 782 | // this is the default price |
783 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
783 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
784 | 784 | $price = (float) $price['_give_amount']; |
785 | 785 | }; |
786 | 786 | } |
787 | 787 | } else { |
788 | 788 | |
789 | - $price = give_get_lowest_price_option( $form_id ); |
|
789 | + $price = give_get_lowest_price_option($form_id); |
|
790 | 790 | } |
791 | 791 | |
792 | - $price = give_sanitize_amount( $price ); |
|
792 | + $price = give_sanitize_amount($price); |
|
793 | 793 | |
794 | 794 | } else { |
795 | 795 | |
796 | - $price = give_get_form_price( $form_id ); |
|
796 | + $price = give_get_form_price($form_id); |
|
797 | 797 | |
798 | 798 | } |
799 | 799 | |
800 | - $price = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id ); |
|
801 | - $formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>'; |
|
802 | - $formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price ); |
|
800 | + $price = apply_filters('give_form_price', give_sanitize_amount($price), $form_id); |
|
801 | + $formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>'; |
|
802 | + $formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price); |
|
803 | 803 | |
804 | - if ( $echo ) { |
|
804 | + if ($echo) { |
|
805 | 805 | echo $formatted_price; |
806 | 806 | } else { |
807 | 807 | return $formatted_price; |
808 | 808 | } |
809 | 809 | } |
810 | 810 | |
811 | -add_filter( 'give_form_price', 'give_format_amount', 10 ); |
|
812 | -add_filter( 'give_form_price', 'give_currency_filter', 20 ); |
|
811 | +add_filter('give_form_price', 'give_format_amount', 10); |
|
812 | +add_filter('give_form_price', 'give_currency_filter', 20); |
|
813 | 813 | |
814 | 814 | |
815 | 815 | /** |
@@ -822,19 +822,19 @@ discard block |
||
822 | 822 | * |
823 | 823 | * @return float $amount Amount of the price option |
824 | 824 | */ |
825 | -function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) { |
|
826 | - $prices = give_get_variable_prices( $form_id ); |
|
825 | +function give_get_price_option_amount($form_id = 0, $price_id = 0) { |
|
826 | + $prices = give_get_variable_prices($form_id); |
|
827 | 827 | |
828 | 828 | $amount = 0.00; |
829 | 829 | |
830 | - foreach ( $prices as $price ) { |
|
831 | - if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) { |
|
832 | - $amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00; |
|
830 | + foreach ($prices as $price) { |
|
831 | + if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) { |
|
832 | + $amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00; |
|
833 | 833 | break; |
834 | 834 | }; |
835 | 835 | } |
836 | 836 | |
837 | - return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id ); |
|
837 | + return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | /** |
@@ -846,13 +846,13 @@ discard block |
||
846 | 846 | * |
847 | 847 | * @return mixed string|int Goal of the form |
848 | 848 | */ |
849 | -function give_get_form_goal( $form_id = 0 ) { |
|
849 | +function give_get_form_goal($form_id = 0) { |
|
850 | 850 | |
851 | - if ( empty( $form_id ) ) { |
|
851 | + if (empty($form_id)) { |
|
852 | 852 | return false; |
853 | 853 | } |
854 | 854 | |
855 | - $form = new Give_Donate_Form( $form_id ); |
|
855 | + $form = new Give_Donate_Form($form_id); |
|
856 | 856 | |
857 | 857 | return $form->goal; |
858 | 858 | |
@@ -868,27 +868,27 @@ discard block |
||
868 | 868 | * |
869 | 869 | * @return string $formatted_goal |
870 | 870 | */ |
871 | -function give_goal( $form_id = 0, $echo = true ) { |
|
871 | +function give_goal($form_id = 0, $echo = true) { |
|
872 | 872 | |
873 | - if ( empty( $form_id ) ) { |
|
873 | + if (empty($form_id)) { |
|
874 | 874 | $form_id = get_the_ID(); |
875 | 875 | } |
876 | 876 | |
877 | - $goal = give_get_form_goal( $form_id ); |
|
877 | + $goal = give_get_form_goal($form_id); |
|
878 | 878 | |
879 | - $goal = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id ); |
|
880 | - $formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>'; |
|
881 | - $formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal ); |
|
879 | + $goal = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id); |
|
880 | + $formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>'; |
|
881 | + $formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal); |
|
882 | 882 | |
883 | - if ( $echo ) { |
|
883 | + if ($echo) { |
|
884 | 884 | echo $formatted_goal; |
885 | 885 | } else { |
886 | 886 | return $formatted_goal; |
887 | 887 | } |
888 | 888 | } |
889 | 889 | |
890 | -add_filter( 'give_form_goal', 'give_format_amount', 10 ); |
|
891 | -add_filter( 'give_form_goal', 'give_currency_filter', 20 ); |
|
890 | +add_filter('give_form_goal', 'give_format_amount', 10); |
|
891 | +add_filter('give_form_goal', 'give_currency_filter', 20); |
|
892 | 892 | |
893 | 893 | |
894 | 894 | /** |
@@ -900,15 +900,15 @@ discard block |
||
900 | 900 | * |
901 | 901 | * @return bool $ret Whether or not the logged_in_only setting is set |
902 | 902 | */ |
903 | -function give_logged_in_only( $form_id ) { |
|
903 | +function give_logged_in_only($form_id) { |
|
904 | 904 | // If _give_logged_in_only is set to enable then guest can donate from that specific form. |
905 | 905 | // Otherwise it is member only donation form. |
906 | - $val = give_get_meta( $form_id, '_give_logged_in_only', true ); |
|
907 | - $val = ! empty( $val ) ? $val : 'enabled'; |
|
906 | + $val = give_get_meta($form_id, '_give_logged_in_only', true); |
|
907 | + $val = ! empty($val) ? $val : 'enabled'; |
|
908 | 908 | |
909 | - $ret = ! give_is_setting_enabled( $val ); |
|
909 | + $ret = ! give_is_setting_enabled($val); |
|
910 | 910 | |
911 | - return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id ); |
|
911 | + return (bool) apply_filters('give_logged_in_only', $ret, $form_id); |
|
912 | 912 | } |
913 | 913 | |
914 | 914 | |
@@ -921,11 +921,11 @@ discard block |
||
921 | 921 | * |
922 | 922 | * @return string |
923 | 923 | */ |
924 | -function give_show_login_register_option( $form_id ) { |
|
924 | +function give_show_login_register_option($form_id) { |
|
925 | 925 | |
926 | - $show_register_form = give_get_meta( $form_id, '_give_show_register_form', true ); |
|
926 | + $show_register_form = give_get_meta($form_id, '_give_show_register_form', true); |
|
927 | 927 | |
928 | - return apply_filters( 'give_show_register_form', $show_register_form, $form_id ); |
|
928 | + return apply_filters('give_show_register_form', $show_register_form, $form_id); |
|
929 | 929 | |
930 | 930 | } |
931 | 931 | |
@@ -941,12 +941,12 @@ discard block |
||
941 | 941 | * |
942 | 942 | * @return array |
943 | 943 | */ |
944 | -function _give_get_prefill_form_field_values( $form_id ) { |
|
944 | +function _give_get_prefill_form_field_values($form_id) { |
|
945 | 945 | $logged_in_donor_info = array(); |
946 | 946 | |
947 | - if ( is_user_logged_in() ) : |
|
948 | - $donor_data = get_userdata( get_current_user_id() ); |
|
949 | - $donor_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
947 | + if (is_user_logged_in()) : |
|
948 | + $donor_data = get_userdata(get_current_user_id()); |
|
949 | + $donor_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
950 | 950 | |
951 | 951 | $logged_in_donor_info = array( |
952 | 952 | // First name. |
@@ -959,42 +959,42 @@ discard block |
||
959 | 959 | 'give_email' => $donor_data->user_email, |
960 | 960 | |
961 | 961 | // Street address 1. |
962 | - 'card_address' => ( ! empty( $donor_address['line1'] ) ? $donor_address['line1'] : '' ), |
|
962 | + 'card_address' => ( ! empty($donor_address['line1']) ? $donor_address['line1'] : ''), |
|
963 | 963 | |
964 | 964 | // Street address 2. |
965 | - 'card_address_2' => ( ! empty( $donor_address['line2'] ) ? $donor_address['line2'] : '' ), |
|
965 | + 'card_address_2' => ( ! empty($donor_address['line2']) ? $donor_address['line2'] : ''), |
|
966 | 966 | |
967 | 967 | // Country. |
968 | - 'billing_country' => ( ! empty( $donor_address['country'] ) ? $donor_address['country'] : '' ), |
|
968 | + 'billing_country' => ( ! empty($donor_address['country']) ? $donor_address['country'] : ''), |
|
969 | 969 | |
970 | 970 | // State. |
971 | - 'card_state' => ( ! empty( $donor_address['state'] ) ? $donor_address['state'] : '' ), |
|
971 | + 'card_state' => ( ! empty($donor_address['state']) ? $donor_address['state'] : ''), |
|
972 | 972 | |
973 | 973 | // City. |
974 | - 'card_city' => ( ! empty( $donor_address['city'] ) ? $donor_address['city'] : '' ), |
|
974 | + 'card_city' => ( ! empty($donor_address['city']) ? $donor_address['city'] : ''), |
|
975 | 975 | |
976 | 976 | // Zipcode |
977 | - 'card_zip' => ( ! empty( $donor_address['zip'] ) ? $donor_address['zip'] : '' ), |
|
977 | + 'card_zip' => ( ! empty($donor_address['zip']) ? $donor_address['zip'] : ''), |
|
978 | 978 | ); |
979 | 979 | endif; |
980 | 980 | |
981 | 981 | // Bailout: Auto fill form field values only form form which donor is donating. |
982 | 982 | if ( |
983 | - empty( $_GET['form-id'] ) |
|
983 | + empty($_GET['form-id']) |
|
984 | 984 | || ! $form_id |
985 | - || ( $form_id !== absint( $_GET['form-id'] ) ) |
|
985 | + || ($form_id !== absint($_GET['form-id'])) |
|
986 | 986 | ) { |
987 | 987 | return $logged_in_donor_info; |
988 | 988 | } |
989 | 989 | |
990 | 990 | // Get purchase data. |
991 | - $give_purchase_data = Give()->session->get( 'give_purchase' ); |
|
991 | + $give_purchase_data = Give()->session->get('give_purchase'); |
|
992 | 992 | |
993 | 993 | // Get donor info from form data. |
994 | - $give_donor_info_in_session = empty( $give_purchase_data['post_data'] ) |
|
994 | + $give_donor_info_in_session = empty($give_purchase_data['post_data']) |
|
995 | 995 | ? array() |
996 | 996 | : $give_purchase_data['post_data']; |
997 | 997 | |
998 | 998 | // Output. |
999 | - return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info ); |
|
999 | + return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info); |
|
1000 | 1000 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * |
393 | 393 | * @param int|bool $payment_id A given payment |
394 | 394 | * |
395 | - * @return mixed void|false |
|
395 | + * @return false|null void|false |
|
396 | 396 | */ |
397 | 397 | public function __construct( $payment_id = false ) { |
398 | 398 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * |
464 | 464 | * @param string $name The attribute to get |
465 | 465 | * |
466 | - * @return boolean If the item is set or not |
|
466 | + * @return boolean|null If the item is set or not |
|
467 | 467 | */ |
468 | 468 | public function __isset( $name ) { |
469 | 469 | if ( property_exists( $this, $name ) ) { |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | * |
1303 | 1303 | * @param string $note The note to add |
1304 | 1304 | * |
1305 | - * @return void |
|
1305 | + * @return false|null |
|
1306 | 1306 | */ |
1307 | 1307 | public function add_note( $note = false ) { |
1308 | 1308 | // Bail if no note specified. |
@@ -1050,7 +1050,7 @@ |
||
1050 | 1050 | // Find a match between price_id and level_id. |
1051 | 1051 | // First verify array keys exists THEN make the match. |
1052 | 1052 | if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) ) |
1053 | - && $args['price_id'] == $price['_give_id']['level_id'] |
|
1053 | + && $args['price_id'] == $price['_give_id']['level_id'] |
|
1054 | 1054 | ) { |
1055 | 1055 | $item_price = $price['_give_amount']; |
1056 | 1056 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -394,13 +394,13 @@ discard block |
||
394 | 394 | * |
395 | 395 | * @return mixed void|false |
396 | 396 | */ |
397 | - public function __construct( $payment_id = false ) { |
|
397 | + public function __construct($payment_id = false) { |
|
398 | 398 | |
399 | - if ( empty( $payment_id ) ) { |
|
399 | + if (empty($payment_id)) { |
|
400 | 400 | return false; |
401 | 401 | } |
402 | 402 | |
403 | - $this->setup_payment( $payment_id ); |
|
403 | + $this->setup_payment($payment_id); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | /** |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | * |
414 | 414 | * @return mixed The value. |
415 | 415 | */ |
416 | - public function __get( $key ) { |
|
416 | + public function __get($key) { |
|
417 | 417 | |
418 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
418 | + if (method_exists($this, 'get_'.$key)) { |
|
419 | 419 | |
420 | - $value = call_user_func( array( $this, 'get_' . $key ) ); |
|
420 | + $value = call_user_func(array($this, 'get_'.$key)); |
|
421 | 421 | |
422 | 422 | } else { |
423 | 423 | |
@@ -439,18 +439,18 @@ discard block |
||
439 | 439 | * @param string $key The property name |
440 | 440 | * @param mixed $value The value of the property |
441 | 441 | */ |
442 | - public function __set( $key, $value ) { |
|
443 | - $ignore = array( '_ID' ); |
|
442 | + public function __set($key, $value) { |
|
443 | + $ignore = array('_ID'); |
|
444 | 444 | |
445 | - if ( $key === 'status' ) { |
|
445 | + if ($key === 'status') { |
|
446 | 446 | $this->old_status = $this->status; |
447 | 447 | } |
448 | 448 | |
449 | - if ( ! in_array( $key, $ignore ) ) { |
|
450 | - $this->pending[ $key ] = $value; |
|
449 | + if ( ! in_array($key, $ignore)) { |
|
450 | + $this->pending[$key] = $value; |
|
451 | 451 | } |
452 | 452 | |
453 | - if ( '_ID' !== $key ) { |
|
453 | + if ('_ID' !== $key) { |
|
454 | 454 | $this->$key = $value; |
455 | 455 | } |
456 | 456 | } |
@@ -465,9 +465,9 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @return boolean If the item is set or not |
467 | 467 | */ |
468 | - public function __isset( $name ) { |
|
469 | - if ( property_exists( $this, $name ) ) { |
|
470 | - return false === empty( $this->$name ); |
|
468 | + public function __isset($name) { |
|
469 | + if (property_exists($this, $name)) { |
|
470 | + return false === empty($this->$name); |
|
471 | 471 | } else { |
472 | 472 | return null; |
473 | 473 | } |
@@ -483,20 +483,20 @@ discard block |
||
483 | 483 | * |
484 | 484 | * @return bool If the setup was successful or not |
485 | 485 | */ |
486 | - private function setup_payment( $payment_id ) { |
|
486 | + private function setup_payment($payment_id) { |
|
487 | 487 | $this->pending = array(); |
488 | 488 | |
489 | - if ( empty( $payment_id ) ) { |
|
489 | + if (empty($payment_id)) { |
|
490 | 490 | return false; |
491 | 491 | } |
492 | 492 | |
493 | - $payment = get_post( $payment_id ); |
|
493 | + $payment = get_post($payment_id); |
|
494 | 494 | |
495 | - if ( ! $payment || is_wp_error( $payment ) ) { |
|
495 | + if ( ! $payment || is_wp_error($payment)) { |
|
496 | 496 | return false; |
497 | 497 | } |
498 | 498 | |
499 | - if ( 'give_payment' !== $payment->post_type ) { |
|
499 | + if ('give_payment' !== $payment->post_type) { |
|
500 | 500 | return false; |
501 | 501 | } |
502 | 502 | |
@@ -510,13 +510,13 @@ discard block |
||
510 | 510 | * @param Give_Payment $this Payment object. |
511 | 511 | * @param int $payment_id The ID of the payment. |
512 | 512 | */ |
513 | - do_action( 'give_pre_setup_payment', $this, $payment_id ); |
|
513 | + do_action('give_pre_setup_payment', $this, $payment_id); |
|
514 | 514 | |
515 | 515 | // Primary Identifier. |
516 | - $this->ID = absint( $payment_id ); |
|
516 | + $this->ID = absint($payment_id); |
|
517 | 517 | |
518 | 518 | // Protected ID that can never be changed. |
519 | - $this->_ID = absint( $payment_id ); |
|
519 | + $this->_ID = absint($payment_id); |
|
520 | 520 | |
521 | 521 | // We have a payment, get the generic payment_meta item to reduce calls to it. |
522 | 522 | $this->payment_meta = $this->get_meta(); |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $this->parent_payment = $payment->post_parent; |
532 | 532 | |
533 | 533 | $all_payment_statuses = give_get_payment_statuses(); |
534 | - $this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status ); |
|
534 | + $this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status); |
|
535 | 535 | |
536 | 536 | // Items. |
537 | 537 | $this->fees = $this->setup_fees(); |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | * @param Give_Payment $this Payment object. |
574 | 574 | * @param int $payment_id The ID of the payment. |
575 | 575 | */ |
576 | - do_action( 'give_setup_payment', $this, $payment_id ); |
|
576 | + do_action('give_setup_payment', $this, $payment_id); |
|
577 | 577 | |
578 | 578 | return true; |
579 | 579 | } |
@@ -591,8 +591,8 @@ discard block |
||
591 | 591 | * |
592 | 592 | * @return void |
593 | 593 | */ |
594 | - public function update_payment_setup( $payment_id ) { |
|
595 | - $this->setup_payment( $payment_id ); |
|
594 | + public function update_payment_setup($payment_id) { |
|
595 | + $this->setup_payment($payment_id); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | /** |
@@ -607,24 +607,24 @@ discard block |
||
607 | 607 | |
608 | 608 | // Construct the payment title. |
609 | 609 | $payment_title = ''; |
610 | - if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) { |
|
611 | - $payment_title = $this->first_name . ' ' . $this->last_name; |
|
612 | - } elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) { |
|
610 | + if ( ! empty($this->first_name) && ! empty($this->last_name)) { |
|
611 | + $payment_title = $this->first_name.' '.$this->last_name; |
|
612 | + } elseif ( ! empty($this->first_name) && empty($this->last_name)) { |
|
613 | 613 | $payment_title = $this->first_name; |
614 | - } elseif ( ! empty( $this->email ) && is_email( $this->email ) ) { |
|
614 | + } elseif ( ! empty($this->email) && is_email($this->email)) { |
|
615 | 615 | $payment_title = $this->email; |
616 | 616 | } |
617 | 617 | |
618 | 618 | // Set Key. |
619 | - if ( empty( $this->key ) ) { |
|
619 | + if (empty($this->key)) { |
|
620 | 620 | |
621 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
622 | - $this->key = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ); // Unique key |
|
621 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
622 | + $this->key = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key |
|
623 | 623 | $this->pending['key'] = $this->key; |
624 | 624 | } |
625 | 625 | |
626 | 626 | // Set IP. |
627 | - if ( empty( $this->ip ) ) { |
|
627 | + if (empty($this->ip)) { |
|
628 | 628 | |
629 | 629 | $this->ip = give_get_ip(); |
630 | 630 | $this->pending['ip'] = $this->ip; |
@@ -651,63 +651,63 @@ discard block |
||
651 | 651 | 'fees' => $this->fees, |
652 | 652 | ); |
653 | 653 | |
654 | - $args = apply_filters( 'give_insert_payment_args', array( |
|
654 | + $args = apply_filters('give_insert_payment_args', array( |
|
655 | 655 | 'post_title' => $payment_title, |
656 | 656 | 'post_status' => $this->status, |
657 | 657 | 'post_type' => 'give_payment', |
658 | - 'post_date' => ! empty( $this->date ) ? $this->date : null, |
|
659 | - 'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null, |
|
658 | + 'post_date' => ! empty($this->date) ? $this->date : null, |
|
659 | + 'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null, |
|
660 | 660 | 'post_parent' => $this->parent_payment, |
661 | - ), $payment_data ); |
|
661 | + ), $payment_data); |
|
662 | 662 | |
663 | 663 | // Create a blank payment |
664 | - $payment_id = wp_insert_post( $args ); |
|
664 | + $payment_id = wp_insert_post($args); |
|
665 | 665 | |
666 | - if ( ! empty( $payment_id ) ) { |
|
666 | + if ( ! empty($payment_id)) { |
|
667 | 667 | |
668 | 668 | $this->ID = $payment_id; |
669 | 669 | $this->_ID = $payment_id; |
670 | 670 | |
671 | 671 | $customer = new stdClass; |
672 | 672 | |
673 | - if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) { |
|
674 | - $customer = new Give_Customer( get_current_user_id(), true ); |
|
673 | + if (did_action('give_pre_process_donation') && is_user_logged_in()) { |
|
674 | + $customer = new Give_Customer(get_current_user_id(), true); |
|
675 | 675 | |
676 | 676 | // Customer is logged in but used a different email to purchase with so assign to their customer record |
677 | - if ( ! empty( $customer->id ) && $this->email != $customer->email ) { |
|
678 | - $customer->add_email( $this->email ); |
|
677 | + if ( ! empty($customer->id) && $this->email != $customer->email) { |
|
678 | + $customer->add_email($this->email); |
|
679 | 679 | } |
680 | 680 | } |
681 | 681 | |
682 | - if ( empty( $customer->id ) ) { |
|
683 | - $customer = new Give_Customer( $this->email ); |
|
682 | + if (empty($customer->id)) { |
|
683 | + $customer = new Give_Customer($this->email); |
|
684 | 684 | } |
685 | 685 | |
686 | - if ( empty( $customer->id ) ) { |
|
686 | + if (empty($customer->id)) { |
|
687 | 687 | |
688 | 688 | $customer_data = array( |
689 | - 'name' => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '', |
|
689 | + 'name' => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '', |
|
690 | 690 | 'email' => $this->email, |
691 | 691 | 'user_id' => $this->user_id, |
692 | 692 | ); |
693 | 693 | |
694 | - $customer->create( $customer_data ); |
|
694 | + $customer->create($customer_data); |
|
695 | 695 | |
696 | 696 | } |
697 | 697 | |
698 | 698 | $this->customer_id = $customer->id; |
699 | 699 | $this->pending['customer_id'] = $this->customer_id; |
700 | - $customer->attach_payment( $this->ID, false ); |
|
700 | + $customer->attach_payment($this->ID, false); |
|
701 | 701 | |
702 | - $this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data ); |
|
703 | - if ( ! empty( $this->payment_meta['fees'] ) ) { |
|
704 | - $this->fees = array_merge( $this->fees, $this->payment_meta['fees'] ); |
|
705 | - foreach ( $this->fees as $fee ) { |
|
706 | - $this->increase_fees( $fee['amount'] ); |
|
702 | + $this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data); |
|
703 | + if ( ! empty($this->payment_meta['fees'])) { |
|
704 | + $this->fees = array_merge($this->fees, $this->payment_meta['fees']); |
|
705 | + foreach ($this->fees as $fee) { |
|
706 | + $this->increase_fees($fee['amount']); |
|
707 | 707 | } |
708 | 708 | } |
709 | 709 | |
710 | - $this->update_meta( '_give_payment_meta', $this->payment_meta ); |
|
710 | + $this->update_meta('_give_payment_meta', $this->payment_meta); |
|
711 | 711 | $this->new = true; |
712 | 712 | }// End if(). |
713 | 713 | |
@@ -729,11 +729,11 @@ discard block |
||
729 | 729 | $saved = false; |
730 | 730 | |
731 | 731 | // Must have an ID. |
732 | - if ( empty( $this->ID ) ) { |
|
732 | + if (empty($this->ID)) { |
|
733 | 733 | |
734 | 734 | $payment_id = $this->insert_payment(); |
735 | 735 | |
736 | - if ( false === $payment_id ) { |
|
736 | + if (false === $payment_id) { |
|
737 | 737 | $saved = false; |
738 | 738 | } else { |
739 | 739 | $this->ID = $payment_id; |
@@ -741,48 +741,48 @@ discard block |
||
741 | 741 | } |
742 | 742 | |
743 | 743 | // Set ID if not matching. |
744 | - if ( $this->ID !== $this->_ID ) { |
|
744 | + if ($this->ID !== $this->_ID) { |
|
745 | 745 | $this->ID = $this->_ID; |
746 | 746 | } |
747 | 747 | |
748 | 748 | // If we have something pending, let's save it. |
749 | - if ( ! empty( $this->pending ) ) { |
|
749 | + if ( ! empty($this->pending)) { |
|
750 | 750 | |
751 | 751 | $total_increase = 0; |
752 | 752 | $total_decrease = 0; |
753 | 753 | |
754 | - foreach ( $this->pending as $key => $value ) { |
|
754 | + foreach ($this->pending as $key => $value) { |
|
755 | 755 | |
756 | - switch ( $key ) { |
|
756 | + switch ($key) { |
|
757 | 757 | |
758 | 758 | case 'donations': |
759 | 759 | // Update totals for pending donations. |
760 | - foreach ( $this->pending[ $key ] as $item ) { |
|
760 | + foreach ($this->pending[$key] as $item) { |
|
761 | 761 | |
762 | - $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; |
|
763 | - $price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0; |
|
762 | + $quantity = isset($item['quantity']) ? $item['quantity'] : 1; |
|
763 | + $price_id = isset($item['price_id']) ? $item['price_id'] : 0; |
|
764 | 764 | |
765 | - switch ( $item['action'] ) { |
|
765 | + switch ($item['action']) { |
|
766 | 766 | |
767 | 767 | case 'add': |
768 | 768 | |
769 | 769 | $price = $item['price']; |
770 | 770 | |
771 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
771 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
772 | 772 | |
773 | 773 | // Add sales logs. |
774 | - $log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) ); |
|
774 | + $log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp')); |
|
775 | 775 | |
776 | 776 | $y = 0; |
777 | - while ( $y < $quantity ) { |
|
777 | + while ($y < $quantity) { |
|
778 | 778 | |
779 | - give_record_sale_in_log( $item['id'], $this->ID, $price_id, $log_date ); |
|
780 | - $y ++; |
|
779 | + give_record_sale_in_log($item['id'], $this->ID, $price_id, $log_date); |
|
780 | + $y++; |
|
781 | 781 | } |
782 | 782 | |
783 | - $form = new Give_Donate_Form( $item['id'] ); |
|
784 | - $form->increase_sales( $quantity ); |
|
785 | - $form->increase_earnings( $price ); |
|
783 | + $form = new Give_Donate_Form($item['id']); |
|
784 | + $form->increase_sales($quantity); |
|
785 | + $form->increase_earnings($price); |
|
786 | 786 | |
787 | 787 | $total_increase += $price; |
788 | 788 | } |
@@ -807,15 +807,15 @@ discard block |
||
807 | 807 | ), |
808 | 808 | ); |
809 | 809 | |
810 | - $found_logs = get_posts( $log_args ); |
|
811 | - foreach ( $found_logs as $log ) { |
|
812 | - wp_delete_post( $log->ID, true ); |
|
810 | + $found_logs = get_posts($log_args); |
|
811 | + foreach ($found_logs as $log) { |
|
812 | + wp_delete_post($log->ID, true); |
|
813 | 813 | } |
814 | 814 | |
815 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
816 | - $form = new Give_Donate_Form( $item['id'] ); |
|
817 | - $form->decrease_sales( $quantity ); |
|
818 | - $form->decrease_earnings( $item['amount'] ); |
|
815 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
816 | + $form = new Give_Donate_Form($item['id']); |
|
817 | + $form->decrease_sales($quantity); |
|
818 | + $form->decrease_earnings($item['amount']); |
|
819 | 819 | |
820 | 820 | $total_decrease += $item['amount']; |
821 | 821 | } |
@@ -827,17 +827,17 @@ discard block |
||
827 | 827 | |
828 | 828 | case 'fees': |
829 | 829 | |
830 | - if ( 'publish' !== $this->status && 'complete' !== $this->status ) { |
|
830 | + if ('publish' !== $this->status && 'complete' !== $this->status) { |
|
831 | 831 | break; |
832 | 832 | } |
833 | 833 | |
834 | - if ( empty( $this->pending[ $key ] ) ) { |
|
834 | + if (empty($this->pending[$key])) { |
|
835 | 835 | break; |
836 | 836 | } |
837 | 837 | |
838 | - foreach ( $this->pending[ $key ] as $fee ) { |
|
838 | + foreach ($this->pending[$key] as $fee) { |
|
839 | 839 | |
840 | - switch ( $fee['action'] ) { |
|
840 | + switch ($fee['action']) { |
|
841 | 841 | |
842 | 842 | case 'add': |
843 | 843 | $total_increase += $fee['amount']; |
@@ -853,43 +853,43 @@ discard block |
||
853 | 853 | break; |
854 | 854 | |
855 | 855 | case 'status': |
856 | - $this->update_status( $this->status ); |
|
856 | + $this->update_status($this->status); |
|
857 | 857 | break; |
858 | 858 | |
859 | 859 | case 'gateway': |
860 | - $this->update_meta( '_give_payment_gateway', $this->gateway ); |
|
860 | + $this->update_meta('_give_payment_gateway', $this->gateway); |
|
861 | 861 | break; |
862 | 862 | |
863 | 863 | case 'mode': |
864 | - $this->update_meta( '_give_payment_mode', $this->mode ); |
|
864 | + $this->update_meta('_give_payment_mode', $this->mode); |
|
865 | 865 | break; |
866 | 866 | |
867 | 867 | case 'transaction_id': |
868 | - $this->update_meta( '_give_payment_transaction_id', $this->transaction_id ); |
|
868 | + $this->update_meta('_give_payment_transaction_id', $this->transaction_id); |
|
869 | 869 | break; |
870 | 870 | |
871 | 871 | case 'ip': |
872 | - $this->update_meta( '_give_payment_user_ip', $this->ip ); |
|
872 | + $this->update_meta('_give_payment_user_ip', $this->ip); |
|
873 | 873 | break; |
874 | 874 | |
875 | 875 | case 'customer_id': |
876 | - $this->update_meta( '_give_payment_customer_id', $this->customer_id ); |
|
876 | + $this->update_meta('_give_payment_customer_id', $this->customer_id); |
|
877 | 877 | break; |
878 | 878 | |
879 | 879 | case 'user_id': |
880 | - $this->update_meta( '_give_payment_user_id', $this->user_id ); |
|
880 | + $this->update_meta('_give_payment_user_id', $this->user_id); |
|
881 | 881 | break; |
882 | 882 | |
883 | 883 | case 'form_title': |
884 | - $this->update_meta( '_give_payment_form_title', $this->form_title ); |
|
884 | + $this->update_meta('_give_payment_form_title', $this->form_title); |
|
885 | 885 | break; |
886 | 886 | |
887 | 887 | case 'form_id': |
888 | - $this->update_meta( '_give_payment_form_id', $this->form_id ); |
|
888 | + $this->update_meta('_give_payment_form_id', $this->form_id); |
|
889 | 889 | break; |
890 | 890 | |
891 | 891 | case 'price_id': |
892 | - $this->update_meta( '_give_payment_price_id', $this->price_id ); |
|
892 | + $this->update_meta('_give_payment_price_id', $this->price_id); |
|
893 | 893 | break; |
894 | 894 | |
895 | 895 | case 'first_name': |
@@ -905,15 +905,15 @@ discard block |
||
905 | 905 | break; |
906 | 906 | |
907 | 907 | case 'email': |
908 | - $this->update_meta( '_give_payment_user_email', $this->email ); |
|
908 | + $this->update_meta('_give_payment_user_email', $this->email); |
|
909 | 909 | break; |
910 | 910 | |
911 | 911 | case 'key': |
912 | - $this->update_meta( '_give_payment_purchase_key', $this->key ); |
|
912 | + $this->update_meta('_give_payment_purchase_key', $this->key); |
|
913 | 913 | break; |
914 | 914 | |
915 | 915 | case 'number': |
916 | - $this->update_meta( '_give_payment_number', $this->number ); |
|
916 | + $this->update_meta('_give_payment_number', $this->number); |
|
917 | 917 | break; |
918 | 918 | |
919 | 919 | case 'date': |
@@ -923,11 +923,11 @@ discard block |
||
923 | 923 | 'edit_date' => true, |
924 | 924 | ); |
925 | 925 | |
926 | - wp_update_post( $args ); |
|
926 | + wp_update_post($args); |
|
927 | 927 | break; |
928 | 928 | |
929 | 929 | case 'completed_date': |
930 | - $this->update_meta( '_give_completed_date', $this->completed_date ); |
|
930 | + $this->update_meta('_give_completed_date', $this->completed_date); |
|
931 | 931 | break; |
932 | 932 | |
933 | 933 | case 'parent_payment': |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | 'post_parent' => $this->parent_payment, |
937 | 937 | ); |
938 | 938 | |
939 | - wp_update_post( $args ); |
|
939 | + wp_update_post($args); |
|
940 | 940 | break; |
941 | 941 | |
942 | 942 | default: |
@@ -947,33 +947,33 @@ discard block |
||
947 | 947 | * |
948 | 948 | * @param Give_Payment $this Payment object. |
949 | 949 | */ |
950 | - do_action( 'give_payment_save', $this, $key ); |
|
950 | + do_action('give_payment_save', $this, $key); |
|
951 | 951 | break; |
952 | 952 | }// End switch(). |
953 | 953 | }// End foreach(). |
954 | 954 | |
955 | - if ( 'pending' !== $this->status ) { |
|
955 | + if ('pending' !== $this->status) { |
|
956 | 956 | |
957 | - $customer = new Give_Customer( $this->customer_id ); |
|
957 | + $customer = new Give_Customer($this->customer_id); |
|
958 | 958 | |
959 | 959 | $total_change = $total_increase - $total_decrease; |
960 | - if ( $total_change < 0 ) { |
|
960 | + if ($total_change < 0) { |
|
961 | 961 | |
962 | - $total_change = - ( $total_change ); |
|
962 | + $total_change = - ($total_change); |
|
963 | 963 | // Decrease the customer's donation stats. |
964 | - $customer->decrease_value( $total_change ); |
|
965 | - give_decrease_total_earnings( $total_change ); |
|
964 | + $customer->decrease_value($total_change); |
|
965 | + give_decrease_total_earnings($total_change); |
|
966 | 966 | |
967 | - } elseif ( $total_change > 0 ) { |
|
967 | + } elseif ($total_change > 0) { |
|
968 | 968 | |
969 | 969 | // Increase the customer's donation stats. |
970 | - $customer->increase_value( $total_change ); |
|
971 | - give_increase_total_earnings( $total_change ); |
|
970 | + $customer->increase_value($total_change); |
|
971 | + give_increase_total_earnings($total_change); |
|
972 | 972 | |
973 | 973 | } |
974 | 974 | } |
975 | 975 | |
976 | - $this->update_meta( '_give_payment_total', $this->total ); |
|
976 | + $this->update_meta('_give_payment_total', $this->total); |
|
977 | 977 | |
978 | 978 | $new_meta = array( |
979 | 979 | 'form_title' => $this->form_title, |
@@ -985,12 +985,12 @@ discard block |
||
985 | 985 | ); |
986 | 986 | |
987 | 987 | $meta = $this->get_meta(); |
988 | - $merged_meta = array_merge( $meta, $new_meta ); |
|
988 | + $merged_meta = array_merge($meta, $new_meta); |
|
989 | 989 | |
990 | 990 | // Only save the payment meta if it's changed. |
991 | - if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) { |
|
992 | - $updated = $this->update_meta( '_give_payment_meta', $merged_meta ); |
|
993 | - if ( false !== $updated ) { |
|
991 | + if (md5(serialize($meta)) !== md5(serialize($merged_meta))) { |
|
992 | + $updated = $this->update_meta('_give_payment_meta', $merged_meta); |
|
993 | + if (false !== $updated) { |
|
994 | 994 | $saved = true; |
995 | 995 | } |
996 | 996 | } |
@@ -999,8 +999,8 @@ discard block |
||
999 | 999 | $saved = true; |
1000 | 1000 | }// End if(). |
1001 | 1001 | |
1002 | - if ( true === $saved ) { |
|
1003 | - $this->setup_payment( $this->ID ); |
|
1002 | + if (true === $saved) { |
|
1003 | + $this->setup_payment($this->ID); |
|
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | return $saved; |
@@ -1018,12 +1018,12 @@ discard block |
||
1018 | 1018 | * |
1019 | 1019 | * @return bool True when successful, false otherwise |
1020 | 1020 | */ |
1021 | - public function add_donation( $form_id = 0, $args = array(), $options = array() ) { |
|
1021 | + public function add_donation($form_id = 0, $args = array(), $options = array()) { |
|
1022 | 1022 | |
1023 | - $donation = new Give_Donate_Form( $form_id ); |
|
1023 | + $donation = new Give_Donate_Form($form_id); |
|
1024 | 1024 | |
1025 | 1025 | // Bail if this post isn't a give donation form. |
1026 | - if ( ! $donation || $donation->post_type !== 'give_forms' ) { |
|
1026 | + if ( ! $donation || $donation->post_type !== 'give_forms') { |
|
1027 | 1027 | return false; |
1028 | 1028 | } |
1029 | 1029 | |
@@ -1034,59 +1034,59 @@ discard block |
||
1034 | 1034 | 'fees' => array(), |
1035 | 1035 | ); |
1036 | 1036 | |
1037 | - $args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults ); |
|
1037 | + $args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults); |
|
1038 | 1038 | |
1039 | 1039 | // Allow overriding the price. |
1040 | - if ( false !== $args['price'] ) { |
|
1040 | + if (false !== $args['price']) { |
|
1041 | 1041 | $item_price = $args['price']; |
1042 | 1042 | } else { |
1043 | 1043 | |
1044 | 1044 | // Deal with variable pricing. |
1045 | - if ( give_has_variable_prices( $donation->ID ) ) { |
|
1046 | - $prices = maybe_unserialize( give_get_meta( $form_id, '_give_donation_levels', true ) ); |
|
1045 | + if (give_has_variable_prices($donation->ID)) { |
|
1046 | + $prices = maybe_unserialize(give_get_meta($form_id, '_give_donation_levels', true)); |
|
1047 | 1047 | $item_price = ''; |
1048 | 1048 | // Loop through prices. |
1049 | - foreach ( $prices as $price ) { |
|
1049 | + foreach ($prices as $price) { |
|
1050 | 1050 | // Find a match between price_id and level_id. |
1051 | 1051 | // First verify array keys exists THEN make the match. |
1052 | - if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) ) |
|
1052 | + if ((isset($args['price_id']) && isset($price['_give_id']['level_id'])) |
|
1053 | 1053 | && $args['price_id'] == $price['_give_id']['level_id'] |
1054 | 1054 | ) { |
1055 | 1055 | $item_price = $price['_give_amount']; |
1056 | 1056 | } |
1057 | 1057 | } |
1058 | 1058 | // Fallback to the lowest price point. |
1059 | - if ( $item_price == '' ) { |
|
1060 | - $item_price = give_get_lowest_price_option( $donation->ID ); |
|
1061 | - $args['price_id'] = give_get_lowest_price_id( $donation->ID ); |
|
1059 | + if ($item_price == '') { |
|
1060 | + $item_price = give_get_lowest_price_option($donation->ID); |
|
1061 | + $args['price_id'] = give_get_lowest_price_id($donation->ID); |
|
1062 | 1062 | } |
1063 | 1063 | } else { |
1064 | 1064 | // Simple form price. |
1065 | - $item_price = give_get_form_price( $donation->ID ); |
|
1065 | + $item_price = give_get_form_price($donation->ID); |
|
1066 | 1066 | } |
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | // Sanitizing the price here so we don't have a dozen calls later. |
1070 | - $item_price = give_sanitize_amount( $item_price ); |
|
1071 | - $total = round( $item_price, give_currency_decimal_filter() ); |
|
1070 | + $item_price = give_sanitize_amount($item_price); |
|
1071 | + $total = round($item_price, give_currency_decimal_filter()); |
|
1072 | 1072 | |
1073 | 1073 | // Add Options. |
1074 | 1074 | $default_options = array(); |
1075 | - if ( false !== $args['price_id'] ) { |
|
1075 | + if (false !== $args['price_id']) { |
|
1076 | 1076 | $default_options['price_id'] = (int) $args['price_id']; |
1077 | 1077 | } |
1078 | - $options = wp_parse_args( $options, $default_options ); |
|
1078 | + $options = wp_parse_args($options, $default_options); |
|
1079 | 1079 | |
1080 | 1080 | // Do not allow totals to go negative. |
1081 | - if ( $total < 0 ) { |
|
1081 | + if ($total < 0) { |
|
1082 | 1082 | $total = 0; |
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | $donation = array( |
1086 | 1086 | 'name' => $donation->post_title, |
1087 | 1087 | 'id' => $donation->ID, |
1088 | - 'price' => round( $total, give_currency_decimal_filter() ), |
|
1089 | - 'subtotal' => round( $total, give_currency_decimal_filter() ), |
|
1088 | + 'price' => round($total, give_currency_decimal_filter()), |
|
1089 | + 'subtotal' => round($total, give_currency_decimal_filter()), |
|
1090 | 1090 | 'fees' => $args['fees'], |
1091 | 1091 | 'price_id' => $args['price_id'], |
1092 | 1092 | 'action' => 'add', |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | $this->pending['donations'][] = $donation; |
1097 | 1097 | |
1098 | - $this->increase_subtotal( $total ); |
|
1098 | + $this->increase_subtotal($total); |
|
1099 | 1099 | |
1100 | 1100 | return true; |
1101 | 1101 | |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | * |
1113 | 1113 | * @return bool If the item was removed or not |
1114 | 1114 | */ |
1115 | - public function remove_donation( $form_id, $args = array() ) { |
|
1115 | + public function remove_donation($form_id, $args = array()) { |
|
1116 | 1116 | |
1117 | 1117 | // Set some defaults. |
1118 | 1118 | $defaults = array( |
@@ -1120,12 +1120,12 @@ discard block |
||
1120 | 1120 | 'price' => false, |
1121 | 1121 | 'price_id' => false, |
1122 | 1122 | ); |
1123 | - $args = wp_parse_args( $args, $defaults ); |
|
1123 | + $args = wp_parse_args($args, $defaults); |
|
1124 | 1124 | |
1125 | - $form = new Give_Donate_Form( $form_id ); |
|
1125 | + $form = new Give_Donate_Form($form_id); |
|
1126 | 1126 | |
1127 | 1127 | // Bail if this post isn't a valid give donation form. |
1128 | - if ( ! $form || $form->post_type !== 'give_forms' ) { |
|
1128 | + if ( ! $form || $form->post_type !== 'give_forms') { |
|
1129 | 1129 | return false; |
1130 | 1130 | } |
1131 | 1131 | |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | |
1139 | 1139 | $this->pending['donations'][] = $pending_args; |
1140 | 1140 | |
1141 | - $this->decrease_subtotal( $this->total ); |
|
1141 | + $this->decrease_subtotal($this->total); |
|
1142 | 1142 | |
1143 | 1143 | return true; |
1144 | 1144 | } |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | * |
1155 | 1155 | * @return bool If the fee was added |
1156 | 1156 | */ |
1157 | - public function add_fee( $args, $global = true ) { |
|
1157 | + public function add_fee($args, $global = true) { |
|
1158 | 1158 | |
1159 | 1159 | $default_args = array( |
1160 | 1160 | 'label' => '', |
@@ -1164,15 +1164,15 @@ discard block |
||
1164 | 1164 | 'price_id' => 0, |
1165 | 1165 | ); |
1166 | 1166 | |
1167 | - $fee = wp_parse_args( $args, $default_args ); |
|
1167 | + $fee = wp_parse_args($args, $default_args); |
|
1168 | 1168 | $this->fees[] = $fee; |
1169 | 1169 | |
1170 | 1170 | $added_fee = $fee; |
1171 | 1171 | $added_fee['action'] = 'add'; |
1172 | 1172 | $this->pending['fees'][] = $added_fee; |
1173 | - reset( $this->fees ); |
|
1173 | + reset($this->fees); |
|
1174 | 1174 | |
1175 | - $this->increase_fees( $fee['amount'] ); |
|
1175 | + $this->increase_fees($fee['amount']); |
|
1176 | 1176 | |
1177 | 1177 | return true; |
1178 | 1178 | } |
@@ -1187,11 +1187,11 @@ discard block |
||
1187 | 1187 | * |
1188 | 1188 | * @return bool If the fee was removed successfully |
1189 | 1189 | */ |
1190 | - public function remove_fee( $key ) { |
|
1190 | + public function remove_fee($key) { |
|
1191 | 1191 | $removed = false; |
1192 | 1192 | |
1193 | - if ( is_numeric( $key ) ) { |
|
1194 | - $removed = $this->remove_fee_by( 'index', $key ); |
|
1193 | + if (is_numeric($key)) { |
|
1194 | + $removed = $this->remove_fee_by('index', $key); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | return $removed; |
@@ -1210,55 +1210,55 @@ discard block |
||
1210 | 1210 | * |
1211 | 1211 | * @return boolean If the item is removed |
1212 | 1212 | */ |
1213 | - public function remove_fee_by( $key, $value, $global = false ) { |
|
1213 | + public function remove_fee_by($key, $value, $global = false) { |
|
1214 | 1214 | |
1215 | - $allowed_fee_keys = apply_filters( 'give_payment_fee_keys', array( |
|
1215 | + $allowed_fee_keys = apply_filters('give_payment_fee_keys', array( |
|
1216 | 1216 | 'index', |
1217 | 1217 | 'label', |
1218 | 1218 | 'amount', |
1219 | 1219 | 'type', |
1220 | - ) ); |
|
1220 | + )); |
|
1221 | 1221 | |
1222 | - if ( ! in_array( $key, $allowed_fee_keys ) ) { |
|
1222 | + if ( ! in_array($key, $allowed_fee_keys)) { |
|
1223 | 1223 | return false; |
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | $removed = false; |
1227 | - if ( 'index' === $key && array_key_exists( $value, $this->fees ) ) { |
|
1227 | + if ('index' === $key && array_key_exists($value, $this->fees)) { |
|
1228 | 1228 | |
1229 | - $removed_fee = $this->fees[ $value ]; |
|
1229 | + $removed_fee = $this->fees[$value]; |
|
1230 | 1230 | $removed_fee['action'] = 'remove'; |
1231 | 1231 | $this->pending['fees'][] = $removed_fee; |
1232 | 1232 | |
1233 | - $this->decrease_fees( $removed_fee['amount'] ); |
|
1233 | + $this->decrease_fees($removed_fee['amount']); |
|
1234 | 1234 | |
1235 | - unset( $this->fees[ $value ] ); |
|
1235 | + unset($this->fees[$value]); |
|
1236 | 1236 | $removed = true; |
1237 | 1237 | |
1238 | - } elseif ( 'index' !== $key ) { |
|
1238 | + } elseif ('index' !== $key) { |
|
1239 | 1239 | |
1240 | - foreach ( $this->fees as $index => $fee ) { |
|
1240 | + foreach ($this->fees as $index => $fee) { |
|
1241 | 1241 | |
1242 | - if ( isset( $fee[ $key ] ) && $fee[ $key ] == $value ) { |
|
1242 | + if (isset($fee[$key]) && $fee[$key] == $value) { |
|
1243 | 1243 | |
1244 | 1244 | $removed_fee = $fee; |
1245 | 1245 | $removed_fee['action'] = 'remove'; |
1246 | 1246 | $this->pending['fees'][] = $removed_fee; |
1247 | 1247 | |
1248 | - $this->decrease_fees( $removed_fee['amount'] ); |
|
1248 | + $this->decrease_fees($removed_fee['amount']); |
|
1249 | 1249 | |
1250 | - unset( $this->fees[ $index ] ); |
|
1250 | + unset($this->fees[$index]); |
|
1251 | 1251 | $removed = true; |
1252 | 1252 | |
1253 | - if ( false === $global ) { |
|
1253 | + if (false === $global) { |
|
1254 | 1254 | break; |
1255 | 1255 | } |
1256 | 1256 | } |
1257 | 1257 | } |
1258 | 1258 | } |
1259 | 1259 | |
1260 | - if ( true === $removed ) { |
|
1261 | - $this->fees = array_values( $this->fees ); |
|
1260 | + if (true === $removed) { |
|
1261 | + $this->fees = array_values($this->fees); |
|
1262 | 1262 | } |
1263 | 1263 | |
1264 | 1264 | return $removed; |
@@ -1274,14 +1274,14 @@ discard block |
||
1274 | 1274 | * |
1275 | 1275 | * @return array The Fees for the type specified |
1276 | 1276 | */ |
1277 | - public function get_fees( $type = 'all' ) { |
|
1277 | + public function get_fees($type = 'all') { |
|
1278 | 1278 | $fees = array(); |
1279 | 1279 | |
1280 | - if ( ! empty( $this->fees ) && is_array( $this->fees ) ) { |
|
1280 | + if ( ! empty($this->fees) && is_array($this->fees)) { |
|
1281 | 1281 | |
1282 | - foreach ( $this->fees as $fee_id => $fee ) { |
|
1282 | + foreach ($this->fees as $fee_id => $fee) { |
|
1283 | 1283 | |
1284 | - if ( 'all' != $type && ! empty( $fee['type'] ) && $type != $fee['type'] ) { |
|
1284 | + if ('all' != $type && ! empty($fee['type']) && $type != $fee['type']) { |
|
1285 | 1285 | continue; |
1286 | 1286 | } |
1287 | 1287 | |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | } |
1292 | 1292 | } |
1293 | 1293 | |
1294 | - return apply_filters( 'give_get_payment_fees', $fees, $this->ID, $this ); |
|
1294 | + return apply_filters('give_get_payment_fees', $fees, $this->ID, $this); |
|
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | /** |
@@ -1304,13 +1304,13 @@ discard block |
||
1304 | 1304 | * |
1305 | 1305 | * @return void |
1306 | 1306 | */ |
1307 | - public function add_note( $note = false ) { |
|
1307 | + public function add_note($note = false) { |
|
1308 | 1308 | // Bail if no note specified. |
1309 | - if ( ! $note ) { |
|
1309 | + if ( ! $note) { |
|
1310 | 1310 | return false; |
1311 | 1311 | } |
1312 | 1312 | |
1313 | - give_insert_payment_note( $this->ID, $note ); |
|
1313 | + give_insert_payment_note($this->ID, $note); |
|
1314 | 1314 | } |
1315 | 1315 | |
1316 | 1316 | /** |
@@ -1323,8 +1323,8 @@ discard block |
||
1323 | 1323 | * |
1324 | 1324 | * @return void |
1325 | 1325 | */ |
1326 | - private function increase_subtotal( $amount = 0.00 ) { |
|
1327 | - $amount = (float) $amount; |
|
1326 | + private function increase_subtotal($amount = 0.00) { |
|
1327 | + $amount = (float) $amount; |
|
1328 | 1328 | $this->subtotal += $amount; |
1329 | 1329 | |
1330 | 1330 | $this->recalculate_total(); |
@@ -1340,11 +1340,11 @@ discard block |
||
1340 | 1340 | * |
1341 | 1341 | * @return void |
1342 | 1342 | */ |
1343 | - private function decrease_subtotal( $amount = 0.00 ) { |
|
1344 | - $amount = (float) $amount; |
|
1343 | + private function decrease_subtotal($amount = 0.00) { |
|
1344 | + $amount = (float) $amount; |
|
1345 | 1345 | $this->subtotal -= $amount; |
1346 | 1346 | |
1347 | - if ( $this->subtotal < 0 ) { |
|
1347 | + if ($this->subtotal < 0) { |
|
1348 | 1348 | $this->subtotal = 0; |
1349 | 1349 | } |
1350 | 1350 | |
@@ -1361,8 +1361,8 @@ discard block |
||
1361 | 1361 | * |
1362 | 1362 | * @return void |
1363 | 1363 | */ |
1364 | - private function increase_fees( $amount = 0.00 ) { |
|
1365 | - $amount = (float) $amount; |
|
1364 | + private function increase_fees($amount = 0.00) { |
|
1365 | + $amount = (float) $amount; |
|
1366 | 1366 | $this->fees_total += $amount; |
1367 | 1367 | |
1368 | 1368 | $this->recalculate_total(); |
@@ -1378,11 +1378,11 @@ discard block |
||
1378 | 1378 | * |
1379 | 1379 | * @return void |
1380 | 1380 | */ |
1381 | - private function decrease_fees( $amount = 0.00 ) { |
|
1382 | - $amount = (float) $amount; |
|
1381 | + private function decrease_fees($amount = 0.00) { |
|
1382 | + $amount = (float) $amount; |
|
1383 | 1383 | $this->fees_total -= $amount; |
1384 | 1384 | |
1385 | - if ( $this->fees_total < 0 ) { |
|
1385 | + if ($this->fees_total < 0) { |
|
1386 | 1386 | $this->fees_total = 0; |
1387 | 1387 | } |
1388 | 1388 | |
@@ -1411,24 +1411,24 @@ discard block |
||
1411 | 1411 | * |
1412 | 1412 | * @return bool $updated Returns if the status was successfully updated. |
1413 | 1413 | */ |
1414 | - public function update_status( $status = false ) { |
|
1414 | + public function update_status($status = false) { |
|
1415 | 1415 | |
1416 | 1416 | // standardize the 'complete(d)' status. |
1417 | - if ( $status == 'completed' || $status == 'complete' ) { |
|
1417 | + if ($status == 'completed' || $status == 'complete') { |
|
1418 | 1418 | $status = 'publish'; |
1419 | 1419 | } |
1420 | 1420 | |
1421 | - $old_status = ! empty( $this->old_status ) ? $this->old_status : false; |
|
1421 | + $old_status = ! empty($this->old_status) ? $this->old_status : false; |
|
1422 | 1422 | |
1423 | - if ( $old_status === $status ) { |
|
1423 | + if ($old_status === $status) { |
|
1424 | 1424 | return false; // Don't permit status changes that aren't changes. |
1425 | 1425 | } |
1426 | 1426 | |
1427 | - $do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status ); |
|
1427 | + $do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status); |
|
1428 | 1428 | |
1429 | 1429 | $updated = false; |
1430 | 1430 | |
1431 | - if ( $do_change ) { |
|
1431 | + if ($do_change) { |
|
1432 | 1432 | |
1433 | 1433 | /** |
1434 | 1434 | * Fires before changing payment status. |
@@ -1439,21 +1439,21 @@ discard block |
||
1439 | 1439 | * @param string $status The new status. |
1440 | 1440 | * @param string $old_status The old status. |
1441 | 1441 | */ |
1442 | - do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status ); |
|
1442 | + do_action('give_before_payment_status_change', $this->ID, $status, $old_status); |
|
1443 | 1443 | |
1444 | 1444 | $update_fields = array( |
1445 | 1445 | 'ID' => $this->ID, |
1446 | 1446 | 'post_status' => $status, |
1447 | - 'edit_date' => current_time( 'mysql' ), |
|
1447 | + 'edit_date' => current_time('mysql'), |
|
1448 | 1448 | ); |
1449 | 1449 | |
1450 | - $updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) ); |
|
1450 | + $updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields)); |
|
1451 | 1451 | |
1452 | 1452 | $all_payment_statuses = give_get_payment_statuses(); |
1453 | - $this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status ); |
|
1453 | + $this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status); |
|
1454 | 1454 | |
1455 | 1455 | // Process any specific status functions. |
1456 | - switch ( $status ) { |
|
1456 | + switch ($status) { |
|
1457 | 1457 | case 'refunded': |
1458 | 1458 | $this->process_refund(); |
1459 | 1459 | break; |
@@ -1480,7 +1480,7 @@ discard block |
||
1480 | 1480 | * @param string $status The new status. |
1481 | 1481 | * @param string $old_status The old status. |
1482 | 1482 | */ |
1483 | - do_action( 'give_update_payment_status', $this->ID, $status, $old_status ); |
|
1483 | + do_action('give_update_payment_status', $this->ID, $status, $old_status); |
|
1484 | 1484 | |
1485 | 1485 | }// End if(). |
1486 | 1486 | |
@@ -1515,33 +1515,33 @@ discard block |
||
1515 | 1515 | * |
1516 | 1516 | * @return mixed The value from the post meta |
1517 | 1517 | */ |
1518 | - public function get_meta( $meta_key = '_give_payment_meta', $single = true ) { |
|
1518 | + public function get_meta($meta_key = '_give_payment_meta', $single = true) { |
|
1519 | 1519 | |
1520 | - $meta = give_get_meta( $this->ID, $meta_key, $single ); |
|
1520 | + $meta = give_get_meta($this->ID, $meta_key, $single); |
|
1521 | 1521 | |
1522 | - if ( $meta_key === '_give_payment_meta' ) { |
|
1522 | + if ($meta_key === '_give_payment_meta') { |
|
1523 | 1523 | $meta = (array) $meta; |
1524 | 1524 | |
1525 | - if ( empty( $meta['key'] ) ) { |
|
1525 | + if (empty($meta['key'])) { |
|
1526 | 1526 | $meta['key'] = $this->setup_payment_key(); |
1527 | 1527 | } |
1528 | 1528 | |
1529 | - if ( empty( $meta['form_title'] ) ) { |
|
1529 | + if (empty($meta['form_title'])) { |
|
1530 | 1530 | $meta['form_title'] = $this->setup_form_title(); |
1531 | 1531 | } |
1532 | 1532 | |
1533 | - if ( empty( $meta['email'] ) ) { |
|
1533 | + if (empty($meta['email'])) { |
|
1534 | 1534 | $meta['email'] = $this->setup_email(); |
1535 | 1535 | } |
1536 | 1536 | |
1537 | - if ( empty( $meta['date'] ) ) { |
|
1538 | - $meta['date'] = get_post_field( 'post_date', $this->ID ); |
|
1537 | + if (empty($meta['date'])) { |
|
1538 | + $meta['date'] = get_post_field('post_date', $this->ID); |
|
1539 | 1539 | } |
1540 | 1540 | } |
1541 | 1541 | |
1542 | - $meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID ); |
|
1542 | + $meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID); |
|
1543 | 1543 | |
1544 | - return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key ); |
|
1544 | + return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key); |
|
1545 | 1545 | } |
1546 | 1546 | |
1547 | 1547 | /** |
@@ -1556,23 +1556,23 @@ discard block |
||
1556 | 1556 | * |
1557 | 1557 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure |
1558 | 1558 | */ |
1559 | - public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) { |
|
1560 | - if ( empty( $meta_key ) ) { |
|
1559 | + public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') { |
|
1560 | + if (empty($meta_key)) { |
|
1561 | 1561 | return false; |
1562 | 1562 | } |
1563 | 1563 | |
1564 | - if ( $meta_key == 'key' || $meta_key == 'date' ) { |
|
1564 | + if ($meta_key == 'key' || $meta_key == 'date') { |
|
1565 | 1565 | |
1566 | 1566 | $current_meta = $this->get_meta(); |
1567 | - $current_meta[ $meta_key ] = $meta_value; |
|
1567 | + $current_meta[$meta_key] = $meta_value; |
|
1568 | 1568 | |
1569 | 1569 | $meta_key = '_give_payment_meta'; |
1570 | 1570 | $meta_value = $current_meta; |
1571 | 1571 | |
1572 | - } elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) { |
|
1572 | + } elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') { |
|
1573 | 1573 | |
1574 | - $meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
1575 | - give_update_meta( $this->ID, '_give_payment_user_email', $meta_value ); |
|
1574 | + $meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
1575 | + give_update_meta($this->ID, '_give_payment_user_email', $meta_value); |
|
1576 | 1576 | |
1577 | 1577 | $current_meta = $this->get_meta(); |
1578 | 1578 | $current_meta['user_info']['email'] = $meta_value; |
@@ -1582,9 +1582,9 @@ discard block |
||
1582 | 1582 | |
1583 | 1583 | } |
1584 | 1584 | |
1585 | - $meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
1585 | + $meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
1586 | 1586 | |
1587 | - return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value ); |
|
1587 | + return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value); |
|
1588 | 1588 | } |
1589 | 1589 | |
1590 | 1590 | /** |
@@ -1599,14 +1599,14 @@ discard block |
||
1599 | 1599 | $process_refund = true; |
1600 | 1600 | |
1601 | 1601 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1602 | - if ( 'publish' != $this->old_status || 'refunded' != $this->status ) { |
|
1602 | + if ('publish' != $this->old_status || 'refunded' != $this->status) { |
|
1603 | 1603 | $process_refund = false; |
1604 | 1604 | } |
1605 | 1605 | |
1606 | 1606 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1607 | - $process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this ); |
|
1607 | + $process_refund = apply_filters('give_should_process_refund', $process_refund, $this); |
|
1608 | 1608 | |
1609 | - if ( false === $process_refund ) { |
|
1609 | + if (false === $process_refund) { |
|
1610 | 1610 | return; |
1611 | 1611 | } |
1612 | 1612 | |
@@ -1617,13 +1617,13 @@ discard block |
||
1617 | 1617 | * |
1618 | 1618 | * @param Give_Payment $this Payment object. |
1619 | 1619 | */ |
1620 | - do_action( 'give_pre_refund_payment', $this ); |
|
1620 | + do_action('give_pre_refund_payment', $this); |
|
1621 | 1621 | |
1622 | - $decrease_earnings = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this ); |
|
1623 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this ); |
|
1624 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this ); |
|
1622 | + $decrease_earnings = apply_filters('give_decrease_store_earnings_on_refund', true, $this); |
|
1623 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this); |
|
1624 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this); |
|
1625 | 1625 | |
1626 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
1626 | + $this->maybe_alter_stats($decrease_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
1627 | 1627 | $this->delete_sales_logs(); |
1628 | 1628 | |
1629 | 1629 | // @todo: Refresh only range related stat cache |
@@ -1636,7 +1636,7 @@ discard block |
||
1636 | 1636 | * |
1637 | 1637 | * @param Give_Payment $this Payment object. |
1638 | 1638 | */ |
1639 | - do_action( 'give_post_refund_payment', $this ); |
|
1639 | + do_action('give_post_refund_payment', $this); |
|
1640 | 1640 | } |
1641 | 1641 | |
1642 | 1642 | /** |
@@ -1663,26 +1663,26 @@ discard block |
||
1663 | 1663 | $process_pending = true; |
1664 | 1664 | |
1665 | 1665 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1666 | - if ( 'publish' != $this->old_status || 'pending' != $this->status ) { |
|
1666 | + if ('publish' != $this->old_status || 'pending' != $this->status) { |
|
1667 | 1667 | $process_pending = false; |
1668 | 1668 | } |
1669 | 1669 | |
1670 | 1670 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1671 | - $process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this ); |
|
1671 | + $process_pending = apply_filters('give_should_process_pending', $process_pending, $this); |
|
1672 | 1672 | |
1673 | - if ( false === $process_pending ) { |
|
1673 | + if (false === $process_pending) { |
|
1674 | 1674 | return; |
1675 | 1675 | } |
1676 | 1676 | |
1677 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_pending', true, $this ); |
|
1678 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_pending', true, $this ); |
|
1679 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_pending', true, $this ); |
|
1677 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_pending', true, $this); |
|
1678 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_pending', true, $this); |
|
1679 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_pending', true, $this); |
|
1680 | 1680 | |
1681 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
1681 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
1682 | 1682 | $this->delete_sales_logs(); |
1683 | 1683 | |
1684 | 1684 | $this->completed_date = false; |
1685 | - $this->update_meta( '_give_completed_date', '' ); |
|
1685 | + $this->update_meta('_give_completed_date', ''); |
|
1686 | 1686 | |
1687 | 1687 | // @todo: Refresh only range related stat cache |
1688 | 1688 | give_delete_donation_stats(); |
@@ -1700,26 +1700,26 @@ discard block |
||
1700 | 1700 | $process_cancelled = true; |
1701 | 1701 | |
1702 | 1702 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1703 | - if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) { |
|
1703 | + if ('publish' != $this->old_status || 'cancelled' != $this->status) { |
|
1704 | 1704 | $process_cancelled = false; |
1705 | 1705 | } |
1706 | 1706 | |
1707 | 1707 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1708 | - $process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this ); |
|
1708 | + $process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this); |
|
1709 | 1709 | |
1710 | - if ( false === $process_cancelled ) { |
|
1710 | + if (false === $process_cancelled) { |
|
1711 | 1711 | return; |
1712 | 1712 | } |
1713 | 1713 | |
1714 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_cancelled', true, $this ); |
|
1715 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_cancelled', true, $this ); |
|
1716 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_cancelled', true, $this ); |
|
1714 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_cancelled', true, $this); |
|
1715 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_cancelled', true, $this); |
|
1716 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_cancelled', true, $this); |
|
1717 | 1717 | |
1718 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
1718 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
1719 | 1719 | $this->delete_sales_logs(); |
1720 | 1720 | |
1721 | 1721 | $this->completed_date = false; |
1722 | - $this->update_meta( '_give_completed_date', '' ); |
|
1722 | + $this->update_meta('_give_completed_date', ''); |
|
1723 | 1723 | |
1724 | 1724 | // @todo: Refresh only range related stat cache |
1725 | 1725 | give_delete_donation_stats(); |
@@ -1735,26 +1735,26 @@ discard block |
||
1735 | 1735 | $process_revoked = true; |
1736 | 1736 | |
1737 | 1737 | // If the payment was not in publish, don't decrement stats as they were never incremented. |
1738 | - if ( 'publish' != $this->old_status || 'revoked' != $this->status ) { |
|
1738 | + if ('publish' != $this->old_status || 'revoked' != $this->status) { |
|
1739 | 1739 | $process_revoked = false; |
1740 | 1740 | } |
1741 | 1741 | |
1742 | 1742 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1743 | - $process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this ); |
|
1743 | + $process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this); |
|
1744 | 1744 | |
1745 | - if ( false === $process_revoked ) { |
|
1745 | + if (false === $process_revoked) { |
|
1746 | 1746 | return; |
1747 | 1747 | } |
1748 | 1748 | |
1749 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_revoked', true, $this ); |
|
1750 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_revoked', true, $this ); |
|
1751 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_revoked', true, $this ); |
|
1749 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_revoked', true, $this); |
|
1750 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_revoked', true, $this); |
|
1751 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_revoked', true, $this); |
|
1752 | 1752 | |
1753 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
1753 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
1754 | 1754 | $this->delete_sales_logs(); |
1755 | 1755 | |
1756 | 1756 | $this->completed_date = false; |
1757 | - $this->update_meta( '_give_completed_date', '' ); |
|
1757 | + $this->update_meta('_give_completed_date', ''); |
|
1758 | 1758 | |
1759 | 1759 | // @todo: Refresh only range related stat cache |
1760 | 1760 | give_delete_donation_stats(); |
@@ -1772,25 +1772,25 @@ discard block |
||
1772 | 1772 | * |
1773 | 1773 | * @return void |
1774 | 1774 | */ |
1775 | - private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) { |
|
1775 | + private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) { |
|
1776 | 1776 | |
1777 | - give_undo_purchase( false, $this->ID ); |
|
1777 | + give_undo_purchase(false, $this->ID); |
|
1778 | 1778 | |
1779 | 1779 | // Decrease store earnings. |
1780 | - if ( true === $alter_store_earnings ) { |
|
1781 | - give_decrease_total_earnings( $this->total ); |
|
1780 | + if (true === $alter_store_earnings) { |
|
1781 | + give_decrease_total_earnings($this->total); |
|
1782 | 1782 | } |
1783 | 1783 | |
1784 | 1784 | // Decrement the stats for the customer. |
1785 | - if ( ! empty( $this->customer_id ) ) { |
|
1785 | + if ( ! empty($this->customer_id)) { |
|
1786 | 1786 | |
1787 | - $customer = new Give_Customer( $this->customer_id ); |
|
1787 | + $customer = new Give_Customer($this->customer_id); |
|
1788 | 1788 | |
1789 | - if ( true === $alter_customer_value ) { |
|
1790 | - $customer->decrease_value( $this->total ); |
|
1789 | + if (true === $alter_customer_value) { |
|
1790 | + $customer->decrease_value($this->total); |
|
1791 | 1791 | } |
1792 | 1792 | |
1793 | - if ( true === $alter_customer_purchase_count ) { |
|
1793 | + if (true === $alter_customer_purchase_count) { |
|
1794 | 1794 | $customer->decrease_purchase_count(); |
1795 | 1795 | } |
1796 | 1796 | } |
@@ -1839,13 +1839,13 @@ discard block |
||
1839 | 1839 | * @return string The date the payment was completed |
1840 | 1840 | */ |
1841 | 1841 | private function setup_completed_date() { |
1842 | - $payment = get_post( $this->ID ); |
|
1842 | + $payment = get_post($this->ID); |
|
1843 | 1843 | |
1844 | - if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) { |
|
1844 | + if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) { |
|
1845 | 1845 | return false; // This payment was never completed. |
1846 | 1846 | } |
1847 | 1847 | |
1848 | - $date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date; |
|
1848 | + $date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date; |
|
1849 | 1849 | |
1850 | 1850 | return $date; |
1851 | 1851 | } |
@@ -1859,7 +1859,7 @@ discard block |
||
1859 | 1859 | * @return string The payment mode |
1860 | 1860 | */ |
1861 | 1861 | private function setup_mode() { |
1862 | - return $this->get_meta( '_give_payment_mode' ); |
|
1862 | + return $this->get_meta('_give_payment_mode'); |
|
1863 | 1863 | } |
1864 | 1864 | |
1865 | 1865 | /** |
@@ -1871,18 +1871,18 @@ discard block |
||
1871 | 1871 | * @return float The payment total |
1872 | 1872 | */ |
1873 | 1873 | private function setup_total() { |
1874 | - $amount = $this->get_meta( '_give_payment_total', true ); |
|
1874 | + $amount = $this->get_meta('_give_payment_total', true); |
|
1875 | 1875 | |
1876 | - if ( empty( $amount ) && '0.00' != $amount ) { |
|
1877 | - $meta = $this->get_meta( '_give_payment_meta', true ); |
|
1878 | - $meta = maybe_unserialize( $meta ); |
|
1876 | + if (empty($amount) && '0.00' != $amount) { |
|
1877 | + $meta = $this->get_meta('_give_payment_meta', true); |
|
1878 | + $meta = maybe_unserialize($meta); |
|
1879 | 1879 | |
1880 | - if ( isset( $meta['amount'] ) ) { |
|
1880 | + if (isset($meta['amount'])) { |
|
1881 | 1881 | $amount = $meta['amount']; |
1882 | 1882 | } |
1883 | 1883 | } |
1884 | 1884 | |
1885 | - return round( floatval( $amount ), give_currency_decimal_filter() ); |
|
1885 | + return round(floatval($amount), give_currency_decimal_filter()); |
|
1886 | 1886 | } |
1887 | 1887 | |
1888 | 1888 | /** |
@@ -1910,9 +1910,9 @@ discard block |
||
1910 | 1910 | private function setup_fees_total() { |
1911 | 1911 | $fees_total = (float) 0.00; |
1912 | 1912 | |
1913 | - $payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array(); |
|
1914 | - if ( ! empty( $payment_fees ) ) { |
|
1915 | - foreach ( $payment_fees as $fee ) { |
|
1913 | + $payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array(); |
|
1914 | + if ( ! empty($payment_fees)) { |
|
1915 | + foreach ($payment_fees as $fee) { |
|
1916 | 1916 | $fees_total += (float) $fee['amount']; |
1917 | 1917 | } |
1918 | 1918 | } |
@@ -1930,7 +1930,7 @@ discard block |
||
1930 | 1930 | * @return string The currency for the payment |
1931 | 1931 | */ |
1932 | 1932 | private function setup_currency() { |
1933 | - $currency = isset( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency(), $this ); |
|
1933 | + $currency = isset($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency(), $this); |
|
1934 | 1934 | |
1935 | 1935 | return $currency; |
1936 | 1936 | } |
@@ -1944,7 +1944,7 @@ discard block |
||
1944 | 1944 | * @return array The Fees |
1945 | 1945 | */ |
1946 | 1946 | private function setup_fees() { |
1947 | - $payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array(); |
|
1947 | + $payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array(); |
|
1948 | 1948 | |
1949 | 1949 | return $payment_fees; |
1950 | 1950 | } |
@@ -1958,7 +1958,7 @@ discard block |
||
1958 | 1958 | * @return string The gateway |
1959 | 1959 | */ |
1960 | 1960 | private function setup_gateway() { |
1961 | - $gateway = $this->get_meta( '_give_payment_gateway', true ); |
|
1961 | + $gateway = $this->get_meta('_give_payment_gateway', true); |
|
1962 | 1962 | |
1963 | 1963 | return $gateway; |
1964 | 1964 | } |
@@ -1972,11 +1972,11 @@ discard block |
||
1972 | 1972 | * @return string The donation ID |
1973 | 1973 | */ |
1974 | 1974 | private function setup_transaction_id() { |
1975 | - $transaction_id = $this->get_meta( '_give_payment_transaction_id', true ); |
|
1975 | + $transaction_id = $this->get_meta('_give_payment_transaction_id', true); |
|
1976 | 1976 | |
1977 | - if ( empty( $transaction_id ) ) { |
|
1977 | + if (empty($transaction_id)) { |
|
1978 | 1978 | $gateway = $this->gateway; |
1979 | - $transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID ); |
|
1979 | + $transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID); |
|
1980 | 1980 | } |
1981 | 1981 | |
1982 | 1982 | return $transaction_id; |
@@ -1991,7 +1991,7 @@ discard block |
||
1991 | 1991 | * @return string The IP address for the payment |
1992 | 1992 | */ |
1993 | 1993 | private function setup_ip() { |
1994 | - $ip = $this->get_meta( '_give_payment_user_ip', true ); |
|
1994 | + $ip = $this->get_meta('_give_payment_user_ip', true); |
|
1995 | 1995 | |
1996 | 1996 | return $ip; |
1997 | 1997 | } |
@@ -2005,7 +2005,7 @@ discard block |
||
2005 | 2005 | * @return int The Customer ID |
2006 | 2006 | */ |
2007 | 2007 | private function setup_customer_id() { |
2008 | - $customer_id = $this->get_meta( '_give_payment_customer_id', true ); |
|
2008 | + $customer_id = $this->get_meta('_give_payment_customer_id', true); |
|
2009 | 2009 | |
2010 | 2010 | return $customer_id; |
2011 | 2011 | } |
@@ -2019,7 +2019,7 @@ discard block |
||
2019 | 2019 | * @return int The User ID |
2020 | 2020 | */ |
2021 | 2021 | private function setup_user_id() { |
2022 | - $user_id = $this->get_meta( '_give_payment_user_id', true ); |
|
2022 | + $user_id = $this->get_meta('_give_payment_user_id', true); |
|
2023 | 2023 | |
2024 | 2024 | return $user_id; |
2025 | 2025 | } |
@@ -2033,10 +2033,10 @@ discard block |
||
2033 | 2033 | * @return string The email address for the payment |
2034 | 2034 | */ |
2035 | 2035 | private function setup_email() { |
2036 | - $email = $this->get_meta( '_give_payment_user_email', true ); |
|
2036 | + $email = $this->get_meta('_give_payment_user_email', true); |
|
2037 | 2037 | |
2038 | - if ( empty( $email ) ) { |
|
2039 | - $email = Give()->customers->get_column( 'email', $this->customer_id ); |
|
2038 | + if (empty($email)) { |
|
2039 | + $email = Give()->customers->get_column('email', $this->customer_id); |
|
2040 | 2040 | } |
2041 | 2041 | |
2042 | 2042 | return $email; |
@@ -2056,15 +2056,15 @@ discard block |
||
2056 | 2056 | 'last_name' => $this->last_name, |
2057 | 2057 | ); |
2058 | 2058 | |
2059 | - $user_info = isset( $this->payment_meta['user_info'] ) ? maybe_unserialize( $this->payment_meta['user_info'] ) : array(); |
|
2060 | - $user_info = wp_parse_args( $user_info, $defaults ); |
|
2059 | + $user_info = isset($this->payment_meta['user_info']) ? maybe_unserialize($this->payment_meta['user_info']) : array(); |
|
2060 | + $user_info = wp_parse_args($user_info, $defaults); |
|
2061 | 2061 | |
2062 | - if ( empty( $user_info ) ) { |
|
2062 | + if (empty($user_info)) { |
|
2063 | 2063 | // Get the customer, but only if it's been created. |
2064 | - $customer = new Give_Customer( $this->customer_id ); |
|
2064 | + $customer = new Give_Customer($this->customer_id); |
|
2065 | 2065 | |
2066 | - if ( $customer->id > 0 ) { |
|
2067 | - $name = explode( ' ', $customer->name, 2 ); |
|
2066 | + if ($customer->id > 0) { |
|
2067 | + $name = explode(' ', $customer->name, 2); |
|
2068 | 2068 | $user_info = array( |
2069 | 2069 | 'first_name' => $name[0], |
2070 | 2070 | 'last_name' => $name[1], |
@@ -2074,29 +2074,29 @@ discard block |
||
2074 | 2074 | } |
2075 | 2075 | } else { |
2076 | 2076 | // Get the customer, but only if it's been created. |
2077 | - $customer = new Give_Customer( $this->customer_id ); |
|
2078 | - if ( $customer->id > 0 ) { |
|
2079 | - foreach ( $user_info as $key => $value ) { |
|
2080 | - if ( ! empty( $value ) ) { |
|
2077 | + $customer = new Give_Customer($this->customer_id); |
|
2078 | + if ($customer->id > 0) { |
|
2079 | + foreach ($user_info as $key => $value) { |
|
2080 | + if ( ! empty($value)) { |
|
2081 | 2081 | continue; |
2082 | 2082 | } |
2083 | 2083 | |
2084 | - switch ( $key ) { |
|
2084 | + switch ($key) { |
|
2085 | 2085 | case 'first_name': |
2086 | - $name = explode( ' ', $customer->name, 2 ); |
|
2086 | + $name = explode(' ', $customer->name, 2); |
|
2087 | 2087 | |
2088 | - $user_info[ $key ] = $name[0]; |
|
2088 | + $user_info[$key] = $name[0]; |
|
2089 | 2089 | break; |
2090 | 2090 | |
2091 | 2091 | case 'last_name': |
2092 | - $name = explode( ' ', $customer->name, 2 ); |
|
2093 | - $last_name = ! empty( $name[1] ) ? $name[1] : ''; |
|
2092 | + $name = explode(' ', $customer->name, 2); |
|
2093 | + $last_name = ! empty($name[1]) ? $name[1] : ''; |
|
2094 | 2094 | |
2095 | - $user_info[ $key ] = $last_name; |
|
2095 | + $user_info[$key] = $last_name; |
|
2096 | 2096 | break; |
2097 | 2097 | |
2098 | 2098 | case 'email': |
2099 | - $user_info[ $key ] = $customer->email; |
|
2099 | + $user_info[$key] = $customer->email; |
|
2100 | 2100 | break; |
2101 | 2101 | } |
2102 | 2102 | } |
@@ -2117,7 +2117,7 @@ discard block |
||
2117 | 2117 | */ |
2118 | 2118 | private function setup_address() { |
2119 | 2119 | |
2120 | - $address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array( |
|
2120 | + $address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array( |
|
2121 | 2121 | 'line1' => '', |
2122 | 2122 | 'line2' => '', |
2123 | 2123 | 'city' => '', |
@@ -2139,7 +2139,7 @@ discard block |
||
2139 | 2139 | */ |
2140 | 2140 | private function setup_form_title() { |
2141 | 2141 | |
2142 | - $form_id = $this->get_meta( '_give_payment_form_title', true ); |
|
2142 | + $form_id = $this->get_meta('_give_payment_form_title', true); |
|
2143 | 2143 | |
2144 | 2144 | return $form_id; |
2145 | 2145 | } |
@@ -2154,7 +2154,7 @@ discard block |
||
2154 | 2154 | */ |
2155 | 2155 | private function setup_form_id() { |
2156 | 2156 | |
2157 | - $form_id = $this->get_meta( '_give_payment_form_id', true ); |
|
2157 | + $form_id = $this->get_meta('_give_payment_form_id', true); |
|
2158 | 2158 | |
2159 | 2159 | return $form_id; |
2160 | 2160 | } |
@@ -2168,7 +2168,7 @@ discard block |
||
2168 | 2168 | * @return int The Form Price ID |
2169 | 2169 | */ |
2170 | 2170 | private function setup_price_id() { |
2171 | - $price_id = $this->get_meta( '_give_payment_price_id', true ); |
|
2171 | + $price_id = $this->get_meta('_give_payment_price_id', true); |
|
2172 | 2172 | |
2173 | 2173 | return $price_id; |
2174 | 2174 | } |
@@ -2182,7 +2182,7 @@ discard block |
||
2182 | 2182 | * @return string The Payment Key |
2183 | 2183 | */ |
2184 | 2184 | private function setup_payment_key() { |
2185 | - $key = $this->get_meta( '_give_payment_purchase_key', true ); |
|
2185 | + $key = $this->get_meta('_give_payment_purchase_key', true); |
|
2186 | 2186 | |
2187 | 2187 | return $key; |
2188 | 2188 | } |
@@ -2198,11 +2198,11 @@ discard block |
||
2198 | 2198 | private function setup_payment_number() { |
2199 | 2199 | $number = $this->ID; |
2200 | 2200 | |
2201 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
2201 | + if (give_get_option('enable_sequential')) { |
|
2202 | 2202 | |
2203 | - $number = $this->get_meta( '_give_payment_number', true ); |
|
2203 | + $number = $this->get_meta('_give_payment_number', true); |
|
2204 | 2204 | |
2205 | - if ( ! $number ) { |
|
2205 | + if ( ! $number) { |
|
2206 | 2206 | |
2207 | 2207 | $number = $this->ID; |
2208 | 2208 | |
@@ -2220,7 +2220,7 @@ discard block |
||
2220 | 2220 | * @return array The payment object as an array |
2221 | 2221 | */ |
2222 | 2222 | public function array_convert() { |
2223 | - return get_object_vars( $this ); |
|
2223 | + return get_object_vars($this); |
|
2224 | 2224 | } |
2225 | 2225 | |
2226 | 2226 | |
@@ -2233,7 +2233,7 @@ discard block |
||
2233 | 2233 | * @return bool |
2234 | 2234 | */ |
2235 | 2235 | public function is_completed() { |
2236 | - return ( 'publish' === $this->status && $this->completed_date ); |
|
2236 | + return ('publish' === $this->status && $this->completed_date); |
|
2237 | 2237 | } |
2238 | 2238 | |
2239 | 2239 | /** |
@@ -2245,7 +2245,7 @@ discard block |
||
2245 | 2245 | * @return string Date payment was completed |
2246 | 2246 | */ |
2247 | 2247 | private function get_completed_date() { |
2248 | - return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this ); |
|
2248 | + return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this); |
|
2249 | 2249 | } |
2250 | 2250 | |
2251 | 2251 | /** |
@@ -2257,7 +2257,7 @@ discard block |
||
2257 | 2257 | * @return float Payment subtotal |
2258 | 2258 | */ |
2259 | 2259 | private function get_subtotal() { |
2260 | - return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this ); |
|
2260 | + return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this); |
|
2261 | 2261 | } |
2262 | 2262 | |
2263 | 2263 | /** |
@@ -2269,7 +2269,7 @@ discard block |
||
2269 | 2269 | * @return string Payment currency code |
2270 | 2270 | */ |
2271 | 2271 | private function get_currency() { |
2272 | - return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this ); |
|
2272 | + return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this); |
|
2273 | 2273 | } |
2274 | 2274 | |
2275 | 2275 | /** |
@@ -2281,7 +2281,7 @@ discard block |
||
2281 | 2281 | * @return string Gateway used |
2282 | 2282 | */ |
2283 | 2283 | private function get_gateway() { |
2284 | - return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this ); |
|
2284 | + return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this); |
|
2285 | 2285 | } |
2286 | 2286 | |
2287 | 2287 | /** |
@@ -2293,7 +2293,7 @@ discard block |
||
2293 | 2293 | * @return string Donation ID from merchant processor |
2294 | 2294 | */ |
2295 | 2295 | private function get_transaction_id() { |
2296 | - return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this ); |
|
2296 | + return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this); |
|
2297 | 2297 | } |
2298 | 2298 | |
2299 | 2299 | /** |
@@ -2305,7 +2305,7 @@ discard block |
||
2305 | 2305 | * @return string Payment IP address |
2306 | 2306 | */ |
2307 | 2307 | private function get_ip() { |
2308 | - return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this ); |
|
2308 | + return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this); |
|
2309 | 2309 | } |
2310 | 2310 | |
2311 | 2311 | /** |
@@ -2317,7 +2317,7 @@ discard block |
||
2317 | 2317 | * @return int Payment customer ID |
2318 | 2318 | */ |
2319 | 2319 | private function get_customer_id() { |
2320 | - return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this ); |
|
2320 | + return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this); |
|
2321 | 2321 | } |
2322 | 2322 | |
2323 | 2323 | /** |
@@ -2329,7 +2329,7 @@ discard block |
||
2329 | 2329 | * @return int Payment user ID |
2330 | 2330 | */ |
2331 | 2331 | private function get_user_id() { |
2332 | - return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this ); |
|
2332 | + return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this); |
|
2333 | 2333 | } |
2334 | 2334 | |
2335 | 2335 | /** |
@@ -2341,7 +2341,7 @@ discard block |
||
2341 | 2341 | * @return string Payment customer email |
2342 | 2342 | */ |
2343 | 2343 | private function get_email() { |
2344 | - return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this ); |
|
2344 | + return apply_filters('give_payment_user_email', $this->email, $this->ID, $this); |
|
2345 | 2345 | } |
2346 | 2346 | |
2347 | 2347 | /** |
@@ -2353,7 +2353,7 @@ discard block |
||
2353 | 2353 | * @return array Payment user info |
2354 | 2354 | */ |
2355 | 2355 | private function get_user_info() { |
2356 | - return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this ); |
|
2356 | + return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this); |
|
2357 | 2357 | } |
2358 | 2358 | |
2359 | 2359 | /** |
@@ -2365,7 +2365,7 @@ discard block |
||
2365 | 2365 | * @return array Payment billing address |
2366 | 2366 | */ |
2367 | 2367 | private function get_address() { |
2368 | - return apply_filters( 'give_payment_address', $this->address, $this->ID, $this ); |
|
2368 | + return apply_filters('give_payment_address', $this->address, $this->ID, $this); |
|
2369 | 2369 | } |
2370 | 2370 | |
2371 | 2371 | /** |
@@ -2377,7 +2377,7 @@ discard block |
||
2377 | 2377 | * @return string Payment key |
2378 | 2378 | */ |
2379 | 2379 | private function get_key() { |
2380 | - return apply_filters( 'give_payment_key', $this->key, $this->ID, $this ); |
|
2380 | + return apply_filters('give_payment_key', $this->key, $this->ID, $this); |
|
2381 | 2381 | } |
2382 | 2382 | |
2383 | 2383 | /** |
@@ -2389,7 +2389,7 @@ discard block |
||
2389 | 2389 | * @return string Payment form id |
2390 | 2390 | */ |
2391 | 2391 | private function get_form_id() { |
2392 | - return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this ); |
|
2392 | + return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this); |
|
2393 | 2393 | } |
2394 | 2394 | |
2395 | 2395 | /** |
@@ -2401,7 +2401,7 @@ discard block |
||
2401 | 2401 | * @return int|string Payment number |
2402 | 2402 | */ |
2403 | 2403 | private function get_number() { |
2404 | - return apply_filters( 'give_payment_number', $this->number, $this->ID, $this ); |
|
2404 | + return apply_filters('give_payment_number', $this->number, $this->ID, $this); |
|
2405 | 2405 | } |
2406 | 2406 | |
2407 | 2407 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @see Give_Cron::weekly_events() |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
|
38 | - add_action( 'wp', array( $this, 'schedule_Events' ) ); |
|
37 | + add_filter('cron_schedules', array($this, 'add_schedules')); |
|
38 | + add_action('wp', array($this, 'schedule_Events')); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array An array of non-default cron schedules. |
50 | 50 | */ |
51 | - public function add_schedules( $schedules = array() ) { |
|
51 | + public function add_schedules($schedules = array()) { |
|
52 | 52 | // Adds once weekly to the existing schedules. |
53 | 53 | $schedules['weekly'] = array( |
54 | 54 | 'interval' => 604800, |
55 | - 'display' => esc_html__( 'Once Weekly', 'give' ) |
|
55 | + 'display' => esc_html__('Once Weekly', 'give') |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | return $schedules; |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | private function weekly_events() { |
83 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
84 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
83 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
84 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @return void |
95 | 95 | */ |
96 | 96 | private function daily_events() { |
97 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
98 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
97 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
98 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | 'default' => get_bloginfo( 'admin_email' ), |
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | - array( |
|
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | - 'id' => 'email_settings_docs_link', |
|
85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
87 | - 'type' => 'give_docs_link', |
|
88 | - ), |
|
82 | + array( |
|
83 | + 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | + 'id' => 'email_settings_docs_link', |
|
85 | + 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | + 'title' => __( 'Email Settings', 'give' ), |
|
87 | + 'type' => 'give_docs_link', |
|
88 | + ), |
|
89 | 89 | array( |
90 | 90 | 'id' => 'give_title_email_settings_1', |
91 | 91 | 'type' => 'sectionend' |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | - array( |
|
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | - 'id' => 'donation_receipt_settings_docs_link', |
|
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | - 'type' => 'give_docs_link', |
|
127 | - ), |
|
121 | + array( |
|
122 | + 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | + 'id' => 'donation_receipt_settings_docs_link', |
|
124 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | + 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | + 'type' => 'give_docs_link', |
|
127 | + ), |
|
128 | 128 | array( |
129 | 129 | 'id' => 'give_title_email_settings_2', |
130 | 130 | 'type' => 'sectionend' |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | 'type' => 'textarea', |
176 | 176 | 'default' => get_bloginfo( 'admin_email' ) |
177 | 177 | ), |
178 | - array( |
|
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | - 'id' => 'donation_notification_settings_docs_link', |
|
181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | - 'type' => 'give_docs_link', |
|
184 | - ), |
|
178 | + array( |
|
179 | + 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | + 'id' => 'donation_notification_settings_docs_link', |
|
181 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | + 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | + 'type' => 'give_docs_link', |
|
184 | + ), |
|
185 | 185 | array( |
186 | 186 | 'id' => 'give_title_email_settings_3', |
187 | 187 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Email' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Email')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Email. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'emails'; |
30 | - $this->label = esc_html__( 'Emails', 'give' ); |
|
30 | + $this->label = esc_html__('Emails', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'email-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'email-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Email |
@@ -54,36 +54,36 @@ discard block |
||
54 | 54 | ), |
55 | 55 | array( |
56 | 56 | 'id' => 'email_template', |
57 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
58 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
57 | + 'name' => esc_html__('Email Template', 'give'), |
|
58 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
59 | 59 | 'type' => 'select', |
60 | 60 | 'options' => give_get_email_templates() |
61 | 61 | ), |
62 | 62 | array( |
63 | 63 | 'id' => 'email_logo', |
64 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
65 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
64 | + 'name' => esc_html__('Logo', 'give'), |
|
65 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
66 | 66 | 'type' => 'file' |
67 | 67 | ), |
68 | 68 | array( |
69 | 69 | 'id' => 'from_name', |
70 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
71 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
72 | - 'default' => get_bloginfo( 'name' ), |
|
70 | + 'name' => esc_html__('From Name', 'give'), |
|
71 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
72 | + 'default' => get_bloginfo('name'), |
|
73 | 73 | 'type' => 'text' |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'id' => 'from_email', |
77 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
78 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
79 | - 'default' => get_bloginfo( 'admin_email' ), |
|
77 | + 'name' => esc_html__('From Email', 'give'), |
|
78 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
79 | + 'default' => get_bloginfo('admin_email'), |
|
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | 82 | array( |
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
83 | + 'name' => esc_html__('Email Settings Docs Link', 'give'), |
|
84 | 84 | 'id' => 'email_settings_docs_link', |
85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
85 | + 'url' => esc_url('http://docs.givewp.com/settings-emails'), |
|
86 | + 'title' => __('Email Settings', 'give'), |
|
87 | 87 | 'type' => 'give_docs_link', |
88 | 88 | ), |
89 | 89 | array( |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | ), |
103 | 103 | array( |
104 | 104 | 'id' => 'donation_subject', |
105 | - 'name' => esc_html__( 'Donation Email Subject', 'give' ), |
|
106 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
107 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
105 | + 'name' => esc_html__('Donation Email Subject', 'give'), |
|
106 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
107 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
108 | 108 | 'type' => 'text' |
109 | 109 | ), |
110 | 110 | array( |
111 | 111 | 'id' => 'donation_receipt', |
112 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
112 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
113 | 113 | 'desc' => sprintf( |
114 | 114 | /* translators: %s: emails tags list */ |
115 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give' ), |
|
115 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give'), |
|
116 | 116 | '<br/>'.give_get_emails_tags_list() |
117 | 117 | ), |
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
122 | + 'name' => esc_html__('Donation Receipt Settings Docs Link', 'give'), |
|
123 | 123 | 'id' => 'donation_receipt_settings_docs_link', |
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
124 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-receipt'), |
|
125 | + 'title' => __('Donation Receipt Settings', 'give'), |
|
126 | 126 | 'type' => 'give_docs_link', |
127 | 127 | ), |
128 | 128 | array( |
@@ -141,28 +141,28 @@ discard block |
||
141 | 141 | ), |
142 | 142 | array( |
143 | 143 | 'id' => 'admin_notices', |
144 | - 'name' => esc_html__( 'Admin Notifications', 'give' ), |
|
145 | - 'desc' => esc_html__( 'Enable/Disable all admin notifications from Give completely.', 'give' ), |
|
144 | + 'name' => esc_html__('Admin Notifications', 'give'), |
|
145 | + 'desc' => esc_html__('Enable/Disable all admin notifications from Give completely.', 'give'), |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'enabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ) |
152 | 152 | ), |
153 | 153 | array( |
154 | 154 | 'id' => 'donation_notification_subject', |
155 | - 'name' => esc_html__( 'Donation Notification Subject', 'give' ), |
|
156 | - 'desc' => esc_html__( 'Enter the subject line for the admin donation notification email.', 'give' ), |
|
155 | + 'name' => esc_html__('Donation Notification Subject', 'give'), |
|
156 | + 'desc' => esc_html__('Enter the subject line for the admin donation notification email.', 'give'), |
|
157 | 157 | 'type' => 'text', |
158 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ) |
|
158 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give') |
|
159 | 159 | ), |
160 | 160 | array( |
161 | 161 | 'id' => 'donation_notification', |
162 | - 'name' => esc_html__( 'Donation Notification', 'give' ), |
|
162 | + 'name' => esc_html__('Donation Notification', 'give'), |
|
163 | 163 | 'desc' => sprintf( |
164 | 164 | /* translators: %s: emails tags list */ |
165 | - __( 'Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give' ), |
|
165 | + __('Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give'), |
|
166 | 166 | '<br/>'.give_get_emails_tags_list() |
167 | 167 | ), |
168 | 168 | 'type' => 'wysiwyg', |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | ), |
171 | 171 | array( |
172 | 172 | 'id' => 'admin_notice_emails', |
173 | - 'name' => esc_html__( 'Donation Notification Emails', 'give' ), |
|
174 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
173 | + 'name' => esc_html__('Donation Notification Emails', 'give'), |
|
174 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
175 | 175 | 'type' => 'textarea', |
176 | - 'default' => get_bloginfo( 'admin_email' ) |
|
176 | + 'default' => get_bloginfo('admin_email') |
|
177 | 177 | ), |
178 | 178 | array( |
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
179 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
180 | 180 | 'id' => 'donation_notification_settings_docs_link', |
181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
181 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-notification'), |
|
182 | + 'title' => __('Donation Notification Settings', 'give'), |
|
183 | 183 | 'type' => 'give_docs_link', |
184 | 184 | ), |
185 | 185 | array( |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * Filter the emails settings. |
195 | 195 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
196 | 196 | */ |
197 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
197 | + $settings = apply_filters('give_settings_emails', $settings); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Filter the settings. |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @since 1.8 |
203 | 203 | * @param array $settings |
204 | 204 | */ |
205 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
205 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
206 | 206 | |
207 | 207 | // Output. |
208 | 208 | return $settings; |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function get_sections() { |
218 | 218 | $sections = array( |
219 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
220 | - 'donation-receipt' => esc_html__( 'Donation Receipt', 'give' ), |
|
221 | - 'new-donation-notification' => esc_html__( 'New Donation Notification', 'give' ) |
|
219 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
220 | + 'donation-receipt' => esc_html__('Donation Receipt', 'give'), |
|
221 | + 'new-donation-notification' => esc_html__('New Donation Notification', 'give') |
|
222 | 222 | ); |
223 | 223 | |
224 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
224 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Profile Editor', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'give_profile_editor' ); |
|
26 | + parent::__construct('give_profile_editor'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Receipt', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Receipt', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_receipt' ); |
|
30 | + parent::__construct('give_receipt'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -40,60 +40,60 @@ discard block |
||
40 | 40 | return array( |
41 | 41 | array( |
42 | 42 | 'type' => 'container', |
43 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
43 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')), |
|
44 | 44 | ), |
45 | 45 | array( |
46 | 46 | 'type' => 'listbox', |
47 | 47 | 'name' => 'price', |
48 | - 'label' => esc_html__( 'Show Donation Amount:', 'give' ), |
|
48 | + 'label' => esc_html__('Show Donation Amount:', 'give'), |
|
49 | 49 | 'options' => array( |
50 | - 'true' => esc_html__( 'Show', 'give' ), |
|
51 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
50 | + 'true' => esc_html__('Show', 'give'), |
|
51 | + 'false' => esc_html__('Hide', 'give'), |
|
52 | 52 | ), |
53 | 53 | ), |
54 | 54 | array( |
55 | 55 | 'type' => 'listbox', |
56 | 56 | 'name' => 'donor', |
57 | - 'label' => esc_html__( 'Show Donor Name:', 'give' ), |
|
57 | + 'label' => esc_html__('Show Donor Name:', 'give'), |
|
58 | 58 | 'options' => array( |
59 | - 'true' => esc_html__( 'Show', 'give' ), |
|
60 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
59 | + 'true' => esc_html__('Show', 'give'), |
|
60 | + 'false' => esc_html__('Hide', 'give'), |
|
61 | 61 | ), |
62 | 62 | ), |
63 | 63 | array( |
64 | 64 | 'type' => 'listbox', |
65 | 65 | 'name' => 'date', |
66 | - 'label' => esc_html__( 'Show Date:', 'give' ), |
|
66 | + 'label' => esc_html__('Show Date:', 'give'), |
|
67 | 67 | 'options' => array( |
68 | - 'true' => esc_html__( 'Show', 'give' ), |
|
69 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
68 | + 'true' => esc_html__('Show', 'give'), |
|
69 | + 'false' => esc_html__('Hide', 'give'), |
|
70 | 70 | ), |
71 | 71 | ), |
72 | 72 | array( |
73 | 73 | 'type' => 'listbox', |
74 | 74 | 'name' => 'payment_key', |
75 | - 'label' => esc_html__( 'Show Payment Key:', 'give' ), |
|
75 | + 'label' => esc_html__('Show Payment Key:', 'give'), |
|
76 | 76 | 'options' => array( |
77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
77 | + 'true' => esc_html__('Show', 'give'), |
|
78 | + 'false' => esc_html__('Hide', 'give'), |
|
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'type' => 'listbox', |
83 | 83 | 'name' => 'payment_method', |
84 | - 'label' => esc_html__( 'Show Payment Method:', 'give' ), |
|
84 | + 'label' => esc_html__('Show Payment Method:', 'give'), |
|
85 | 85 | 'options' => array( |
86 | - 'true' => esc_html__( 'Show', 'give' ), |
|
87 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
86 | + 'true' => esc_html__('Show', 'give'), |
|
87 | + 'false' => esc_html__('Hide', 'give'), |
|
88 | 88 | ), |
89 | 89 | ), |
90 | 90 | array( |
91 | 91 | 'type' => 'listbox', |
92 | 92 | 'name' => 'payment_id', |
93 | - 'label' => esc_html__( 'Show Payment ID:', 'give' ), |
|
93 | + 'label' => esc_html__('Show Payment ID:', 'give'), |
|
94 | 94 | 'options' => array( |
95 | - 'true' => esc_html__( 'Show', 'give' ), |
|
96 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
95 | + 'true' => esc_html__('Show', 'give'), |
|
96 | + 'false' => esc_html__('Hide', 'give'), |
|
97 | 97 | ), |
98 | 98 | ), |
99 | 99 | ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_register' ); |
|
27 | + parent::__construct('give_register'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | return array( |
38 | 38 | array( |
39 | 39 | 'type' => 'container', |
40 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
40 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
41 | 41 | ), |
42 | 42 | array( |
43 | 43 | 'type' => 'textbox', |
44 | 44 | 'name' => 'redirect', |
45 | 45 | 'minWidth' => 320, |
46 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
46 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
47 | 47 | ), |
48 | 48 | ); |
49 | 49 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Donation History', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Donation History', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'donation_history' ); |
|
26 | + parent::__construct('donation_history'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array The altered list of views |
25 | 25 | */ |
26 | -function give_register_default_customer_views( $views ) { |
|
26 | +function give_register_default_customer_views($views) { |
|
27 | 27 | |
28 | 28 | $default_views = array( |
29 | 29 | 'overview' => 'give_customers_view', |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | 'notes' => 'give_customer_notes_view' |
32 | 32 | ); |
33 | 33 | |
34 | - return array_merge( $views, $default_views ); |
|
34 | + return array_merge($views, $default_views); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'give_customer_views', 'give_register_default_customer_views', 1, 1 ); |
|
38 | +add_filter('give_customer_views', 'give_register_default_customer_views', 1, 1); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register a tab for the single customer view |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The altered list of tabs |
48 | 48 | */ |
49 | -function give_register_default_customer_tabs( $tabs ) { |
|
49 | +function give_register_default_customer_tabs($tabs) { |
|
50 | 50 | |
51 | 51 | $default_tabs = array( |
52 | - 'overview' => array( 'dashicon' => 'dashicons-admin-users', 'title' => esc_html__( 'Donor Profile', 'give' ) ), |
|
53 | - 'notes' => array( 'dashicon' => 'dashicons-admin-comments', 'title' => esc_html__( 'Donor Notes', 'give' ) ) |
|
52 | + 'overview' => array('dashicon' => 'dashicons-admin-users', 'title' => esc_html__('Donor Profile', 'give')), |
|
53 | + 'notes' => array('dashicon' => 'dashicons-admin-comments', 'title' => esc_html__('Donor Notes', 'give')) |
|
54 | 54 | ); |
55 | 55 | |
56 | - return array_merge( $tabs, $default_tabs ); |
|
56 | + return array_merge($tabs, $default_tabs); |
|
57 | 57 | } |
58 | 58 | |
59 | -add_filter( 'give_customer_tabs', 'give_register_default_customer_tabs', 1, 1 ); |
|
59 | +add_filter('give_customer_tabs', 'give_register_default_customer_tabs', 1, 1); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Register the Delete icon as late as possible so it's at the bottom |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return array The altered list of tabs, with 'delete' at the bottom |
69 | 69 | */ |
70 | -function give_register_delete_customer_tab( $tabs ) { |
|
70 | +function give_register_delete_customer_tab($tabs) { |
|
71 | 71 | |
72 | - $tabs['delete'] = array( 'dashicon' => 'dashicons-trash', 'title' => esc_html__( 'Delete Donor', 'give' ) ); |
|
72 | + $tabs['delete'] = array('dashicon' => 'dashicons-trash', 'title' => esc_html__('Delete Donor', 'give')); |
|
73 | 73 | |
74 | 74 | return $tabs; |
75 | 75 | } |
76 | 76 | |
77 | -add_filter( 'give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1 ); |
|
77 | +add_filter('give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1); |