@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | * |
859 | 859 | * @todo Remove this, when WordPress Core ticket is resolved (https://core.trac.wordpress.org/ticket/16828). |
860 | 860 | * |
861 | - * @return bool |
|
861 | + * @return false|null |
|
862 | 862 | */ |
863 | 863 | function give_donation_metabox_menu() { |
864 | 864 | |
@@ -1448,7 +1448,7 @@ discard block |
||
1448 | 1448 | * @since 1.8.13 |
1449 | 1449 | * |
1450 | 1450 | * @param array $list List of objects or arrays |
1451 | - * @param int|string $field Field from the object to place instead of the entire object |
|
1451 | + * @param string $field Field from the object to place instead of the entire object |
|
1452 | 1452 | * @param int|string $index_key Optional. Field from the object to use as keys for the new array. |
1453 | 1453 | * Default null. |
1454 | 1454 | * |
@@ -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,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_is_test_mode() { |
25 | 25 | |
26 | - $ret = give_is_setting_enabled( give_get_option( 'test_mode' ) ); |
|
26 | + $ret = give_is_setting_enabled(give_get_option('test_mode')); |
|
27 | 27 | |
28 | - return (bool) apply_filters( 'give_is_test_mode', $ret ); |
|
28 | + return (bool) apply_filters('give_is_test_mode', $ret); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function give_get_currency() { |
39 | 39 | |
40 | - $currency = give_get_option( 'currency', 'USD' ); |
|
40 | + $currency = give_get_option('currency', 'USD'); |
|
41 | 41 | |
42 | - return apply_filters( 'give_currency', $currency ); |
|
42 | + return apply_filters('give_currency', $currency); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function give_get_currency_position() { |
53 | 53 | |
54 | - $currency_pos = give_get_option( 'currency_position', 'before' ); |
|
54 | + $currency_pos = give_get_option('currency_position', 'before'); |
|
55 | 55 | |
56 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
56 | + return apply_filters('give_currency_position', $currency_pos); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -66,39 +66,39 @@ discard block |
||
66 | 66 | |
67 | 67 | function give_get_currencies() { |
68 | 68 | $currencies = array( |
69 | - 'USD' => __( 'US Dollars ($)', 'give' ), |
|
70 | - 'EUR' => __( 'Euros (€)', 'give' ), |
|
71 | - 'GBP' => __( 'Pounds Sterling (£)', 'give' ), |
|
72 | - 'AUD' => __( 'Australian Dollars ($)', 'give' ), |
|
73 | - 'BRL' => __( 'Brazilian Real (R$)', 'give' ), |
|
74 | - 'CAD' => __( 'Canadian Dollars ($)', 'give' ), |
|
75 | - 'CZK' => __( 'Czech Koruna (Kč)', 'give' ), |
|
76 | - 'DKK' => __( 'Danish Krone (kr.)', 'give' ), |
|
77 | - 'HKD' => __( 'Hong Kong Dollar ($)', 'give' ), |
|
78 | - 'HUF' => __( 'Hungarian Forint (Ft)', 'give' ), |
|
79 | - 'ILS' => __( 'Israeli Shekel (₪)', 'give' ), |
|
80 | - 'JPY' => __( 'Japanese Yen (¥)', 'give' ), |
|
81 | - 'MYR' => __( 'Malaysian Ringgits (RM)', 'give' ), |
|
82 | - 'MXN' => __( 'Mexican Peso ($)', 'give' ), |
|
83 | - 'MAD' => __( 'Moroccan Dirham (.د.م)', 'give' ), |
|
84 | - 'NZD' => __( 'New Zealand Dollar ($)', 'give' ), |
|
85 | - 'NOK' => __( 'Norwegian Krone (Kr.)', 'give' ), |
|
86 | - 'PHP' => __( 'Philippine Pesos (₱)', 'give' ), |
|
87 | - 'PLN' => __( 'Polish Zloty (zł)', 'give' ), |
|
88 | - 'SGD' => __( 'Singapore Dollar ($)', 'give' ), |
|
89 | - 'KRW' => __( 'South Korean Won (₩)', 'give' ), |
|
90 | - 'ZAR' => __( 'South African Rand (R)', 'give' ), |
|
91 | - 'SEK' => __( 'Swedish Krona (kr)', 'give' ), |
|
92 | - 'CHF' => __( 'Swiss Franc (CHF)', 'give' ), |
|
93 | - 'TWD' => __( 'Taiwan New Dollars (NT$)', 'give' ), |
|
94 | - 'THB' => __( 'Thai Baht (฿)', 'give' ), |
|
95 | - 'INR' => __( 'Indian Rupee (₹)', 'give' ), |
|
96 | - 'TRY' => __( 'Turkish Lira (₺)', 'give' ), |
|
97 | - 'RIAL' => __( 'Iranian Rial (﷼)', 'give' ), |
|
98 | - 'RUB' => __( 'Russian Rubles (руб)', 'give' ), |
|
69 | + 'USD' => __('US Dollars ($)', 'give'), |
|
70 | + 'EUR' => __('Euros (€)', 'give'), |
|
71 | + 'GBP' => __('Pounds Sterling (£)', 'give'), |
|
72 | + 'AUD' => __('Australian Dollars ($)', 'give'), |
|
73 | + 'BRL' => __('Brazilian Real (R$)', 'give'), |
|
74 | + 'CAD' => __('Canadian Dollars ($)', 'give'), |
|
75 | + 'CZK' => __('Czech Koruna (Kč)', 'give'), |
|
76 | + 'DKK' => __('Danish Krone (kr.)', 'give'), |
|
77 | + 'HKD' => __('Hong Kong Dollar ($)', 'give'), |
|
78 | + 'HUF' => __('Hungarian Forint (Ft)', 'give'), |
|
79 | + 'ILS' => __('Israeli Shekel (₪)', 'give'), |
|
80 | + 'JPY' => __('Japanese Yen (¥)', 'give'), |
|
81 | + 'MYR' => __('Malaysian Ringgits (RM)', 'give'), |
|
82 | + 'MXN' => __('Mexican Peso ($)', 'give'), |
|
83 | + 'MAD' => __('Moroccan Dirham (.د.م)', 'give'), |
|
84 | + 'NZD' => __('New Zealand Dollar ($)', 'give'), |
|
85 | + 'NOK' => __('Norwegian Krone (Kr.)', 'give'), |
|
86 | + 'PHP' => __('Philippine Pesos (₱)', 'give'), |
|
87 | + 'PLN' => __('Polish Zloty (zł)', 'give'), |
|
88 | + 'SGD' => __('Singapore Dollar ($)', 'give'), |
|
89 | + 'KRW' => __('South Korean Won (₩)', 'give'), |
|
90 | + 'ZAR' => __('South African Rand (R)', 'give'), |
|
91 | + 'SEK' => __('Swedish Krona (kr)', 'give'), |
|
92 | + 'CHF' => __('Swiss Franc (CHF)', 'give'), |
|
93 | + 'TWD' => __('Taiwan New Dollars (NT$)', 'give'), |
|
94 | + 'THB' => __('Thai Baht (฿)', 'give'), |
|
95 | + 'INR' => __('Indian Rupee (₹)', 'give'), |
|
96 | + 'TRY' => __('Turkish Lira (₺)', 'give'), |
|
97 | + 'RIAL' => __('Iranian Rial (﷼)', 'give'), |
|
98 | + 'RUB' => __('Russian Rubles (руб)', 'give'), |
|
99 | 99 | ); |
100 | 100 | |
101 | - return apply_filters( 'give_currencies', $currencies ); |
|
101 | + return apply_filters('give_currencies', $currencies); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return array |
113 | 113 | */ |
114 | -function give_currency_symbols( $decode_currencies = false ) { |
|
114 | +function give_currency_symbols($decode_currencies = false) { |
|
115 | 115 | $currencies = array( |
116 | 116 | 'GBP' => '£', |
117 | 117 | 'BRL' => 'R$', |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | 'MAD' => '.د.م', |
144 | 144 | ); |
145 | 145 | |
146 | - if ( $decode_currencies ) { |
|
147 | - $currencies = array_map( 'html_entity_decode', $currencies ); |
|
146 | + if ($decode_currencies) { |
|
147 | + $currencies = array_map('html_entity_decode', $currencies); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @param array $currencies |
156 | 156 | */ |
157 | - return apply_filters( 'give_currency_symbols', $currencies ); |
|
157 | + return apply_filters('give_currency_symbols', $currencies); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | * |
172 | 172 | * @return string The symbol to use for the currency |
173 | 173 | */ |
174 | -function give_currency_symbol( $currency = '', $decode_currency = false ) { |
|
174 | +function give_currency_symbol($currency = '', $decode_currency = false) { |
|
175 | 175 | |
176 | - if ( empty( $currency ) ) { |
|
176 | + if (empty($currency)) { |
|
177 | 177 | $currency = give_get_currency(); |
178 | 178 | } |
179 | 179 | |
180 | - $currencies = give_currency_symbols( $decode_currency ); |
|
181 | - $symbol = array_key_exists( $currency, $currencies ) ? $currencies[ $currency ] : $currency; |
|
180 | + $currencies = give_currency_symbols($decode_currency); |
|
181 | + $symbol = array_key_exists($currency, $currencies) ? $currencies[$currency] : $currency; |
|
182 | 182 | |
183 | 183 | /** |
184 | 184 | * Filter the currency symbol |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @param string $symbol |
189 | 189 | * @param string $currency |
190 | 190 | */ |
191 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
191 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | |
@@ -201,13 +201,13 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return string |
203 | 203 | */ |
204 | -function give_get_currency_name( $currency_code ) { |
|
204 | +function give_get_currency_name($currency_code) { |
|
205 | 205 | $currency_name = ''; |
206 | 206 | $currency_names = give_get_currencies(); |
207 | 207 | |
208 | - if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) { |
|
209 | - $currency_name = explode( '(', $currency_names[ $currency_code ] ); |
|
210 | - $currency_name = trim( current( $currency_name ) ); |
|
208 | + if ($currency_code && array_key_exists($currency_code, $currency_names)) { |
|
209 | + $currency_name = explode('(', $currency_names[$currency_code]); |
|
210 | + $currency_name = trim(current($currency_name)); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @param string $currency_name |
219 | 219 | * @param string $currency_code |
220 | 220 | */ |
221 | - return apply_filters( 'give_currency_name', $currency_name, $currency_code ); |
|
221 | + return apply_filters('give_currency_name', $currency_name, $currency_code); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -232,18 +232,18 @@ discard block |
||
232 | 232 | |
233 | 233 | global $wp; |
234 | 234 | |
235 | - if ( get_option( 'permalink_structure' ) ) { |
|
236 | - $base = trailingslashit( home_url( $wp->request ) ); |
|
235 | + if (get_option('permalink_structure')) { |
|
236 | + $base = trailingslashit(home_url($wp->request)); |
|
237 | 237 | } else { |
238 | - $base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) ); |
|
239 | - $base = remove_query_arg( array( 'post_type', 'name' ), $base ); |
|
238 | + $base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request))); |
|
239 | + $base = remove_query_arg(array('post_type', 'name'), $base); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | $scheme = is_ssl() ? 'https' : 'http'; |
243 | - $current_uri = set_url_scheme( $base, $scheme ); |
|
243 | + $current_uri = set_url_scheme($base, $scheme); |
|
244 | 244 | |
245 | - if ( is_front_page() ) { |
|
246 | - $current_uri = home_url( '/' ); |
|
245 | + if (is_front_page()) { |
|
246 | + $current_uri = home_url('/'); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @param string $current_uri |
255 | 255 | */ |
256 | - return apply_filters( 'give_get_current_page_url', $current_uri ); |
|
256 | + return apply_filters('give_get_current_page_url', $current_uri); |
|
257 | 257 | |
258 | 258 | } |
259 | 259 | |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | */ |
276 | 276 | $gateways = give_get_enabled_payment_gateways(); |
277 | 277 | |
278 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
278 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
279 | 279 | $ret = true; |
280 | - } elseif ( count( $gateways ) == 1 ) { |
|
280 | + } elseif (count($gateways) == 1) { |
|
281 | 281 | $ret = false; |
282 | - } elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
282 | + } elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
283 | 283 | $ret = false; |
284 | 284 | } |
285 | 285 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @param bool $ret |
292 | 292 | */ |
293 | - return (bool) apply_filters( 'give_is_cc_verify_enabled', $ret ); |
|
293 | + return (bool) apply_filters('give_is_cc_verify_enabled', $ret); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -302,26 +302,26 @@ discard block |
||
302 | 302 | function give_get_timezone_id() { |
303 | 303 | |
304 | 304 | // if site timezone string exists, return it. |
305 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
305 | + if ($timezone = get_option('timezone_string')) { |
|
306 | 306 | return $timezone; |
307 | 307 | } |
308 | 308 | |
309 | 309 | // get UTC offset, if it isn't set return UTC. |
310 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
310 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
311 | 311 | return 'UTC'; |
312 | 312 | } |
313 | 313 | |
314 | 314 | // attempt to guess the timezone string from the UTC offset. |
315 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
315 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
316 | 316 | |
317 | 317 | // last try, guess timezone string manually. |
318 | - if ( $timezone === false ) { |
|
318 | + if ($timezone === false) { |
|
319 | 319 | |
320 | - $is_dst = date( 'I' ); |
|
320 | + $is_dst = date('I'); |
|
321 | 321 | |
322 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
323 | - foreach ( $abbr as $city ) { |
|
324 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
322 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
323 | + foreach ($abbr as $city) { |
|
324 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
325 | 325 | return $city['timezone_id']; |
326 | 326 | } |
327 | 327 | } |
@@ -345,17 +345,17 @@ discard block |
||
345 | 345 | |
346 | 346 | $ip = '127.0.0.1'; |
347 | 347 | |
348 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
348 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
349 | 349 | // check ip from share internet |
350 | 350 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
351 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
351 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
352 | 352 | // to check ip is pass from proxy |
353 | 353 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
354 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
354 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
355 | 355 | $ip = $_SERVER['REMOTE_ADDR']; |
356 | 356 | } |
357 | 357 | |
358 | - return apply_filters( 'give_get_ip', $ip ); |
|
358 | + return apply_filters('give_get_ip', $ip); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -370,9 +370,9 @@ discard block |
||
370 | 370 | * |
371 | 371 | * @uses Give()->session->set() |
372 | 372 | */ |
373 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
374 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
375 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
373 | +function give_set_purchase_session($purchase_data = array()) { |
|
374 | + Give()->session->set('give_purchase', $purchase_data); |
|
375 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | * @return mixed array | false |
387 | 387 | */ |
388 | 388 | function give_get_purchase_session() { |
389 | - return Give()->session->get( 'give_purchase' ); |
|
389 | + return Give()->session->get('give_purchase'); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
@@ -398,33 +398,33 @@ discard block |
||
398 | 398 | * |
399 | 399 | * @return string |
400 | 400 | */ |
401 | -function give_payment_gateway_item_title( $payment_data ) { |
|
402 | - $form_id = intval( $payment_data['post_data']['give-form-id'] ); |
|
401 | +function give_payment_gateway_item_title($payment_data) { |
|
402 | + $form_id = intval($payment_data['post_data']['give-form-id']); |
|
403 | 403 | $item_name = $payment_data['post_data']['give-form-title']; |
404 | - $is_custom_amount = give_is_setting_enabled( give_get_meta( $form_id, '_give_custom_amount', true ) ); |
|
404 | + $is_custom_amount = give_is_setting_enabled(give_get_meta($form_id, '_give_custom_amount', true)); |
|
405 | 405 | |
406 | 406 | // Verify has variable prices. |
407 | - if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) { |
|
407 | + if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) { |
|
408 | 408 | |
409 | - $item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] ); |
|
410 | - $price_level_amount = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] ); |
|
409 | + $item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']); |
|
410 | + $price_level_amount = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']); |
|
411 | 411 | |
412 | 412 | // Donation given doesn't match selected level (must be a custom amount). |
413 | - if ( $price_level_amount !== give_maybe_sanitize_amount( $payment_data['post_data']['give-amount'] ) ) { |
|
414 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
413 | + if ($price_level_amount !== give_maybe_sanitize_amount($payment_data['post_data']['give-amount'])) { |
|
414 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
415 | 415 | |
416 | 416 | // user custom amount text if any, fallback to default if not. |
417 | - $item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) ); |
|
417 | + $item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give')); |
|
418 | 418 | |
419 | - } elseif ( ! empty( $item_price_level_text ) ) { |
|
419 | + } elseif ( ! empty($item_price_level_text)) { |
|
420 | 420 | // Matches a donation level - append level text. |
421 | - $item_name .= ' - ' . $item_price_level_text; |
|
421 | + $item_name .= ' - '.$item_price_level_text; |
|
422 | 422 | } |
423 | 423 | } // End if(). |
424 | - elseif ( $is_custom_amount && give_get_form_price( $form_id ) !== give_maybe_sanitize_amount( $payment_data['post_data']['give-amount'] ) ) { |
|
425 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
424 | + elseif ($is_custom_amount && give_get_form_price($form_id) !== give_maybe_sanitize_amount($payment_data['post_data']['give-amount'])) { |
|
425 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
426 | 426 | // user custom amount text if any, fallback to default if not. |
427 | - $item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) ); |
|
427 | + $item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give')); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @return string |
440 | 440 | */ |
441 | - return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data ); |
|
441 | + return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
@@ -454,36 +454,36 @@ discard block |
||
454 | 454 | * |
455 | 455 | * @return string |
456 | 456 | */ |
457 | -function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) { |
|
458 | - $form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : ''; |
|
457 | +function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) { |
|
458 | + $form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : ''; |
|
459 | 459 | |
460 | 460 | // Form title. |
461 | - $summary = ( ! empty( $donation_data['post_data']['give-form-title'] ) ? $donation_data['post_data']['give-form-title'] : ( ! empty( $form_id ) ? wp_sprintf( __( 'Donation Form ID: %d', 'give' ), $form_id ) : __( 'Untitled donation form', 'give' ) ) ); |
|
461 | + $summary = ( ! empty($donation_data['post_data']['give-form-title']) ? $donation_data['post_data']['give-form-title'] : ( ! empty($form_id) ? wp_sprintf(__('Donation Form ID: %d', 'give'), $form_id) : __('Untitled donation form', 'give'))); |
|
462 | 462 | |
463 | 463 | // Form multilevel if applicable. |
464 | - if ( isset( $donation_data['post_data']['give-price-id'] ) ) { |
|
465 | - $summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] ); |
|
464 | + if (isset($donation_data['post_data']['give-price-id'])) { |
|
465 | + $summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | // Add Donor's name + email if requested. |
469 | - if ( $name_and_email ) { |
|
469 | + if ($name_and_email) { |
|
470 | 470 | |
471 | 471 | // First name |
472 | - if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) { |
|
473 | - $summary .= ' - ' . $donation_data['user_info']['first_name']; |
|
472 | + if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) { |
|
473 | + $summary .= ' - '.$donation_data['user_info']['first_name']; |
|
474 | 474 | } |
475 | 475 | |
476 | - if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) { |
|
477 | - $summary .= ' ' . $donation_data['user_info']['last_name']; |
|
476 | + if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) { |
|
477 | + $summary .= ' '.$donation_data['user_info']['last_name']; |
|
478 | 478 | } |
479 | 479 | |
480 | - $summary .= ' (' . $donation_data['user_email'] . ')'; |
|
480 | + $summary .= ' ('.$donation_data['user_email'].')'; |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | // Cut the length |
484 | - $summary = substr( $summary, 0, $length ); |
|
484 | + $summary = substr($summary, 0, $length); |
|
485 | 485 | |
486 | - return apply_filters( 'give_payment_gateway_donation_summary', $summary ); |
|
486 | + return apply_filters('give_payment_gateway_donation_summary', $summary); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | |
@@ -498,31 +498,31 @@ discard block |
||
498 | 498 | function give_get_host() { |
499 | 499 | $host = false; |
500 | 500 | |
501 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
501 | + if (defined('WPE_APIKEY')) { |
|
502 | 502 | $host = 'WP Engine'; |
503 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
503 | + } elseif (defined('PAGELYBIN')) { |
|
504 | 504 | $host = 'Pagely'; |
505 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
505 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
506 | 506 | $host = 'ICDSoft'; |
507 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
507 | + } elseif (DB_HOST == 'mysqlv5') { |
|
508 | 508 | $host = 'NetworkSolutions'; |
509 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
509 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
510 | 510 | $host = 'iPage'; |
511 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
511 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
512 | 512 | $host = 'IPower'; |
513 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
513 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
514 | 514 | $host = 'MediaTemple Grid'; |
515 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
515 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
516 | 516 | $host = 'pair Networks'; |
517 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
517 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
518 | 518 | $host = 'Rackspace Cloud'; |
519 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
519 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
520 | 520 | $host = 'SysFix.eu Power Hosting'; |
521 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
521 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
522 | 522 | $host = 'Flywheel'; |
523 | 523 | } else { |
524 | 524 | // Adding a general fallback for data gathering |
525 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
525 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | return $host; |
@@ -538,67 +538,67 @@ discard block |
||
538 | 538 | * |
539 | 539 | * @return bool true if host matches, false if not |
540 | 540 | */ |
541 | -function give_is_host( $host = false ) { |
|
541 | +function give_is_host($host = false) { |
|
542 | 542 | |
543 | 543 | $return = false; |
544 | 544 | |
545 | - if ( $host ) { |
|
546 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
545 | + if ($host) { |
|
546 | + $host = str_replace(' ', '', strtolower($host)); |
|
547 | 547 | |
548 | - switch ( $host ) { |
|
548 | + switch ($host) { |
|
549 | 549 | case 'wpengine': |
550 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
550 | + if (defined('WPE_APIKEY')) { |
|
551 | 551 | $return = true; |
552 | 552 | } |
553 | 553 | break; |
554 | 554 | case 'pagely': |
555 | - if ( defined( 'PAGELYBIN' ) ) { |
|
555 | + if (defined('PAGELYBIN')) { |
|
556 | 556 | $return = true; |
557 | 557 | } |
558 | 558 | break; |
559 | 559 | case 'icdsoft': |
560 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
560 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
561 | 561 | $return = true; |
562 | 562 | } |
563 | 563 | break; |
564 | 564 | case 'networksolutions': |
565 | - if ( DB_HOST == 'mysqlv5' ) { |
|
565 | + if (DB_HOST == 'mysqlv5') { |
|
566 | 566 | $return = true; |
567 | 567 | } |
568 | 568 | break; |
569 | 569 | case 'ipage': |
570 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
570 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
571 | 571 | $return = true; |
572 | 572 | } |
573 | 573 | break; |
574 | 574 | case 'ipower': |
575 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
575 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
576 | 576 | $return = true; |
577 | 577 | } |
578 | 578 | break; |
579 | 579 | case 'mediatemplegrid': |
580 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
580 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
581 | 581 | $return = true; |
582 | 582 | } |
583 | 583 | break; |
584 | 584 | case 'pairnetworks': |
585 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
585 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
586 | 586 | $return = true; |
587 | 587 | } |
588 | 588 | break; |
589 | 589 | case 'rackspacecloud': |
590 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
590 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
591 | 591 | $return = true; |
592 | 592 | } |
593 | 593 | break; |
594 | 594 | case 'sysfix.eu': |
595 | 595 | case 'sysfix.eupowerhosting': |
596 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
596 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
597 | 597 | $return = true; |
598 | 598 | } |
599 | 599 | break; |
600 | 600 | case 'flywheel': |
601 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
601 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
602 | 602 | $return = true; |
603 | 603 | } |
604 | 604 | break; |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * @param string $replacement Optional. The function that should have been called. |
632 | 632 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function. |
633 | 633 | */ |
634 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
634 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
635 | 635 | |
636 | 636 | /** |
637 | 637 | * Fires while give deprecated function call occurs. |
@@ -644,19 +644,19 @@ discard block |
||
644 | 644 | * @param string $replacement Optional. The function that should have been called. |
645 | 645 | * @param string $version The plugin version that deprecated the function. |
646 | 646 | */ |
647 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
647 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
648 | 648 | |
649 | - $show_errors = current_user_can( 'manage_options' ); |
|
649 | + $show_errors = current_user_can('manage_options'); |
|
650 | 650 | |
651 | 651 | // Allow plugin to filter the output error trigger. |
652 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
653 | - if ( ! is_null( $replacement ) ) { |
|
654 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
655 | - trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
652 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
653 | + if ( ! is_null($replacement)) { |
|
654 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
655 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
656 | 656 | // Alternatively we could dump this to a file. |
657 | 657 | } else { |
658 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
659 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
658 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
659 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
660 | 660 | // Alternatively we could dump this to a file. |
661 | 661 | } |
662 | 662 | } |
@@ -670,8 +670,8 @@ discard block |
||
670 | 670 | * @return string $post_id |
671 | 671 | */ |
672 | 672 | function give_get_admin_post_id() { |
673 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; |
|
674 | - if ( ! $post_id && isset( $_POST['post_id'] ) ) { |
|
673 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; |
|
674 | + if ( ! $post_id && isset($_POST['post_id'])) { |
|
675 | 675 | $post_id = $_POST['post_id']; |
676 | 676 | } |
677 | 677 | |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | * @return string Arg separator output |
686 | 686 | */ |
687 | 687 | function give_get_php_arg_separator_output() { |
688 | - return ini_get( 'arg_separator.output' ); |
|
688 | + return ini_get('arg_separator.output'); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | |
@@ -700,10 +700,10 @@ discard block |
||
700 | 700 | * |
701 | 701 | * @return string Short month name |
702 | 702 | */ |
703 | -function give_month_num_to_name( $n ) { |
|
704 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
703 | +function give_month_num_to_name($n) { |
|
704 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
705 | 705 | |
706 | - return date_i18n( 'M', $timestamp ); |
|
706 | + return date_i18n('M', $timestamp); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | |
@@ -716,10 +716,10 @@ discard block |
||
716 | 716 | * |
717 | 717 | * @return bool Whether or not function is disabled. |
718 | 718 | */ |
719 | -function give_is_func_disabled( $function ) { |
|
720 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
719 | +function give_is_func_disabled($function) { |
|
720 | + $disabled = explode(',', ini_get('disable_functions')); |
|
721 | 721 | |
722 | - return in_array( $function, $disabled ); |
|
722 | + return in_array($function, $disabled); |
|
723 | 723 | } |
724 | 724 | |
725 | 725 | /** |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | function give_get_newsletter() { |
731 | 731 | ?> |
732 | 732 | |
733 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
733 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
734 | 734 | |
735 | 735 | <div class="give-newsletter-form-wrap"> |
736 | 736 | |
@@ -738,33 +738,33 @@ discard block |
||
738 | 738 | method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" |
739 | 739 | target="_blank" novalidate> |
740 | 740 | <div class="give-newsletter-confirmation"> |
741 | - <p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
741 | + <p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
742 | 742 | </div> |
743 | 743 | |
744 | 744 | <table class="form-table give-newsletter-form"> |
745 | 745 | <tr valign="middle"> |
746 | 746 | <td> |
747 | 747 | <label for="mce-EMAIL" |
748 | - class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label> |
|
748 | + class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> |
|
749 | 749 | <input type="email" name="EMAIL" id="mce-EMAIL" |
750 | - placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" |
|
750 | + placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" |
|
751 | 751 | class="required email" value=""> |
752 | 752 | </td> |
753 | 753 | <td> |
754 | 754 | <label for="mce-FNAME" |
755 | - class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label> |
|
755 | + class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> |
|
756 | 756 | <input type="text" name="FNAME" id="mce-FNAME" |
757 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value=""> |
|
757 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value=""> |
|
758 | 758 | </td> |
759 | 759 | <td> |
760 | 760 | <label for="mce-LNAME" |
761 | - class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label> |
|
761 | + class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> |
|
762 | 762 | <input type="text" name="LNAME" id="mce-LNAME" |
763 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value=""> |
|
763 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> |
|
764 | 764 | </td> |
765 | 765 | <td> |
766 | 766 | <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" |
767 | - value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>"> |
|
767 | + value="<?php esc_attr_e('Subscribe', 'give'); ?>"> |
|
768 | 768 | </td> |
769 | 769 | </tr> |
770 | 770 | </table> |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | * |
818 | 818 | * @return string |
819 | 819 | */ |
820 | -function give_svg_icons( $icon ) { |
|
820 | +function give_svg_icons($icon) { |
|
821 | 821 | |
822 | 822 | // Store your SVGs in an associative array |
823 | 823 | $svgs = array( |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | ); |
830 | 830 | |
831 | 831 | // Return the chosen icon's SVG string |
832 | - return $svgs[ $icon ]; |
|
832 | + return $svgs[$icon]; |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | /** |
@@ -841,15 +841,15 @@ discard block |
||
841 | 841 | * |
842 | 842 | * @return mixed |
843 | 843 | */ |
844 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
845 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
846 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' ); |
|
844 | +function modify_nav_menu_meta_box_object($post_type) { |
|
845 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
846 | + $post_type->labels->name = esc_html__('Donation Forms', 'give'); |
|
847 | 847 | } |
848 | 848 | |
849 | 849 | return $post_type; |
850 | 850 | } |
851 | 851 | |
852 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
852 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
853 | 853 | |
854 | 854 | /** |
855 | 855 | * Show Donation Forms Post Type in Appearance > Menus by default on fresh install. |
@@ -868,35 +868,35 @@ discard block |
||
868 | 868 | // Proceed, if current screen is navigation menus. |
869 | 869 | if ( |
870 | 870 | 'nav-menus' === $screen->id && |
871 | - give_is_setting_enabled( give_get_option( 'forms_singular' ) ) && |
|
872 | - ! get_user_option( 'give_is_donation_forms_menu_updated' ) |
|
871 | + give_is_setting_enabled(give_get_option('forms_singular')) && |
|
872 | + ! get_user_option('give_is_donation_forms_menu_updated') |
|
873 | 873 | ) { |
874 | 874 | |
875 | 875 | // Return false, if it fails to retrieve hidden meta box list and is not admin. |
876 | 876 | if ( |
877 | 877 | ! is_admin() || |
878 | - ( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) ) |
|
878 | + ( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus')) |
|
879 | 879 | ) { |
880 | 880 | return false; |
881 | 881 | } |
882 | 882 | |
883 | 883 | // Return false, In case, we don't find 'Donation Form' in hidden meta box list. |
884 | - if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) { |
|
884 | + if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) { |
|
885 | 885 | return false; |
886 | 886 | } |
887 | 887 | |
888 | 888 | // Exclude 'Donation Form' value from hidden meta box's list. |
889 | - $hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) ); |
|
889 | + $hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms')); |
|
890 | 890 | |
891 | 891 | // Get current user ID. |
892 | 892 | $user = wp_get_current_user(); |
893 | 893 | |
894 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
895 | - update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true ); |
|
894 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
895 | + update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true); |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
899 | -add_action( 'current_screen', 'give_donation_metabox_menu' ); |
|
899 | +add_action('current_screen', 'give_donation_metabox_menu'); |
|
900 | 900 | |
901 | 901 | /** |
902 | 902 | * Array_column backup usage |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | * @license https://opensource.org/licenses/MIT MIT |
910 | 910 | */ |
911 | 911 | |
912 | -if ( ! function_exists( 'array_column' ) ) { |
|
912 | +if ( ! function_exists('array_column')) { |
|
913 | 913 | /** |
914 | 914 | * Returns the values from a single column of the input array, identified by |
915 | 915 | * the $columnKey. |
@@ -928,53 +928,53 @@ discard block |
||
928 | 928 | * |
929 | 929 | * @return array |
930 | 930 | */ |
931 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
931 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
932 | 932 | // Using func_get_args() in order to check for proper number of |
933 | 933 | // parameters and trigger errors exactly as the built-in array_column() |
934 | 934 | // does in PHP 5.5. |
935 | 935 | $argc = func_num_args(); |
936 | 936 | $params = func_get_args(); |
937 | 937 | |
938 | - if ( $argc < 2 ) { |
|
939 | - trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING ); |
|
938 | + if ($argc < 2) { |
|
939 | + trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); |
|
940 | 940 | |
941 | 941 | return null; |
942 | 942 | } |
943 | 943 | |
944 | - if ( ! is_array( $params[0] ) ) { |
|
945 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING ); |
|
944 | + if ( ! is_array($params[0])) { |
|
945 | + trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); |
|
946 | 946 | |
947 | 947 | return null; |
948 | 948 | } |
949 | 949 | |
950 | - if ( ! is_int( $params[1] ) |
|
951 | - && ! is_float( $params[1] ) |
|
952 | - && ! is_string( $params[1] ) |
|
950 | + if ( ! is_int($params[1]) |
|
951 | + && ! is_float($params[1]) |
|
952 | + && ! is_string($params[1]) |
|
953 | 953 | && $params[1] !== null |
954 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
954 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
955 | 955 | ) { |
956 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
956 | + trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
957 | 957 | |
958 | 958 | return false; |
959 | 959 | } |
960 | 960 | |
961 | - if ( isset( $params[2] ) |
|
962 | - && ! is_int( $params[2] ) |
|
963 | - && ! is_float( $params[2] ) |
|
964 | - && ! is_string( $params[2] ) |
|
965 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
961 | + if (isset($params[2]) |
|
962 | + && ! is_int($params[2]) |
|
963 | + && ! is_float($params[2]) |
|
964 | + && ! is_string($params[2]) |
|
965 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
966 | 966 | ) { |
967 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
967 | + trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
968 | 968 | |
969 | 969 | return false; |
970 | 970 | } |
971 | 971 | |
972 | 972 | $paramsInput = $params[0]; |
973 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
973 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
974 | 974 | |
975 | 975 | $paramsIndexKey = null; |
976 | - if ( isset( $params[2] ) ) { |
|
977 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
976 | + if (isset($params[2])) { |
|
977 | + if (is_float($params[2]) || is_int($params[2])) { |
|
978 | 978 | $paramsIndexKey = (int) $params[2]; |
979 | 979 | } else { |
980 | 980 | $paramsIndexKey = (string) $params[2]; |
@@ -983,26 +983,26 @@ discard block |
||
983 | 983 | |
984 | 984 | $resultArray = array(); |
985 | 985 | |
986 | - foreach ( $paramsInput as $row ) { |
|
986 | + foreach ($paramsInput as $row) { |
|
987 | 987 | $key = $value = null; |
988 | 988 | $keySet = $valueSet = false; |
989 | 989 | |
990 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
990 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
991 | 991 | $keySet = true; |
992 | - $key = (string) $row[ $paramsIndexKey ]; |
|
992 | + $key = (string) $row[$paramsIndexKey]; |
|
993 | 993 | } |
994 | 994 | |
995 | - if ( $paramsColumnKey === null ) { |
|
995 | + if ($paramsColumnKey === null) { |
|
996 | 996 | $valueSet = true; |
997 | 997 | $value = $row; |
998 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
998 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
999 | 999 | $valueSet = true; |
1000 | - $value = $row[ $paramsColumnKey ]; |
|
1000 | + $value = $row[$paramsColumnKey]; |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | - if ( $valueSet ) { |
|
1004 | - if ( $keySet ) { |
|
1005 | - $resultArray[ $key ] = $value; |
|
1003 | + if ($valueSet) { |
|
1004 | + if ($keySet) { |
|
1005 | + $resultArray[$key] = $value; |
|
1006 | 1006 | } else { |
1007 | 1007 | $resultArray[] = $value; |
1008 | 1008 | } |
@@ -1022,40 +1022,40 @@ discard block |
||
1022 | 1022 | * |
1023 | 1023 | * @return bool Whether the receipt is visible or not. |
1024 | 1024 | */ |
1025 | -function give_can_view_receipt( $payment_key = '' ) { |
|
1025 | +function give_can_view_receipt($payment_key = '') { |
|
1026 | 1026 | |
1027 | 1027 | $return = false; |
1028 | 1028 | |
1029 | - if ( empty( $payment_key ) ) { |
|
1029 | + if (empty($payment_key)) { |
|
1030 | 1030 | return $return; |
1031 | 1031 | } |
1032 | 1032 | |
1033 | 1033 | global $give_receipt_args; |
1034 | 1034 | |
1035 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
1035 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
1036 | 1036 | |
1037 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
1037 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
1038 | 1038 | |
1039 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
1039 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
1040 | 1040 | |
1041 | - if ( is_user_logged_in() ) { |
|
1042 | - if ( $user_id === (int) get_current_user_id() ) { |
|
1041 | + if (is_user_logged_in()) { |
|
1042 | + if ($user_id === (int) get_current_user_id()) { |
|
1043 | 1043 | $return = true; |
1044 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
1044 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
1045 | 1045 | $return = true; |
1046 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
1046 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
1047 | 1047 | $return = true; |
1048 | 1048 | } |
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | $session = give_get_purchase_session(); |
1052 | - if ( ! empty( $session ) && ! is_user_logged_in() ) { |
|
1053 | - if ( $session['purchase_key'] === $payment_meta['key'] ) { |
|
1052 | + if ( ! empty($session) && ! is_user_logged_in()) { |
|
1053 | + if ($session['purchase_key'] === $payment_meta['key']) { |
|
1054 | 1054 | $return = true; |
1055 | 1055 | } |
1056 | 1056 | } |
1057 | 1057 | |
1058 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
1058 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
1059 | 1059 | |
1060 | 1060 | } |
1061 | 1061 | |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | * |
1065 | 1065 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
1066 | 1066 | */ |
1067 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
1067 | +if ( ! function_exists('cal_days_in_month')) { |
|
1068 | 1068 | /** |
1069 | 1069 | * cal_days_in_month |
1070 | 1070 | * |
@@ -1074,8 +1074,8 @@ discard block |
||
1074 | 1074 | * |
1075 | 1075 | * @return bool|string |
1076 | 1076 | */ |
1077 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
1078 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
1077 | + function cal_days_in_month($calendar, $month, $year) { |
|
1078 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
1079 | 1079 | } |
1080 | 1080 | } |
1081 | 1081 | |
@@ -1094,42 +1094,42 @@ discard block |
||
1094 | 1094 | */ |
1095 | 1095 | function give_get_plugins() { |
1096 | 1096 | $plugins = get_plugins(); |
1097 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() ); |
|
1097 | + $active_plugin_paths = (array) get_option('active_plugins', array()); |
|
1098 | 1098 | |
1099 | - if ( is_multisite() ) { |
|
1100 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); |
|
1101 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths ); |
|
1099 | + if (is_multisite()) { |
|
1100 | + $network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); |
|
1101 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths); |
|
1102 | 1102 | } |
1103 | 1103 | |
1104 | - foreach ( $plugins as $plugin_path => $plugin_data ) { |
|
1104 | + foreach ($plugins as $plugin_path => $plugin_data) { |
|
1105 | 1105 | // Is plugin active? |
1106 | - if ( in_array( $plugin_path, $active_plugin_paths ) ) { |
|
1107 | - $plugins[ $plugin_path ]['Status'] = 'active'; |
|
1106 | + if (in_array($plugin_path, $active_plugin_paths)) { |
|
1107 | + $plugins[$plugin_path]['Status'] = 'active'; |
|
1108 | 1108 | } else { |
1109 | - $plugins[ $plugin_path ]['Status'] = 'inactive'; |
|
1109 | + $plugins[$plugin_path]['Status'] = 'inactive'; |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | - $dirname = strtolower( dirname( $plugin_path ) ); |
|
1112 | + $dirname = strtolower(dirname($plugin_path)); |
|
1113 | 1113 | |
1114 | 1114 | // Is plugin a Give add-on by WordImpress? |
1115 | - if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { |
|
1115 | + if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { |
|
1116 | 1116 | // Plugin is a Give-addon. |
1117 | - $plugins[ $plugin_path ]['Type'] = 'add-on'; |
|
1117 | + $plugins[$plugin_path]['Type'] = 'add-on'; |
|
1118 | 1118 | |
1119 | 1119 | // Get license info from database. |
1120 | - $plugin_name = str_replace( 'Give - ', '', $plugin_data['Name'] ); |
|
1121 | - $db_option = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active'; |
|
1122 | - $license_active = get_option( $db_option ); |
|
1120 | + $plugin_name = str_replace('Give - ', '', $plugin_data['Name']); |
|
1121 | + $db_option = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active'; |
|
1122 | + $license_active = get_option($db_option); |
|
1123 | 1123 | |
1124 | 1124 | // Does a valid license exist? |
1125 | - if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { |
|
1126 | - $plugins[ $plugin_path ]['License'] = true; |
|
1125 | + if ( ! empty($license_active) && 'valid' === $license_active->license) { |
|
1126 | + $plugins[$plugin_path]['License'] = true; |
|
1127 | 1127 | } else { |
1128 | - $plugins[ $plugin_path ]['License'] = false; |
|
1128 | + $plugins[$plugin_path]['License'] = false; |
|
1129 | 1129 | } |
1130 | 1130 | } else { |
1131 | 1131 | // Plugin is not a Give add-on. |
1132 | - $plugins[ $plugin_path ]['Type'] = 'other'; |
|
1132 | + $plugins[$plugin_path]['Type'] = 'other'; |
|
1133 | 1133 | } |
1134 | 1134 | } |
1135 | 1135 | |
@@ -1146,16 +1146,16 @@ discard block |
||
1146 | 1146 | * |
1147 | 1147 | * @return bool |
1148 | 1148 | */ |
1149 | -function give_is_terms_enabled( $form_id ) { |
|
1150 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
1149 | +function give_is_terms_enabled($form_id) { |
|
1150 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
1151 | 1151 | |
1152 | 1152 | if ( |
1153 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1154 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1153 | + give_is_setting_enabled($form_option, 'global') |
|
1154 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1155 | 1155 | ) { |
1156 | 1156 | return true; |
1157 | 1157 | |
1158 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1158 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1159 | 1159 | return true; |
1160 | 1160 | |
1161 | 1161 | } else { |
@@ -1179,9 +1179,9 @@ discard block |
||
1179 | 1179 | * |
1180 | 1180 | * @return WP_Error|bool |
1181 | 1181 | */ |
1182 | -function give_delete_donation_stats( $date_range = '', $args = array() ) { |
|
1182 | +function give_delete_donation_stats($date_range = '', $args = array()) { |
|
1183 | 1183 | // Delete all cache. |
1184 | - $status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) ); |
|
1184 | + $status = Give_Cache::delete(Give_Cache::get_options_like('give_stats')); |
|
1185 | 1185 | |
1186 | 1186 | /** |
1187 | 1187 | * Fire the action when donation stats delete. |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | * @param string|array $date_range |
1192 | 1192 | * @param array $args |
1193 | 1193 | */ |
1194 | - do_action( 'give_delete_donation_stats', $status, $date_range, $args ); |
|
1194 | + do_action('give_delete_donation_stats', $status, $date_range, $args); |
|
1195 | 1195 | |
1196 | 1196 | return $status; |
1197 | 1197 | } |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | * |
1210 | 1210 | * @return mixed |
1211 | 1211 | */ |
1212 | -function give_get_meta( $id, $meta_key, $single = false, $default = false ) { |
|
1212 | +function give_get_meta($id, $meta_key, $single = false, $default = false) { |
|
1213 | 1213 | /** |
1214 | 1214 | * Filter the meta value |
1215 | 1215 | * |
@@ -1217,14 +1217,14 @@ discard block |
||
1217 | 1217 | */ |
1218 | 1218 | $meta_value = apply_filters( |
1219 | 1219 | 'give_get_meta', |
1220 | - get_post_meta( $id, $meta_key, $single ), |
|
1220 | + get_post_meta($id, $meta_key, $single), |
|
1221 | 1221 | $id, |
1222 | 1222 | $meta_key, |
1223 | 1223 | $default |
1224 | 1224 | ); |
1225 | 1225 | |
1226 | 1226 | if ( |
1227 | - ( empty( $meta_key ) || empty( $meta_value ) ) |
|
1227 | + (empty($meta_key) || empty($meta_value)) |
|
1228 | 1228 | && $default |
1229 | 1229 | ) { |
1230 | 1230 | $meta_value = $default; |
@@ -1245,15 +1245,15 @@ discard block |
||
1245 | 1245 | * |
1246 | 1246 | * @return mixed |
1247 | 1247 | */ |
1248 | -function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1249 | - $status = update_post_meta( $id, $meta_key, $meta_value, $prev_value ); |
|
1248 | +function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') { |
|
1249 | + $status = update_post_meta($id, $meta_key, $meta_value, $prev_value); |
|
1250 | 1250 | |
1251 | 1251 | /** |
1252 | 1252 | * Filter the meta value update status |
1253 | 1253 | * |
1254 | 1254 | * @since 1.8.8 |
1255 | 1255 | */ |
1256 | - return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value ); |
|
1256 | + return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value); |
|
1257 | 1257 | } |
1258 | 1258 | |
1259 | 1259 | /** |
@@ -1267,15 +1267,15 @@ discard block |
||
1267 | 1267 | * |
1268 | 1268 | * @return mixed |
1269 | 1269 | */ |
1270 | -function give_delete_meta( $id, $meta_key, $meta_value = '' ) { |
|
1271 | - $status = delete_post_meta( $id, $meta_key, $meta_value ); |
|
1270 | +function give_delete_meta($id, $meta_key, $meta_value = '') { |
|
1271 | + $status = delete_post_meta($id, $meta_key, $meta_value); |
|
1272 | 1272 | |
1273 | 1273 | /** |
1274 | 1274 | * Filter the meta value delete status |
1275 | 1275 | * |
1276 | 1276 | * @since 1.8.8 |
1277 | 1277 | */ |
1278 | - return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value ); |
|
1278 | + return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value); |
|
1279 | 1279 | } |
1280 | 1280 | |
1281 | 1281 | /** |
@@ -1287,15 +1287,15 @@ discard block |
||
1287 | 1287 | * |
1288 | 1288 | * @return bool If the action has been added to the completed actions array |
1289 | 1289 | */ |
1290 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
1290 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
1291 | 1291 | |
1292 | - if ( empty( $upgrade_action ) ) { |
|
1292 | + if (empty($upgrade_action)) { |
|
1293 | 1293 | return false; |
1294 | 1294 | } |
1295 | 1295 | |
1296 | 1296 | $completed_upgrades = give_get_completed_upgrades(); |
1297 | 1297 | |
1298 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
1298 | + return in_array($upgrade_action, $completed_upgrades); |
|
1299 | 1299 | |
1300 | 1300 | } |
1301 | 1301 | |
@@ -1307,8 +1307,8 @@ discard block |
||
1307 | 1307 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
1308 | 1308 | */ |
1309 | 1309 | function give_maybe_resume_upgrade() { |
1310 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
1311 | - if ( empty( $doing_upgrade ) ) { |
|
1310 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
1311 | + if (empty($doing_upgrade)) { |
|
1312 | 1312 | return false; |
1313 | 1313 | } |
1314 | 1314 | |
@@ -1324,9 +1324,9 @@ discard block |
||
1324 | 1324 | * |
1325 | 1325 | * @return bool If the function was successfully added |
1326 | 1326 | */ |
1327 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
1327 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
1328 | 1328 | |
1329 | - if ( empty( $upgrade_action ) ) { |
|
1329 | + if (empty($upgrade_action)) { |
|
1330 | 1330 | return false; |
1331 | 1331 | } |
1332 | 1332 | |
@@ -1334,16 +1334,16 @@ discard block |
||
1334 | 1334 | $completed_upgrades[] = $upgrade_action; |
1335 | 1335 | |
1336 | 1336 | // Remove any blanks, and only show uniques. |
1337 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
1337 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
1338 | 1338 | |
1339 | 1339 | /** |
1340 | 1340 | * Fire the action when any upgrade set to complete. |
1341 | 1341 | * |
1342 | 1342 | * @since 1.8.12 |
1343 | 1343 | */ |
1344 | - do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades ); |
|
1344 | + do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades); |
|
1345 | 1345 | |
1346 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
1346 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
1347 | 1347 | } |
1348 | 1348 | |
1349 | 1349 | /** |
@@ -1353,7 +1353,7 @@ discard block |
||
1353 | 1353 | * @return array The array of completed upgrades |
1354 | 1354 | */ |
1355 | 1355 | function give_get_completed_upgrades() { |
1356 | - return (array) get_option( 'give_completed_upgrades' ); |
|
1356 | + return (array) get_option('give_completed_upgrades'); |
|
1357 | 1357 | } |
1358 | 1358 | |
1359 | 1359 | /** |
@@ -1363,21 +1363,21 @@ discard block |
||
1363 | 1363 | * |
1364 | 1364 | * @param \WP_Query |
1365 | 1365 | */ |
1366 | -function give_remove_pages_from_search( $query ) { |
|
1367 | - if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) { |
|
1368 | - $transaction_failed = give_get_option( 'failure_page', 0 ); |
|
1369 | - $success_page = give_get_option( 'success_page', 0 ); |
|
1366 | +function give_remove_pages_from_search($query) { |
|
1367 | + if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) { |
|
1368 | + $transaction_failed = give_get_option('failure_page', 0); |
|
1369 | + $success_page = give_get_option('success_page', 0); |
|
1370 | 1370 | $args = apply_filters( |
1371 | 1371 | 'give_remove_pages_from_search', array( |
1372 | 1372 | $transaction_failed, |
1373 | 1373 | $success_page, |
1374 | 1374 | ), $query |
1375 | 1375 | ); |
1376 | - $query->set( 'post__not_in', $args ); |
|
1376 | + $query->set('post__not_in', $args); |
|
1377 | 1377 | } |
1378 | 1378 | } |
1379 | 1379 | |
1380 | -add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 ); |
|
1380 | +add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1); |
|
1381 | 1381 | |
1382 | 1382 | /** |
1383 | 1383 | * Inserts a new key/value before a key in the array. |
@@ -1393,14 +1393,14 @@ discard block |
||
1393 | 1393 | * |
1394 | 1394 | * @see array_insert_before() |
1395 | 1395 | */ |
1396 | -function give_array_insert_before( $key, array &$array, $new_key, $new_value ) { |
|
1397 | - if ( array_key_exists( $key, $array ) ) { |
|
1396 | +function give_array_insert_before($key, array &$array, $new_key, $new_value) { |
|
1397 | + if (array_key_exists($key, $array)) { |
|
1398 | 1398 | $new = array(); |
1399 | - foreach ( $array as $k => $value ) { |
|
1400 | - if ( $k === $key ) { |
|
1401 | - $new[ $new_key ] = $new_value; |
|
1399 | + foreach ($array as $k => $value) { |
|
1400 | + if ($k === $key) { |
|
1401 | + $new[$new_key] = $new_value; |
|
1402 | 1402 | } |
1403 | - $new[ $k ] = $value; |
|
1403 | + $new[$k] = $value; |
|
1404 | 1404 | } |
1405 | 1405 | |
1406 | 1406 | return $new; |
@@ -1423,13 +1423,13 @@ discard block |
||
1423 | 1423 | * |
1424 | 1424 | * @see array_insert_before() |
1425 | 1425 | */ |
1426 | -function give_array_insert_after( $key, array &$array, $new_key, $new_value ) { |
|
1427 | - if ( array_key_exists( $key, $array ) ) { |
|
1426 | +function give_array_insert_after($key, array &$array, $new_key, $new_value) { |
|
1427 | + if (array_key_exists($key, $array)) { |
|
1428 | 1428 | $new = array(); |
1429 | - foreach ( $array as $k => $value ) { |
|
1430 | - $new[ $k ] = $value; |
|
1431 | - if ( $k === $key ) { |
|
1432 | - $new[ $new_key ] = $new_value; |
|
1429 | + foreach ($array as $k => $value) { |
|
1430 | + $new[$k] = $value; |
|
1431 | + if ($k === $key) { |
|
1432 | + $new[$new_key] = $new_value; |
|
1433 | 1433 | } |
1434 | 1434 | } |
1435 | 1435 | |
@@ -1456,21 +1456,21 @@ discard block |
||
1456 | 1456 | * corresponding to `$index_key`. If `$index_key` is null, array keys from the original |
1457 | 1457 | * `$list` will be preserved in the results. |
1458 | 1458 | */ |
1459 | -function give_list_pluck( $list, $field, $index_key = null ) { |
|
1459 | +function give_list_pluck($list, $field, $index_key = null) { |
|
1460 | 1460 | |
1461 | - if ( ! $index_key ) { |
|
1461 | + if ( ! $index_key) { |
|
1462 | 1462 | /* |
1463 | 1463 | * This is simple. Could at some point wrap array_column() |
1464 | 1464 | * if we knew we had an array of arrays. |
1465 | 1465 | */ |
1466 | - foreach ( $list as $key => $value ) { |
|
1467 | - if ( is_object( $value ) ) { |
|
1468 | - if ( isset( $value->$field ) ) { |
|
1469 | - $list[ $key ] = $value->$field; |
|
1466 | + foreach ($list as $key => $value) { |
|
1467 | + if (is_object($value)) { |
|
1468 | + if (isset($value->$field)) { |
|
1469 | + $list[$key] = $value->$field; |
|
1470 | 1470 | } |
1471 | 1471 | } else { |
1472 | - if ( isset( $value[ $field ] ) ) { |
|
1473 | - $list[ $key ] = $value[ $field ]; |
|
1472 | + if (isset($value[$field])) { |
|
1473 | + $list[$key] = $value[$field]; |
|
1474 | 1474 | } |
1475 | 1475 | } |
1476 | 1476 | } |
@@ -1483,18 +1483,18 @@ discard block |
||
1483 | 1483 | * to the end of the stack. This is how array_column() behaves. |
1484 | 1484 | */ |
1485 | 1485 | $newlist = array(); |
1486 | - foreach ( $list as $value ) { |
|
1487 | - if ( is_object( $value ) ) { |
|
1488 | - if ( isset( $value->$index_key ) ) { |
|
1489 | - $newlist[ $value->$index_key ] = $value->$field; |
|
1486 | + foreach ($list as $value) { |
|
1487 | + if (is_object($value)) { |
|
1488 | + if (isset($value->$index_key)) { |
|
1489 | + $newlist[$value->$index_key] = $value->$field; |
|
1490 | 1490 | } else { |
1491 | 1491 | $newlist[] = $value->$field; |
1492 | 1492 | } |
1493 | 1493 | } else { |
1494 | - if ( isset( $value[ $index_key ] ) ) { |
|
1495 | - $newlist[ $value[ $index_key ] ] = $value[ $field ]; |
|
1494 | + if (isset($value[$index_key])) { |
|
1495 | + $newlist[$value[$index_key]] = $value[$field]; |
|
1496 | 1496 | } else { |
1497 | - $newlist[] = $value[ $field ]; |
|
1497 | + $newlist[] = $value[$field]; |
|
1498 | 1498 | } |
1499 | 1499 | } |
1500 | 1500 | } |
@@ -1517,8 +1517,8 @@ discard block |
||
1517 | 1517 | * |
1518 | 1518 | * @return int|false Meta ID on success, false on failure. |
1519 | 1519 | */ |
1520 | -function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) { |
|
1521 | - return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique ); |
|
1520 | +function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) { |
|
1521 | + return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique); |
|
1522 | 1522 | } |
1523 | 1523 | |
1524 | 1524 | /** |
@@ -1536,8 +1536,8 @@ discard block |
||
1536 | 1536 | * |
1537 | 1537 | * @return bool True on success, false on failure. |
1538 | 1538 | */ |
1539 | -function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) { |
|
1540 | - return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value ); |
|
1539 | +function delete_donor_meta($donor_id, $meta_key, $meta_value = '') { |
|
1540 | + return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value); |
|
1541 | 1541 | } |
1542 | 1542 | |
1543 | 1543 | /** |
@@ -1552,8 +1552,8 @@ discard block |
||
1552 | 1552 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single |
1553 | 1553 | * is true. |
1554 | 1554 | */ |
1555 | -function get_donor_meta( $donor_id, $key = '', $single = false ) { |
|
1556 | - return get_metadata( 'give_customer', $donor_id, $key, $single ); |
|
1555 | +function get_donor_meta($donor_id, $key = '', $single = false) { |
|
1556 | + return get_metadata('give_customer', $donor_id, $key, $single); |
|
1557 | 1557 | } |
1558 | 1558 | |
1559 | 1559 | /** |
@@ -1570,8 +1570,8 @@ discard block |
||
1570 | 1570 | * |
1571 | 1571 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure. |
1572 | 1572 | */ |
1573 | -function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1574 | - return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value ); |
|
1573 | +function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') { |
|
1574 | + return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value); |
|
1575 | 1575 | } |
1576 | 1576 | |
1577 | 1577 | /* |
@@ -1581,15 +1581,15 @@ discard block |
||
1581 | 1581 | * |
1582 | 1582 | * @param int $form_id Form id of which recalculation needs to be done. |
1583 | 1583 | */ |
1584 | -function give_recount_form_income_donation( $form_id = false ) { |
|
1584 | +function give_recount_form_income_donation($form_id = false) { |
|
1585 | 1585 | // Check if form id is not empty. |
1586 | - if ( ! empty( $form_id ) ) { |
|
1586 | + if ( ! empty($form_id)) { |
|
1587 | 1587 | /** |
1588 | 1588 | * Filter to modify payment status. |
1589 | 1589 | * |
1590 | 1590 | * @since 1.8.13 |
1591 | 1591 | */ |
1592 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
1592 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
1593 | 1593 | |
1594 | 1594 | /** |
1595 | 1595 | * Filter to modify args of payment query before recalculating the form total |
@@ -1600,7 +1600,7 @@ discard block |
||
1600 | 1600 | 'give_recount_form_stats_args', array( |
1601 | 1601 | 'give_forms' => $form_id, |
1602 | 1602 | 'status' => $accepted_statuses, |
1603 | - 'posts_per_page' => - 1, |
|
1603 | + 'posts_per_page' => -1, |
|
1604 | 1604 | 'fields' => 'ids', |
1605 | 1605 | ) |
1606 | 1606 | ); |
@@ -1610,28 +1610,28 @@ discard block |
||
1610 | 1610 | 'earnings' => 0, |
1611 | 1611 | ); |
1612 | 1612 | |
1613 | - $payments = new Give_Payments_Query( $args ); |
|
1613 | + $payments = new Give_Payments_Query($args); |
|
1614 | 1614 | $payments = $payments->get_payments(); |
1615 | 1615 | |
1616 | - if ( $payments ) { |
|
1617 | - foreach ( $payments as $payment ) { |
|
1616 | + if ($payments) { |
|
1617 | + foreach ($payments as $payment) { |
|
1618 | 1618 | // Ensure acceptible status only |
1619 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
1619 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
1620 | 1620 | continue; |
1621 | 1621 | } |
1622 | 1622 | |
1623 | 1623 | // Ensure only payments for this form are counted |
1624 | - if ( $payment->form_id != $form_id ) { |
|
1624 | + if ($payment->form_id != $form_id) { |
|
1625 | 1625 | continue; |
1626 | 1626 | } |
1627 | 1627 | |
1628 | - $totals['sales'] ++; |
|
1628 | + $totals['sales']++; |
|
1629 | 1629 | $totals['earnings'] += $payment->total; |
1630 | 1630 | |
1631 | 1631 | } |
1632 | 1632 | } |
1633 | - give_update_meta( $form_id, '_give_form_sales', $totals['sales'] ); |
|
1634 | - give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) ); |
|
1633 | + give_update_meta($form_id, '_give_form_sales', $totals['sales']); |
|
1634 | + give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings'])); |
|
1635 | 1635 | }// End if(). |
1636 | 1636 | } |
1637 | 1637 | |
@@ -1662,7 +1662,7 @@ discard block |
||
1662 | 1662 | ); |
1663 | 1663 | |
1664 | 1664 | // Check for Zero Based Currency. |
1665 | - if ( in_array( give_get_currency(), $zero_based_currency ) ) { |
|
1665 | + if (in_array(give_get_currency(), $zero_based_currency)) { |
|
1666 | 1666 | return true; |
1667 | 1667 | } |
1668 | 1668 |
@@ -7,23 +7,23 @@ discard block |
||
7 | 7 | |
8 | 8 | global $give_access_form_outputted; |
9 | 9 | $show_form = true; |
10 | -$email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : ''; |
|
10 | +$email = isset($_POST['give_email']) ? $_POST['give_email'] : ''; |
|
11 | 11 | |
12 | 12 | // reCAPTCHA |
13 | -$recaptcha_key = give_get_option( 'recaptcha_key' ); |
|
14 | -$recaptcha_secret = give_get_option( 'recaptcha_secret' ); |
|
15 | -$enable_recaptcha = ( ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ) ? true : false; |
|
13 | +$recaptcha_key = give_get_option('recaptcha_key'); |
|
14 | +$recaptcha_secret = give_get_option('recaptcha_secret'); |
|
15 | +$enable_recaptcha = ( ! empty($recaptcha_key) && ! empty($recaptcha_secret)) ? true : false; |
|
16 | 16 | |
17 | 17 | // Only output the form once. |
18 | -if ( $give_access_form_outputted ) { |
|
18 | +if ($give_access_form_outputted) { |
|
19 | 19 | return; |
20 | 20 | } |
21 | 21 | |
22 | 22 | // Form submission |
23 | -if ( is_email( $email ) && wp_verify_nonce( $_POST['_wpnonce'], 'give' ) ) { |
|
23 | +if (is_email($email) && wp_verify_nonce($_POST['_wpnonce'], 'give')) { |
|
24 | 24 | |
25 | 25 | // Use reCAPTCHA |
26 | - if ( $enable_recaptcha ) { |
|
26 | + if ($enable_recaptcha) { |
|
27 | 27 | |
28 | 28 | $args = array( |
29 | 29 | 'secret' => $recaptcha_secret, |
@@ -31,68 +31,68 @@ discard block |
||
31 | 31 | 'remoteip' => $_POST['give_ip'], |
32 | 32 | ); |
33 | 33 | |
34 | - if ( ! empty( $args['response'] ) ) { |
|
35 | - $request = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array( |
|
34 | + if ( ! empty($args['response'])) { |
|
35 | + $request = wp_remote_post('https://www.google.com/recaptcha/api/siteverify', array( |
|
36 | 36 | 'body' => $args, |
37 | - ) ); |
|
38 | - if ( ! is_wp_error( $request ) || 200 == wp_remote_retrieve_response_code( $request ) ) { |
|
37 | + )); |
|
38 | + if ( ! is_wp_error($request) || 200 == wp_remote_retrieve_response_code($request)) { |
|
39 | 39 | |
40 | - $response = json_decode( $request['body'], true ); |
|
40 | + $response = json_decode($request['body'], true); |
|
41 | 41 | |
42 | 42 | // reCAPTCHA fail |
43 | - if ( ! $response['success'] ) { |
|
44 | - give_set_error( 'give_recaptcha_test_failed', apply_filters( 'give_recaptcha_test_failed_message', esc_html__( 'reCAPTCHA test failed.', 'give' ) ) ); |
|
43 | + if ( ! $response['success']) { |
|
44 | + give_set_error('give_recaptcha_test_failed', apply_filters('give_recaptcha_test_failed_message', esc_html__('reCAPTCHA test failed.', 'give'))); |
|
45 | 45 | } |
46 | 46 | } else { |
47 | 47 | |
48 | 48 | // Connection issue |
49 | - give_set_error( 'give_recaptcha_connection_issue', apply_filters( 'give_recaptcha_connection_issue_message', esc_html__( 'Unable to connect to reCAPTCHA server.', 'give' ) ) ); |
|
49 | + give_set_error('give_recaptcha_connection_issue', apply_filters('give_recaptcha_connection_issue_message', esc_html__('Unable to connect to reCAPTCHA server.', 'give'))); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | } // End if(). |
53 | 53 | else { |
54 | 54 | |
55 | - give_set_error( 'give_recaptcha_failed', apply_filters( 'give_recaptcha_failed_message', esc_html__( 'It looks like the reCAPTCHA test has failed.', 'give' ) ) ); |
|
55 | + give_set_error('give_recaptcha_failed', apply_filters('give_recaptcha_failed_message', esc_html__('It looks like the reCAPTCHA test has failed.', 'give'))); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | 60 | // If no errors or only expired token key error - then send email |
61 | - if ( ! give_get_errors() ) { |
|
61 | + if ( ! give_get_errors()) { |
|
62 | 62 | |
63 | - $donor = Give()->donors->get_donor_by( 'email', $email ); |
|
63 | + $donor = Give()->donors->get_donor_by('email', $email); |
|
64 | 64 | |
65 | - if ( isset( $donor->id ) ) { |
|
66 | - if ( Give()->email_access->can_send_email( $donor->id ) ) { |
|
67 | - Give()->email_access->send_email( $donor->id, $email ); |
|
65 | + if (isset($donor->id)) { |
|
66 | + if (Give()->email_access->can_send_email($donor->id)) { |
|
67 | + Give()->email_access->send_email($donor->id, $email); |
|
68 | 68 | $show_form = false; |
69 | 69 | } |
70 | 70 | } else { |
71 | - give_set_error( 'give_no_donor_email_exists', apply_filters( 'give_no_donor_email_exists_message', __( 'It looks like that donor email address does not exist.', 'give' ) ) ); |
|
71 | + give_set_error('give_no_donor_email_exists', apply_filters('give_no_donor_email_exists_message', __('It looks like that donor email address does not exist.', 'give'))); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | }// End if(). |
75 | 75 | |
76 | 76 | // Print any messages & errors |
77 | -Give()->notices->render_frontend_notices( 0 ); |
|
77 | +Give()->notices->render_frontend_notices(0); |
|
78 | 78 | |
79 | 79 | // Show the email login form? |
80 | -if ( $show_form ) { ?> |
|
80 | +if ($show_form) { ?> |
|
81 | 81 | <div class="give-form"> |
82 | 82 | |
83 | 83 | <?php |
84 | - if ( ! give_get_errors() ) { |
|
85 | - Give()->notices->print_frontend_notice( apply_filters( 'give_email_access_message', __( 'Please enter the email address you used for your donation. A verification email containing an access link will be sent to you.', 'give' ) ), true ); |
|
84 | + if ( ! give_get_errors()) { |
|
85 | + Give()->notices->print_frontend_notice(apply_filters('give_email_access_message', __('Please enter the email address you used for your donation. A verification email containing an access link will be sent to you.', 'give')), true); |
|
86 | 86 | } ?> |
87 | 87 | |
88 | 88 | <form method="post" action="" id="give-email-access-form"> |
89 | - <label for="give-email"><?php esc_html__( 'Donation Email:', 'give' ); ?></label> |
|
90 | - <input id="give-email" type="email" name="give_email" value="" placeholder="<?php esc_attr_e( 'Your donation email', 'give' ); ?>" /> |
|
91 | - <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'give' ); ?>" /> |
|
89 | + <label for="give-email"><?php esc_html__('Donation Email:', 'give'); ?></label> |
|
90 | + <input id="give-email" type="email" name="give_email" value="" placeholder="<?php esc_attr_e('Your donation email', 'give'); ?>" /> |
|
91 | + <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('give'); ?>" /> |
|
92 | 92 | |
93 | 93 | <?php |
94 | 94 | // Enable reCAPTCHA? |
95 | - if ( $enable_recaptcha ) { ?> |
|
95 | + if ($enable_recaptcha) { ?> |
|
96 | 96 | |
97 | 97 | <script> |
98 | 98 | //IP verify for reCAPTCHA |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | <input type="hidden" name="give_ip" class="give_ip" value="" /> |
111 | 111 | <?php } ?> |
112 | 112 | |
113 | - <input type="submit" class="give-submit" value="<?php esc_attr_e( 'Email access token', 'give' ); ?>" /> |
|
113 | + <input type="submit" class="give-submit" value="<?php esc_attr_e('Email access token', 'give'); ?>" /> |
|
114 | 114 | </form> |
115 | 115 | </div> |
116 | 116 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | Give()->notices->print_frontend_notice( |
122 | 122 | sprintf( |
123 | 123 | /* translators: %s: user email address */ |
124 | - esc_html__( 'An email with an access link has been sent to %s.', 'give' ), |
|
124 | + esc_html__('An email with an access link has been sent to %s.', 'give'), |
|
125 | 125 | |
126 | 126 | ), |
127 | 127 | true, |
@@ -94,7 +94,7 @@ |
||
94 | 94 | <?php |
95 | 95 | // Display View Receipt or. |
96 | 96 | if ( 'publish' !== $post->post_status |
97 | - && 'subscription' !== $post->post_status |
|
97 | + && 'subscription' !== $post->post_status |
|
98 | 98 | ) : ?> |
99 | 99 | <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) ); ?>"><span |
100 | 100 | class="give-donation-status <?php echo $post->post_status; ?>"><?php echo esc_html__( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' »'; ?></span></a> |
@@ -4,18 +4,18 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | // User's Donations. |
7 | -if ( is_user_logged_in() ) { |
|
8 | - $donations = give_get_users_donations( get_current_user_id(), 20, true, 'any' ); |
|
9 | -} elseif ( Give()->email_access->token_exists ) { |
|
7 | +if (is_user_logged_in()) { |
|
8 | + $donations = give_get_users_donations(get_current_user_id(), 20, true, 'any'); |
|
9 | +} elseif (Give()->email_access->token_exists) { |
|
10 | 10 | // Email Access Token? |
11 | - $donations = give_get_users_donations( 0, 20, true, 'any' ); |
|
12 | -} elseif ( Give()->session->get_session_expiration() !== false ) { |
|
11 | + $donations = give_get_users_donations(0, 20, true, 'any'); |
|
12 | +} elseif (Give()->session->get_session_expiration() !== false) { |
|
13 | 13 | // Session active? |
14 | - $email = Give()->session->get( 'give_email' ); |
|
15 | - $donations = give_get_users_donations( $email, 20, true, 'any' ); |
|
14 | + $email = Give()->session->get('give_email'); |
|
15 | + $donations = give_get_users_donations($email, 20, true, 'any'); |
|
16 | 16 | } |
17 | 17 | |
18 | -if ( $donations ) : ?> |
|
18 | +if ($donations) : ?> |
|
19 | 19 | <table id="give_user_history" class="give-table"> |
20 | 20 | <thead> |
21 | 21 | <tr class="give-donation-row"> |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @since 1.7 |
29 | 29 | */ |
30 | - do_action( 'give_donation_history_header_before' ); |
|
30 | + do_action('give_donation_history_header_before'); |
|
31 | 31 | ?> |
32 | - <th scope="col" class="give-donation-id"><?php esc_html_e( 'ID', 'give' ); ?></th> |
|
33 | - <th scope="col" class="give-donation-date"><?php esc_html_e( 'Date', 'give' ); ?></th> |
|
34 | - <th scope="col" class="give-donation-amount"><?php esc_html_e( 'Amount', 'give' ); ?></th> |
|
35 | - <th scope="col" class="give-donation-details"><?php esc_html_e( 'Details', 'give' ); ?></th> |
|
32 | + <th scope="col" class="give-donation-id"><?php esc_html_e('ID', 'give'); ?></th> |
|
33 | + <th scope="col" class="give-donation-date"><?php esc_html_e('Date', 'give'); ?></th> |
|
34 | + <th scope="col" class="give-donation-amount"><?php esc_html_e('Amount', 'give'); ?></th> |
|
35 | + <th scope="col" class="give-donation-details"><?php esc_html_e('Details', 'give'); ?></th> |
|
36 | 36 | <?php |
37 | 37 | /** |
38 | 38 | * Fires in current user donation history table, after the header row ends. |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @since 1.7 |
43 | 43 | */ |
44 | - do_action( 'give_donation_history_header_after' ); |
|
44 | + do_action('give_donation_history_header_after'); |
|
45 | 45 | ?> |
46 | 46 | </tr> |
47 | 47 | </thead> |
48 | - <?php foreach ( $donations as $post ) : |
|
49 | - setup_postdata( $post ); |
|
50 | - $donation_data = give_get_payment_meta( $post->ID ); ?> |
|
48 | + <?php foreach ($donations as $post) : |
|
49 | + setup_postdata($post); |
|
50 | + $donation_data = give_get_payment_meta($post->ID); ?> |
|
51 | 51 | <tr class="give-donation-row"> |
52 | 52 | <?php |
53 | 53 | /** |
@@ -60,19 +60,19 @@ discard block |
||
60 | 60 | * @param int $post_id The ID of the post. |
61 | 61 | * @param mixed $donation_data Payment meta data. |
62 | 62 | */ |
63 | - do_action( 'give_donation_history_row_start', $post->ID, $donation_data ); |
|
63 | + do_action('give_donation_history_row_start', $post->ID, $donation_data); |
|
64 | 64 | ?> |
65 | - <td class="give-donation-id">#<?php echo give_get_payment_number( $post->ID ); ?></td> |
|
66 | - <td class="give-donation-date"><?php echo date_i18n( give_date_format(), strtotime( get_post_field( 'post_date', $post->ID ) ) ); ?></td> |
|
65 | + <td class="give-donation-id">#<?php echo give_get_payment_number($post->ID); ?></td> |
|
66 | + <td class="give-donation-date"><?php echo date_i18n(give_date_format(), strtotime(get_post_field('post_date', $post->ID))); ?></td> |
|
67 | 67 | <td class="give-donation-amount"> |
68 | 68 | <span class="give-donation-amount"> |
69 | 69 | <?php |
70 | - $currency_code = give_get_payment_currency_code( $post->ID ); |
|
70 | + $currency_code = give_get_payment_currency_code($post->ID); |
|
71 | 71 | $donation_amount = give_currency_filter( |
72 | - give_format_amount( give_get_payment_amount( $post->ID ), array( |
|
72 | + give_format_amount(give_get_payment_amount($post->ID), array( |
|
73 | 73 | 'sanitize' => false, |
74 | 74 | 'currency' => $currency_code |
75 | - ) ), |
|
75 | + )), |
|
76 | 76 | $currency_code |
77 | 77 | ); |
78 | 78 | |
@@ -86,20 +86,20 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return int |
88 | 88 | */ |
89 | - echo apply_filters( 'give_donation_history_row_amount', $donation_amount, $post->ID ); |
|
89 | + echo apply_filters('give_donation_history_row_amount', $donation_amount, $post->ID); |
|
90 | 90 | ?> |
91 | 91 | </span> |
92 | 92 | </td> |
93 | 93 | <td class="give-donation-details"> |
94 | 94 | <?php |
95 | 95 | // Display View Receipt or. |
96 | - if ( 'publish' !== $post->post_status |
|
96 | + if ('publish' !== $post->post_status |
|
97 | 97 | && 'subscription' !== $post->post_status |
98 | 98 | ) : ?> |
99 | - <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) ); ?>"><span |
|
100 | - class="give-donation-status <?php echo $post->post_status; ?>"><?php echo esc_html__( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' »'; ?></span></a> |
|
99 | + <a href="<?php echo esc_url(add_query_arg('payment_key', give_get_payment_key($post->ID), give_get_history_page_uri())); ?>"><span |
|
100 | + class="give-donation-status <?php echo $post->post_status; ?>"><?php echo esc_html__('View', 'give').' '.give_get_payment_status($post, true).' »'; ?></span></a> |
|
101 | 101 | <?php else : ?> |
102 | - <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) ); ?>"><?php esc_html_e( 'View Receipt »', 'give' ); ?></a> |
|
102 | + <a href="<?php echo esc_url(add_query_arg('payment_key', give_get_payment_key($post->ID), give_get_history_page_uri())); ?>"><?php esc_html_e('View Receipt »', 'give'); ?></a> |
|
103 | 103 | <?php endif; ?> |
104 | 104 | </td> |
105 | 105 | <?php |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param int $post_id The ID of the post. |
114 | 114 | * @param mixed $donation_data Payment meta data. |
115 | 115 | */ |
116 | - do_action( 'give_donation_history_row_end', $post->ID, $donation_data ); |
|
116 | + do_action('give_donation_history_row_end', $post->ID, $donation_data); |
|
117 | 117 | ?> |
118 | 118 | </tr> |
119 | 119 | <?php endforeach; ?> |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | <div id="give-donation-history-pagination" class="give_pagination navigation"> |
122 | 122 | <?php |
123 | 123 | $big = 999999; |
124 | - echo paginate_links( array( |
|
125 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
124 | + echo paginate_links(array( |
|
125 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
126 | 126 | 'format' => '?paged=%#%', |
127 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
128 | - 'total' => ceil( give_count_donations_of_donor() / 20 ) // 20 items per page |
|
129 | - ) ); |
|
127 | + 'current' => max(1, get_query_var('paged')), |
|
128 | + 'total' => ceil(give_count_donations_of_donor() / 20) // 20 items per page |
|
129 | + )); |
|
130 | 130 | ?> |
131 | 131 | </div> |
132 | 132 | <?php wp_reset_postdata(); ?> |
133 | 133 | <?php else : ?> |
134 | - <?php Give()->notices->print_frontend_notice( esc_html__( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?> |
|
134 | + <?php Give()->notices->print_frontend_notice(esc_html__('It looks like you haven\'t made any donations.', 'give'), true, 'success'); ?> |
|
135 | 135 | <?php endif; |
@@ -98,8 +98,11 @@ discard block |
||
98 | 98 | ) : ?> |
99 | 99 | <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) ); ?>"><span |
100 | 100 | class="give-donation-status <?php echo $post->post_status; ?>"><?php echo esc_html__( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' »'; ?></span></a> |
101 | - <?php else : ?> |
|
102 | - <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) ); ?>"><?php esc_html_e( 'View Receipt »', 'give' ); ?></a> |
|
101 | + <?php else { |
|
102 | + : ?> |
|
103 | + <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) ); |
|
104 | +} |
|
105 | +?>"><?php esc_html_e( 'View Receipt »', 'give' ); ?></a> |
|
103 | 106 | <?php endif; ?> |
104 | 107 | </td> |
105 | 108 | <?php |
@@ -130,6 +133,9 @@ discard block |
||
130 | 133 | ?> |
131 | 134 | </div> |
132 | 135 | <?php wp_reset_postdata(); ?> |
133 | -<?php else : ?> |
|
134 | - <?php Give()->notices->print_frontend_notice( esc_html__( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?> |
|
136 | +<?php else { |
|
137 | + : ?> |
|
138 | + <?php Give()->notices->print_frontend_notice( esc_html__( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); |
|
139 | +} |
|
140 | +?> |
|
135 | 141 | <?php endif; |
@@ -6,25 +6,25 @@ discard block |
||
6 | 6 | global $give_receipt_args, $payment; |
7 | 7 | |
8 | 8 | // Validation: Ensure $payment var is set. |
9 | -if ( empty( $payment ) ) { |
|
10 | - $payment = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0; |
|
9 | +if (empty($payment)) { |
|
10 | + $payment = ! empty($give_receipt_args['id']) ? get_post($give_receipt_args['id']) : 0; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // Double-Validation: Check for $payment global. |
14 | -if ( empty( $payment ) ) { |
|
15 | - Give()->notices->print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) ); |
|
14 | +if (empty($payment)) { |
|
15 | + Give()->notices->print_frontend_notice(__('The specified receipt ID appears to be invalid.', 'give')); |
|
16 | 16 | |
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | 20 | $donation_id = $payment->ID; |
21 | -$form_id = give_get_payment_meta( $donation_id, '_give_payment_form_id', true ); |
|
22 | -$meta = give_get_payment_meta( $donation_id ); |
|
23 | -$donation = give_get_payment_form_title( $meta ); |
|
24 | -$user = give_get_payment_meta_user_info( $donation_id ); |
|
25 | -$email = give_get_payment_user_email( $donation_id ); |
|
21 | +$form_id = give_get_payment_meta($donation_id, '_give_payment_form_id', true); |
|
22 | +$meta = give_get_payment_meta($donation_id); |
|
23 | +$donation = give_get_payment_form_title($meta); |
|
24 | +$user = give_get_payment_meta_user_info($donation_id); |
|
25 | +$email = give_get_payment_user_email($donation_id); |
|
26 | 26 | $status = $payment->post_status; |
27 | -$status_label = give_get_payment_status( $payment, true ); |
|
27 | +$status_label = give_get_payment_status($payment, true); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Generate Donation Receipt Arguments. |
@@ -35,50 +35,50 @@ discard block |
||
35 | 35 | * @since 1.8.8 |
36 | 36 | */ |
37 | 37 | $give_receipt_args['donation_receipt']['donor'] = array( |
38 | - 'name' => __( 'Donor', 'give' ), |
|
39 | - 'value' => $user['first_name'] . ' ' . $user['last_name'], |
|
38 | + 'name' => __('Donor', 'give'), |
|
39 | + 'value' => $user['first_name'].' '.$user['last_name'], |
|
40 | 40 | 'display' => $give_receipt_args['donor'], |
41 | 41 | ); |
42 | 42 | |
43 | 43 | $give_receipt_args['donation_receipt']['date'] = array( |
44 | - 'name' => __( 'Date', 'give' ), |
|
45 | - 'value' => date_i18n( give_date_format(), strtotime( $meta['date'] ) ), |
|
44 | + 'name' => __('Date', 'give'), |
|
45 | + 'value' => date_i18n(give_date_format(), strtotime($meta['date'])), |
|
46 | 46 | 'display' => $give_receipt_args['date'], |
47 | 47 | ); |
48 | 48 | |
49 | 49 | $give_receipt_args['donation_receipt']['total_donation'] = array( |
50 | - 'name' => __( 'Total Donation', 'give' ), |
|
51 | - 'value' => give_payment_amount( $donation_id ), |
|
50 | + 'name' => __('Total Donation', 'give'), |
|
51 | + 'value' => give_payment_amount($donation_id), |
|
52 | 52 | 'display' => $give_receipt_args['price'], |
53 | 53 | ); |
54 | 54 | |
55 | 55 | $give_receipt_args['donation_receipt']['donation'] = array( |
56 | - 'name' => __( 'Donation', 'give' ), |
|
56 | + 'name' => __('Donation', 'give'), |
|
57 | 57 | 'value' => $donation, |
58 | 58 | 'display' => true, |
59 | 59 | ); |
60 | 60 | |
61 | 61 | $give_receipt_args['donation_receipt']['donation_status'] = array( |
62 | - 'name' => __( 'Donation Status', 'give' ), |
|
63 | - 'value' => esc_attr( $status_label ), |
|
62 | + 'name' => __('Donation Status', 'give'), |
|
63 | + 'value' => esc_attr($status_label), |
|
64 | 64 | 'display' => $give_receipt_args['payment_status'], |
65 | 65 | ); |
66 | 66 | |
67 | 67 | $give_receipt_args['donation_receipt']['donation_id'] = array( |
68 | - 'name' => __( 'Donation ID', 'give' ), |
|
68 | + 'name' => __('Donation ID', 'give'), |
|
69 | 69 | 'value' => $donation_id, |
70 | 70 | 'display' => $give_receipt_args['payment_id'], |
71 | 71 | ); |
72 | 72 | |
73 | 73 | $give_receipt_args['donation_receipt']['payment_key'] = array( |
74 | - 'name' => __( 'Payment Key', 'give' ), |
|
75 | - 'value' => get_post_meta( $donation_id, '_give_payment_purchase_key', true ), |
|
74 | + 'name' => __('Payment Key', 'give'), |
|
75 | + 'value' => get_post_meta($donation_id, '_give_payment_purchase_key', true), |
|
76 | 76 | 'display' => $give_receipt_args['payment_key'], |
77 | 77 | ); |
78 | 78 | |
79 | 79 | $give_receipt_args['donation_receipt']['payment_method'] = array( |
80 | - 'name' => __( 'Payment Method', 'give' ), |
|
81 | - 'value' => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ), |
|
80 | + 'name' => __('Payment Method', 'give'), |
|
81 | + 'value' => give_get_gateway_checkout_label(give_get_payment_gateway($donation_id)), |
|
82 | 82 | 'display' => $give_receipt_args['payment_method'], |
83 | 83 | ); |
84 | 84 | |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @since 1.8.8 |
95 | 95 | */ |
96 | -$give_receipt_args['donation_receipt'] = apply_filters( 'give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id ); |
|
96 | +$give_receipt_args['donation_receipt'] = apply_filters('give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id); |
|
97 | 97 | |
98 | 98 | // When the donation were made through offline donation, We won't show receipt and payment status though. |
99 | -if ( 'offline' === give_get_payment_gateway( $payment->ID ) && 'pending' === $status ) { |
|
99 | +if ('offline' === give_get_payment_gateway($payment->ID) && 'pending' === $status) { |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Before the offline donation receipt content starts. |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @param Give_Payment $payment Donation payment object. |
107 | 107 | * @param array $give_receipt_args Receipt Arguments. |
108 | 108 | */ |
109 | - do_action( 'give_receipt_before_offline_payment', $payment, $give_receipt_args ); |
|
109 | + do_action('give_receipt_before_offline_payment', $payment, $give_receipt_args); |
|
110 | 110 | ?> |
111 | - <h2><?php echo apply_filters( 'give_receipt_offline_payment_heading', __( 'Your Donation is Almost Complete!', 'give' ) ); ?></h2> |
|
112 | - <div id="give_donation_receipt" class="<?php echo esc_attr( apply_filters( 'give_receipt_offline_payment_classes', 'give_receipt_offline_payment' ) ); ?>"> |
|
111 | + <h2><?php echo apply_filters('give_receipt_offline_payment_heading', __('Your Donation is Almost Complete!', 'give')); ?></h2> |
|
112 | + <div id="give_donation_receipt" class="<?php echo esc_attr(apply_filters('give_receipt_offline_payment_classes', 'give_receipt_offline_payment')); ?>"> |
|
113 | 113 | <?php |
114 | 114 | // Instruction for offline donation. |
115 | - $offline_instruction = give_get_offline_payment_instruction( $form_id, true ); |
|
115 | + $offline_instruction = give_get_offline_payment_instruction($form_id, true); |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Instruction for the offline donation. |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param Give_Payment $payment Payment object. |
124 | 124 | * @param integer $form_id Donation form id. |
125 | 125 | */ |
126 | - echo apply_filters( 'give_receipt_offline_payment_instruction', $offline_instruction, $payment, $form_id ); |
|
126 | + echo apply_filters('give_receipt_offline_payment_instruction', $offline_instruction, $payment, $form_id); |
|
127 | 127 | ?> |
128 | 128 | </div> |
129 | 129 | <?php |
@@ -135,52 +135,52 @@ discard block |
||
135 | 135 | * @param Give_Payment $payment Donation payment object. |
136 | 136 | * @param array $give_receipt_args Receipt Arguments. |
137 | 137 | */ |
138 | - do_action( 'give_receipt_after_offline_payment', $payment, $give_receipt_args ); |
|
138 | + do_action('give_receipt_after_offline_payment', $payment, $give_receipt_args); |
|
139 | 139 | |
140 | 140 | return; |
141 | 141 | } |
142 | 142 | |
143 | 143 | // Show payment status notice based on shortcode attribute. |
144 | -if ( filter_var( $give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN ) ) { |
|
144 | +if (filter_var($give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN)) { |
|
145 | 145 | $notice_message = ''; |
146 | 146 | $notice_type = 'warning'; |
147 | 147 | |
148 | - switch ( $status ) { |
|
148 | + switch ($status) { |
|
149 | 149 | case 'publish': |
150 | - $notice_message = __( 'Payment Complete: Thank you for your donation.', 'give' ); |
|
150 | + $notice_message = __('Payment Complete: Thank you for your donation.', 'give'); |
|
151 | 151 | $notice_type = 'success'; |
152 | 152 | break; |
153 | 153 | case 'pending': |
154 | - $notice_message = __( 'Payment Pending: Your donation is currently processing.', 'give' ); |
|
154 | + $notice_message = __('Payment Pending: Your donation is currently processing.', 'give'); |
|
155 | 155 | $notice_type = 'warning'; |
156 | 156 | break; |
157 | 157 | case 'refunded': |
158 | - $notice_message = __( 'Payment Refunded: Your donation has been refunded.', 'give' ); |
|
158 | + $notice_message = __('Payment Refunded: Your donation has been refunded.', 'give'); |
|
159 | 159 | $notice_type = 'warning'; |
160 | 160 | break; |
161 | 161 | case 'preapproval': |
162 | - $notice_message = __( 'Payment Preapproved: Thank you for your donation.', 'give' ); |
|
162 | + $notice_message = __('Payment Preapproved: Thank you for your donation.', 'give'); |
|
163 | 163 | $notice_type = 'warning'; |
164 | 164 | break; |
165 | 165 | case 'failed': |
166 | - $notice_message = __( 'Payment Failed: Please contact the site owner for assistance.', 'give' ); |
|
166 | + $notice_message = __('Payment Failed: Please contact the site owner for assistance.', 'give'); |
|
167 | 167 | $notice_type = 'error'; |
168 | 168 | break; |
169 | 169 | case 'cancelled': |
170 | - $notice_message = __( 'Payment Cancelled: Your donation has been cancelled.', 'give' ); |
|
170 | + $notice_message = __('Payment Cancelled: Your donation has been cancelled.', 'give'); |
|
171 | 171 | $notice_type = 'error'; |
172 | 172 | break; |
173 | 173 | case 'abandoned': |
174 | - $notice_message = __( 'Payment Abandoned: This donation has not been completed.', 'give' ); |
|
174 | + $notice_message = __('Payment Abandoned: This donation has not been completed.', 'give'); |
|
175 | 175 | $notice_type = 'error'; |
176 | 176 | break; |
177 | 177 | case 'revoked': |
178 | - $notice_message = __( 'Payment Revoked: Please contact the site owner for assistance.', 'give' ); |
|
178 | + $notice_message = __('Payment Revoked: Please contact the site owner for assistance.', 'give'); |
|
179 | 179 | $notice_type = 'error'; |
180 | 180 | break; |
181 | 181 | } |
182 | 182 | |
183 | - if ( ! empty( $notice_message ) ) { |
|
183 | + if ( ! empty($notice_message)) { |
|
184 | 184 | /** |
185 | 185 | * Filters payment status notice for receipts. |
186 | 186 | * |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param string $status Payment status. |
196 | 196 | * @param array $meta Array of meta data related to the payment. |
197 | 197 | */ |
198 | - echo apply_filters( 'give_receipt_status_notice', Give()->notices->print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $meta ); |
|
198 | + echo apply_filters('give_receipt_status_notice', Give()->notices->print_frontend_notice($notice_message, false, $notice_type), $id, $status, $meta); |
|
199 | 199 | } |
200 | 200 | }// End if(). |
201 | 201 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @param object $payment The payment object. |
210 | 210 | * @param array $give_receipt_args Receipt_argument. |
211 | 211 | */ |
212 | -do_action( 'give_payment_receipt_before_table', $payment, $give_receipt_args ); |
|
212 | +do_action('give_payment_receipt_before_table', $payment, $give_receipt_args); |
|
213 | 213 | ?> |
214 | 214 | |
215 | 215 | <table id="give_donation_receipt" class="give-table"> |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | * @param object $payment The payment object. |
226 | 226 | * @param array $give_receipt_args Receipt_argument. |
227 | 227 | */ |
228 | - do_action( 'give_payment_receipt_header_before', $payment, $give_receipt_args ); |
|
228 | + do_action('give_payment_receipt_header_before', $payment, $give_receipt_args); |
|
229 | 229 | ?> |
230 | 230 | <tr> |
231 | 231 | <th scope="colgroup" colspan="2"> |
232 | - <span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ) ?></span> |
|
232 | + <span class="give-receipt-thead-text"><?php esc_html_e('Donation Receipt', 'give') ?></span> |
|
233 | 233 | </th> |
234 | 234 | </tr> |
235 | 235 | <?php |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @param object $payment The payment object. |
244 | 244 | * @param array $give_receipt_args Receipt_argument. |
245 | 245 | */ |
246 | - do_action( 'give_payment_receipt_header_after', $payment, $give_receipt_args ); |
|
246 | + do_action('give_payment_receipt_header_after', $payment, $give_receipt_args); |
|
247 | 247 | ?> |
248 | 248 | </thead> |
249 | 249 | |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | * @param object $payment The payment object. |
260 | 260 | * @param array $give_receipt_args Receipt_argument. |
261 | 261 | */ |
262 | - do_action( 'give_payment_receipt_before', $payment, $give_receipt_args ); |
|
262 | + do_action('give_payment_receipt_before', $payment, $give_receipt_args); |
|
263 | 263 | ?> |
264 | 264 | |
265 | - <?php foreach ( $give_receipt_args['donation_receipt'] as $receipt_item ) { ?> |
|
266 | - <?php if ( filter_var( $receipt_item['display'], FILTER_VALIDATE_BOOLEAN ) ) : ?> |
|
265 | + <?php foreach ($give_receipt_args['donation_receipt'] as $receipt_item) { ?> |
|
266 | + <?php if (filter_var($receipt_item['display'], FILTER_VALIDATE_BOOLEAN)) : ?> |
|
267 | 267 | <tr> |
268 | 268 | <td scope="row"><strong><?php echo $receipt_item['name']; ?></strong></td> |
269 | 269 | <td><?php echo $receipt_item['value']; ?></td> |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @param object $payment The payment object. |
283 | 283 | * @param array $give_receipt_args Receipt_argument. |
284 | 284 | */ |
285 | - do_action( 'give_payment_receipt_after', $payment, $give_receipt_args ); |
|
285 | + do_action('give_payment_receipt_after', $payment, $give_receipt_args); |
|
286 | 286 | ?> |
287 | 287 | </tbody> |
288 | 288 | </table> |
@@ -298,5 +298,5 @@ discard block |
||
298 | 298 | * @param object $payment The payment object. |
299 | 299 | * @param array $give_receipt_args Receipt_argument. |
300 | 300 | */ |
301 | -do_action( 'give_payment_receipt_after_table', $payment, $give_receipt_args ); |
|
301 | +do_action('give_payment_receipt_after_table', $payment, $give_receipt_args); |
|
302 | 302 | ?> |
@@ -7,22 +7,22 @@ discard block |
||
7 | 7 | * @copyright Copyright (c) 2016, WordImpress |
8 | 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
9 | 9 | */ |
10 | -$current_user = wp_get_current_user(); |
|
10 | +$current_user = wp_get_current_user(); |
|
11 | 11 | |
12 | -if ( is_user_logged_in() ): |
|
12 | +if (is_user_logged_in()): |
|
13 | 13 | $user_id = get_current_user_id(); |
14 | - $first_name = get_user_meta( $user_id, 'first_name', true ); |
|
15 | - $last_name = get_user_meta( $user_id, 'last_name', true ); |
|
14 | + $first_name = get_user_meta($user_id, 'first_name', true); |
|
15 | + $last_name = get_user_meta($user_id, 'last_name', true); |
|
16 | 16 | $display_name = $current_user->display_name; |
17 | - $address = give_get_donor_address( $user_id ); |
|
17 | + $address = give_get_donor_address($user_id); |
|
18 | 18 | |
19 | - if ( isset( $_GET['updated'] ) && $_GET['updated'] == true && ! give_get_errors() ): ?> |
|
19 | + if (isset($_GET['updated']) && $_GET['updated'] == true && ! give_get_errors()): ?> |
|
20 | 20 | <p class="give_success"> |
21 | - <strong><?php esc_html_e( 'Success:', 'give' ); ?></strong> <?php esc_html_e( 'Your profile has been updated.', 'give' ); ?> |
|
21 | + <strong><?php esc_html_e('Success:', 'give'); ?></strong> <?php esc_html_e('Your profile has been updated.', 'give'); ?> |
|
22 | 22 | </p> |
23 | 23 | <?php endif; ?> |
24 | 24 | |
25 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
25 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
26 | 26 | |
27 | 27 | <?php |
28 | 28 | /** |
@@ -32,39 +32,39 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 1.0 |
34 | 34 | */ |
35 | - do_action( 'give_profile_editor_before' ); |
|
35 | + do_action('give_profile_editor_before'); |
|
36 | 36 | ?> |
37 | 37 | |
38 | 38 | <form id="give_profile_editor_form" class="give-form" action="<?php echo give_get_current_page_url(); ?>" method="post"> |
39 | 39 | |
40 | 40 | <fieldset> |
41 | - <legend id="give_profile_name_label"><?php _e( 'Profile', 'give' ); ?></legend> |
|
41 | + <legend id="give_profile_name_label"><?php _e('Profile', 'give'); ?></legend> |
|
42 | 42 | |
43 | - <h3 id="give_personal_information_label" class="give-section-break"><?php _e( 'Change your Name', 'give' ); ?></h3> |
|
43 | + <h3 id="give_personal_information_label" class="give-section-break"><?php _e('Change your Name', 'give'); ?></h3> |
|
44 | 44 | |
45 | 45 | <p id="give_profile_first_name_wrap" class="form-row form-row-first form-row-responsive"> |
46 | - <label for="give_first_name"><?php _e( 'First Name', 'give' ); ?></label> |
|
47 | - <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr( $first_name ); ?>"/> |
|
46 | + <label for="give_first_name"><?php _e('First Name', 'give'); ?></label> |
|
47 | + <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr($first_name); ?>"/> |
|
48 | 48 | </p> |
49 | 49 | |
50 | 50 | <p id="give_profile_last_name_wrap" class="form-row form-row-last form-row-responsive"> |
51 | - <label for="give_last_name"><?php _e( 'Last Name', 'give' ); ?></label> |
|
52 | - <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr( $last_name ); ?>"/> |
|
51 | + <label for="give_last_name"><?php _e('Last Name', 'give'); ?></label> |
|
52 | + <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr($last_name); ?>"/> |
|
53 | 53 | </p> |
54 | 54 | |
55 | 55 | <p id="give_profile_display_name_wrap" class="form-row form-row-first form-row-responsive"> |
56 | - <label for="give_display_name"><?php _e( 'Display Name', 'give' ); ?></label> |
|
56 | + <label for="give_display_name"><?php _e('Display Name', 'give'); ?></label> |
|
57 | 57 | <select name="give_display_name" id="give_display_name" class="select give-select"> |
58 | - <?php if ( ! empty( $current_user->first_name ) ): ?> |
|
59 | - <option <?php selected( $display_name, $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->first_name ); ?>"><?php echo esc_html( $current_user->first_name ); ?></option> |
|
58 | + <?php if ( ! empty($current_user->first_name)): ?> |
|
59 | + <option <?php selected($display_name, $current_user->first_name); ?> value="<?php echo esc_attr($current_user->first_name); ?>"><?php echo esc_html($current_user->first_name); ?></option> |
|
60 | 60 | <?php endif; ?> |
61 | - <option <?php selected( $display_name, $current_user->user_nicename ); ?> value="<?php echo esc_attr( $current_user->user_nicename ); ?>"><?php echo esc_html( $current_user->user_nicename ); ?></option> |
|
62 | - <?php if ( ! empty( $current_user->last_name ) ): ?> |
|
63 | - <option <?php selected( $display_name, $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->last_name ); ?>"><?php echo esc_html( $current_user->last_name ); ?></option> |
|
61 | + <option <?php selected($display_name, $current_user->user_nicename); ?> value="<?php echo esc_attr($current_user->user_nicename); ?>"><?php echo esc_html($current_user->user_nicename); ?></option> |
|
62 | + <?php if ( ! empty($current_user->last_name)): ?> |
|
63 | + <option <?php selected($display_name, $current_user->last_name); ?> value="<?php echo esc_attr($current_user->last_name); ?>"><?php echo esc_html($current_user->last_name); ?></option> |
|
64 | 64 | <?php endif; ?> |
65 | - <?php if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ): ?> |
|
66 | - <option <?php selected( $display_name, $current_user->first_name . ' ' . $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->first_name . ' ' . $current_user->last_name ); ?>"><?php echo esc_html( $current_user->first_name . ' ' . $current_user->last_name ); ?></option> |
|
67 | - <option <?php selected( $display_name, $current_user->last_name . ' ' . $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->last_name . ' ' . $current_user->first_name ); ?>"><?php echo esc_html( $current_user->last_name . ' ' . $current_user->first_name ); ?></option> |
|
65 | + <?php if ( ! empty($current_user->first_name) && ! empty($current_user->last_name)): ?> |
|
66 | + <option <?php selected($display_name, $current_user->first_name.' '.$current_user->last_name); ?> value="<?php echo esc_attr($current_user->first_name.' '.$current_user->last_name); ?>"><?php echo esc_html($current_user->first_name.' '.$current_user->last_name); ?></option> |
|
67 | + <option <?php selected($display_name, $current_user->last_name.' '.$current_user->first_name); ?> value="<?php echo esc_attr($current_user->last_name.' '.$current_user->first_name); ?>"><?php echo esc_html($current_user->last_name.' '.$current_user->first_name); ?></option> |
|
68 | 68 | <?php endif; ?> |
69 | 69 | </select> |
70 | 70 | <?php |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @since 1.0 |
77 | 77 | */ |
78 | - do_action( 'give_profile_editor_name' ); |
|
78 | + do_action('give_profile_editor_name'); |
|
79 | 79 | ?> |
80 | 80 | </p> |
81 | 81 | |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @since 1.0 |
89 | 89 | */ |
90 | - do_action( 'give_profile_editor_after_name' ); |
|
90 | + do_action('give_profile_editor_after_name'); |
|
91 | 91 | ?> |
92 | 92 | |
93 | 93 | <p class="form-row form-row-last form-row-responsive"> |
94 | - <label for="give_email"><?php _e( 'Email Address', 'give' ); ?></label> |
|
95 | - <input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr( $current_user->user_email ); ?>" required aria-required="true"/> |
|
94 | + <label for="give_email"><?php _e('Email Address', 'give'); ?></label> |
|
95 | + <input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr($current_user->user_email); ?>" required aria-required="true"/> |
|
96 | 96 | <?php |
97 | 97 | /** |
98 | 98 | * Fires in the profile editor shortcode, to the email section. |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @since 1.0 |
103 | 103 | */ |
104 | - do_action( 'give_profile_editor_email' ); |
|
104 | + do_action('give_profile_editor_email'); |
|
105 | 105 | ?> |
106 | 106 | </p> |
107 | 107 | |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @since 1.0 |
115 | 115 | */ |
116 | - do_action( 'give_profile_editor_after_email' ); |
|
116 | + do_action('give_profile_editor_after_email'); |
|
117 | 117 | ?> |
118 | 118 | |
119 | - <h3 id="give_profile_billing_address_label" class="give-section-break"><?php _e( 'Change your Billing Address', 'give' ); ?></h3> |
|
119 | + <h3 id="give_profile_billing_address_label" class="give-section-break"><?php _e('Change your Billing Address', 'give'); ?></h3> |
|
120 | 120 | |
121 | 121 | <div id="give_profile_billing_address_wrap"> |
122 | 122 | <?php |
123 | 123 | // Get selected country from address. |
124 | - $selected_country = ( ! empty( $address['country'] ) ? $address['country'] : '' ); |
|
124 | + $selected_country = ( ! empty($address['country']) ? $address['country'] : ''); |
|
125 | 125 | |
126 | 126 | $selected_state = ''; |
127 | - if ( $selected_country === give_get_country() ) { |
|
127 | + if ($selected_country === give_get_country()) { |
|
128 | 128 | // Get default selected state by admin. |
129 | 129 | $selected_state = give_get_state(); |
130 | 130 | } |
131 | 131 | |
132 | 132 | // Get selected state from address. |
133 | - $selected_state = ! empty( $address['state'] ) ? $address['state'] : $selected_state; |
|
133 | + $selected_state = ! empty($address['state']) ? $address['state'] : $selected_state; |
|
134 | 134 | |
135 | - $label = __( 'State', 'give' ); |
|
135 | + $label = __('State', 'give'); |
|
136 | 136 | $states_label = give_get_states_label(); |
137 | 137 | // Check if $country code exists in the array key for states label. |
138 | - if ( array_key_exists( $selected_country, $states_label ) ) { |
|
139 | - $label = $states_label[ $selected_country ]; |
|
138 | + if (array_key_exists($selected_country, $states_label)) { |
|
139 | + $label = $states_label[$selected_country]; |
|
140 | 140 | } |
141 | 141 | |
142 | - $states = give_get_states( $selected_country ); |
|
142 | + $states = give_get_states($selected_country); |
|
143 | 143 | |
144 | 144 | // Get the country list that do not have any states init. |
145 | 145 | $no_states_country = give_no_states_country_list(); |
@@ -149,39 +149,39 @@ discard block |
||
149 | 149 | ?> |
150 | 150 | |
151 | 151 | <p id="give-card-country-wrap" class="form-row form-row-wide"> |
152 | - <label for="give_address_country"><?php _e( 'Country', 'give' ); ?></label> |
|
152 | + <label for="give_address_country"><?php _e('Country', 'give'); ?></label> |
|
153 | 153 | <select name="give_address_country" id="give_address_country" class="select give-select"> |
154 | - <?php foreach ( give_get_country_list() as $key => $country ) : ?> |
|
155 | - <option value="<?php echo $key; ?>"<?php selected( $selected_country, $key ); ?>><?php echo esc_html( $country ); ?></option> |
|
154 | + <?php foreach (give_get_country_list() as $key => $country) : ?> |
|
155 | + <option value="<?php echo $key; ?>"<?php selected($selected_country, $key); ?>><?php echo esc_html($country); ?></option> |
|
156 | 156 | <?php endforeach; ?> |
157 | 157 | </select> |
158 | 158 | </p> |
159 | 159 | |
160 | 160 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
161 | - <label for="give_address_line1"><?php _e( 'Address 1', 'give' ); ?></label> |
|
161 | + <label for="give_address_line1"><?php _e('Address 1', 'give'); ?></label> |
|
162 | 162 | <input name="give_address_line1" id="give_address_line1" class="text give-input" type="text" |
163 | - value="<?php echo esc_attr( $address['line1'] ); ?>"/> |
|
163 | + value="<?php echo esc_attr($address['line1']); ?>"/> |
|
164 | 164 | </p> |
165 | 165 | |
166 | 166 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
167 | - <label for="give_address_line2"><?php _e( 'Address 2', 'give' ); ?></label> |
|
167 | + <label for="give_address_line2"><?php _e('Address 2', 'give'); ?></label> |
|
168 | 168 | <input name="give_address_line2" id="give_address_line2" class="text give-input" type="text" |
169 | - value="<?php echo esc_attr( $address['line2'] ); ?>"/> |
|
169 | + value="<?php echo esc_attr($address['line2']); ?>"/> |
|
170 | 170 | </p> |
171 | 171 | |
172 | 172 | |
173 | 173 | <p id="give-card-state-wrap" |
174 | - class="form-row form-row-wide <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?>"> |
|
175 | - <label for="give_address_state"><?php _e( 'State / Province / County', 'give' ); ?></label> |
|
174 | + class="form-row form-row-wide <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?>"> |
|
175 | + <label for="give_address_state"><?php _e('State / Province / County', 'give'); ?></label> |
|
176 | 176 | <?php |
177 | - if ( ! empty( $states ) ) : ?> |
|
177 | + if ( ! empty($states)) : ?> |
|
178 | 178 | <select |
179 | 179 | name="give_address_state" |
180 | 180 | id="give_address_state" |
181 | 181 | class="give_address_state" |
182 | 182 | <?php |
183 | - foreach ( $states as $state_code => $state ) { |
|
184 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
183 | + foreach ($states as $state_code => $state) { |
|
184 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
185 | 185 | } |
186 | 186 | ?> |
187 | 187 | </select> |
@@ -194,15 +194,15 @@ discard block |
||
194 | 194 | </p> |
195 | 195 | |
196 | 196 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
197 | - <label for="give_address_city"><?php _e( 'City', 'give' ); ?></label> |
|
197 | + <label for="give_address_city"><?php _e('City', 'give'); ?></label> |
|
198 | 198 | <input name="give_address_city" id="give_address_city" class="text give-input" type="text" |
199 | - value="<?php echo esc_attr( $address['city'] ); ?>"/> |
|
199 | + value="<?php echo esc_attr($address['city']); ?>"/> |
|
200 | 200 | </p> |
201 | 201 | |
202 | 202 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
203 | - <label for="give_address_zip"><?php _e( 'Zip / Postal Code', 'give' ); ?></label> |
|
203 | + <label for="give_address_zip"><?php _e('Zip / Postal Code', 'give'); ?></label> |
|
204 | 204 | <input name="give_address_zip" id="give_address_zip" class="text give-input" type="text" |
205 | - value="<?php echo esc_attr( $address['zip'] ); ?>"/> |
|
205 | + value="<?php echo esc_attr($address['zip']); ?>"/> |
|
206 | 206 | </p> |
207 | 207 | |
208 | 208 | <?php |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @since 1.0 |
215 | 215 | */ |
216 | - do_action( 'give_profile_editor_address' ); |
|
216 | + do_action('give_profile_editor_address'); |
|
217 | 217 | ?> |
218 | 218 | |
219 | 219 | </div> |
@@ -226,19 +226,19 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @since 1.0 |
228 | 228 | */ |
229 | - do_action( 'give_profile_editor_after_address' ); |
|
229 | + do_action('give_profile_editor_after_address'); |
|
230 | 230 | ?> |
231 | 231 | |
232 | - <h3 id="give_profile_password_label" class="give-section-break"><?php _e( 'Change your Password', 'give' ); ?></h3> |
|
232 | + <h3 id="give_profile_password_label" class="give-section-break"><?php _e('Change your Password', 'give'); ?></h3> |
|
233 | 233 | |
234 | 234 | <div id="give_profile_password_wrap" class="give-clearfix"> |
235 | 235 | <p id="give_profile_password_wrap_1" class="form-row form-row-first form-row-responsive"> |
236 | - <label for="give_new_user_pass1"><?php _e( 'New Password', 'give' ); ?></label> |
|
236 | + <label for="give_new_user_pass1"><?php _e('New Password', 'give'); ?></label> |
|
237 | 237 | <input name="give_new_user_pass1" id="give_new_user_pass1" class="password give-input" type="password"/> |
238 | 238 | </p> |
239 | 239 | |
240 | 240 | <p id="give_profile_password_wrap_2" class="form-row form-row-last form-row-responsive"> |
241 | - <label for="give_new_user_pass2"><?php _e( 'Re-enter Password', 'give' ); ?></label> |
|
241 | + <label for="give_new_user_pass2"><?php _e('Re-enter Password', 'give'); ?></label> |
|
242 | 242 | <input name="give_new_user_pass2" id="give_new_user_pass2" class="password give-input" type="password"/> |
243 | 243 | <?php |
244 | 244 | /** |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @since 1.0 |
250 | 250 | */ |
251 | - do_action( 'give_profile_editor_password' ); |
|
251 | + do_action('give_profile_editor_password'); |
|
252 | 252 | ?> |
253 | 253 | </p> |
254 | 254 | </div> |
255 | 255 | |
256 | - <p class="give_password_change_notice"><?php _e( 'Please note after changing your password, you must log back in.', 'give' ); ?></p> |
|
256 | + <p class="give_password_change_notice"><?php _e('Please note after changing your password, you must log back in.', 'give'); ?></p> |
|
257 | 257 | |
258 | 258 | <?php |
259 | 259 | /** |
@@ -263,14 +263,14 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @since 1.0 |
265 | 265 | */ |
266 | - do_action( 'give_profile_editor_after_password' ); |
|
266 | + do_action('give_profile_editor_after_password'); |
|
267 | 267 | ?> |
268 | 268 | |
269 | 269 | <p id="give_profile_submit_wrap"> |
270 | - <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce( 'give-profile-editor-nonce' ); ?>"/> |
|
270 | + <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce('give-profile-editor-nonce'); ?>"/> |
|
271 | 271 | <input type="hidden" name="give_action" value="edit_user_profile"/> |
272 | - <input type="hidden" name="give_redirect" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
273 | - <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e( 'Save Changes', 'give' ); ?>"/> |
|
272 | + <input type="hidden" name="give_redirect" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
273 | + <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e('Save Changes', 'give'); ?>"/> |
|
274 | 274 | </p> |
275 | 275 | |
276 | 276 | </fieldset> |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @since 1.0 |
287 | 287 | */ |
288 | - do_action( 'give_profile_editor_after' ); |
|
288 | + do_action('give_profile_editor_after'); |
|
289 | 289 | ?> |
290 | 290 | |
291 | 291 | <?php |
292 | 292 | else: |
293 | - _e( 'You need to login to edit your profile.', 'give' ); |
|
293 | + _e('You need to login to edit your profile.', 'give'); |
|
294 | 294 | echo give_login_form(); |
295 | 295 | endif; |
@@ -185,10 +185,13 @@ discard block |
||
185 | 185 | } |
186 | 186 | ?> |
187 | 187 | </select> |
188 | - <?php else : ?> |
|
188 | + <?php else { |
|
189 | + : ?> |
|
189 | 190 | <input type="text" size="6" name="give_address_state" id="give_address_state" |
190 | 191 | class="give_address_state give-input" |
191 | - placeholder="<?php echo $label; ?>" value="<?php echo $selected_state; ?>"/> |
|
192 | + placeholder="<?php echo $label; |
|
193 | +} |
|
194 | +?>" value="<?php echo $selected_state; ?>"/> |
|
192 | 195 | <?php endif; |
193 | 196 | ?> |
194 | 197 | </p> |
@@ -289,7 +292,9 @@ discard block |
||
289 | 292 | ?> |
290 | 293 | |
291 | 294 | <?php |
292 | -else: |
|
295 | +else { |
|
296 | + : |
|
293 | 297 | _e( 'You need to login to edit your profile.', 'give' ); |
298 | +} |
|
294 | 299 | echo give_login_form(); |
295 | 300 | endif; |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly. |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Main Give Class |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return Give |
203 | 203 | */ |
204 | 204 | public static function instance() { |
205 | - if ( is_null( self::$_instance ) ) { |
|
205 | + if (is_null(self::$_instance)) { |
|
206 | 206 | self::$_instance = new self(); |
207 | 207 | } |
208 | 208 | |
@@ -214,13 +214,13 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function __construct() { |
216 | 216 | // PHP version |
217 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
218 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
217 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
218 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | // Bailout: Need minimum php version to load plugin. |
222 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
223 | - add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) ); |
|
222 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
223 | + add_action('admin_notices', array($this, 'minmum_phpversion_notice')); |
|
224 | 224 | |
225 | 225 | return; |
226 | 226 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $this->includes(); |
231 | 231 | $this->init_hooks(); |
232 | 232 | |
233 | - do_action( 'give_loaded' ); |
|
233 | + do_action('give_loaded'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | * @since 1.8.9 |
240 | 240 | */ |
241 | 241 | private function init_hooks() { |
242 | - register_activation_hook( __FILE__, 'give_install' ); |
|
243 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
242 | + register_activation_hook(__FILE__, 'give_install'); |
|
243 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
244 | 244 | } |
245 | 245 | /** |
246 | 246 | * Init Give when WordPress Initializes. |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @since 1.8.9 |
256 | 256 | */ |
257 | - do_action( 'before_give_init' ); |
|
257 | + do_action('before_give_init'); |
|
258 | 258 | |
259 | 259 | // Set up localization. |
260 | 260 | $this->load_textdomain(); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @since 1.8.7 |
281 | 281 | */ |
282 | - do_action( 'give_init', $this ); |
|
282 | + do_action('give_init', $this); |
|
283 | 283 | |
284 | 284 | } |
285 | 285 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function __clone() { |
298 | 298 | // Cloning instances of the class is forbidden. |
299 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
299 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function __wakeup() { |
311 | 311 | // Unserializing instances of the class is forbidden. |
312 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
312 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -323,33 +323,33 @@ discard block |
||
323 | 323 | private function setup_constants() { |
324 | 324 | |
325 | 325 | // Plugin version |
326 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
327 | - define( 'GIVE_VERSION', '1.8.15' ); |
|
326 | + if ( ! defined('GIVE_VERSION')) { |
|
327 | + define('GIVE_VERSION', '1.8.15'); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | // Plugin Folder Path |
331 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
332 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
331 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
332 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | // Plugin Folder URL |
336 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
337 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
336 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
337 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | // Plugin Basename aka: "give/give.php" |
341 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
342 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
341 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
342 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | // Plugin Root File |
346 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
347 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
346 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
347 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | // Make sure CAL_GREGORIAN is defined |
351 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
352 | - define( 'CAL_GREGORIAN', 1 ); |
|
351 | + if ( ! defined('CAL_GREGORIAN')) { |
|
352 | + define('CAL_GREGORIAN', 1); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -364,132 +364,132 @@ discard block |
||
364 | 364 | private function includes() { |
365 | 365 | global $give_options; |
366 | 366 | |
367 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
368 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
367 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
368 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
369 | 369 | $give_options = give_get_settings(); |
370 | 370 | |
371 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
372 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
373 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
374 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
375 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
376 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
377 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
378 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
379 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
380 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
381 | - |
|
382 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
383 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
384 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
386 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
387 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
388 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
391 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
392 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
393 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
394 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
395 | - |
|
396 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php'; |
|
400 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
401 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
402 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
403 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
404 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
405 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
406 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
407 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
408 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
409 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
410 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
411 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
412 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
413 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
414 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
415 | - |
|
416 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
417 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
418 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
419 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
420 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
421 | - |
|
422 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
423 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
424 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
425 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
426 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
427 | - |
|
428 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
429 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
430 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
431 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
432 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
433 | - |
|
434 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php'; |
|
435 | - |
|
436 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
437 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
371 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
372 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
373 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
374 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
375 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
376 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
377 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
378 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
379 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
380 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
381 | + |
|
382 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
383 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
384 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
386 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
387 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
388 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
391 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
392 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
393 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
394 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
395 | + |
|
396 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/import-functions.php'; |
|
400 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
401 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
402 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
403 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
404 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
405 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
406 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
407 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
408 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
409 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
410 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
411 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
412 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
413 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
414 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
415 | + |
|
416 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
417 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
418 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
419 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
420 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
421 | + |
|
422 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
423 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
424 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
425 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
426 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
427 | + |
|
428 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
429 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
430 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
431 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
432 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
433 | + |
|
434 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php'; |
|
435 | + |
|
436 | + if (defined('WP_CLI') && WP_CLI) { |
|
437 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
438 | 438 | } |
439 | 439 | |
440 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
440 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
441 | 441 | |
442 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
443 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
444 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
445 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
446 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
447 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
448 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
449 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
450 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
451 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
452 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php'; |
|
442 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
443 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
444 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
445 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
446 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
447 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
448 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
449 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
450 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
451 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
452 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php'; |
|
453 | 453 | |
454 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
455 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
454 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
455 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
456 | 456 | |
457 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
458 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
459 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
457 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
458 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
459 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
460 | 460 | |
461 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
462 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
463 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
461 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
462 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
463 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
464 | 464 | |
465 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
466 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
467 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
468 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
465 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
466 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
467 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
468 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
469 | 469 | |
470 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
471 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
472 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
470 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
471 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
472 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
473 | 473 | |
474 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
474 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
475 | 475 | |
476 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
476 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
477 | 477 | |
478 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
479 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
480 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
481 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
482 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
483 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
484 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
485 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
486 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
478 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
479 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
481 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
482 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
483 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
484 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
485 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
486 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
487 | 487 | |
488 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
488 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
489 | 489 | |
490 | 490 | }// End if(). |
491 | 491 | |
492 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
492 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
@@ -504,16 +504,16 @@ discard block |
||
504 | 504 | public function load_textdomain() { |
505 | 505 | |
506 | 506 | // Set filter for Give's languages directory |
507 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
508 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
507 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
508 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
509 | 509 | |
510 | 510 | // Traditional WordPress plugin locale filter. |
511 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
512 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
511 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
512 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
513 | 513 | |
514 | - unload_textdomain( 'give' ); |
|
515 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
516 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
514 | + unload_textdomain('give'); |
|
515 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
516 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
517 | 517 | |
518 | 518 | } |
519 | 519 | |
@@ -526,17 +526,17 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function minmum_phpversion_notice() { |
528 | 528 | // Bailout. |
529 | - if ( ! is_admin() ) { |
|
529 | + if ( ! is_admin()) { |
|
530 | 530 | return; |
531 | 531 | } |
532 | 532 | |
533 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
534 | - $notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>'; |
|
535 | - $notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>'; |
|
536 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
537 | - $notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>'; |
|
538 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
539 | - $notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>'; |
|
533 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
534 | + $notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>'; |
|
535 | + $notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>'; |
|
536 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
537 | + $notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>'; |
|
538 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
539 | + $notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>'; |
|
540 | 540 | |
541 | 541 | echo sprintf( |
542 | 542 | '<div class="notice notice-error">%1$s</div>', |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | // Get offline payment instruction. |
45 | - $offline_instructions = give_get_offline_payment_instruction( $form_id, true ); |
|
45 | + $offline_instructions = give_get_offline_payment_instruction($form_id, true); |
|
46 | 46 | |
47 | 47 | ob_start(); |
48 | 48 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param int $form_id Give form id. |
55 | 55 | */ |
56 | - do_action( 'give_before_offline_info_fields', $form_id ); |
|
56 | + do_action('give_before_offline_info_fields', $form_id); |
|
57 | 57 | ?> |
58 | 58 | <fieldset id="give_offline_payment_info"> |
59 | - <?php echo stripslashes( $offline_instructions ); ?> |
|
59 | + <?php echo stripslashes($offline_instructions); ?> |
|
60 | 60 | </fieldset> |
61 | 61 | <?php |
62 | 62 | /** |
@@ -66,35 +66,35 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param int $form_id Give form id. |
68 | 68 | */ |
69 | - do_action( 'give_after_offline_info_fields', $form_id ); |
|
69 | + do_action('give_after_offline_info_fields', $form_id); |
|
70 | 70 | |
71 | 71 | echo ob_get_clean(); |
72 | 72 | } |
73 | 73 | |
74 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
74 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Give Offline Billing Field |
78 | 78 | * |
79 | 79 | * @param $form_id |
80 | 80 | */ |
81 | -function give_offline_billing_fields( $form_id ) { |
|
81 | +function give_offline_billing_fields($form_id) { |
|
82 | 82 | //Enable Default CC fields (billing info) |
83 | - $post_offline_cc_fields = give_get_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
84 | - $post_offline_customize_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
83 | + $post_offline_cc_fields = give_get_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
84 | + $post_offline_customize_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
85 | 85 | |
86 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
86 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
87 | 87 | |
88 | 88 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
89 | 89 | if ( |
90 | - ( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) ) |
|
91 | - || ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) ) |
|
90 | + (give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields)) |
|
91 | + || (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields)) |
|
92 | 92 | ) { |
93 | - give_default_cc_address_fields( $form_id ); |
|
93 | + give_default_cc_address_fields($form_id); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
97 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Process the payment |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return void |
107 | 107 | */ |
108 | -function give_offline_process_payment( $purchase_data ) { |
|
108 | +function give_offline_process_payment($purchase_data) { |
|
109 | 109 | |
110 | 110 | // Setup the payment details. |
111 | 111 | $payment_data = array( |
112 | 112 | 'price' => $purchase_data['price'], |
113 | 113 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
114 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
115 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
114 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
115 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
116 | 116 | 'date' => $purchase_data['date'], |
117 | 117 | 'user_email' => $purchase_data['user_email'], |
118 | 118 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -124,20 +124,20 @@ discard block |
||
124 | 124 | |
125 | 125 | |
126 | 126 | // record the pending payment |
127 | - $payment = give_insert_payment( $payment_data ); |
|
127 | + $payment = give_insert_payment($payment_data); |
|
128 | 128 | |
129 | - if ( $payment ) { |
|
130 | - give_offline_send_admin_notice( $payment ); |
|
131 | - give_offline_send_donor_instructions( $payment ); |
|
129 | + if ($payment) { |
|
130 | + give_offline_send_admin_notice($payment); |
|
131 | + give_offline_send_donor_instructions($payment); |
|
132 | 132 | give_send_to_success_page(); |
133 | 133 | } else { |
134 | 134 | // if errors are present, send the user back to the donation form so they can be corrected |
135 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
135 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | } |
139 | 139 | |
140 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
140 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
141 | 141 | |
142 | 142 | |
143 | 143 | /** |
@@ -150,59 +150,59 @@ discard block |
||
150 | 150 | * @since 1.0 |
151 | 151 | * @return void |
152 | 152 | */ |
153 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
153 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
154 | 154 | |
155 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
156 | - $post_offline_customization_option = give_get_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
155 | + $payment_data = give_get_payment_meta($payment_id); |
|
156 | + $post_offline_customization_option = give_get_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
157 | 157 | |
158 | 158 | //Customize email content depending on whether the single form has been customized |
159 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
159 | + $email_content = give_get_option('global_offline_donation_email'); |
|
160 | 160 | |
161 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
162 | - $email_content = give_get_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
161 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
162 | + $email_content = give_get_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
163 | 163 | } |
164 | 164 | |
165 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
165 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
166 | 166 | |
167 | 167 | /** |
168 | 168 | * Filters the from name. |
169 | 169 | * |
170 | 170 | * @since 1.7 |
171 | 171 | */ |
172 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
172 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
173 | 173 | |
174 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
174 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
175 | 175 | |
176 | 176 | /** |
177 | 177 | * Filters the from email. |
178 | 178 | * |
179 | 179 | * @since 1.7 |
180 | 180 | */ |
181 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
181 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
182 | 182 | |
183 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
183 | + $to_email = give_get_payment_user_email($payment_id); |
|
184 | 184 | |
185 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
186 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
187 | - $subject = give_get_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
185 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
186 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
187 | + $subject = give_get_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
188 | 188 | } |
189 | 189 | |
190 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
191 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
190 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
191 | + $subject = give_do_email_tags($subject, $payment_id); |
|
192 | 192 | |
193 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
194 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
193 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
194 | + $message = give_do_email_tags($email_content, $payment_id); |
|
195 | 195 | |
196 | 196 | $emails = Give()->emails; |
197 | 197 | |
198 | - $emails->__set( 'from_name', $from_name ); |
|
199 | - $emails->__set( 'from_email', $from_email ); |
|
200 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
198 | + $emails->__set('from_name', $from_name); |
|
199 | + $emails->__set('from_email', $from_email); |
|
200 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
201 | 201 | |
202 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
203 | - $emails->__set( 'headers', $headers ); |
|
202 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
203 | + $emails->__set('headers', $headers); |
|
204 | 204 | |
205 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
205 | + $emails->send($to_email, $subject, $message, $attachments); |
|
206 | 206 | |
207 | 207 | } |
208 | 208 | |
@@ -219,54 +219,54 @@ discard block |
||
219 | 219 | * @return void |
220 | 220 | * |
221 | 221 | */ |
222 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
222 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
223 | 223 | |
224 | 224 | /* Send an email notification to the admin */ |
225 | 225 | $admin_email = give_get_admin_notice_emails(); |
226 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
226 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
227 | 227 | |
228 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
229 | - $user_data = get_userdata( $user_info['id'] ); |
|
228 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
229 | + $user_data = get_userdata($user_info['id']); |
|
230 | 230 | $name = $user_data->display_name; |
231 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
232 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
231 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
232 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
233 | 233 | } else { |
234 | 234 | $name = $user_info['email']; |
235 | 235 | } |
236 | 236 | |
237 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ), array( 'sanitize' => false ) ) ); |
|
237 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id), array('sanitize' => false))); |
|
238 | 238 | |
239 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id ); |
|
239 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id); |
|
240 | 240 | |
241 | - $admin_message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
242 | - $admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n"; |
|
243 | - $admin_message .= __( 'The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
241 | + $admin_message = __('Dear Admin,', 'give')."\n\n"; |
|
242 | + $admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n"; |
|
243 | + $admin_message .= __('The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
244 | 244 | |
245 | 245 | |
246 | - $admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
247 | - $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
246 | + $admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
247 | + $admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
248 | 248 | |
249 | 249 | $admin_message .= sprintf( |
250 | 250 | '<a href="%1$s">%2$s</a>', |
251 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ), |
|
252 | - __( 'View Donation Details »', 'give' ) |
|
253 | - ) . "\n\n"; |
|
251 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id), |
|
252 | + __('View Donation Details »', 'give') |
|
253 | + )."\n\n"; |
|
254 | 254 | |
255 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
256 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
255 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
256 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
257 | 257 | |
258 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
259 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
258 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
259 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
260 | 260 | |
261 | 261 | //Send Email |
262 | 262 | $emails = Give()->emails; |
263 | - $emails->__set( 'heading', __( 'New Offline Donation', 'give' ) ); |
|
263 | + $emails->__set('heading', __('New Offline Donation', 'give')); |
|
264 | 264 | |
265 | - if ( ! empty( $admin_headers ) ) { |
|
266 | - $emails->__set( 'headers', $admin_headers ); |
|
265 | + if ( ! empty($admin_headers)) { |
|
266 | + $emails->__set('headers', $admin_headers); |
|
267 | 267 | } |
268 | 268 | |
269 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
269 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
270 | 270 | |
271 | 271 | } |
272 | 272 | |
@@ -278,20 +278,20 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @return array |
280 | 280 | */ |
281 | -function give_offline_add_settings( $settings ) { |
|
281 | +function give_offline_add_settings($settings) { |
|
282 | 282 | |
283 | 283 | // Bailout: Do not show offline gateways setting in to metabox if its disabled globally. |
284 | - if ( in_array( 'offline', give_get_option( 'gateways' ) ) ) { |
|
284 | + if (in_array('offline', give_get_option('gateways'))) { |
|
285 | 285 | return $settings; |
286 | 286 | } |
287 | 287 | |
288 | 288 | //Vars |
289 | 289 | $prefix = '_give_'; |
290 | 290 | |
291 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
291 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
292 | 292 | |
293 | 293 | //this gateway isn't active |
294 | - if ( ! $is_gateway_active ) { |
|
294 | + if ( ! $is_gateway_active) { |
|
295 | 295 | //return settings and bounce |
296 | 296 | return $settings; |
297 | 297 | } |
@@ -300,34 +300,34 @@ discard block |
||
300 | 300 | $check_settings = array( |
301 | 301 | |
302 | 302 | array( |
303 | - 'name' => __( 'Offline Donations', 'give' ), |
|
304 | - 'desc' => __( 'Do you want to customize the donation instructions for this form?', 'give' ), |
|
305 | - 'id' => $prefix . 'customize_offline_donations', |
|
303 | + 'name' => __('Offline Donations', 'give'), |
|
304 | + 'desc' => __('Do you want to customize the donation instructions for this form?', 'give'), |
|
305 | + 'id' => $prefix.'customize_offline_donations', |
|
306 | 306 | 'type' => 'radio_inline', |
307 | 307 | 'default' => 'global', |
308 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
309 | - 'global' => __( 'Global Option', 'give' ), |
|
310 | - 'enabled' => __( 'Customize', 'give' ), |
|
311 | - 'disabled' => __( 'Disable', 'give' ), |
|
308 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
309 | + 'global' => __('Global Option', 'give'), |
|
310 | + 'enabled' => __('Customize', 'give'), |
|
311 | + 'disabled' => __('Disable', 'give'), |
|
312 | 312 | ) |
313 | 313 | ), |
314 | 314 | ), |
315 | 315 | array( |
316 | - 'name' => __( 'Billing Fields', 'give' ), |
|
317 | - 'desc' => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
318 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
316 | + 'name' => __('Billing Fields', 'give'), |
|
317 | + 'desc' => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
318 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
319 | 319 | 'row_classes' => 'give-subfield give-hidden', |
320 | 320 | 'type' => 'radio_inline', |
321 | 321 | 'default' => 'disabled', |
322 | 322 | 'options' => array( |
323 | - 'enabled' => __( 'Enabled', 'give' ), |
|
324 | - 'disabled' => __( 'Disabled', 'give' ), |
|
323 | + 'enabled' => __('Enabled', 'give'), |
|
324 | + 'disabled' => __('Disabled', 'give'), |
|
325 | 325 | ), |
326 | 326 | ), |
327 | 327 | array( |
328 | - 'id' => $prefix . 'offline_checkout_notes', |
|
329 | - 'name' => __( 'Donation Instructions', 'give' ), |
|
330 | - 'desc' => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
328 | + 'id' => $prefix.'offline_checkout_notes', |
|
329 | + 'name' => __('Donation Instructions', 'give'), |
|
330 | + 'desc' => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
331 | 331 | 'default' => give_get_default_offline_donation_content(), |
332 | 332 | 'type' => 'wysiwyg', |
333 | 333 | 'row_classes' => 'give-subfield give-hidden', |
@@ -336,17 +336,17 @@ discard block |
||
336 | 336 | ), |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'id' => $prefix . 'offline_donation_subject', |
|
340 | - 'name' => __( 'Email Subject', 'give' ), |
|
341 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
342 | - 'default' => __( '{form_title} - Offline Donation Instructions', 'give' ), |
|
339 | + 'id' => $prefix.'offline_donation_subject', |
|
340 | + 'name' => __('Email Subject', 'give'), |
|
341 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
342 | + 'default' => __('{form_title} - Offline Donation Instructions', 'give'), |
|
343 | 343 | 'row_classes' => 'give-subfield give-hidden', |
344 | 344 | 'type' => 'text', |
345 | 345 | ), |
346 | 346 | array( |
347 | - 'id' => $prefix . 'offline_donation_email', |
|
348 | - 'name' => __( 'Email Instructions', 'give' ), |
|
349 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(), |
|
347 | + 'id' => $prefix.'offline_donation_email', |
|
348 | + 'name' => __('Email Instructions', 'give'), |
|
349 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(), |
|
350 | 350 | 'default' => give_get_default_offline_donation_email_content(), |
351 | 351 | 'type' => 'wysiwyg', |
352 | 352 | 'row_classes' => 'give-subfield give-hidden', |
@@ -358,14 +358,14 @@ discard block |
||
358 | 358 | 'name' => 'offline_docs', |
359 | 359 | 'type' => 'docs_link', |
360 | 360 | 'url' => 'http://docs.givewp.com/settings-gateway-offline-donations', |
361 | - 'title' => __( 'Offline Donations', 'give' ), |
|
361 | + 'title' => __('Offline Donations', 'give'), |
|
362 | 362 | ), |
363 | 363 | ); |
364 | 364 | |
365 | - return array_merge( $settings, $check_settings ); |
|
365 | + return array_merge($settings, $check_settings); |
|
366 | 366 | } |
367 | 367 | |
368 | -add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' ); |
|
368 | +add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings'); |
|
369 | 369 | |
370 | 370 | |
371 | 371 | /** |
@@ -377,32 +377,32 @@ discard block |
||
377 | 377 | */ |
378 | 378 | function give_get_default_offline_donation_content() { |
379 | 379 | |
380 | - $sitename = get_bloginfo( 'sitename' ); |
|
380 | + $sitename = get_bloginfo('sitename'); |
|
381 | 381 | |
382 | - $default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
382 | + $default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
383 | 383 | $default_text .= '<ol>'; |
384 | 384 | $default_text .= '<li>'; |
385 | 385 | $default_text .= sprintf( |
386 | 386 | /* translators: %s: site name */ |
387 | - __( 'Make a check payable to "%s"', 'give' ), |
|
387 | + __('Make a check payable to "%s"', 'give'), |
|
388 | 388 | $sitename |
389 | 389 | ); |
390 | 390 | $default_text .= '</li>'; |
391 | 391 | $default_text .= '<li>'; |
392 | 392 | $default_text .= sprintf( |
393 | 393 | /* translators: %s: site name */ |
394 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
394 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
395 | 395 | $sitename |
396 | 396 | ); |
397 | 397 | $default_text .= '</li>'; |
398 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
398 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
399 | 399 | $default_text .= '</ol>'; |
400 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
400 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
401 | 401 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
402 | 402 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
403 | - $default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
403 | + $default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
404 | 404 | |
405 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
405 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
406 | 406 | |
407 | 407 | } |
408 | 408 | |
@@ -415,34 +415,34 @@ discard block |
||
415 | 415 | */ |
416 | 416 | function give_get_default_offline_donation_email_content() { |
417 | 417 | |
418 | - $sitename = get_bloginfo( 'sitename' ); |
|
419 | - $default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>'; |
|
420 | - $default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
418 | + $sitename = get_bloginfo('sitename'); |
|
419 | + $default_text = '<p>'.__('Dear {name},', 'give').'</p>'; |
|
420 | + $default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
421 | 421 | $default_text .= '<ol>'; |
422 | 422 | $default_text .= '<li>'; |
423 | 423 | $default_text .= sprintf( |
424 | 424 | /* translators: %s: site name */ |
425 | - __( 'Make a check payable to "%s"', 'give' ), |
|
425 | + __('Make a check payable to "%s"', 'give'), |
|
426 | 426 | $sitename |
427 | 427 | ); |
428 | 428 | $default_text .= '</li>'; |
429 | 429 | $default_text .= '<li>'; |
430 | 430 | $default_text .= sprintf( |
431 | 431 | /* translators: %s: site name */ |
432 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
432 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
433 | 433 | $sitename |
434 | 434 | ); |
435 | 435 | $default_text .= '</li>'; |
436 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
436 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
437 | 437 | $default_text .= '</ol>'; |
438 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
438 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
439 | 439 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
440 | 440 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
441 | - $default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
442 | - $default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>'; |
|
443 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
441 | + $default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
442 | + $default_text .= '<p>'.__('Sincerely,', 'give').'</p>'; |
|
443 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
444 | 444 | |
445 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
445 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
446 | 446 | |
447 | 447 | } |
448 | 448 | |
@@ -456,17 +456,17 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @return string |
458 | 458 | */ |
459 | -function give_offline_donation_receipt_status_notice( $notice, $id ) { |
|
460 | - $payment = new Give_Payment( $id ); |
|
459 | +function give_offline_donation_receipt_status_notice($notice, $id) { |
|
460 | + $payment = new Give_Payment($id); |
|
461 | 461 | |
462 | - if ( 'offline' !== $payment->gateway || $payment->is_completed() ) { |
|
462 | + if ('offline' !== $payment->gateway || $payment->is_completed()) { |
|
463 | 463 | return $notice; |
464 | 464 | } |
465 | 465 | |
466 | - return Give()->notices->print_frontend_notice( __( 'Payment Pending: Please follow the instructions below to complete your donation.', 'give' ), false, 'warning' ); |
|
466 | + return Give()->notices->print_frontend_notice(__('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning'); |
|
467 | 467 | } |
468 | 468 | |
469 | -add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 ); |
|
469 | +add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2); |
|
470 | 470 | |
471 | 471 | /** |
472 | 472 | * Get offline payment instructions. |
@@ -478,27 +478,27 @@ discard block |
||
478 | 478 | * |
479 | 479 | * @return string |
480 | 480 | */ |
481 | -function give_get_offline_payment_instruction( $form_id, $wpautop = false ) { |
|
481 | +function give_get_offline_payment_instruction($form_id, $wpautop = false) { |
|
482 | 482 | // Bailout. |
483 | - if ( ! $form_id ) { |
|
483 | + if ( ! $form_id) { |
|
484 | 484 | return ''; |
485 | 485 | } |
486 | 486 | |
487 | - $post_offline_customization_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
488 | - $post_offline_instructions = give_get_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
489 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
487 | + $post_offline_customization_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
488 | + $post_offline_instructions = give_get_meta($form_id, '_give_offline_checkout_notes', true); |
|
489 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
490 | 490 | $offline_instructions = $global_offline_instruction; |
491 | 491 | |
492 | - if ( give_is_setting_enabled( $post_offline_customization_option ) ) { |
|
492 | + if (give_is_setting_enabled($post_offline_customization_option)) { |
|
493 | 493 | $offline_instructions = $post_offline_instructions; |
494 | 494 | } |
495 | 495 | |
496 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
496 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
497 | 497 | |
498 | 498 | /* translators: %s: form settings url */ |
499 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url ); |
|
499 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url); |
|
500 | 500 | |
501 | - return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions ); |
|
501 | + return ($wpautop ? wpautop($offline_instructions) : $offline_instructions); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | |
@@ -512,24 +512,24 @@ discard block |
||
512 | 512 | * |
513 | 513 | * @return array |
514 | 514 | */ |
515 | -function give_filter_offline_gateway( $gateway_list, $form_id ) { |
|
515 | +function give_filter_offline_gateway($gateway_list, $form_id) { |
|
516 | 516 | if ( |
517 | 517 | // Show offline payment gateway if enable for new donation form. |
518 | - ( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) |
|
518 | + (false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) |
|
519 | 519 | && $form_id |
520 | - && ! give_is_setting_enabled( give_get_meta( $form_id, '_give_customize_offline_donations', true ), array( |
|
520 | + && ! give_is_setting_enabled(give_get_meta($form_id, '_give_customize_offline_donations', true), array( |
|
521 | 521 | 'enabled', |
522 | 522 | 'global', |
523 | - ) ) |
|
523 | + )) |
|
524 | 524 | ) { |
525 | - unset( $gateway_list['offline'] ); |
|
525 | + unset($gateway_list['offline']); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | // Output. |
529 | 529 | return $gateway_list; |
530 | 530 | } |
531 | 531 | |
532 | -add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 ); |
|
532 | +add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2); |
|
533 | 533 | |
534 | 534 | /** |
535 | 535 | * Set default gateway to global default payment gateway |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | * |
544 | 544 | * @return void |
545 | 545 | */ |
546 | -function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) { |
|
547 | - if ( ! give_is_setting_enabled( $meta_value ) && ( 'offline' === give_get_meta( $postid, '_give_default_gateway', true ) ) ) { |
|
548 | - give_update_meta( $postid, '_give_default_gateway', 'global' ); |
|
546 | +function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) { |
|
547 | + if ( ! give_is_setting_enabled($meta_value) && ('offline' === give_get_meta($postid, '_give_default_gateway', true))) { |
|
548 | + give_update_meta($postid, '_give_default_gateway', 'global'); |
|
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
552 | -add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 ); |
|
552 | +add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return bool |
24 | 24 | */ |
25 | -function give_paypal_standard_billing_fields( $form_id ) { |
|
25 | +function give_paypal_standard_billing_fields($form_id) { |
|
26 | 26 | |
27 | - if ( give_is_setting_enabled( give_get_option( 'paypal_standard_billing_details' ) ) ) { |
|
28 | - give_default_cc_address_fields( $form_id ); |
|
27 | + if (give_is_setting_enabled(give_get_option('paypal_standard_billing_details'))) { |
|
28 | + give_default_cc_address_fields($form_id); |
|
29 | 29 | |
30 | 30 | return true; |
31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | } |
36 | 36 | |
37 | -add_action( 'give_paypal_cc_form', 'give_paypal_standard_billing_fields' ); |
|
37 | +add_action('give_paypal_cc_form', 'give_paypal_standard_billing_fields'); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Process PayPal Payment. |
@@ -45,28 +45,28 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return void |
47 | 47 | */ |
48 | -function give_process_paypal_payment( $payment_data ) { |
|
48 | +function give_process_paypal_payment($payment_data) { |
|
49 | 49 | |
50 | 50 | // Validate nonce. |
51 | - give_validate_nonce( $payment_data['gateway_nonce'], 'give-gateway' ); |
|
51 | + give_validate_nonce($payment_data['gateway_nonce'], 'give-gateway'); |
|
52 | 52 | |
53 | - $payment_id = give_create_payment( $payment_data ); |
|
53 | + $payment_id = give_create_payment($payment_data); |
|
54 | 54 | |
55 | 55 | // Check payment. |
56 | - if ( empty( $payment_id ) ) { |
|
56 | + if (empty($payment_id)) { |
|
57 | 57 | // Record the error. |
58 | - give_record_gateway_error( __( 'Payment Error', 'give' ), sprintf( /* translators: %s: payment data */ |
|
59 | - __( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ), json_encode( $payment_data ) ), $payment_id ); |
|
58 | + give_record_gateway_error(__('Payment Error', 'give'), sprintf( /* translators: %s: payment data */ |
|
59 | + __('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'), json_encode($payment_data) ), $payment_id); |
|
60 | 60 | // Problems? Send back. |
61 | - give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] ); |
|
61 | + give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // Redirect to PayPal. |
65 | - wp_redirect( give_build_paypal_url( $payment_id, $payment_data ) ); |
|
65 | + wp_redirect(give_build_paypal_url($payment_id, $payment_data)); |
|
66 | 66 | exit; |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_gateway_paypal', 'give_process_paypal_payment' ); |
|
69 | +add_action('give_gateway_paypal', 'give_process_paypal_payment'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Listens for a PayPal IPN requests and then sends to the processing function. |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | function give_listen_for_paypal_ipn() { |
78 | 78 | |
79 | 79 | // Regular PayPal IPN. |
80 | - if ( isset( $_GET['give-listener'] ) && 'IPN' === $_GET['give-listener'] ) { |
|
80 | + if (isset($_GET['give-listener']) && 'IPN' === $_GET['give-listener']) { |
|
81 | 81 | /** |
82 | 82 | * Fires while verifying PayPal IPN |
83 | 83 | * |
84 | 84 | * @since 1.0 |
85 | 85 | */ |
86 | - do_action( 'give_verify_paypal_ipn' ); |
|
86 | + do_action('give_verify_paypal_ipn'); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | -add_action( 'init', 'give_listen_for_paypal_ipn' ); |
|
90 | +add_action('init', 'give_listen_for_paypal_ipn'); |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Process PayPal IPN |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | function give_process_paypal_ipn() { |
99 | 99 | |
100 | 100 | // Check the request method is POST. |
101 | - if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' !== $_SERVER['REQUEST_METHOD'] ) { |
|
101 | + if (isset($_SERVER['REQUEST_METHOD']) && 'POST' !== $_SERVER['REQUEST_METHOD']) { |
|
102 | 102 | return; |
103 | 103 | } |
104 | 104 | |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | $post_data = ''; |
107 | 107 | |
108 | 108 | // Fallback just in case post_max_size is lower than needed. |
109 | - if ( ini_get( 'allow_url_fopen' ) ) { |
|
110 | - $post_data = file_get_contents( 'php://input' ); |
|
109 | + if (ini_get('allow_url_fopen')) { |
|
110 | + $post_data = file_get_contents('php://input'); |
|
111 | 111 | } else { |
112 | 112 | // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough. |
113 | - ini_set( 'post_max_size', '12M' ); |
|
113 | + ini_set('post_max_size', '12M'); |
|
114 | 114 | } |
115 | 115 | // Start the encoded data collection with notification command. |
116 | 116 | $encoded_data = 'cmd=_notify-validate'; |
@@ -119,39 +119,39 @@ discard block |
||
119 | 119 | $arg_separator = give_get_php_arg_separator_output(); |
120 | 120 | |
121 | 121 | // Verify there is a post_data. |
122 | - if ( $post_data || strlen( $post_data ) > 0 ) { |
|
122 | + if ($post_data || strlen($post_data) > 0) { |
|
123 | 123 | // Append the data. |
124 | - $encoded_data .= $arg_separator . $post_data; |
|
124 | + $encoded_data .= $arg_separator.$post_data; |
|
125 | 125 | } else { |
126 | 126 | // Check if POST is empty. |
127 | - if ( empty( $_POST ) ) { |
|
127 | + if (empty($_POST)) { |
|
128 | 128 | // Nothing to do. |
129 | 129 | return; |
130 | 130 | } else { |
131 | 131 | // Loop through each POST. |
132 | - foreach ( $_POST as $key => $value ) { |
|
132 | + foreach ($_POST as $key => $value) { |
|
133 | 133 | // Encode the value and append the data. |
134 | - $encoded_data .= $arg_separator . "$key=" . urlencode( $value ); |
|
134 | + $encoded_data .= $arg_separator."$key=".urlencode($value); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Convert collected post data to an array. |
140 | - parse_str( $encoded_data, $encoded_data_array ); |
|
140 | + parse_str($encoded_data, $encoded_data_array); |
|
141 | 141 | |
142 | - foreach ( $encoded_data_array as $key => $value ) { |
|
142 | + foreach ($encoded_data_array as $key => $value) { |
|
143 | 143 | |
144 | - if ( false !== strpos( $key, 'amp;' ) ) { |
|
145 | - $new_key = str_replace( '&', '&', $key ); |
|
146 | - $new_key = str_replace( 'amp;', '&', $new_key ); |
|
144 | + if (false !== strpos($key, 'amp;')) { |
|
145 | + $new_key = str_replace('&', '&', $key); |
|
146 | + $new_key = str_replace('amp;', '&', $new_key); |
|
147 | 147 | |
148 | - unset( $encoded_data_array[ $key ] ); |
|
149 | - $encoded_data_array[ $new_key ] = $value; |
|
148 | + unset($encoded_data_array[$key]); |
|
149 | + $encoded_data_array[$new_key] = $value; |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | // Validate IPN request w/ PayPal if user hasn't disabled this security measure. |
154 | - if ( give_is_setting_enabled( give_get_option( 'paypal_verification' ) ) ) { |
|
154 | + if (give_is_setting_enabled(give_get_option('paypal_verification'))) { |
|
155 | 155 | |
156 | 156 | $remote_post_vars = array( |
157 | 157 | 'method' => 'POST', |
@@ -171,25 +171,25 @@ discard block |
||
171 | 171 | ); |
172 | 172 | |
173 | 173 | // Validate the IPN. |
174 | - $api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars ); |
|
174 | + $api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars); |
|
175 | 175 | |
176 | - if ( is_wp_error( $api_response ) ) { |
|
177 | - give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
178 | - __( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) ); |
|
176 | + if (is_wp_error($api_response)) { |
|
177 | + give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */ |
|
178 | + __('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) )); |
|
179 | 179 | |
180 | 180 | return; // Something went wrong. |
181 | 181 | } |
182 | 182 | |
183 | - if ( 'VERIFIED' !== $api_response['body'] ) { |
|
184 | - give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
185 | - __( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) ); |
|
183 | + if ('VERIFIED' !== $api_response['body']) { |
|
184 | + give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */ |
|
185 | + __('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) )); |
|
186 | 186 | |
187 | 187 | return; // Response not okay. |
188 | 188 | } |
189 | 189 | }// End if(). |
190 | 190 | |
191 | 191 | // Check if $post_data_array has been populated. |
192 | - if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) { |
|
192 | + if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) { |
|
193 | 193 | return; |
194 | 194 | } |
195 | 195 | |
@@ -198,28 +198,28 @@ discard block |
||
198 | 198 | 'payment_status' => '', |
199 | 199 | ); |
200 | 200 | |
201 | - $encoded_data_array = wp_parse_args( $encoded_data_array, $defaults ); |
|
201 | + $encoded_data_array = wp_parse_args($encoded_data_array, $defaults); |
|
202 | 202 | |
203 | - $payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0; |
|
203 | + $payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0; |
|
204 | 204 | $txn_type = $encoded_data_array['txn_type']; |
205 | 205 | |
206 | 206 | // Check for PayPal IPN Notifications and update data based on it. |
207 | - $current_timestamp = current_time( 'timestamp' ); |
|
207 | + $current_timestamp = current_time('timestamp'); |
|
208 | 208 | $paypal_ipn_vars = array( |
209 | - 'auth_status' => ( $api_response['body'] ) ? $api_response['body'] : 'N/A', |
|
209 | + 'auth_status' => ($api_response['body']) ? $api_response['body'] : 'N/A', |
|
210 | 210 | 'transaction_id' => $encoded_data_array['txn_id'], |
211 | 211 | 'payment_id' => $payment_id, |
212 | 212 | ); |
213 | - update_option( 'give_last_paypal_ipn_received', $paypal_ipn_vars ); |
|
214 | - give_insert_payment_note( $payment_id, sprintf( |
|
215 | - __( 'Last IPN received on %s at %s', 'give' ), |
|
216 | - date_i18n( 'm/d/Y', $current_timestamp ), |
|
217 | - date_i18n( 'H:i', $current_timestamp ) |
|
213 | + update_option('give_last_paypal_ipn_received', $paypal_ipn_vars); |
|
214 | + give_insert_payment_note($payment_id, sprintf( |
|
215 | + __('Last IPN received on %s at %s', 'give'), |
|
216 | + date_i18n('m/d/Y', $current_timestamp), |
|
217 | + date_i18n('H:i', $current_timestamp) |
|
218 | 218 | ) |
219 | 219 | ); |
220 | - give_update_meta( $payment_id, 'give_last_paypal_ipn_received', $current_timestamp ); |
|
220 | + give_update_meta($payment_id, 'give_last_paypal_ipn_received', $current_timestamp); |
|
221 | 221 | |
222 | - if ( has_action( 'give_paypal_' . $txn_type ) ) { |
|
222 | + if (has_action('give_paypal_'.$txn_type)) { |
|
223 | 223 | /** |
224 | 224 | * Fires while processing PayPal IPN $txn_type. |
225 | 225 | * |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param array $encoded_data_array Encoded data. |
231 | 231 | * @param int $payment_id Payment id. |
232 | 232 | */ |
233 | - do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id ); |
|
233 | + do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id); |
|
234 | 234 | } else { |
235 | 235 | /** |
236 | 236 | * Fires while process PayPal IPN. |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * @param array $encoded_data_array Encoded data. |
243 | 243 | * @param int $payment_id Payment id. |
244 | 244 | */ |
245 | - do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id ); |
|
245 | + do_action('give_paypal_web_accept', $encoded_data_array, $payment_id); |
|
246 | 246 | } |
247 | 247 | exit; |
248 | 248 | } |
249 | 249 | |
250 | -add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' ); |
|
250 | +add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn'); |
|
251 | 251 | |
252 | 252 | /** |
253 | 253 | * Process web accept (one time) payment IPNs. |
@@ -259,99 +259,99 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @return void |
261 | 261 | */ |
262 | -function give_process_paypal_web_accept( $data, $payment_id ) { |
|
262 | +function give_process_paypal_web_accept($data, $payment_id) { |
|
263 | 263 | |
264 | 264 | // Only allow through these transaction types. |
265 | - if ( 'web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower( $data['payment_status'] ) ) { |
|
265 | + if ('web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower($data['payment_status'])) { |
|
266 | 266 | return; |
267 | 267 | } |
268 | 268 | |
269 | 269 | // Need $payment_id to continue. |
270 | - if ( empty( $payment_id ) ) { |
|
270 | + if (empty($payment_id)) { |
|
271 | 271 | return; |
272 | 272 | } |
273 | 273 | |
274 | 274 | // Collect donation payment details. |
275 | 275 | $paypal_amount = $data['mc_gross']; |
276 | - $payment_status = strtolower( $data['payment_status'] ); |
|
277 | - $currency_code = strtolower( $data['mc_currency'] ); |
|
278 | - $business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] ); |
|
279 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
276 | + $payment_status = strtolower($data['payment_status']); |
|
277 | + $currency_code = strtolower($data['mc_currency']); |
|
278 | + $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']); |
|
279 | + $payment_meta = give_get_payment_meta($payment_id); |
|
280 | 280 | |
281 | 281 | // Must be a PayPal standard IPN. |
282 | - if ( 'paypal' !== give_get_payment_gateway( $payment_id ) ) { |
|
282 | + if ('paypal' !== give_get_payment_gateway($payment_id)) { |
|
283 | 283 | return; |
284 | 284 | } |
285 | 285 | |
286 | 286 | // Verify payment recipient. |
287 | - if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) !== 0 ) { |
|
287 | + if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) !== 0) { |
|
288 | 288 | |
289 | - give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
290 | - __( 'Invalid business email in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id ); |
|
291 | - give_update_payment_status( $payment_id, 'failed' ); |
|
292 | - give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid PayPal business email.', 'give' ) ); |
|
289 | + give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */ |
|
290 | + __('Invalid business email in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id); |
|
291 | + give_update_payment_status($payment_id, 'failed'); |
|
292 | + give_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'give')); |
|
293 | 293 | |
294 | 294 | return; |
295 | 295 | } |
296 | 296 | |
297 | 297 | // Verify payment currency. |
298 | - if ( $currency_code !== strtolower( $payment_meta['currency'] ) ) { |
|
298 | + if ($currency_code !== strtolower($payment_meta['currency'])) { |
|
299 | 299 | |
300 | - give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
301 | - __( 'Invalid currency in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id ); |
|
302 | - give_update_payment_status( $payment_id, 'failed' ); |
|
303 | - give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) ); |
|
300 | + give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */ |
|
301 | + __('Invalid currency in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id); |
|
302 | + give_update_payment_status($payment_id, 'failed'); |
|
303 | + give_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'give')); |
|
304 | 304 | |
305 | 305 | return; |
306 | 306 | } |
307 | 307 | |
308 | 308 | // Process refunds & reversed. |
309 | - if ( 'refunded' === $payment_status || 'reversed' === $payment_status ) { |
|
310 | - give_process_paypal_refund( $data, $payment_id ); |
|
309 | + if ('refunded' === $payment_status || 'reversed' === $payment_status) { |
|
310 | + give_process_paypal_refund($data, $payment_id); |
|
311 | 311 | |
312 | 312 | return; |
313 | 313 | } |
314 | 314 | |
315 | 315 | // Only complete payments once. |
316 | - if ( 'publish' === get_post_status( $payment_id ) ) { |
|
316 | + if ('publish' === get_post_status($payment_id)) { |
|
317 | 317 | return; |
318 | 318 | } |
319 | 319 | |
320 | 320 | // Retrieve the total donation amount (before PayPal). |
321 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
321 | + $payment_amount = give_get_payment_amount($payment_id); |
|
322 | 322 | |
323 | 323 | // Check that the donation PP and local db amounts match. |
324 | - if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
324 | + if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
325 | 325 | // The prices don't match |
326 | - give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
327 | - __( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id ); |
|
328 | - give_update_payment_status( $payment_id, 'failed' ); |
|
329 | - give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) ); |
|
326 | + give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */ |
|
327 | + __('Invalid payment amount in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id); |
|
328 | + give_update_payment_status($payment_id, 'failed'); |
|
329 | + give_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'give')); |
|
330 | 330 | |
331 | 331 | return; |
332 | 332 | } |
333 | 333 | |
334 | 334 | // Process completed donations. |
335 | - if ( 'completed' === $payment_status || give_is_test_mode() ) { |
|
335 | + if ('completed' === $payment_status || give_is_test_mode()) { |
|
336 | 336 | |
337 | - give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */ |
|
338 | - __( 'PayPal Transaction ID: %s', 'give' ), $data['txn_id'] ) ); |
|
339 | - give_set_payment_transaction_id( $payment_id, $data['txn_id'] ); |
|
340 | - give_update_payment_status( $payment_id, 'publish' ); |
|
337 | + give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */ |
|
338 | + __('PayPal Transaction ID: %s', 'give'), $data['txn_id'] )); |
|
339 | + give_set_payment_transaction_id($payment_id, $data['txn_id']); |
|
340 | + give_update_payment_status($payment_id, 'publish'); |
|
341 | 341 | |
342 | - } elseif ( 'pending' === $payment_status && isset( $data['pending_reason'] ) ) { |
|
342 | + } elseif ('pending' === $payment_status && isset($data['pending_reason'])) { |
|
343 | 343 | |
344 | 344 | // Look for possible pending reasons, such as an echeck. |
345 | - $note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) ); |
|
345 | + $note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason'])); |
|
346 | 346 | |
347 | - if ( ! empty( $note ) ) { |
|
348 | - give_insert_payment_note( $payment_id, $note ); |
|
347 | + if ( ! empty($note)) { |
|
348 | + give_insert_payment_note($payment_id, $note); |
|
349 | 349 | } |
350 | 350 | } |
351 | 351 | |
352 | 352 | } |
353 | 353 | |
354 | -add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2 ); |
|
354 | +add_action('give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2); |
|
355 | 355 | |
356 | 356 | /** |
357 | 357 | * Process PayPal IPN Refunds |
@@ -363,35 +363,35 @@ discard block |
||
363 | 363 | * |
364 | 364 | * @return void |
365 | 365 | */ |
366 | -function give_process_paypal_refund( $data, $payment_id = 0 ) { |
|
366 | +function give_process_paypal_refund($data, $payment_id = 0) { |
|
367 | 367 | |
368 | 368 | // Collect payment details. |
369 | - if ( empty( $payment_id ) ) { |
|
369 | + if (empty($payment_id)) { |
|
370 | 370 | return; |
371 | 371 | } |
372 | 372 | |
373 | 373 | // Only refund payments once. |
374 | - if ( 'refunded' === get_post_status( $payment_id ) ) { |
|
374 | + if ('refunded' === get_post_status($payment_id)) { |
|
375 | 375 | return; |
376 | 376 | } |
377 | 377 | |
378 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
378 | + $payment_amount = give_get_payment_amount($payment_id); |
|
379 | 379 | $refund_amount = $data['payment_gross'] * - 1; |
380 | 380 | |
381 | - if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
381 | + if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
382 | 382 | |
383 | - give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */ |
|
384 | - __( 'Partial PayPal refund processed: %s', 'give' ), $data['parent_txn_id'] ) ); |
|
383 | + give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */ |
|
384 | + __('Partial PayPal refund processed: %s', 'give'), $data['parent_txn_id'] )); |
|
385 | 385 | |
386 | 386 | return; // This is a partial refund |
387 | 387 | |
388 | 388 | } |
389 | 389 | |
390 | - give_insert_payment_note( $payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */ |
|
391 | - __( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ), $data['parent_txn_id'], $data['reason_code'] ) ); |
|
392 | - give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */ |
|
393 | - __( 'PayPal Refund Transaction ID: %s', 'give' ), $data['txn_id'] ) ); |
|
394 | - give_update_payment_status( $payment_id, 'refunded' ); |
|
390 | + give_insert_payment_note($payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */ |
|
391 | + __('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'), $data['parent_txn_id'], $data['reason_code'] )); |
|
392 | + give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */ |
|
393 | + __('PayPal Refund Transaction ID: %s', 'give'), $data['txn_id'] )); |
|
394 | + give_update_payment_status($payment_id, 'refunded'); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
@@ -403,24 +403,24 @@ discard block |
||
403 | 403 | * |
404 | 404 | * @return string |
405 | 405 | */ |
406 | -function give_get_paypal_redirect( $ssl_check = false ) { |
|
406 | +function give_get_paypal_redirect($ssl_check = false) { |
|
407 | 407 | |
408 | - if ( is_ssl() || ! $ssl_check ) { |
|
408 | + if (is_ssl() || ! $ssl_check) { |
|
409 | 409 | $protocol = 'https://'; |
410 | 410 | } else { |
411 | 411 | $protocol = 'http://'; |
412 | 412 | } |
413 | 413 | |
414 | 414 | // Check the current payment mode |
415 | - if ( give_is_test_mode() ) { |
|
415 | + if (give_is_test_mode()) { |
|
416 | 416 | // Test mode |
417 | - $paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
417 | + $paypal_uri = $protocol.'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
418 | 418 | } else { |
419 | 419 | // Live mode |
420 | - $paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr'; |
|
420 | + $paypal_uri = $protocol.'www.paypal.com/cgi-bin/webscr'; |
|
421 | 421 | } |
422 | 422 | |
423 | - return apply_filters( 'give_paypal_uri', $paypal_uri ); |
|
423 | + return apply_filters('give_paypal_uri', $paypal_uri); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -430,9 +430,9 @@ discard block |
||
430 | 430 | * @return string |
431 | 431 | */ |
432 | 432 | function give_get_paypal_page_style() { |
433 | - $page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) ); |
|
433 | + $page_style = trim(give_get_option('paypal_page_style', 'PayPal')); |
|
434 | 434 | |
435 | - return apply_filters( 'give_paypal_page_style', $page_style ); |
|
435 | + return apply_filters('give_paypal_page_style', $page_style); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | /** |
@@ -446,26 +446,26 @@ discard block |
||
446 | 446 | * |
447 | 447 | * @return string |
448 | 448 | */ |
449 | -function give_paypal_success_page_content( $content ) { |
|
449 | +function give_paypal_success_page_content($content) { |
|
450 | 450 | |
451 | - if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) { |
|
451 | + if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) { |
|
452 | 452 | return $content; |
453 | 453 | } |
454 | 454 | |
455 | - $payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false; |
|
455 | + $payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false; |
|
456 | 456 | |
457 | - if ( ! $payment_id ) { |
|
457 | + if ( ! $payment_id) { |
|
458 | 458 | $session = give_get_purchase_session(); |
459 | - $payment_id = give_get_purchase_id_by_key( $session['purchase_key'] ); |
|
459 | + $payment_id = give_get_purchase_id_by_key($session['purchase_key']); |
|
460 | 460 | } |
461 | 461 | |
462 | - $payment = get_post( $payment_id ); |
|
463 | - if ( $payment && 'pending' === $payment->post_status ) { |
|
462 | + $payment = get_post($payment_id); |
|
463 | + if ($payment && 'pending' === $payment->post_status) { |
|
464 | 464 | |
465 | 465 | // Payment is still pending so show processing indicator to fix the race condition. |
466 | 466 | ob_start(); |
467 | 467 | |
468 | - give_get_template_part( 'payment', 'processing' ); |
|
468 | + give_get_template_part('payment', 'processing'); |
|
469 | 469 | |
470 | 470 | $content = ob_get_clean(); |
471 | 471 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | |
476 | 476 | } |
477 | 477 | |
478 | -add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' ); |
|
478 | +add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content'); |
|
479 | 479 | |
480 | 480 | /** |
481 | 481 | * Given a transaction ID, generate a link to the PayPal transaction ID details |
@@ -487,16 +487,16 @@ discard block |
||
487 | 487 | * |
488 | 488 | * @return string A link to the PayPal transaction details |
489 | 489 | */ |
490 | -function give_paypal_link_transaction_id( $transaction_id, $payment_id ) { |
|
490 | +function give_paypal_link_transaction_id($transaction_id, $payment_id) { |
|
491 | 491 | |
492 | 492 | $paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='; |
493 | - $transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>'; |
|
493 | + $transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>'; |
|
494 | 494 | |
495 | - return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url ); |
|
495 | + return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url); |
|
496 | 496 | |
497 | 497 | } |
498 | 498 | |
499 | -add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 ); |
|
499 | +add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2); |
|
500 | 500 | |
501 | 501 | |
502 | 502 | /** |
@@ -508,64 +508,64 @@ discard block |
||
508 | 508 | * |
509 | 509 | * @return string |
510 | 510 | */ |
511 | -function give_paypal_get_pending_donation_note( $pending_reason ) { |
|
511 | +function give_paypal_get_pending_donation_note($pending_reason) { |
|
512 | 512 | |
513 | 513 | $note = ''; |
514 | 514 | |
515 | - switch ( $pending_reason ) { |
|
515 | + switch ($pending_reason) { |
|
516 | 516 | |
517 | 517 | case 'echeck' : |
518 | 518 | |
519 | - $note = __( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' ); |
|
519 | + $note = __('Payment made via eCheck and will clear automatically in 5-8 days.', 'give'); |
|
520 | 520 | |
521 | 521 | break; |
522 | 522 | |
523 | 523 | case 'address' : |
524 | 524 | |
525 | - $note = __( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' ); |
|
525 | + $note = __('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give'); |
|
526 | 526 | |
527 | 527 | break; |
528 | 528 | |
529 | 529 | case 'intl' : |
530 | 530 | |
531 | - $note = __( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' ); |
|
531 | + $note = __('Payment must be accepted manually through PayPal due to international account regulations.', 'give'); |
|
532 | 532 | |
533 | 533 | break; |
534 | 534 | |
535 | 535 | case 'multi-currency' : |
536 | 536 | |
537 | - $note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' ); |
|
537 | + $note = __('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give'); |
|
538 | 538 | |
539 | 539 | break; |
540 | 540 | |
541 | 541 | case 'paymentreview' : |
542 | 542 | case 'regulatory_review' : |
543 | 543 | |
544 | - $note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' ); |
|
544 | + $note = __('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give'); |
|
545 | 545 | |
546 | 546 | break; |
547 | 547 | |
548 | 548 | case 'unilateral' : |
549 | 549 | |
550 | - $note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'give' ); |
|
550 | + $note = __('Payment was sent to non-confirmed or non-registered email address.', 'give'); |
|
551 | 551 | |
552 | 552 | break; |
553 | 553 | |
554 | 554 | case 'upgrade' : |
555 | 555 | |
556 | - $note = __( 'PayPal account must be upgraded before this payment can be accepted.', 'give' ); |
|
556 | + $note = __('PayPal account must be upgraded before this payment can be accepted.', 'give'); |
|
557 | 557 | |
558 | 558 | break; |
559 | 559 | |
560 | 560 | case 'verify' : |
561 | 561 | |
562 | - $note = __( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' ); |
|
562 | + $note = __('PayPal account is not verified. Verify account in order to accept this donation.', 'give'); |
|
563 | 563 | |
564 | 564 | break; |
565 | 565 | |
566 | 566 | case 'other' : |
567 | 567 | |
568 | - $note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' ); |
|
568 | + $note = __('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give'); |
|
569 | 569 | |
570 | 570 | break; |
571 | 571 | |
@@ -583,49 +583,49 @@ discard block |
||
583 | 583 | * |
584 | 584 | * @return mixed|string |
585 | 585 | */ |
586 | -function give_build_paypal_url( $payment_id, $payment_data ) { |
|
586 | +function give_build_paypal_url($payment_id, $payment_data) { |
|
587 | 587 | // Only send to PayPal if the pending payment is created successfully. |
588 | - $listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) ); |
|
588 | + $listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php')); |
|
589 | 589 | |
590 | 590 | // Get the success url. |
591 | - $return_url = add_query_arg( array( |
|
591 | + $return_url = add_query_arg(array( |
|
592 | 592 | 'payment-confirmation' => 'paypal', |
593 | 593 | 'payment-id' => $payment_id, |
594 | 594 | |
595 | - ), get_permalink( give_get_option( 'success_page' ) ) ); |
|
595 | + ), get_permalink(give_get_option('success_page'))); |
|
596 | 596 | |
597 | 597 | // Get the PayPal redirect uri. |
598 | - $paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?'; |
|
598 | + $paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?'; |
|
599 | 599 | |
600 | 600 | // Item name. |
601 | - $item_name = give_payment_gateway_item_title( $payment_data ); |
|
601 | + $item_name = give_payment_gateway_item_title($payment_data); |
|
602 | 602 | |
603 | 603 | // Setup PayPal API params. |
604 | 604 | $paypal_args = array( |
605 | - 'business' => give_get_option( 'paypal_email', false ), |
|
605 | + 'business' => give_get_option('paypal_email', false), |
|
606 | 606 | 'first_name' => $payment_data['user_info']['first_name'], |
607 | 607 | 'last_name' => $payment_data['user_info']['last_name'], |
608 | 608 | 'email' => $payment_data['user_email'], |
609 | 609 | 'invoice' => $payment_data['purchase_key'], |
610 | 610 | 'amount' => $payment_data['price'], |
611 | - 'item_name' => stripslashes( $item_name ), |
|
611 | + 'item_name' => stripslashes($item_name), |
|
612 | 612 | 'no_shipping' => '1', |
613 | 613 | 'shipping' => '0', |
614 | 614 | 'no_note' => '1', |
615 | 615 | 'currency_code' => give_get_currency(), |
616 | - 'charset' => get_bloginfo( 'charset' ), |
|
616 | + 'charset' => get_bloginfo('charset'), |
|
617 | 617 | 'custom' => $payment_id, |
618 | 618 | 'rm' => '2', |
619 | 619 | 'return' => $return_url, |
620 | - 'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ), |
|
620 | + 'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id), |
|
621 | 621 | 'notify_url' => $listener_url, |
622 | 622 | 'page_style' => give_get_paypal_page_style(), |
623 | - 'cbt' => get_bloginfo( 'name' ), |
|
623 | + 'cbt' => get_bloginfo('name'), |
|
624 | 624 | 'bn' => 'givewp_SP', |
625 | 625 | ); |
626 | 626 | |
627 | 627 | // Add user address if present. |
628 | - if ( ! empty( $payment_data['user_info']['address'] ) ) { |
|
628 | + if ( ! empty($payment_data['user_info']['address'])) { |
|
629 | 629 | $default_address = array( |
630 | 630 | 'line1' => '', |
631 | 631 | 'line2' => '', |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | 'country' => '', |
636 | 636 | ); |
637 | 637 | |
638 | - $address = wp_parse_args( $payment_data['user_info']['address'], $default_address ); |
|
638 | + $address = wp_parse_args($payment_data['user_info']['address'], $default_address); |
|
639 | 639 | |
640 | 640 | $paypal_args['address1'] = $address['line1']; |
641 | 641 | $paypal_args['address2'] = $address['line2']; |
@@ -656,13 +656,13 @@ discard block |
||
656 | 656 | * |
657 | 657 | * @since 1.8 |
658 | 658 | */ |
659 | - $paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data ); |
|
659 | + $paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data); |
|
660 | 660 | |
661 | 661 | // Build query. |
662 | - $paypal_redirect .= http_build_query( $paypal_args ); |
|
662 | + $paypal_redirect .= http_build_query($paypal_args); |
|
663 | 663 | |
664 | 664 | // Fix for some sites that encode the entities. |
665 | - $paypal_redirect = str_replace( '&', '&', $paypal_redirect ); |
|
665 | + $paypal_redirect = str_replace('&', '&', $paypal_redirect); |
|
666 | 666 | |
667 | 667 | return $paypal_redirect; |
668 | 668 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | function give_get_paypal_button_type() { |
678 | 678 | // paypal_button_type can be donation or standard. |
679 | 679 | $paypal_button_type = '_donations'; |
680 | - if ( 'standard' === give_get_option( 'paypal_button_type' ) ) { |
|
680 | + if ('standard' === give_get_option('paypal_button_type')) { |
|
681 | 681 | $paypal_button_type = '_xclick'; |
682 | 682 | } |
683 | 683 |
@@ -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 | |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | function give_donation_history() { |
27 | 27 | |
28 | 28 | // If payment_key query arg exists, return receipt instead of donation history. |
29 | - if ( isset( $_GET['payment_key'] ) ) { |
|
29 | + if (isset($_GET['payment_key'])) { |
|
30 | 30 | ob_start(); |
31 | - echo give_receipt_shortcode( array() ); |
|
32 | - echo '<a href="' . esc_url( give_get_history_page_uri() ) . '">« ' . __( 'Return to All Donations', 'give' ) . '</a>'; |
|
31 | + echo give_receipt_shortcode(array()); |
|
32 | + echo '<a href="'.esc_url(give_get_history_page_uri()).'">« '.__('Return to All Donations', 'give').'</a>'; |
|
33 | 33 | |
34 | 34 | return ob_get_clean(); |
35 | 35 | } |
36 | 36 | |
37 | - $email_access = give_get_option( 'email_access' ); |
|
37 | + $email_access = give_get_option('email_access'); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Determine access |
@@ -44,30 +44,30 @@ discard block |
||
44 | 44 | */ |
45 | 45 | if ( |
46 | 46 | is_user_logged_in() || false !== Give()->session->get_session_expiration() |
47 | - || ( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists ) |
|
47 | + || (give_is_setting_enabled($email_access) && Give()->email_access->token_exists) |
|
48 | 48 | ) { |
49 | 49 | ob_start(); |
50 | - give_get_template_part( 'history', 'donations' ); |
|
50 | + give_get_template_part('history', 'donations'); |
|
51 | 51 | |
52 | 52 | return ob_get_clean(); |
53 | 53 | |
54 | - } elseif ( give_is_setting_enabled( $email_access ) ) { |
|
54 | + } elseif (give_is_setting_enabled($email_access)) { |
|
55 | 55 | // Is Email-based access enabled? |
56 | 56 | ob_start(); |
57 | - give_get_template_part( 'email', 'login-form' ); |
|
57 | + give_get_template_part('email', 'login-form'); |
|
58 | 58 | |
59 | 59 | return ob_get_clean(); |
60 | 60 | |
61 | 61 | } else { |
62 | 62 | |
63 | - $output = apply_filters( 'give_donation_history_nonuser_message', Give()->notices->print_frontend_notice( __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ), false ) ); |
|
64 | - $output .= do_shortcode( '[give_login]' ); |
|
63 | + $output = apply_filters('give_donation_history_nonuser_message', Give()->notices->print_frontend_notice(__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'), false)); |
|
64 | + $output .= do_shortcode('[give_login]'); |
|
65 | 65 | |
66 | 66 | return $output; |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
70 | +add_shortcode('donation_history', 'give_donation_history'); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Donation Form Shortcode |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return string |
82 | 82 | */ |
83 | -function give_form_shortcode( $atts ) { |
|
84 | - $atts = shortcode_atts( array( |
|
83 | +function give_form_shortcode($atts) { |
|
84 | + $atts = shortcode_atts(array( |
|
85 | 85 | 'id' => '', |
86 | 86 | 'show_title' => true, |
87 | 87 | 'show_goal' => true, |
@@ -89,21 +89,21 @@ discard block |
||
89 | 89 | 'float_labels' => '', |
90 | 90 | 'display_style' => '', |
91 | 91 | 'continue_button_title' => '', |
92 | - ), $atts, 'give_form' ); |
|
92 | + ), $atts, 'give_form'); |
|
93 | 93 | |
94 | 94 | // Convert string to bool. |
95 | - $atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN ); |
|
96 | - $atts['show_goal'] = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN ); |
|
95 | + $atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN); |
|
96 | + $atts['show_goal'] = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN); |
|
97 | 97 | |
98 | 98 | //get the Give Form |
99 | 99 | ob_start(); |
100 | - give_get_donation_form( $atts ); |
|
100 | + give_get_donation_form($atts); |
|
101 | 101 | $final_output = ob_get_clean(); |
102 | 102 | |
103 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
103 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
104 | 104 | } |
105 | 105 | |
106 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
106 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Donation Form Goal Shortcode. |
@@ -116,37 +116,37 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return string |
118 | 118 | */ |
119 | -function give_goal_shortcode( $atts ) { |
|
120 | - $atts = shortcode_atts( array( |
|
119 | +function give_goal_shortcode($atts) { |
|
120 | + $atts = shortcode_atts(array( |
|
121 | 121 | 'id' => '', |
122 | 122 | 'show_text' => true, |
123 | 123 | 'show_bar' => true, |
124 | - ), $atts, 'give_goal' ); |
|
124 | + ), $atts, 'give_goal'); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | //get the Give Form. |
128 | 128 | ob_start(); |
129 | 129 | |
130 | 130 | //Sanity check 1: ensure there is an ID Provided. |
131 | - if ( empty( $atts['id'] ) ) { |
|
132 | - Give()->notices->print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true ); |
|
131 | + if (empty($atts['id'])) { |
|
132 | + Give()->notices->print_frontend_notice(__('The shortcode is missing Donation Form ID attribute.', 'give'), true); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | //Sanity check 2: Check the form even has Goals enabled. |
136 | - if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) { |
|
136 | + if ( ! give_is_setting_enabled(give_get_meta($atts['id'], '_give_goal_option', true))) { |
|
137 | 137 | |
138 | - Give()->notices->print_frontend_notice( __( 'The form does not have Goals enabled.', 'give' ), true ); |
|
138 | + Give()->notices->print_frontend_notice(__('The form does not have Goals enabled.', 'give'), true); |
|
139 | 139 | } else { |
140 | 140 | //Passed all sanity checks: output Goal. |
141 | - give_show_goal_progress( $atts['id'], $atts ); |
|
141 | + give_show_goal_progress($atts['id'], $atts); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | $final_output = ob_get_clean(); |
145 | 145 | |
146 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
146 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
147 | 147 | } |
148 | 148 | |
149 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
149 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
150 | 150 | |
151 | 151 | |
152 | 152 | /** |
@@ -163,22 +163,22 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return string |
165 | 165 | */ |
166 | -function give_login_form_shortcode( $atts ) { |
|
167 | - $atts = shortcode_atts( array( |
|
166 | +function give_login_form_shortcode($atts) { |
|
167 | + $atts = shortcode_atts(array( |
|
168 | 168 | // Add backward compatibility for redirect attribute. |
169 | 169 | 'redirect' => '', |
170 | 170 | |
171 | 171 | 'login-redirect' => '', |
172 | 172 | 'logout-redirect' => '', |
173 | - ), $atts, 'give_login' ); |
|
173 | + ), $atts, 'give_login'); |
|
174 | 174 | |
175 | 175 | // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
176 | - $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' ); |
|
176 | + $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : ''); |
|
177 | 177 | |
178 | - return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] ); |
|
178 | + return give_login_form($atts['login-redirect'], $atts['logout-redirect']); |
|
179 | 179 | } |
180 | 180 | |
181 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
181 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
182 | 182 | |
183 | 183 | /** |
184 | 184 | * Register Shortcode. |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @return string |
195 | 195 | */ |
196 | -function give_register_form_shortcode( $atts ) { |
|
197 | - $atts = shortcode_atts( array( |
|
196 | +function give_register_form_shortcode($atts) { |
|
197 | + $atts = shortcode_atts(array( |
|
198 | 198 | 'redirect' => '', |
199 | - ), $atts, 'give_register' ); |
|
199 | + ), $atts, 'give_register'); |
|
200 | 200 | |
201 | - return give_register_form( $atts['redirect'] ); |
|
201 | + return give_register_form($atts['redirect']); |
|
202 | 202 | } |
203 | 203 | |
204 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
204 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Receipt Shortcode. |
@@ -214,12 +214,12 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @return string |
216 | 216 | */ |
217 | -function give_receipt_shortcode( $atts ) { |
|
217 | +function give_receipt_shortcode($atts) { |
|
218 | 218 | |
219 | 219 | global $give_receipt_args, $payment; |
220 | 220 | |
221 | - $give_receipt_args = shortcode_atts( array( |
|
222 | - 'error' => __( 'You are missing the payment key to view this donation receipt.', 'give' ), |
|
221 | + $give_receipt_args = shortcode_atts(array( |
|
222 | + 'error' => __('You are missing the payment key to view this donation receipt.', 'give'), |
|
223 | 223 | 'price' => true, |
224 | 224 | 'donor' => true, |
225 | 225 | 'date' => true, |
@@ -228,50 +228,50 @@ discard block |
||
228 | 228 | 'payment_id' => true, |
229 | 229 | 'payment_status' => false, |
230 | 230 | 'status_notice' => true, |
231 | - ), $atts, 'give_receipt' ); |
|
231 | + ), $atts, 'give_receipt'); |
|
232 | 232 | |
233 | 233 | //set $session var |
234 | 234 | $session = give_get_purchase_session(); |
235 | 235 | |
236 | 236 | //set payment key var |
237 | - if ( isset( $_GET['payment_key'] ) ) { |
|
238 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
239 | - } elseif ( $session ) { |
|
237 | + if (isset($_GET['payment_key'])) { |
|
238 | + $payment_key = urldecode($_GET['payment_key']); |
|
239 | + } elseif ($session) { |
|
240 | 240 | $payment_key = $session['purchase_key']; |
241 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
241 | + } elseif ($give_receipt_args['payment_key']) { |
|
242 | 242 | $payment_key = $give_receipt_args['payment_key']; |
243 | 243 | } |
244 | 244 | |
245 | - $email_access = give_get_option( 'email_access' ); |
|
245 | + $email_access = give_get_option('email_access'); |
|
246 | 246 | |
247 | 247 | // No payment_key found & Email Access is Turned on: |
248 | - if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) { |
|
248 | + if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) { |
|
249 | 249 | |
250 | 250 | ob_start(); |
251 | 251 | |
252 | - give_get_template_part( 'email-login-form' ); |
|
252 | + give_get_template_part('email-login-form'); |
|
253 | 253 | |
254 | 254 | return ob_get_clean(); |
255 | 255 | |
256 | - } elseif ( ! isset( $payment_key ) ) { |
|
256 | + } elseif ( ! isset($payment_key)) { |
|
257 | 257 | |
258 | - return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' ); |
|
258 | + return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error'); |
|
259 | 259 | |
260 | 260 | } |
261 | 261 | |
262 | - $payment_id = give_get_purchase_id_by_key( $payment_key ); |
|
263 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
262 | + $payment_id = give_get_purchase_id_by_key($payment_key); |
|
263 | + $user_can_view = give_can_view_receipt($payment_key); |
|
264 | 264 | |
265 | 265 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt. |
266 | - if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) { |
|
266 | + if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) { |
|
267 | 267 | |
268 | 268 | ob_start(); |
269 | 269 | |
270 | - give_get_template_part( 'email-login-form' ); |
|
270 | + give_get_template_part('email-login-form'); |
|
271 | 271 | |
272 | 272 | return ob_get_clean(); |
273 | 273 | |
274 | - } elseif ( ! $user_can_view ) { |
|
274 | + } elseif ( ! $user_can_view) { |
|
275 | 275 | |
276 | 276 | global $give_login_redirect; |
277 | 277 | |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | |
280 | 280 | ob_start(); |
281 | 281 | |
282 | - Give()->notices->print_frontend_notice( apply_filters( 'give_must_be_logged_in_error_message', __( 'You must be logged in to view this donation receipt.', 'give' ) ) ); |
|
282 | + Give()->notices->print_frontend_notice(apply_filters('give_must_be_logged_in_error_message', __('You must be logged in to view this donation receipt.', 'give'))); |
|
283 | 283 | |
284 | - give_get_template_part( 'shortcode', 'login' ); |
|
284 | + give_get_template_part('shortcode', 'login'); |
|
285 | 285 | |
286 | 286 | $login_form = ob_get_clean(); |
287 | 287 | |
@@ -295,20 +295,20 @@ discard block |
||
295 | 295 | * or if user is logged out and donation was made as a guest, the donation session is checked for |
296 | 296 | * or if user is logged in and the user can view sensitive shop data. |
297 | 297 | */ |
298 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
299 | - return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' ); |
|
298 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
299 | + return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error'); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | ob_start(); |
303 | 303 | |
304 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
304 | + give_get_template_part('shortcode', 'receipt'); |
|
305 | 305 | |
306 | 306 | $display = ob_get_clean(); |
307 | 307 | |
308 | 308 | return $display; |
309 | 309 | } |
310 | 310 | |
311 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
311 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
312 | 312 | |
313 | 313 | /** |
314 | 314 | * Profile Editor Shortcode. |
@@ -327,25 +327,25 @@ discard block |
||
327 | 327 | * |
328 | 328 | * @return string Output generated from the profile editor |
329 | 329 | */ |
330 | -function give_profile_editor_shortcode( $atts ) { |
|
330 | +function give_profile_editor_shortcode($atts) { |
|
331 | 331 | |
332 | 332 | ob_start(); |
333 | 333 | |
334 | 334 | // Restrict access to donor profile, if donor and user are disconnected. |
335 | - $is_donor_disconnected = get_user_meta( get_current_user_id(), '_give_is_donor_disconnected', true ); |
|
336 | - if( is_user_logged_in() && $is_donor_disconnected ) { |
|
337 | - Give()->notices->print_frontend_notice( __( 'Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give' ), true, 'error' ); |
|
335 | + $is_donor_disconnected = get_user_meta(get_current_user_id(), '_give_is_donor_disconnected', true); |
|
336 | + if (is_user_logged_in() && $is_donor_disconnected) { |
|
337 | + Give()->notices->print_frontend_notice(__('Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give'), true, 'error'); |
|
338 | 338 | return false; |
339 | 339 | } |
340 | 340 | |
341 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
341 | + give_get_template_part('shortcode', 'profile-editor'); |
|
342 | 342 | |
343 | 343 | $display = ob_get_clean(); |
344 | 344 | |
345 | 345 | return $display; |
346 | 346 | } |
347 | 347 | |
348 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
348 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
349 | 349 | |
350 | 350 | /** |
351 | 351 | * Process Profile Updater Form. |
@@ -358,30 +358,30 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @return bool |
360 | 360 | */ |
361 | -function give_process_profile_editor_updates( $data ) { |
|
361 | +function give_process_profile_editor_updates($data) { |
|
362 | 362 | // Profile field change request |
363 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
363 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
364 | 364 | return false; |
365 | 365 | } |
366 | 366 | |
367 | 367 | // Nonce security |
368 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
368 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
369 | 369 | return false; |
370 | 370 | } |
371 | 371 | |
372 | 372 | $user_id = get_current_user_id(); |
373 | - $old_user_data = get_userdata( $user_id ); |
|
374 | - |
|
375 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
376 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
377 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
378 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
379 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
380 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
381 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
382 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
383 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
384 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
373 | + $old_user_data = get_userdata($user_id); |
|
374 | + |
|
375 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
376 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
377 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
378 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
379 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
380 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
381 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
382 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
383 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
384 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
385 | 385 | |
386 | 386 | $userdata = array( |
387 | 387 | 'ID' => $user_id, |
@@ -409,40 +409,40 @@ discard block |
||
409 | 409 | * @param int $user_id The ID of the user. |
410 | 410 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
411 | 411 | */ |
412 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
412 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
413 | 413 | |
414 | 414 | // Make sure to validate passwords for existing Donors |
415 | - give_validate_user_password( $data['give_new_user_pass1'], $data['give_new_user_pass2'] ); |
|
415 | + give_validate_user_password($data['give_new_user_pass1'], $data['give_new_user_pass2']); |
|
416 | 416 | |
417 | - if ( empty( $email ) ) { |
|
417 | + if (empty($email)) { |
|
418 | 418 | // Make sure email should not be empty. |
419 | - give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) ); |
|
419 | + give_set_error('email_empty', __('The email you entered is empty.', 'give')); |
|
420 | 420 | |
421 | - } else if ( ! is_email( $email ) ) { |
|
421 | + } else if ( ! is_email($email)) { |
|
422 | 422 | // Make sure email should be valid. |
423 | - give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) ); |
|
423 | + give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give')); |
|
424 | 424 | |
425 | - } else if ( $email != $old_user_data->user_email ) { |
|
425 | + } else if ($email != $old_user_data->user_email) { |
|
426 | 426 | // Make sure the new email doesn't belong to another user |
427 | - if ( email_exists( $email ) ) { |
|
428 | - give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
427 | + if (email_exists($email)) { |
|
428 | + give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give')); |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | 432 | // Check for errors |
433 | 433 | $errors = give_get_errors(); |
434 | 434 | |
435 | - if ( $errors ) { |
|
435 | + if ($errors) { |
|
436 | 436 | // Send back to the profile editor if there are errors |
437 | - wp_redirect( $data['give_redirect'] ); |
|
437 | + wp_redirect($data['give_redirect']); |
|
438 | 438 | give_die(); |
439 | 439 | } |
440 | 440 | |
441 | 441 | // Update the user |
442 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
443 | - $updated = wp_update_user( $userdata ); |
|
442 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
443 | + $updated = wp_update_user($userdata); |
|
444 | 444 | |
445 | - if ( $updated ) { |
|
445 | + if ($updated) { |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Fires after updating user profile. |
@@ -452,12 +452,12 @@ discard block |
||
452 | 452 | * @param int $user_id The ID of the user. |
453 | 453 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
454 | 454 | */ |
455 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
456 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
455 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
456 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
457 | 457 | give_die(); |
458 | 458 | } |
459 | 459 | |
460 | 460 | return false; |
461 | 461 | } |
462 | 462 | |
463 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
463 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |